Merge pull request '花名册高级搜索BUG修复' (#128) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/128
This commit is contained in:
commit
648cc4b3af
|
|
@ -8,7 +8,7 @@
|
|||
<result column="sex" property="sex"/>
|
||||
<result column="email" property="email"/>
|
||||
<result column="mobile" property="phone"/>
|
||||
<result column="account_type" property="accountType"/>
|
||||
<result column="accounttype" property="accountType"/>
|
||||
<result column="status" property="status"/>
|
||||
</resultMap>
|
||||
|
||||
|
|
|
|||
|
|
@ -129,7 +129,63 @@
|
|||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertSearchTemplate">
|
||||
<insert id="insertSearchTemplate" parameterType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO"
|
||||
keyProperty="id"
|
||||
keyColumn="id" useGeneratedKeys="true">
|
||||
INSERT INTO JCL_ORG_SEARCH_TEMPLATE
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
creator,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="basicFields != null">
|
||||
basic_fields,
|
||||
</if>
|
||||
<if test="personalFields != null">
|
||||
personal_fields,
|
||||
</if>
|
||||
<if test="workFields != null">
|
||||
work_fields,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
#{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="basicFields != null">
|
||||
#{basicFields},
|
||||
</if>
|
||||
<if test="personalFields != null">
|
||||
#{personalFields},
|
||||
</if>
|
||||
<if test="workFields != null">
|
||||
#{workFields},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="insertSearchTemplate" parameterType="com.engine.organization.entity.hrmresource.po.SearchTemplatePO"
|
||||
databaseId="oracle">
|
||||
<selectKey keyProperty="id" resultType="int" order="AFTER">
|
||||
select JCL_ORG_SEARCH_TEMPLATE_ID.currval from dual
|
||||
</selectKey>
|
||||
INSERT INTO JCL_ORG_SEARCH_TEMPLATE
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="creator != null">
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public interface HrmResourceService {
|
|||
*/
|
||||
long updateTabForm(HrmRelationSaveParam params);
|
||||
|
||||
void saveSearchTemplate(SearchTemplateParam params);
|
||||
Integer saveSearchTemplate(SearchTemplateParam params);
|
||||
|
||||
void deleteSearchTemplate(@Param("id") Integer id);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,25 +143,17 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
}
|
||||
|
||||
@Override
|
||||
public void saveSearchTemplate(SearchTemplateParam params) {
|
||||
String[] split = params.getFields().split(",");
|
||||
if (split.length > 0) {
|
||||
List<String> basicFieldsBuilder = new ArrayList<>();
|
||||
List<String> personalFieldsBuilder = new ArrayList<>();
|
||||
List<String> workFieldsBuilder = new ArrayList<>();
|
||||
for (String fieldName : split) {
|
||||
if (fieldName.startsWith(HrmGroupEnum.HRM_BASIC.getGroupType().toString())) {
|
||||
basicFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
} else if (fieldName.startsWith(HrmGroupEnum.HRM_PERSONAL.getGroupType().toString())) {
|
||||
personalFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
} else if (fieldName.startsWith(HrmGroupEnum.HRM_WORK.getGroupType().toString())) {
|
||||
workFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
}
|
||||
}
|
||||
SearchTemplatePO searchTemplatePO = SearchTemplatePO.builder().name(params.getShowname()).basicFields(StringUtils.join(basicFieldsBuilder, ",")).personalFields(StringUtils.join(personalFieldsBuilder, ",")).workFields(StringUtils.join(workFieldsBuilder, ",")).creator(user.getUID()).createTime(new Date()).updateTime(new Date()).build();
|
||||
getHrmResourceMapper().insertSearchTemplate(searchTemplatePO);
|
||||
// 保存模板
|
||||
public Integer saveSearchTemplate(SearchTemplateParam params) {
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(params.getFields());
|
||||
if (null == templatePO) {
|
||||
return -1;
|
||||
}
|
||||
templatePO.setName(params.getShowname());
|
||||
templatePO.setCreator(user.getUID());
|
||||
templatePO.setCreateTime(new Date());
|
||||
templatePO.setUpdateTime(new Date());
|
||||
getHrmResourceMapper().insertSearchTemplate(templatePO);
|
||||
return templatePO.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -184,7 +176,9 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
if ("-1".equals(templateId)) {
|
||||
if (StringUtils.isNotBlank(selectKeys)) {
|
||||
SearchTemplatePO templatePO = buildSearchTemplateByFields(selectKeys);
|
||||
buildSearchConditionGroup(templatePO, hrmFieldSearchConditionComInfo, addGroups);
|
||||
if (null != templatePO) {
|
||||
buildSearchConditionGroup(templatePO, hrmFieldSearchConditionComInfo, addGroups);
|
||||
}
|
||||
} else {
|
||||
// 未选择模板展示默认模板搜索条件
|
||||
if (CollectionUtils.isNotEmpty(allConditions)) {
|
||||
|
|
@ -673,26 +667,23 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
|
|||
* @return
|
||||
*/
|
||||
private SearchTemplatePO buildSearchTemplateByFields(String fields) {
|
||||
SearchTemplatePO templatePO = new SearchTemplatePO();
|
||||
String[] split = fields.split(",");
|
||||
if (split.length > 0) {
|
||||
List<String> basicFieldsBuilder = new ArrayList<>();
|
||||
List<String> personalFieldsBuilder = new ArrayList<>();
|
||||
List<String> workFieldsBuilder = new ArrayList<>();
|
||||
List<String> basicFields = new ArrayList<>();
|
||||
List<String> personalFields = new ArrayList<>();
|
||||
List<String> workFields = new ArrayList<>();
|
||||
for (String fieldName : split) {
|
||||
if (fieldName.startsWith(HrmGroupEnum.HRM_BASIC.getGroupType().toString())) {
|
||||
basicFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
basicFields.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
} else if (fieldName.startsWith(HrmGroupEnum.HRM_PERSONAL.getGroupType().toString())) {
|
||||
personalFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
personalFields.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
} else if (fieldName.startsWith(HrmGroupEnum.HRM_WORK.getGroupType().toString())) {
|
||||
workFieldsBuilder.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
workFields.add(fieldName.substring(fieldName.lastIndexOf("_") + 1));
|
||||
}
|
||||
}
|
||||
templatePO.setBasicFields(basicFieldsBuilder.toString());
|
||||
templatePO.setPersonalFields(personalFieldsBuilder.toString());
|
||||
templatePO.setWorkFields(workFieldsBuilder.toString());
|
||||
return SearchTemplatePO.builder().basicFields(StringUtils.join(basicFields, ",")).personalFields(StringUtils.join(personalFields, ",")).workFields(StringUtils.join(workFields, ",")).build();
|
||||
}
|
||||
return templatePO;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -177,8 +177,7 @@ public class HrmResourceController {
|
|||
public ReturnResult saveSearchTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SearchTemplateParam params) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
getHrmResourceWrapper(user).saveSearchTemplate(params);
|
||||
return ReturnResult.successed();
|
||||
return ReturnResult.successed(getHrmResourceWrapper(user).saveSearchTemplate(params));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public class HrmResourceWrapper extends OrganizationWrapper {
|
|||
return getHrmResourceService(user).getSearchCondition(params);
|
||||
}
|
||||
|
||||
public void saveSearchTemplate(SearchTemplateParam params) {
|
||||
getHrmResourceService(user).saveSearchTemplate(params);
|
||||
public Integer saveSearchTemplate(SearchTemplateParam params) {
|
||||
return getHrmResourceService(user).saveSearchTemplate(params);
|
||||
}
|
||||
|
||||
public void deleteSearchTemplate(Integer id) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue