Răsfoiți Sursa

入库+通用 供应商+客户组合查询

koushanshan 2 ani în urmă
părinte
comite
fb0dea1a72

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

@@ -529,6 +529,31 @@ public class CommonController extends BaseController<Map<String, Object>> {
     public ResponseResultVO<?> getInitData(@RequestBody Map<String, Object> param) {
         return commonService.getInitData(param);
     }
+
+
+    /**
+     * @desc   : 查询供应商与客户
+     * @date   : 2024/3/13 14:01
+     * @author : 寇珊珊
+     */
+    @PostMapping({"get_supplier_and_customer"})
+    public ResponseResultVO<?> getSupplierAndCustomer(@RequestBody Map<String, Object> param) {
+        return commonService.getSupplierAndCustomer(param);
+    }
+
+    /**
+     * @desc   : 获取供应商和客户数据(分页)
+     * @date   : 2024/3/13 14:53
+     * @author : 寇珊珊
+     */
+    @ApiOperation(
+            value = "获取供应商和客户数据(分页)",
+            notes = "获取供应商和客户数据(分页)"
+    )
+    @PostMapping("get_supplier_and_customer_by_page")
+    public ResponseResultVO<PageList<Map<String, Object>>> getSupplierAndCustomerByPage(@RequestBody Map<String, Object> param) {
+        return commonService.getSupplierAndCustomerByPage(param);
+    }
 }
 
 

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

@@ -368,4 +368,26 @@ public interface CommonMapper extends BaseMapper<Map<String, Object>> {
     List<Map<String, Object>> getStaff(Map param);
 
 
+    /**
+     * @desc   : 获取供应商和客户数据
+     * @date   : 2024/3/13 14:03
+     * @author : 寇珊珊
+     */
+    List<Map<String, Object>> getSupplierAndCustomer(Map param);
+
+    /**
+     * @desc   : 获取供应商和客户数据分页
+     * @date   : 2024/3/13 14:03
+     * @author : 寇珊珊
+     */
+    List<Map<String,Object>> getSupplierAndCustomerByPage(Map param);
+
+    /**
+     * @desc   : 获取供应商和客户数据分页数量
+     * @date   : 2024/3/13 14:53
+     * @author : 寇珊珊
+     */
+    Long getSupplierAndCustomerByPageCount(Map param);
+
+
 }

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

@@ -978,4 +978,152 @@
     </select>
     <!--获取仓库档案-->
 
+
+
+    <!--获取供应商和客户数据-->
+    <select id="getSupplierAndCustomer" resultType="java.util.Map">
+        select tms.sup_id as "objId",
+        tms.sup_code as "objCode",
+        tms.sup_name as "objName",
+        '供应商' as "objTypeName",
+        1 as "objType",
+        tms.flg_valid as "flgValid"
+        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>
+        </where>
+        union all
+        select cus.cus_id as "objId",
+        cus.cus_code as "objCode",
+        cus.cus_name as "objName",
+        '客户' as "objTypeName",
+        2 as "objType",
+        cus.flg_valid as "flgValid",
+        cus.cus_phone as "phone",
+        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>
+        </where>
+    </select>
+    <!--获取供应商和客户数据分页-->
+    <select id="getSupplierAndCustomerByPage" resultType="java.util.Map">
+        select * from(
+        select tms.sup_id as "objId",
+        tms.sup_code as "objCode",
+        tms.sup_name as "objName",
+        '供应商' as "objTypeName",
+        1 as "objType",
+        tms.flg_valid as "flgValid",
+        tms.contact_phone as "phone"
+        null as "customerPhone" ,
+        tms.contact_name as "contactName" ,
+        tms.contact_phone as "contactPhones"
+        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>
+        </where>
+        union all
+        select cus.cus_id as "objId",
+        cus.cus_code as "objCode",
+        cus.cus_name as "objName",
+        '客户' as "objTypeName",
+        2 as "objType",
+        cus.flg_valid as "flgValid",
+        cus.cus_phone as "phone",
+        cus.address_full as "addressFull"
+        <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>
+        </where>
+        ) tt
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
+    <!--获取供应商和客户数据分页-->
+    <select id="getSupplierAndCustomerByPageCount" resultType="Long">
+        select count(1) from(
+        select tms.sup_id as "objId",
+        tms.sup_code as "objCode",
+        tms.sup_name as "objName",
+        '供应商' as "objTypeName",
+        1 as "objType",
+        tms.flg_valid as "flgValid"
+        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>
+        </where>
+        union all
+        select cus.cus_id as "objId",
+        cus.cus_code as "objCode",
+        cus.cus_name as "objName",
+        '客户' as "objTypeName",
+        2 as "objType",
+        cus.flg_valid as "flgValid",
+        cus.cus_phone as "phone",
+        cus.address_full as "addressFull"
+        from dkic_b.t_csm_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>
+        </where>
+        ) tt
+    </select>
+
 </mapper>

