!118 分部、部门、岗位列表排序

Merge pull request !118 from dxfeng/feature/dxf
pull/119/MERGE
dxfeng 3 years ago committed by Gitee
commit 9ac42b3291
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F

@ -19,4 +19,9 @@ public class BaseQueryParam {
//每页数据条数
private Integer pageSize = 10;
/**
*
*/
private String sortParams;
}

@ -16,7 +16,7 @@ import lombok.NoArgsConstructor;
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class CompSearchParam extends BaseQueryParam {
public class CompSearchParam extends BaseQueryParam {
/**
*

@ -19,7 +19,7 @@ public interface CompMapper {
*
* @return
*/
List<CompPO> list();
List<CompPO> list(@Param("orderSql") String orderSql);
/**
* ID
@ -33,7 +33,7 @@ public interface CompMapper {
*
* @return
*/
List<CompPO> listByFilter(CompPO compPO);
List<CompPO> listByFilter(@Param("compPO") CompPO compPO, @Param("orderSql") String orderSql);
/**
*
@ -95,13 +95,13 @@ public interface CompMapper {
/**
* ID
*
* @param ids
* @return
*/
List<CompPO> getCompsByIds(@Param("ids") Collection<Long> ids);
/**
* /
*
@ -136,6 +136,7 @@ public interface CompMapper {
/**
*
*
* @return
*/
int getMaxShowOrder();

@ -144,7 +144,7 @@
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0 order by show_order
WHERE t.delete_type = 0 order by ${orderSql}
</select>
<select id="listParent" resultMap="BaseResultMap">
@ -182,26 +182,26 @@
<include refid="baseColumns"/>
from jcl_org_comp t where comp_no = #{compNo} AND delete_type = 0
</select>
<select id="listByFilter" parameterType="com.engine.organization.entity.company.po.CompPO"
resultMap="BaseResultMap">
<select id="listByFilter" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM
jcl_org_comp t
WHERE t.delete_type = 0
<include refid="likeSQL"/>
<if test=" parentCompany != null ">
and t.parent_company = #{parentCompany}
<if test=" compPO.parentCompany != null ">
and t.parent_company = #{compPO.parentCompany}
</if>
<if test=" industry != null ">
and t.industry = #{industry}
<if test=" compPO.industry != null ">
and t.industry = #{compPO.industry}
</if>
<if test=" compPrincipal != null ">
and t.comp_principal = #{compPrincipal}
<if test=" compPO.compPrincipal != null ">
and t.comp_principal = #{compPO.compPrincipal}
</if>
<if test=" forbiddenTag != null ">
and t.forbidden_tag = #{forbiddenTag}
<if test=" compPO.forbiddenTag != null ">
and t.forbidden_tag = #{compPO.forbiddenTag}
</if>
order by ${orderSql}
</select>
<select id="listCompsByIds" resultType="java.util.Map">
@ -298,47 +298,47 @@
</update>
<sql id="likeSQL">
<if test=" compNo != null and compNo != '' ">
and t.comp_no like CONCAT('%',#{compNo},'%')
<if test=" compPO.compNo != null and compPO.compNo != '' ">
and t.comp_no like CONCAT('%',#{compPO.compNo},'%')
</if>
<if test=" compName != null and compName != '' ">
and t.comp_name like CONCAT('%',#{compName},'%')
<if test=" compPO.compName != null and compPO.compName != '' ">
and t.comp_name like CONCAT('%',#{compPO.compName},'%')
</if>
<if test=" compNameShort != null and compNameShort != '' ">
and t.comp_name_short like CONCAT('%',#{compNameShort},'%')
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
and t.comp_name_short like CONCAT('%',#{compPO.compNameShort},'%')
</if>
<if test=" orgCode != null and orgCode != '' ">
and t.org_code like CONCAT('%',#{orgCode},'%')
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
and t.org_code like CONCAT('%',#{compPO.orgCode},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" compNo != null and compNo != '' ">
and t.comp_no like '%'||#{compNo}||'%'
<if test=" compPO.compNo != null and compPO.compNo != '' ">
and t.comp_no like '%'||#{compPO.compNo}||'%'
</if>
<if test=" compName != null and compName != '' ">
and t.comp_name like '%'||#{compName}||'%'
<if test=" compPO.compName != null and compPO.compName != '' ">
and t.comp_name like '%'||#{compPO.compName}||'%'
</if>
<if test=" compNameShort != null and compNameShort != '' ">
and t.comp_name_short like '%'||#{compNameShort}||'%'
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
and t.comp_name_short like '%'||#{compPO.compNameShort}||'%'
</if>
<if test=" orgCode != null and orgCode != '' ">
and t.org_code like '%'||#{orgCode}||'%'
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
and t.org_code like '%'||#{compPO.orgCode}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" compNo != null and compNo != '' ">
and t.comp_no like '%'+#{compNo}+'%'
<if test=" compPO.compNo != null and compPO.compNo != '' ">
and t.comp_no like '%'+#{compPO.compNo}+'%'
</if>
<if test=" compName != null and compName != '' ">
and t.comp_name like '%'+#{compName}+'%'
<if test=" compPO.compName != null and compPO.compName != '' ">
and t.comp_name like '%'+#{compPO.compName}+'%'
</if>
<if test=" compNameShort != null and compNameShort != '' ">
and t.comp_name_short like '%'+#{compNameShort}+'%'
<if test=" compPO.compNameShort != null and compPO.compNameShort != '' ">
and t.comp_name_short like '%'+#{compPO.compNameShort}+'%'
</if>
<if test=" orgCode != null and orgCode != '' ">
and t.org_code like '%'+#{orgCode}+'%'
<if test=" compPO.orgCode != null and compPO.orgCode != '' ">
and t.org_code like '%'+#{compPO.orgCode}+'%'
</if>
</sql>

@ -27,7 +27,7 @@ public interface DepartmentMapper {
*
* @return
*/
List<DepartmentPO> list();
List<DepartmentPO> list(@Param("orderSql") String orderSql);
/**
* No
@ -42,7 +42,7 @@ public interface DepartmentMapper {
*
* @return
*/
List<DepartmentPO> listByFilter(DepartmentPO departmentPO);
List<DepartmentPO> listByFilter(@Param("departmentPO") DepartmentPO departmentPO, @Param("orderSql") String orderSql);
/**
*
@ -118,6 +118,7 @@ public interface DepartmentMapper {
/**
*
*
* @return
*/
int getMaxShowOrder();

@ -62,21 +62,22 @@
from jcl_org_dept t
where delete_type = 0
<include refid="likeSQL"/>
<if test=" parentComp != null ">
and t.parent_comp = #{parentComp}
<if test=" departmentPO.parentComp != null ">
and t.parent_comp = #{departmentPO.parentComp}
</if>
<if test=" parentDept != null ">
and t.parent_dept = #{parentDept}
<if test=" departmentPO.parentDept != null ">
and t.parent_dept = #{departmentPO.parentDept}
</if>
<if test=" deptPrincipal != null ">
and t.dept_principal = #{deptPrincipal}
<if test=" departmentPO.deptPrincipal != null ">
and t.dept_principal = #{departmentPO.deptPrincipal}
</if>
<if test=" showOrder != null ">
and t.show_order = #{showOrder}
<if test=" departmentPO.showOrder != null ">
and t.show_order = #{departmentPO.showOrder}
</if>
<if test=" forbiddenTag != null ">
and t.forbidden_tag = #{forbiddenTag}
<if test=" departmentPO.forbiddenTag != null ">
and t.forbidden_tag = #{departmentPO.forbiddenTag}
</if>
order by ${orderSql}
</select>
<select id="getDeptById" resultType="com.engine.organization.entity.department.po.DepartmentPO">
@ -103,7 +104,7 @@
SELECT
<include refid="baseColumns"/>
FROM jcl_org_dept t
WHERE t.delete_type = 0 order by show_order
WHERE t.delete_type = 0 order by ${orderSql}
</select>
<select id="listByNo" resultType="com.engine.organization.entity.department.po.DepartmentPO">
select
@ -268,38 +269,38 @@
<sql id="likeSQL">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like CONCAT('%',#{deptNo},'%')
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like CONCAT('%',#{departmentPO.deptNo},'%')
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like CONCAT('%',#{deptName},'%')
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like CONCAT('%',#{departmentPO.deptName},'%')
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{deptNameShort},'%')
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like CONCAT('%',#{departmentPO.deptNameShort},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like '%'||#{deptNo}||'%'
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like '%'||#{departmentPO.deptNo}||'%'
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like '%'||#{deptName}||'%'
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'||#{departmentPO.deptName}||'%'
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like '%'||#{deptNameShort}||'%'
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like '%'||#{departmentPO.deptNameShort}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" deptNo != null and deptNo != '' ">
and t.dept_no like '%'+#{deptNo}+'%'
<if test=" departmentPO.deptNo != null and departmentPO.deptNo != '' ">
and t.dept_no like '%'+#{departmentPO.deptNo}+'%'
</if>
<if test=" deptName != null and deptName != '' ">
and t.dept_name like '%'+#{deptName}+'%'
<if test=" departmentPO.deptName != null and departmentPO.deptName != '' ">
and t.dept_name like '%'+#{departmentPO.deptName}+'%'
</if>
<if test=" deptNameShort != null and deptNameShort != '' ">
and t.dept_name_short like '%'+#{deptNameShort}+'%'
<if test=" departmentPO.deptNameShort != null and departmentPO.deptNameShort != '' ">
and t.dept_name_short like '%'+#{departmentPO.deptNameShort}+'%'
</if>
</sql>

@ -21,21 +21,22 @@ public interface JobMapper {
*
* @return
*/
List<JobListDTO> listByFilter(JobPO jobPO);
List<JobListDTO> listByFilter(@Param("jobPO")JobPO jobPO,@Param("orderSql") String orderSql);
/**
*
*
* @return
*/
List<JobListDTO> listNoFilter();
List<JobListDTO> listNoFilter(@Param("orderSql") String orderSql);
/**
*
*
* @param jobPO
* @return
*/
List<JobPO> listPOsByFilter(JobPO jobPO);
List<JobPO> listPOsByFilter(@Param("jobPO")JobPO jobPO);
/**
*
@ -126,6 +127,7 @@ public interface JobMapper {
/**
*
*
* @return
*/
int getMaxShowOrder();

@ -216,25 +216,25 @@
t.scheme_id = d.id
WHERE t.delete_type = 0
<include refid="likeSQL"/>
<if test=" parentComp != null ">
and t.parent_comp = #{parentComp}
<if test=" jobPO.parentComp != null ">
and t.parent_comp = #{jobPO.parentComp}
</if>
<if test=" parentDept != null ">
and t.parent_dept = #{parentDept}
<if test=" jobPO.parentDept != null ">
and t.parent_dept = #{jobPO.parentDept}
</if>
<if test=" sequenceId != null ">
and t.sequence_id = #{sequenceId}
<if test=" jobPO.sequenceId != null ">
and t.sequence_id = #{jobPO.sequenceId}
</if>
<if test=" schemeId != null ">
and t.scheme_id = #{schemeId}
<if test=" jobPO.schemeId != null ">
and t.scheme_id = #{jobPO.schemeId}
</if>
<if test=" isKey != null ">
and t.is_key = #{isKey}
<if test=" jobPO.isKey != null ">
and t.is_key = #{jobPO.isKey}
</if>
<if test=" forbiddenTag != null ">
and t.forbidden_tag = #{forbiddenTag}
<if test=" jobPO.forbiddenTag != null ">
and t.forbidden_tag = #{jobPO.forbiddenTag}
</if>
order by show_order
order by ${orderSql}
</select>
<select id="listNoFilter" resultType="com.engine.organization.entity.job.dto.JobListDTO">
@ -253,7 +253,7 @@
t.sequence_id = c.id
left join jcl_org_scheme d on
t.scheme_id = d.id
WHERE t.delete_type = 0 order by show_order
WHERE t.delete_type = 0 order by ${orderSql}
</select>
<select id="getJobById" resultMap="BaseResultMap">
@ -311,23 +311,23 @@
FROM jcl_org_job t
WHERE t.delete_type = 0
<include refid="likeSQL"/>
<if test=" parentComp != null ">
and t.parent_comp = #{parentComp}
<if test=" jobPO.parentComp != null ">
and t.parent_comp = #{jobPO.parentComp}
</if>
<if test=" parentDept != null ">
and t.parent_dept = #{parentDept}
<if test=" jobPO.parentDept != null ">
and t.parent_dept = #{jobPO.parentDept}
</if>
<if test=" sequenceId != null ">
and t.sequence_id = #{sequenceId}
<if test=" jobPO.sequenceId != null ">
and t.sequence_id = #{jobPO.sequenceId}
</if>
<if test=" schemeId != null ">
and t.scheme_id = #{schemeId}
<if test=" jobPO.schemeId != null ">
and t.scheme_id = #{jobPO.schemeId}
</if>
<if test=" isKey != null ">
and t.is_key = #{isKey}
<if test=" jobPO.isKey != null ">
and t.is_key = #{jobPO.isKey}
</if>
<if test=" forbiddenTag != null ">
and t.forbidden_tag = #{forbiddenTag}
<if test=" jobPO.forbiddenTag != null ">
and t.forbidden_tag = #{jobPO.forbiddenTag}
</if>
</select>
<select id="getMaxShowOrder" resultType="java.lang.Integer">
@ -337,65 +337,65 @@
<sql id="likeSQL">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like CONCAT('%',#{jobNo},'%')
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like CONCAT('%',#{jobPO.jobNo},'%')
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like CONCAT('%',#{jobName},'%')
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
and t.job_name like CONCAT('%',#{jobPO.jobName},'%')
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like CONCAT('%',#{workplace},'%')
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like CONCAT('%',#{jobPO.workplace},'%')
</if>
<if test=" description != null and description != '' ">
and t.description like CONCAT('%',#{description},'%')
<if test=" jobPO.description != null and jobPO.description != '' ">
and t.description like CONCAT('%',#{jobPO.description},'%')
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like CONCAT('%',#{workDuty},'%')
<if test=" jobPO.workDuty != null and jobPO.workDuty != '' ">
and t.work_duty like CONCAT('%',#{jobPO.workDuty},'%')
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like CONCAT('%',#{workAuthority},'%')
<if test=" jobPO.workAuthority != null and jobPO.workAuthority != '' ">
and t.work_authority like CONCAT('%',#{jobPO.workAuthority},'%')
</if>
</sql>
<sql id="likeSQL" databaseId="oracle">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like '%'||#{jobNo}||'%'
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like '%'||#{jobPO.jobNo}||'%'
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like '%'||#{jobName}||'%'
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
and t.job_name like '%'||#{jobPO.jobName}||'%'
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like '%'||#{workplace}||'%'
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like '%'||#{jobPO.workplace}||'%'
</if>
<if test=" description != null and description != '' ">
and t.description like '%'||#{description}||'%'
<if test=" jobPO.description != null and jobPO.description != '' ">
and t.description like '%'||#{jobPO.description}||'%'
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like '%'||#{workDuty}||'%'
<if test=" jobPO.workDuty != null and jobPO.workDuty != '' ">
and t.work_duty like '%'||#{jobPO.workDuty}||'%'
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like '%'||#{workAuthority}||'%'
<if test=" jobPO.workAuthority != null and jobPO.workAuthority != '' ">
and t.work_authority like '%'||#{jobPO.workAuthority}||'%'
</if>
</sql>
<sql id="likeSQL" databaseId="sqlserver">
<if test=" jobNo != null and jobNo != '' ">
and t.job_no like '%'+#{jobNo}+'%'
<if test=" jobPO.jobNo != null and jobPO.jobNo != '' ">
and t.job_no like '%'+#{jobPO.jobNo}+'%'
</if>
<if test=" jobName != null and jobName != '' ">
and t.job_name like '%'+#{jobName}+'%'
<if test=" jobPO.jobName != null and jobPO.jobName != '' ">
and t.job_name like '%'+#{jobPO.jobName}+'%'
</if>
<if test=" workplace != null and workplace != '' ">
and t.workplace like '%'+#{workplace}+'%'
<if test=" jobPO.workplace != null and jobPO.workplace != '' ">
and t.workplace like '%'+#{jobPO.workplace}+'%'
</if>
<if test=" description != null and description != '' ">
and t.description like '%'+#{description}+'%'
<if test=" jobPO.description != null and jobPO.description != '' ">
and t.description like '%'+#{jobPO.description}+'%'
</if>
<if test=" workDuty != null and workDuty != '' ">
and t.work_duty like '%'+#{workDuty}+'%'
<if test=" jobPO.workDuty != null and jobPO.workDuty != '' ">
and t.work_duty like '%'+#{jobPO.workDuty}+'%'
</if>
<if test=" workAuthority != null and workAuthority != '' ">
and t.work_authority like '%'+#{workAuthority}+'%'
<if test=" jobPO.workAuthority != null and jobPO.workAuthority != '' ">
and t.work_authority like '%'+#{jobPO.workAuthority}+'%'
</if>
</sql>
</mapper>

@ -22,10 +22,7 @@ import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.service.CompService;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
@ -98,11 +95,12 @@ public class CompServiceImpl extends Service implements CompService {
CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
boolean filter = isFilter(compPO);
PageInfo<CompListDTO> pageInfos;
List<CompPO> alltList = getCompMapper().list();
String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
List<CompPO> alltList = getCompMapper().list(orderSql);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO);
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO, orderSql);
// 添加父级元素
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(alltList, filterCompPOs);
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS);

@ -31,10 +31,7 @@ import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
@ -107,7 +104,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize());
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list();
List<DepartmentPO> departmentPOS = MapperProxyFactory.getProxy(DepartmentMapper.class).list("show_order");
PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class);
@ -151,11 +148,12 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos;
List<DepartmentPO> allList = getDepartmentMapper().list();
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO);
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO, orderSql);
// 添加父级元素
List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs);
List<DepartmentListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS);
@ -527,7 +525,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
// 查询部门信息
Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build();
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild);
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) {

@ -326,7 +326,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
*/
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
// 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) {
@ -343,7 +343,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
}
// 查询分部信息
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild);
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
@ -367,7 +367,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(jobBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
// 添加父级岗位
Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) {

@ -38,10 +38,7 @@ import com.engine.organization.mapper.scheme.GradeMapper;
import com.engine.organization.mapper.scheme.LevelMapper;
import com.engine.organization.service.ExtService;
import com.engine.organization.service.JobService;
import com.engine.organization.util.HasRightUtil;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.*;
import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column;
@ -147,11 +144,12 @@ public class JobServiceImpl extends Service implements JobService {
JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(jobPO);
PageInfo<JobListDTO> pageInfos;
List<JobListDTO> allList = getJobMapper().listNoFilter();
String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
// 通过子级遍历父级元素
if (filter) {
// 根据条件获取元素
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO);
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO,orderSql);
// 添加父级元素
List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), jobListDTOS);
@ -490,7 +488,7 @@ public class JobServiceImpl extends Service implements JobService {
} else if (TYPE_DEPT.equals(type)) {
//
// 查询部门信息
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().deptName(keyword).parentDept(Long.parseLong(id)).build());
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(DepartmentPO.builder().deptName(keyword).parentDept(Long.parseLong(id)).build(), "show_order");
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);
@ -509,9 +507,9 @@ public class JobServiceImpl extends Service implements JobService {
* @return
*/
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) {
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild);
List<DepartmentPO> filterDeparts = getDepartmentMapper().listByFilter(departmentBuild, "show_order");
// 查询分部信息
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild);
List<CompPO> filterComps = getCompMapper().listByFilter(compBuild, "show_order");
Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts);

@ -0,0 +1,57 @@
package com.engine.organization.util;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import org.apache.commons.collections.CollectionUtils;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author:dxfeng
* @createTime: 2022/06/23
* @version: 1.0
*/
public class PageInfoSortUtil {
/**
* SQL
*
* @param sortParams
* @return
*/
public static String getSortSql(String sortParams) {
JSONArray jsonArray = JSONObject.parseArray(sortParams);
if (CollectionUtils.isNotEmpty(jsonArray)) {
JSONObject jsonObject = (JSONObject) jsonArray.get(0);
String orderKey = upperCharToUnderLine(jsonObject.getString("orderkey"));
String sortOrder = jsonObject.getString("sortOrder").replace("end", "");
return "t." + orderKey + " " + sortOrder;
}
return " show_order ";
}
/**
* 线
*
* @param param
* @return
*/
private static String upperCharToUnderLine(String param) {
Pattern p = Pattern.compile("[A-Z]");
if (param == null || param.equals("")) {
return "";
}
StringBuilder builder = new StringBuilder(param);
Matcher mc = p.matcher(param);
int i = 0;
while (mc.find()) {
builder.replace(mc.start() + i, mc.end() + i, "_" + mc.group().toLowerCase());
i++;
}
if ('_' == builder.charAt(0)) {
builder.deleteCharAt(0);
}
return builder.toString();
}
}
Loading…
Cancel
Save