Bladeren bron

供应商

dongke 2 jaren geleden
bovenliggende
commit
5cef22f05e

+ 13 - 1
src/main/java/com/dk/mdm/controller/pur/PurchaseController.java

@@ -41,7 +41,19 @@ public class PurchaseController{
     public ResponseResultVO<PageList<PurchaseResponse>> selectByCond(@RequestBody PurchaseQuery purchaseQuery) {
         return purchaseService.selectByCond(purchaseQuery);
     }
-
+    /**
+     * @desc   : 条件查询 带明细
+     * @author : 王英杰
+     * @date   : 2024/2/28 9:46
+     */
+    @ApiOperation(
+            value = "分页、关联、条件查询",
+            notes = "分页、关联、条件查询"
+    )
+    @PostMapping({"list_by_item"})
+    public ResponseResultVO<PageList<PurchaseResponse>> selectByCondItem(@RequestBody PurchaseQuery purchaseQuery) {
+        return purchaseService.selectByCondItem(purchaseQuery);
+    }
     /**
      * @desc   : 采购订单 待入库查询
      * @author : 王英杰

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

@@ -25,6 +25,13 @@ public interface PurchaseMapper extends BaseMapper<Purchase>{
     List<PurchaseResponse> selectByCond(PurchaseQuery purchaseQuery);
 
     /**
+     * @desc   : 查询采购订单 带明细
+     * @author : 王英杰
+     * @date   : 2024/2/28 9:48
+     */
+    List<PurchaseResponse> selectByCondItem(PurchaseQuery purchaseQuery);
+
+    /**
      * @desc   : 查询采购订单个数
      * @author : 常皓宁
      * @date   : 2024/2/28 9:48

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

@@ -136,6 +136,43 @@
         <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
         <result column="op_db_user" property="opDbUser"/>
         <result column="wh_id" property="whId"/>
+        <collection property="purchaseItemResponseList" resultMap="purchaseItemListMap" columnPrefix="list_"/>
+    </resultMap>
+    <!--    关联映射-->
+    <resultMap id="purchaseItemListMap" type="java.util.Map">
+        <id column="item_id" property="itemId"/>
+        <result column="pur_id" property="purId" typeHandler="UuidTypeHandler"/>
+        <result column="item_index" property="itemIndex"/>
+        <result column="sku_id" property="skuId" typeHandler="UuidTypeHandler"/>
+        <result column="item_qty" property="itemQty"/>
+        <result column="price_std" property="priceStd"/>
+        <result column="amt_std" property="amtStd"/>
+        <result column="price_pur" property="pricePur"/>
+        <result column="item_amt" property="itemAmt"/>
+        <result column="price_discount" property="priceDiscount"/>
+        <result column="non_std_code" property="nonStdCode"/>
+        <result column="into_status" property="intoStatus"/>
+        <result column="intoing_qty" property="intoingQty"/>
+        <result column="intoing_amt" property="intoingAmt"/>
+        <result column="into_qty" property="intoQty"/>
+        <result column="into_amt" property="intoAmt"/>
+        <result column="return_qty" property="returnQty"/>
+        <result column="return_amt" property="returnAmt"/>
+        <result column="remarks" property="remarks"/>
+        <result column="flg_valid" property="flgValid"/>
+        <result column="cp_id" property="cpId"/>
+        <result column="sku_code" property="skuCode"/>
+        <result column="sku_name" property="skuName"/>
+        <result column="sku_model" property="skuModel"/>
+        <result column="short_name" property="shortName"/>
+        <result column="op_create_time" property="opCreateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_create_user_id" property="opCreateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_update_time" property="opUpdateTime" typeHandler="TimestampTypeHandler"/>
+        <result column="op_update_user_id" property="opUpdateUserId" typeHandler="UuidTypeHandler"/>
+        <result column="op_app_code" property="opAppCode"/>
+        <result column="op_timestamp" property="opTimestamp" typeHandler="TimestampTypeHandler"/>
+        <result column="op_db_user" property="opDbUser"/>
+
     </resultMap>
 
     <!-- 通用条件列 -->
@@ -416,6 +453,71 @@
             limit #{end} offset #{start}
         </if>
     </select>
+    <sql id="Base_Column_List_Item_Response_Join">
+        ,tppi.item_id  as "List_item_id",
+        tppi.pur_id  as "List_pur_id",
+        tppi.item_index as "List_item_index",
+        tppi.sku_id as "List_sku_id",
+        tppi.item_qty as "List_item_qty",
+        tppi.price_std as "pricePurchase",
+        tppi.amt_std as "List_amt_std",
+        tppi.price_pur as "List_price_pur",
+        tppi.item_amt as "List_item_amt",
+        tppi.price_discount as "List_price_discount",
+        tppi.non_std_code as "List_non_std_code",
+        tppi.into_status as "List_into_status",
+        tppi.intoing_qty as "List_intoing_qty",
+        tppi.intoing_amt as "List_intoing_amt",
+        tppi.into_qty as "List_into_qty",
+        tppi.into_amt as "List_into_amt",
+        tppi.return_qty as "List_return_qty",
+        tppi.return_amt as "List_return_amt",
+        tppi.remarks as "List_remarks",
+        tppi.flg_valid as "List_flg_valid",
+        tppi.cp_id as "List_cp_id",
+        tppi.op_create_time as "List_op_create_time",
+        tppi.op_create_user_id as "List_op_create_user_id",
+        tppi.op_update_time as "List_op_update_time",
+        tppi.op_update_user_id as "List_op_update_user_id",
+        tppi.op_app_code as "List_op_app_code",
+        tppi.op_timestamp as "List_op_timestamp",
+        tppi.op_db_user as "List_op_db_user",
+        tmgs.sku_code AS  list_sku_code,
+        tmgs.sku_name AS  list_sku_name,
+        tmgb.short_name AS  list_short_name,
+        tmgs.sku_model AS  list_sku_model,
+        tmgs.price_purchase AS  list_price_purchase,
+        tmgs.sku_images AS  list_sku_images,
+        tpit.usable_qty AS list_usable_qty,
+        tpit.inv_qty AS list_inv_qty,
+        tpit.outing_qty AS list_outing_qty
+    </sql>
+
+    <!-- 查询表dkic_b.t_psi_purchase,(条件查询+分页)列表 -->
+    <select id="selectByCondItem" resultMap="BaseResultMapResponse">
+        SELECT
+        <include refid="Base_Column_List_Left_join"/>
+        <include refid="Base_Column_List_Item_Response_Join"/>
+        ,tmo.org_name as "orgName"
+        ,tms.staff_name as "staffName"
+        ,tms1.staff_name as "makeStaffName"
+        ,tmp.sup_name as "supplierName"
+        ,tmw.wh_name as "whName"
+        FROM dkic_b.t_psi_purchase tpp
+        left join dkic_b.t_psi_purchase_item tppi  on tppi.pur_id = tpp.pur_id
+        left join  dkic_b.t_mst_goods_sku  tmgs on tmgs.sku_id = tppi.sku_id
+        left join  dkic_b.t_mst_goods_brand  tmgb on tmgb.brand_id = tmgs.brand_id
+        left join  dkic_b.t_psi_inventory  tpit on tpit.sku_id = tppi.sku_id
+        Left join dkic_b.t_mst_org tmo on tpp.org_id = tmo.org_id
+        Left join dkic_b.t_mst_supplier tmp on tpp.sup_id = tmp.sup_id
+        Left join dkic_b.t_mst_staff tms on tpp.staff_id = tms.staff_id
+        Left join dkic_b.t_mst_staff tms1 on tpp.make_staff = tms1.staff_id
+        Left join dkic_b.t_mst_warehouse tmw on tpp.wh_id = tmw.wh_id
+        <include refid="Condition_1"/>
+        <if test="pageSize != null and currentPage != null and pageSize != 0 and currentPage != 0">
+            limit #{end} offset #{start}
+        </if>
+    </select>
 
 
     <!-- 根据主键查询表dkic_b.t_psi_purchase的一行数据 -->

+ 2 - 0
src/main/java/com/dk/mdm/model/response/pur/PurchaseResponse.java

@@ -11,6 +11,7 @@ import com.dk.common.infrastructure.handler.JsonTypeHandler;
 import com.dk.common.infrastructure.handler.TimestampTypeHandler;
 import com.dk.common.infrastructure.handler.UuidTypeHandler;
 import com.dk.common.model.pojo.PageInfo;
+import com.dk.mdm.model.response.ivt.InboundItemResponse;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
@@ -409,6 +410,7 @@ public class PurchaseResponse extends PageInfo<PurchaseResponse> implements Seri
     @ApiModelProperty(value = "采购订单明细")
     private List<PurchaseItemResponse> purchaseItemResponseList;
 
+
     /*
      * 相关属性
      * @TableField(exist = false)

+ 9 - 1
src/main/java/com/dk/mdm/service/pur/PurchaseService.java

@@ -86,7 +86,15 @@ public class PurchaseService extends BaseService<Purchase> {
     public ResponseResultVO<PageList<PurchaseResponse>> selectByCond(PurchaseQuery purchaseQuery) {
         return super.mergeListWithCount(purchaseQuery, purchaseMapper.selectByCond(purchaseQuery), purchaseMapper.countByCond(purchaseQuery));
     }
-
+    /**
+     * @desc : 条件查询 带明细
+     * @author : 王英杰
+     * @date : 2024/2/28 9:47
+     */
+    @Pagination
+    public ResponseResultVO<PageList<PurchaseResponse>> selectByCondItem(PurchaseQuery purchaseQuery) {
+        return super.mergeListWithCount(purchaseQuery, purchaseMapper.selectByCondItem(purchaseQuery), purchaseMapper.countByCond(purchaseQuery));
+    }
     /**
      * @desc : 采购订单 待入库查询
      * @author : 王英杰