+ 1 - 7
src/main/java/com/dk/mdm/mapper/ivt/IntoReturnItemMapper.java

@@ -37,12 +37,6 @@ public interface IntoReturnItemMapper extends BaseMapper<IntoReturnItem>{
      */
     IntoReturnItemResponse selectById(@Param("itemId") String itemId);
 
-    /**
-     * @desc   : 根据Id修改
-     * @date   : 2024/3/12 9:32
-     * @author : 寇珊珊
-     */
-    int updateById(IntoReturnItem intoReturnItem);
-    
+
 }
 

+ 0 - 6
src/main/java/com/dk/mdm/mapper/ivt/IntoReturnMapper.java

@@ -43,11 +43,5 @@ public interface IntoReturnMapper extends BaseMapper<IntoReturn>{
      */
     IntoReturnResponse selectById(@Param("returnId") String returnId);
 
-    /**
-     * @desc   : 根据Id修改
-     * @date   : 2024/3/12 9:32
-     * @author : 寇珊珊
-     */
-    int updateById(IntoReturn intoReturn);
 }
 

+ 0 - 7
src/main/java/com/dk/mdm/mapper/pur/PurchaseItemMapper.java

@@ -49,12 +49,5 @@ public interface PurchaseItemMapper extends BaseMapper<PurchaseItem>{
     int  updateAmount(PurchaseItem purchaseItem);
 
 
-    /**
-     * @desc   : 根据Id修改
-     * @date   : 2024/3/12 9:32
-     * @author : 寇珊珊
-     */
-    int updateById(PurchaseItem purchaseItem);
-
 }
 

+ 0 - 6
src/main/java/com/dk/mdm/mapper/pur/PurchaseMapper.java

@@ -68,11 +68,5 @@ public interface PurchaseMapper extends BaseMapper<Purchase>{
 
     Purchase selectPurchaseByRighting(PurchaseQuery purchaseQuery);
 
-    /**
-     * @desc   : 根据Id修改
-     * @date   : 2024/3/12 9:32
-     * @author : 寇珊珊
-     */
-    int updateById(Purchase purchase);
 }
 

+ 1 - 1
src/main/java/com/dk/mdm/model/pojo/pur/Purchase.java

@@ -32,7 +32,7 @@ import java.time.LocalDateTime;
 @EqualsAndHashCode(callSuper = true)
 @Accessors(chain = true)
 @ExportTitle("采购订单")
-@TableName(value = "t_psi_purchase", autoResultMap = true)
+@TableName(value = "t_psi_purchase", autoResultMap = true, schema = "dkic_b")
 @ApiModel(value="实体类:采购订单", description="表名:t_psi_purchase")
 public class Purchase extends PageInfo<Purchase> implements Serializable {
 

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

@@ -715,4 +715,45 @@ public class CommonService extends BaseService<Map<String, Object>> {
         }
         return ResponseResultUtil.success(list);
     }
+
+
+
+
+    /**
+     * @desc   : 获取供应商和客户数据
+     * @date   : 2024/3/13 15:09
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<List<Map<String, Object>>> getSupplierAndCustomer(Map<String, Object> param) {
+        // 获取供应商和客户
+        List<Map<String, Object>> list = commonMapper.getSupplierAndCustomer(param);
+        return ResponseResultUtil.success(list);
+
+    }
+    
+    
+    /**
+     * @desc   : 获取供应商和客户数据(分页)
+     * @date   : 2024/3/13 14:02
+     * @author : 寇珊珊
+     */
+    public ResponseResultVO<PageList<Map<String, Object>>> getSupplierAndCustomerByPage(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.getSupplierAndCustomerByPage(param);
+        // 获取总数量
+        Long total = commonMapper.getSupplierAndCustomerByPageCount(param);
+        // 组装返回值
+        data.setPageSize((int) param.get("pageSize")).setCurrentPage((int) param.get("currentPage")).setList(list).setTotal(total);
+        return ResponseResultUtil.success(data);
+    }
+
 }