!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 Integer pageSize = 10;
/**
*
*/
private String sortParams;
} }

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

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

@ -27,7 +27,7 @@ public interface DepartmentMapper {
* *
* @return * @return
*/ */
List<DepartmentPO> list(); List<DepartmentPO> list(@Param("orderSql") String orderSql);
/** /**
* No * No
@ -42,7 +42,7 @@ public interface DepartmentMapper {
* *
* @return * @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 * @return
*/ */
int getMaxShowOrder(); int getMaxShowOrder();

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

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

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

@ -22,10 +22,7 @@ import com.engine.organization.mapper.comp.CompMapper;
import com.engine.organization.mapper.extend.ExtendTitleMapper; import com.engine.organization.mapper.extend.ExtendTitleMapper;
import com.engine.organization.service.CompService; import com.engine.organization.service.CompService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.*;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.coderule.CodeRuleUtil; import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column; 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()); CompPO compPO = CompBO.convertParamToPO(params, (long) user.getUID());
boolean filter = isFilter(compPO); boolean filter = isFilter(compPO);
PageInfo<CompListDTO> pageInfos; PageInfo<CompListDTO> pageInfos;
List<CompPO> alltList = getCompMapper().list(); String orderSql = PageInfoSortUtil.getSortSql(params.getSortParams());
List<CompPO> alltList = getCompMapper().list(orderSql);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
// 根据条件获取元素 // 根据条件获取元素
List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO); List<CompPO> filterCompPOs = getCompMapper().listByFilter(compPO, orderSql);
// 添加父级元素 // 添加父级元素
List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(alltList, filterCompPOs); List<CompListDTO> compListDTOS = CompBO.buildCompDTOList(alltList, filterCompPOs);
List<CompListDTO> subList = PageUtil.subList(params.getCurrent(), params.getPageSize(), compListDTOS); 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.mapper.job.JobMapper;
import com.engine.organization.service.DepartmentService; import com.engine.organization.service.DepartmentService;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.*;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.coderule.CodeRuleUtil; import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column; import com.engine.organization.util.page.Column;
@ -107,7 +104,7 @@ public class DepartmentServiceImpl extends Service implements DepartmentService
public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) { public PageInfo<SingleDeptTreeVO> getDeptListByPid(QuerySingleDeptListParam param) {
//1.查询分部下所有部门 //1.查询分部下所有部门
//PageUtil.start(param.getCurrent(), param.getPageSize()); //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); PageInfo<DepartmentPO> pageInfo = new PageInfo<>(departmentPOS);
List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp()); List<SingleDeptTreeVO> singleDeptTreeVOS = DepartmentBO.buildSingleDeptTreeVOS(departmentPOS, param.getParentComp());
PageInfo<SingleDeptTreeVO> pageInfos = new PageInfo<>(singleDeptTreeVOS, SingleDeptTreeVO.class); 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()); DepartmentPO departmentPO = DepartmentBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(departmentPO); boolean filter = isFilter(departmentPO);
PageInfo<DepartmentListDTO> pageInfos; PageInfo<DepartmentListDTO> pageInfos;
List<DepartmentPO> allList = getDepartmentMapper().list(); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<DepartmentPO> allList = getDepartmentMapper().list(orderSql);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
// 根据条件获取元素 // 根据条件获取元素
List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO); List<DepartmentPO> filterDeptPOs = getDepartmentMapper().listByFilter(departmentPO, orderSql);
// 添加父级元素 // 添加父级元素
List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs); List<DepartmentListDTO> compListDTOS = DepartmentBO.buildDeptDTOList(allList, filterDeptPOs);
List<DepartmentListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), compListDTOS); 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); Long parentCompId = StringUtil.isEmpty(id) ? null : Long.parseLong(id);
CompPO compBuild = CompPO.builder().compName(keyword).parentCompany(parentCompId).build(); 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<>(); Set<CompPO> builderComps = new HashSet<>();
for (CompPO compPO : filterComps) { 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) { private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(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<>(); Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) { 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<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); buildParentDepts(departmentPO, builderDeparts);
@ -367,7 +367,7 @@ public class HrmResourceServiceImpl extends Service implements HrmResourceServic
private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) { private List<SearchTree> buildTreeByDeptAndJob(DepartmentPO departmentBuild, JobPO jobBuild) {
List<JobPO> jobPOS = getJobMapper().listPOsByFilter(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<>(); Set<JobPO> builderJobs = new HashSet<>();
for (JobPO jobPO : jobPOS) { 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.mapper.scheme.LevelMapper;
import com.engine.organization.service.ExtService; import com.engine.organization.service.ExtService;
import com.engine.organization.service.JobService; import com.engine.organization.service.JobService;
import com.engine.organization.util.HasRightUtil; import com.engine.organization.util.*;
import com.engine.organization.util.MenuBtn;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.OrganizationFormItemUtil;
import com.engine.organization.util.coderule.CodeRuleUtil; import com.engine.organization.util.coderule.CodeRuleUtil;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import com.engine.organization.util.page.Column; 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()); JobPO jobPO = JobBO.convertParamsToPO(param, user.getUID());
boolean filter = isFilter(jobPO); boolean filter = isFilter(jobPO);
PageInfo<JobListDTO> pageInfos; PageInfo<JobListDTO> pageInfos;
List<JobListDTO> allList = getJobMapper().listNoFilter(); String orderSql = PageInfoSortUtil.getSortSql(param.getSortParams());
List<JobListDTO> allList = getJobMapper().listNoFilter(orderSql);
// 通过子级遍历父级元素 // 通过子级遍历父级元素
if (filter) { if (filter) {
// 根据条件获取元素 // 根据条件获取元素
List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO); List<JobListDTO> filterJobPOs = getJobMapper().listByFilter(jobPO,orderSql);
// 添加父级元素 // 添加父级元素
List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs); List<JobListDTO> jobListDTOS = JobBO.buildJobDTOList(allList, filterJobPOs);
List<JobListDTO> subList = PageUtil.subList(param.getCurrent(), param.getPageSize(), jobListDTOS); 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)) { } 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<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); buildParentDepts(departmentPO, builderDeparts);
@ -509,9 +507,9 @@ public class JobServiceImpl extends Service implements JobService {
* @return * @return
*/ */
private List<SearchTree> buildTreeByCompAndDept(DepartmentPO departmentBuild, CompPO compBuild) { 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<>(); Set<DepartmentPO> builderDeparts = new HashSet<>();
for (DepartmentPO departmentPO : filterDeparts) { for (DepartmentPO departmentPO : filterDeparts) {
buildParentDepts(departmentPO, builderDeparts); 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