花名册高级搜索BUG修复
This commit is contained in:
parent
9dbce1e8c5
commit
f7ce6b028a
|
|
@ -5,6 +5,8 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/01/05
|
||||
|
|
@ -18,5 +20,5 @@ public class SearchTemplateParam {
|
|||
private String key;
|
||||
private boolean selected;
|
||||
private String showname;
|
||||
private String fields;
|
||||
private List<String> fields;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ package com.engine.organization.service;
|
|||
import com.engine.organization.entity.hrmresource.param.HrmRelationSaveParam;
|
||||
import com.engine.organization.entity.hrmresource.param.SearchTemplateParam;
|
||||
import com.engine.organization.entity.searchtree.SearchTreeParams;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -97,7 +96,26 @@ public interface HrmResourceService {
|
|||
*/
|
||||
long updateTabForm(HrmRelationSaveParam params);
|
||||
|
||||
/**
|
||||
* 保存搜索条件模板
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
Integer saveSearchTemplate(SearchTemplateParam params);
|
||||
|
||||
void deleteSearchTemplate(@Param("id") Integer id);
|
||||
/**
|
||||
* 删除搜索条件模板
|
||||
*
|
||||
* @param id
|
||||
*/
|
||||
void deleteSearchTemplate(Integer id);
|
||||
|
||||
/**
|
||||
* 获取模板所选择的列
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
String getTemplateSelectKeys(Map<String, Object> params);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
|
||||
@Override
|
||||
public Integer saveSearchTemplate(SearchTemplateParam params) {
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(StringUtils.join(params.getFields(), ","));
|
||||
if (null == templatePO) {
|
||||
return -1;
|
||||
}
|
||||
|
|
@ -161,6 +161,33 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
getHrmResourceMapper().deleteSearchTemplate(id, user.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTemplateSelectKeys(Map<String, Object> params) {
|
||||
String templateId = Util.null2String(params.get("templateId"));
|
||||
String column = Util.null2String(params.get("column"));
|
||||
OrganizationAssert.isTrue(StringUtils.isNotBlank(templateId), "数据有误,未找到对应数据");
|
||||
// 判断是否为搜索模板
|
||||
if (StringUtils.isBlank(column)) {
|
||||
SearchTemplatePO searchTemplateById = getHrmResourceMapper().getSearchTemplateById(templateId);
|
||||
String basicFields = searchTemplateById.getBasicFields();
|
||||
String personalFields = searchTemplateById.getPersonalFields();
|
||||
String workflowFields = searchTemplateById.getWorkFields();
|
||||
List<String> selectKeys = new ArrayList<>();
|
||||
if (StringUtils.isNotBlank(basicFields)) {
|
||||
selectKeys.addAll(Arrays.asList(basicFields.split(",")));
|
||||
}
|
||||
if (StringUtils.isNotBlank(personalFields)) {
|
||||
selectKeys.addAll(Arrays.asList(personalFields.split(",")));
|
||||
}
|
||||
if (StringUtils.isNotBlank(workflowFields)) {
|
||||
selectKeys.addAll(Arrays.asList(workflowFields.split(",")));
|
||||
}
|
||||
return StringUtils.join(selectKeys, ",");
|
||||
}
|
||||
return "";
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getSearchCondition(Map<String, Object> params) {
|
||||
String templateId = Util.null2String(params.get("templateId"));
|
||||
|
|
|
|||
|
|
@ -196,6 +196,19 @@ public class HrmResourceController {
|
|||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getTemplateSelectKeys")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getTemplateSelectKeys(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(JSON.toJSON(getHrmResourceWrapper(user).getTemplateSelectKeys(map)));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 列表页顶部按钮
|
||||
*
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
getHrmResourceService(user).deleteSearchTemplate(id);
|
||||
}
|
||||
|
||||
public String getTemplateSelectKeys(Map<String, Object> params) {
|
||||
return getHrmResourceService(user).getTemplateSelectKeys(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getHasRight() {
|
||||
return getHrmResourceService(user).getHasRight();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue