Răsfoiți Sursa

用户,组织机构查询

koushanshan 2 ani în urmă
părinte
comite
7bb0db8c6c

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

@@ -566,6 +566,64 @@ public class CommonController extends BaseController<Map<String, Object>> {
     public ResponseResultVO<PageList<Map<String, Object>>> getSupplierAndCustomerByPage(@RequestBody Map<String, Object> param) {
         return commonService.getSupplierAndCustomerByPage(param);
     }
+
+    /**
+     * @desc   : 查询用户,组织机构(目前用于入库负责人)
+     * @date   : 2024/3/13 16:21
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = "查询用户,组织机构(目前用于入库负责人)",
+            notes = "查询用户,组织机构(目前用于入库负责人)"
+    )
+    @PostMapping("get_user")
+    public ResponseResultVO<List<Map<String, Object>>> getUser(@RequestBody Map<String, Object> param) {
+        return commonService.getUser(param);
+    }
+
+    /**
+     * @desc   : 查询用户,组织机构(目前用于入库负责人) (分页)
+     * @date   : 2024/3/13 16:22
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = " 查询用户,组织机构(目前用于入库负责人)(分页)",
+            notes = " 查询用户,组织机构(目前用于入库负责人)(分页)"
+    )
+    @PostMapping("get_user_by_page")
+    public ResponseResultVO<PageList<Map<String, Object>>> getUserByPage(@RequestBody Map<String, Object> param) {
+        return commonService.getUserByPage(param);
+    }
+
+    /**
+     * @desc   : 获取组织机构
+     * @date   : 2024/3/13 16:48
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = "获取组织机构",
+            notes = "获取组织机构"
+    )
+    @PostMapping("get_organization")
+    public ResponseResultVO<List<Map<String, Object>>> getOrganization(@RequestBody Map<String, Object> param) {
+        return commonService.getOrganization(param);
+    }
+
+
+    /**
+     * @desc   : 获取组织机构(分页)
+     * @date   : 2024/3/13 17:03
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = "获取组织机构(分页)",
+            notes = "获取组织机构(分页)"
+    )
+    @PostMapping("get_organization_by_page")
+    public ResponseResultVO<PageList<Map<String, Object>>> getOrganizationByPage(@RequestBody Map<String, Object> param) {
+        return commonService.getOrganizationByPage(param);
+    }
+
 }
 
 

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

@@ -389,5 +389,47 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
      */
     Long getSupplierAndCustomerByPageCount(Map param);
 
+    /**
+     * @desc   : 获取供应商和客户数据
+     * @date   : 2024/3/13 16:24
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getUser(Map param);
+
+    /**
+     * @desc   : 获取供应商和客户数据(分页)
+     * @date   : 2024/3/13 16:24
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getUserByPage(Map param);
+
+    /**
+     * @desc   : 获取供应商和客户数据个数
+     * @date   : 2024/3/13 16:25
+     * @author : 寇珊珊
+     */
+    Long getUserCount(Map<String, Object> param);
+
+    /**
+     * @desc   : 获取组织机构
+     * @date   : 2024/3/13 17:03
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getOrganization(Map param);
+
+    /**
+     * @desc   : 获取组织机构分页
+     * @date   : 2024/3/13 17:03
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getOrganizationByPage(Map param);
+
+    /**
+     * @desc   : 获取组织机构数量
+     * @date   : 2024/3/13 17:03
+     * @author : 寇珊珊
+     */
+    Long getOrganizationCount(Map<String, Object> param);
+
 
 }

+ 166 - 42
src/main/java/com/dk/mdm/mapper/common/CommonMapper.xml

@@ -996,10 +996,10 @@
             AND tms.flgValid
         </if>
         <if test="objCode != null and objCode != ''">
-            AND tms.sup_code LIKE concat('%', #{objCode}, '%')
+            AND tms.sup_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
         </if>
         <if test="objName != null and objName != ''">
-            AND tms.sup_name LIKE concat('%', #{objName}, '%')
+            AND tms.sup_name LIKE concat('%',my_ex.likequery(#{objCode}),'%')
         </if>
         </where>
         union all
@@ -1013,18 +1013,15 @@
         cus.address_full as "addressFull"
         from dkic_b.t_mst_customer cus
         <where>
-        <if test="flgValid">
-            AND cus.flgValid
-        </if>
-        <if test="objCode != null and objCode != ''">
-            AND cus.cus_code LIKE concat('%', #{objCode}, '%')
-        </if>
-        <if test="objName != null and objName != ''">
-            AND cus.cus_name LIKE concat('%', #{objName}, '%')
-        </if>
-        <if test="flgValid">
-            AND cus.flgValid
-        </if>
+            <if test="flgValid">
+                AND cus.flgValid
+            </if>
+            <if test="objCode != null and objCode != ''">
+                AND cus.cus_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
+            </if>
+            <if test="objName != null and objName != ''">
+                AND cus.cus_name LIKE concat('%',my_ex.likequery(#{objName}),'%')
+            </if>
         </where>
     </select>
     <!--获取供应商和客户数据分页-->
@@ -1040,15 +1037,15 @@
         null as "addressFull"
         from dkic_b.t_mst_supplier tms
         <where >
-        <if test="flgValid">
-            AND tms.flgValid
-        </if>
-        <if test="objCode != null and objCode != ''">
-            AND tms.sup_code LIKE concat('%', #{objCode}, '%')
-        </if>
-        <if test="objName != null and objName != ''">
-            AND tms.sup_name LIKE concat('%', #{objName}, '%')
-        </if>
+            <if test="flgValid">
+                AND tms.flgValid
+            </if>
+            <if test="objCode != null and objCode != ''">
+                AND tms.sup_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
+            </if>
+            <if test="objName != null and objName != ''">
+                AND tms.sup_name LIKE concat('%',my_ex.likequery(#{objCode}),'%')
+            </if>
         </where>
         union all
         select cus.cus_id as "objId",
@@ -1061,18 +1058,18 @@
         cus.address_full as "addressFull"
         from dkic_b.t_mst_customer cus
         <where>
-        <if test="flgValid">
-            AND cus.flgValid
-        </if>
-        <if test="objCode != null and objCode != ''">
-            AND cus.cus_code LIKE concat('%', #{objCode}, '%')
-        </if>
-        <if test="objName != null and objName != ''">
-            AND cus.cus_name LIKE concat('%', #{objName}, '%')
-        </if>
-        <if test="flgValid">
-            AND cus.flgValid
-        </if>
+            <if test="flgValid">
+                AND cus.flgValid
+            </if>
+            <if test="objCode != null and objCode != ''">
+                AND cus.cus_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
+            </if>
+            <if test="objName != null and objName != ''">
+                AND cus.cus_name LIKE concat('%',my_ex.likequery(#{objName}),'%')
+            </if>
+            <if test="flgValid">
+                AND cus.flgValid
+            </if>
         </where>
         ) tt
         <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
@@ -1096,10 +1093,10 @@
                 AND tms.flgValid
             </if>
             <if test="objCode != null and objCode != ''">
-                AND tms.sup_code LIKE concat('%', #{objCode}, '%')
+                AND tms.sup_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
             </if>
             <if test="objName != null and objName != ''">
-                AND tms.sup_name LIKE concat('%', #{objName}, '%')
+                AND tms.sup_name LIKE concat('%',my_ex.likequery(#{objCode}),'%')
             </if>
         </where>
         union all
@@ -1117,16 +1114,143 @@
                 AND cus.flgValid
             </if>
             <if test="objCode != null and objCode != ''">
-                AND cus.cus_code LIKE concat('%', #{objCode}, '%')
+                AND cus.cus_code LIKE concat('%',my_ex.likequery(#{objCode}),'%')
             </if>
             <if test="objName != null and objName != ''">
-                AND cus.cus_name LIKE concat('%', #{objName}, '%')
-            </if>
-            <if test="flgValid">
-                AND cus.flgValid
+                AND cus.cus_name LIKE concat('%',my_ex.likequery(#{objName}),'%')
             </if>
         </where>
         ) tt
     </select>
 
+
+    <!-- 获取用户 -->
+    <select id="getUser" resultType="java.util.Map">
+        select u.user_name as "userName"
+        , u.user_code as "userCode"
+        , u.user_id as "userId"
+        , u.org_id as "orgId"
+        , o.org_name as "orgName"
+        , c.cp_name as "cpName"
+        from core.t_dk_user u
+        left join dkic_b.t_mst_org o on o.org_id = u.org_id
+        left join dkic_a.t_a_company c on c.cp_id = o.sale2_id
+        where
+        u.cp_id = #{cpId}
+        <if test="userCode !=null and userCode !=''">
+            AND u.user_code LIKE concat('%',my_ex.likequery(#{userCode}),'%')
+        </if>
+        <if test="userName !=null and userName !=''">
+            AND u.user_name LIKE concat('%',my_ex.likequery(#{userName}),'%')
+        </if>
+        <if test="orgId !=null">
+            AND u.org_id = #{orgId}
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+    </select>
+
+    <!-- 获取用户分页 -->
+    <select id="getUserByPage" resultType="java.util.Map">
+        select u.user_name as "userName"
+        , u.user_code as "userCode"
+        , u.user_id as "userId"
+        , u.org_id as "orgId"
+        , o.org_name as "orgName"
+        , c.cp_name as "cpName"
+        from core.t_dk_user u
+        left join dkic_b.t_mst_org o on o.org_id = u.org_id
+        left join dkic_a.t_a_company c on c.cp_id = o.sale2_id
+        where
+        u.cp_id = #{cpId}
+        <if test="userCode !=null and userCode !=''">
+            AND u.user_code LIKE concat('%',my_ex.likequery(#{userCode}),'%')
+        </if>
+        <if test="userName !=null and userName !=''">
+            AND u.user_name LIKE concat('%',my_ex.likequery(#{userName}),'%')
+        </if>
+        <if test="orgId !=null">
+            AND u.org_id = #{orgId}
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+    </select>
+
+    <!-- 获取用户分页个数-->
+    <select id="getUserCount" resultType="java.lang.Long">
+        select count(1)
+        from core.t_dk_user u
+        left join dkic_b.t_mst_org o on o.org_id = u.org_id
+        left join dkic_a.t_a_company c on c.cp_id = o.sale2_id
+        where
+        u.cp_id = #{cpId}
+        <if test="userCode !=null and userCode !=''">
+            AND u.user_code LIKE concat('%',my_ex.likequery(#{userCode}),'%')
+        </if>
+        <if test="userName !=null and userName !=''">
+            AND u.user_name LIKE concat('%',my_ex.likequery(#{userName}),'%')
+        </if>
+        <if test="orgId !=null">
+            AND u.org_id = #{orgId}
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+    </select>
+
+
+    <!-- 获取组织机构 -->
+    <select id="getOrganization" resultType="java.util.Map">
+        select o.org_id as "orgId"
+        , o.org_code as "orgCode"
+        , o.org_name as "orgName"
+        from dkic_b.t_mst_org o
+        where
+        o.flg_valid
+        and o.cp_id = #{cpId}
+        <if test="orgCode !=null and orgCode !=''">
+            AND o.org_code LIKE concat('%',my_ex.likequery(#{orgCode}),'%')
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+        order by o.level_code
+    </select>
+    <!-- 获取组织机构分页 -->
+    <select id="getOrganizationByPage" resultType="java.util.Map">
+        select o.org_id as "orgId"
+        , o.org_code as "orgCode"
+        , o.org_name as "orgName"
+        from dkic_b.t_mst_org o
+        where
+        o.flg_valid
+        and o.cp_id = #{cpId}
+        <if test="orgCode !=null and orgCode !=''">
+            AND o.org_code LIKE concat('%',my_ex.likequery(#{orgCode}),'%')
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+        order by o.level_code
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+    <!-- 获取组织机构分个数-->
+    <select id="getOrganizationCount" resultType="java.lang.Long">
+        SELECT count(1)
+        from dkic_b.t_mst_org o
+        where
+        o.flg_valid
+        and o.cp_id = #{cpId}
+        <if test="orgCode !=null and orgCode !=''">
+            AND o.org_code LIKE concat('%',my_ex.likequery(#{orgCode}),'%')
+        </if>
+        <if test="orgName !=null and orgName !=''">
+            AND o.org_name LIKE concat('%',my_ex.likequery(#{orgName}),'%')
+        </if>
+    </select>
+
 </mapper>

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

@@ -784,4 +784,77 @@ public class CommonService extends BaseService<Map<String, Object>> {
         return ResponseResultUtil.success(data);
     }
 
+
+    /**
+     * @desc   : 查询用户,组织机构(目前用于入库负责人)
+     * @date   : 2024/3/13 16:24
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getUser(Map<String, Object> param) {
+        List<Map<String, Object>> list = commonMapper.getUser(param);
+        return ResponseResultUtil.success(list);
+    }
+
+
+    /**
+     * @desc   : 查询用户,组织机构(目前用于入库负责人) (分页)
+     * @date   : 2024/3/13 16:24
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<PageList<Map<String, Object>>> getUserByPage(Map<String, Object> param) {
+        // 校验分页参数
+        if (param.get("pageSize") == null || param.get("currentPage") == null) {
+            return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
+        }
+        // 定义返回值
+        PageList<Map<String, Object>> data = new PageList<>();
+        // 分页参数赋值
+        param = this.getLimit(param);
+        // 获取用户
+        List<Map<String, Object>> list = commonMapper.getUserByPage(param);
+        // 获取总数量
+        Long total = commonMapper.getUserCount(param);
+        // 组装返回值
+        data.setPageSize((int) param.get("pageSize")).setCurrentPage((int) param.get("currentPage")).setList(list).setTotal(total);
+        return ResponseResultUtil.success(data);
+    }
+
+    /**
+     * @desc   : 获取组织机构
+     * @date   : 2024/3/13 17:01
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getOrganization(Map<String, Object> param) {
+        // 获取组织机构
+        List<Map<String, Object>> list = commonMapper.getOrganization(param);
+        return ResponseResultUtil.success(list);
+    }
+
+
+    /**
+     * @desc   : 获取组织机构(分页)
+     * @date   : 2024/3/13 17:01
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<PageList<Map<String, Object>>> getOrganizationByPage(Map<String, Object> param) {
+        // 校验分页参数
+        if (param.get("pageSize") == null || param.get("currentPage") == null) {
+            return ResponseResultUtil.error(ResponseCodeEnum.OPERATE_FAIL, "请检查分页参数!");
+        }
+        // 定义返回值
+        PageList<Map<String, Object>> data = new PageList<>();
+        // 分页参数赋值
+        param = this.getLimit(param);
+        // 获取组织机构
+        List<Map<String, Object>> list = commonMapper.getOrganizationByPage(param);
+        // 获取总数量
+        Long total = commonMapper.getOrganizationCount(param);
+        // 组装返回值
+        data.setPageSize((int) param.get("pageSize")).setCurrentPage((int) param.get("currentPage")).setList(list).setTotal(total);
+        return ResponseResultUtil.success(data);
+    }
+
+
+
+
 }