Explorar el Código

增加控件查询

fubin hace 2 años
padre
commit
7bcd3906bd

+ 11 - 0
src/main/java/com/dk/mdm/controller/common/CommonController.java

@@ -161,6 +161,17 @@ public class CommonController extends BaseController<Map<String, Object>> {
     }
 
     /**
+     * @desc : 获取组织部门(分页)
+     * @author : 姜宁
+     * @date : 2023/1/29 16:52
+     */
+    @ApiOperation(value = "获取员工分页查询", notes = "获取员工分页查询")
+    @PostMapping({"get_org_by_page"})
+    public ResponseResultVO<PageList<Map<String, Object>>> getOrgByPage(@RequestBody Map<String, Object> param) {
+        return commonService.getOrgByPage(param);
+    }
+
+    /**
      * @desc : 获取产品品牌
      * @author : 夏常明
      * @date : 2023/1/10 13:53

+ 7 - 0
src/main/java/com/dk/mdm/mapper/common/CommonMapper.java

@@ -78,6 +78,13 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     List<Map<String, Object>> getOrg(Map param);
 
     /**
+     * @desc : 获取部门(数量)
+     * @author : 姜宁
+     * @date : 2023/1/29 17:04
+     */
+    Long getOrgCountByPage(Map param);
+
+    /**
      * @desc : 获取产品品牌
      * @author : 夏常明
      * @date : 2023/1/10 13:57

+ 38 - 72
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -177,17 +177,17 @@
 
     <!-- 获取组织部门 -->
     <select id="getOrg" resultType="java.util.Map">
-        select org_Id AS "orgId",
-        org_code AS "orgCode",
-        org_name AS "orgName",
-        org_Id AS "id",
-        parent_id AS "parentId",
-        top_Id AS "topId",
-        display_no AS "displayNo",
-        remarks
-        from core.t_organization
-        where fty_id = #{ftyId}
-        and flg_valid
+        select org_Id     AS "orgId",
+               org_code   AS "orgCode",
+               org_name   AS "orgName",
+               org_Id     AS "id",
+               parent_id  AS "parentId",
+               top_Id     AS "topId",
+               display_no AS "displayNo",
+               remarks
+        from dkic_b.t_mst_org
+        where flg_valid
+          and cp_id = #{cpId}
         <if test="topId != null">
             AND top_id = #{topId}
         </if>
@@ -196,6 +196,22 @@
         </if>
         order by display_no
     </select>
+
+    <!-- t_mst_org,(条件查询)个数 -->
+    <select id="getOrgCountByPage" resultType="Long">
+        SELECT
+        count(1)
+        from dkic_b.t_mst_org
+        where flg_valid
+          and cp_id = #{cpId}
+        <if test="topId != null">
+            AND top_id = #{topId}
+        </if>
+        <if test="orgId != null">
+            AND org_id != #{orgId}
+        </if>
+    </select>
+
     <!-- 产品品牌-->
     <select id="getBrand" resultType="java.util.Map">
         select brand_id   as "brandId",
@@ -272,47 +288,20 @@
 
     <!-- 获取员工 -->
     <select id="getStaffByPage" resultType="java.util.Map">
-        select staff.staff_id AS "staffId",
-        staff.staff_code AS "staffCode",
-        staff.staff_name AS "staffName",
-        sys.f_code_name(staff.staff_code,staff.staff_name) AS "staffCodeName",
-        staff.job_id AS "jobId",
-        org.level_name AS "orgName",
-        post.post_name AS "postName",
-        job.job_name AS "jobName",
-        staff.remarks
-        from core.t_staff AS staff
-        left join core.t_organization AS org
-        on staff.org_id = org.org_id
-        left join core.t_post AS post
-        on staff.post_id = post.post_id
-        left join core.t_job AS job
-        on staff.job_id = job.job_id
-        where staff.fty_id = #{ftyId}
-        and staff.flg_valid
-        and staff.staff_status = '员工状态-在职'
-        <if test="jobName != null and jobName != ''">
-            And position (#{jobName} in job.job_name)>0
-        </if>
+        select staff.staff_id                                      AS "staffId",
+               staff.staff_code                                    AS "staffCode",
+               staff.staff_name                                    AS "staffName",
+               sys.f_code_name(staff.staff_code, staff.staff_name) AS "staffCodeName",
+               staff.remarks
+        from dkic_b.t_mst_staff AS staff
+        where staff.flg_valid
+          and staff.cp_id =#{cpId}
         <if test="staffCode != null and staffCode != ''">
             And position (#{staffCode} in staff.staff_code)>0
         </if>
         <if test="staffName != null and staffName != ''">
             And position (#{staffName} in staff.staff_name)>0
         </if>
-        <if test="jobId != null and jobId != ''">
-            And staff.job_id = #{jobId}
-        </if>
-        <if test="jobIds != null and jobIds.size() > 0">
-            And staff.job_id =any(#{jobIds, typeHandler=BigIntListTypeHandler})
-        </if>
-        <if test="staffUserId != null and staffUserId != ''">
-            And EXISTS(select 1 from core.t_work_team t where t.user_id = #{staffUserId}
-            <if test="jobId != null and jobId != ''">
-                And t.wt_job_id = #{jobId}
-            </if>
-            And staff.staff_id = any (t.staff_ids))
-        </if>
         order by staff.staff_code
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
             limit #{end} offset #{start}
@@ -323,38 +312,15 @@
     <select id="getStaffCountByPage" resultType="Long">
         SELECT
         count(1)
-        from core.t_staff AS staff
-        left join core.t_organization AS org
-        on staff.org_id = org.org_id
-        left join core.t_post AS post
-        on staff.post_id = post.post_id
-        left join core.t_job AS job
-        on staff.job_id = job.job_id
-        where staff.fty_id = #{ftyId}
-        and staff.flg_valid
-        and staff.staff_status = '员工状态-在职'
-        <if test="jobName != null and jobName != ''">
-            And position (#{jobName} in job.job_name)>0
-        </if>
+        from dkic_b.t_mst_staff AS staff
+        where staff.flg_valid
+          and staff.cp_id =#{cpId}
         <if test="staffCode != null and staffCode != ''">
             And position (#{staffCode} in staff.staff_code)>0
         </if>
         <if test="staffName != null and staffName != ''">
             And position (#{staffName} in staff.staff_name)>0
         </if>
-        <if test="jobId != null and jobId != ''">
-            And staff.job_id = #{jobId}
-        </if>
-        <if test="jobIds != null and jobIds.size() > 0">
-            And staff.job_id =any(#{jobIds, typeHandler=BigIntListTypeHandler})
-        </if>
-        <if test="staffUserId != null and staffUserId != ''">
-            And EXISTS(select 1 from core.t_work_team t where t.user_id = #{staffUserId}
-            <if test="jobId != null and jobId != ''">
-                And t.wt_job_id = #{jobId}
-            </if>
-            And staff.staff_id = any (t.staff_ids))
-        </if>
     </select>
 
     <!--    函数查询单个系统参数-->

+ 16 - 0
src/main/java/com/dk/mdm/service/common/CommonService.java

@@ -151,6 +151,22 @@ public class CommonService extends BaseService<Map<String, Object>> {
     }
 
     /**
+     * @desc : 获取部门
+     * @author : 姜宁
+     * @date : 2023/1/29 17:01
+     */
+    public ResponseResultVO<PageList<Map<String, Object>>> getOrgByPage(Map<String, Object> param) {
+        // 校验分页参数
+        if (param.get("pageSize") == null || param.get("currentPage") == null) {
+            return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
+        }
+        // 分页参数赋值
+        param = this.getLimit(param);
+        return super.mergeListWithCount(param, commonMapper.getOrg(param),
+                commonMapper.getOrgCountByPage(param));
+    }
+
+    /**
      * @desc : 获取商品品牌
      * @author : 夏常明
      * @date : 2023/1/10 14:24