Quellcode durchsuchen

feat:添加小程序码包列表接口

fangxinjian vor 3 Jahren
Ursprung
Commit
2b6f72ce88

+ 26 - 15
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/mapper/QrPackageMapper.java

@@ -1,13 +1,17 @@
 package com.abi.qms.platform.dao.mapper;
 
 import com.abi.qms.platform.dao.entity.QrPackage;
-import com.abi.qms.platform.dao.vo.result.*;
-import com.abi.qms.platform.dto.req.ListActivePackageAddReq;
+import com.abi.qms.platform.dao.vo.result.QrPackageVO;
+import com.abi.qms.platform.dao.vo.result.QrPackageWxVO;
+import com.abi.qms.platform.dao.vo.result.QrSingleCheckVO;
 import com.abi.qms.platform.dto.req.ListQrPackageReq;
+import com.abi.qms.platform.dto.req.ListQrPackageWxReq;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 码包 Mapper接口
  *
@@ -16,25 +20,32 @@ import org.apache.ibatis.annotations.Param;
  */
 public interface QrPackageMapper extends BaseMapper<QrPackage> {
 
-	/**
-	 * 分页查询码包信息
-	 */
-	IPage<QrPackageVO> listQrPackage(IPage page, @Param("param") ListQrPackageReq param);
+    /**
+     * 分页查询码包信息
+     */
+    IPage<QrPackageVO> listQrPackage(IPage page, @Param("param") ListQrPackageReq param);
 
-	/**
-	 * 查询码包详细信息
-	 */
-	QrPackageVO selectQrPackageDetailById(Long id);
+    /**
+     * 查询码包详细信息
+     */
+    QrPackageVO selectQrPackageDetailById(Long id);
 
 
-	/**
-	 * 单码查询详细信息
-	 */
-	QrSingleCheckVO getQrSingleCheckDetailById(@Param("id") Long id);
+    /**
+     * 单码查询详细信息
+     */
+    QrSingleCheckVO getQrSingleCheckDetailById(@Param("id") Long id);
 
+    /**
+     * 小程序查询码包列表
+     *
+     * @param req
+     * @return
+     */
+    List<QrPackageWxVO> listWxQrPackage(@Param("req") ListQrPackageWxReq req);
 
 
-	//    6.03已废弃
+    //    6.03已废弃
 //	/**
 //	 * 通过码活动id查询关联码包列表
 //	 * @param page

+ 32 - 0
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dao/vo/result/QrPackageWxVO.java

@@ -0,0 +1,32 @@
+package com.abi.qms.platform.dao.vo.result;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.io.Serializable;
+
+/**
+ * @author: fangxinjian
+ * @date: 2021/06/09 10:15
+ * @description:
+ */
+@Data
+@ApiModel
+public class QrPackageWxVO implements Serializable {
+
+    @ApiModelProperty(value = "码包ID")
+    private Long packageId;
+
+    @ApiModelProperty(value = "活动名称")
+    private String activeName;
+
+    @ApiModelProperty(value = "物料名称")
+    private String materialName;
+
+    @ApiModelProperty(value = "条码总数")
+    private Integer packageTotalNum;
+
+    @ApiModelProperty(value = "已激活条码数")
+    private Integer activePackageNum;
+}

+ 2 - 8
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/req/ListQrPackageWxReq.java

@@ -15,14 +15,8 @@ import java.io.Serializable;
 @ApiModel
 public class ListQrPackageWxReq implements Serializable {
 
-    @ApiModelProperty(value = "码包ID")
-    private Long packageId;
-
-    @ApiModelProperty(value = "活动名称")
-    private String activeName;
-
-    @ApiModelProperty(value = "物料名称")
-    private String materialName;
+    @ApiModelProperty(value = "码包ID/活动名称/物料名称")
+    private String queryParam;
 
     @ApiModelProperty(value = "激活状态 0-未激活 1-已激活")
     private Integer activeStatus;

+ 35 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/dto/res/ListQrPackageWxRes.java

@@ -1,17 +1,51 @@
 package com.abi.qms.platform.dto.res;
 
 import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.AllArgsConstructor;
 import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
 
 import java.io.Serializable;
+import java.util.List;
 
 /**
  * @author: fangxinjian
  * @date: 2021/06/09 09:57
- * @description:
+ * @description: 小程序码包列表出参
  */
 @Data
 @ApiModel
 public class ListQrPackageWxRes implements Serializable {
 
+    @ApiModelProperty("码包列表")
+    private List<QrPackageWxBean> qrPackageWxBeanList;
+
+    /**
+     * 码包Bean
+     */
+    @Data
+    @NoArgsConstructor
+    @AllArgsConstructor
+    @ToString
+    @ApiModel(value = "ListQrPackageWxRes_QrPackageWxBean")
+    public static class QrPackageWxBean {
+
+        @ApiModelProperty(value = "码包ID")
+        private Long packageId;
+
+        @ApiModelProperty(value = "活动名称")
+        private String activeName;
+
+        @ApiModelProperty(value = "物料名称")
+        private String materialName;
+
+        @ApiModelProperty(value = "条码总数")
+        private Integer packageTotalNum;
+
+        @ApiModelProperty(value = "已激活条码数")
+        private Integer activePackageNum;
+    }
+
 }

+ 10 - 1
abi-cloud-qr-platform-server/src/main/java/com/abi/qms/platform/service/impl/QrPackageServiceImpl.java

@@ -36,6 +36,7 @@ import com.abi.qms.platform.dao.vo.result.PackageActiveVO;
 import com.abi.qms.platform.dao.vo.result.QrBoxMappingVO;
 import com.abi.qms.platform.dao.vo.result.QrPackageBatchVO;
 import com.abi.qms.platform.dao.vo.result.QrPackageVO;
+import com.abi.qms.platform.dao.vo.result.QrPackageWxVO;
 import com.abi.qms.platform.dao.vo.result.QrSingleCheckVO;
 import com.abi.qms.platform.dto.req.DeleteQrPackageReq;
 import com.abi.qms.platform.dto.req.DownloadQrPackageReq;
@@ -896,7 +897,15 @@ public class QrPackageServiceImpl implements QrPackageService {
 
     @Override
     public ListQrPackageWxRes listWxQrPackage(ListQrPackageWxReq listQrPackageWxReq) {
-        return null;
+
+        ListQrPackageWxRes res = new ListQrPackageWxRes();
+
+        List<QrPackageWxVO> qrPackageWxVOList = qrPackageMapper.listWxQrPackage(listQrPackageWxReq);
+
+        List<ListQrPackageWxRes.QrPackageWxBean> beanList = PojoConverterUtils.copyList(qrPackageWxVOList, ListQrPackageWxRes.QrPackageWxBean.class);
+        res.setQrPackageWxBeanList(beanList);
+
+        return res;
     }
 
     /**

+ 135 - 115
abi-cloud-qr-platform-server/src/main/resources/dao/mapper/QrPackageMapper.xml

@@ -1,35 +1,35 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper
-PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
-"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+        PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.abi.qms.platform.dao.mapper.QrPackageMapper">
 
     <!-- 通用查询映射结果 -->
     <resultMap id="BaseResultMap" type="com.abi.qms.platform.dao.entity.QrPackage">
-        <id column="ID" property="id" />
-        <result column="MATERIAL_ID" property="materialId" />
-        <result column="FACTORY_COVER_ID" property="factoryCoverId" />
-        <result column="FACTORY_BEER_ID" property="factoryBeerId" />
-        <result column="STANDBY_RATIO" property="standbyRatio" />
-        <result column="BOX_CODE_FORMAT_ID" property="boxCodeFormatId" />
-        <result column="SAP_ORDER_NO" property="sapOrderNo" />
-        <result column="QR_NUMBER" property="qrNumber" />
-        <result column="APPLY_STATUS" property="applyStatus" />
-        <result column="GENERATE_STATUS" property="generateStatus" />
-        <result column="GENERATE_TIME" property="generateTime" />
-        <result column="REASON_APPLY" property="reasonApply" />
-        <result column="DOWNLOAD_PATH" property="downloadPath" />
-        <result column="IS_DOWNLOAD" property="isDownload" />
-        <result column="DOWNLOAD_TIME" property="downloadTime" />
-        <result column="CREATE_TIME" property="createTime" />
-        <result column="CREATE_BY" property="createBy" />
-        <result column="UPDATE_TIME" property="updateTime" />
-        <result column="UPDATE_BY" property="updateBy" />
-        <result column="IS_DELETE" property="isDelete" />
-        <result column="ZIP_PASSWORD" property="zipPassword" />
-        <result column="QR_TYPE" property="qrType" />
-        <result column="FACTORY_COVER_LEVEL_TWO_ID" property="factoryCoverLevelTwoId" />
-        <result column="INVALID" property="invalid" />
+        <id column="ID" property="id"/>
+        <result column="MATERIAL_ID" property="materialId"/>
+        <result column="FACTORY_COVER_ID" property="factoryCoverId"/>
+        <result column="FACTORY_BEER_ID" property="factoryBeerId"/>
+        <result column="STANDBY_RATIO" property="standbyRatio"/>
+        <result column="BOX_CODE_FORMAT_ID" property="boxCodeFormatId"/>
+        <result column="SAP_ORDER_NO" property="sapOrderNo"/>
+        <result column="QR_NUMBER" property="qrNumber"/>
+        <result column="APPLY_STATUS" property="applyStatus"/>
+        <result column="GENERATE_STATUS" property="generateStatus"/>
+        <result column="GENERATE_TIME" property="generateTime"/>
+        <result column="REASON_APPLY" property="reasonApply"/>
+        <result column="DOWNLOAD_PATH" property="downloadPath"/>
+        <result column="IS_DOWNLOAD" property="isDownload"/>
+        <result column="DOWNLOAD_TIME" property="downloadTime"/>
+        <result column="CREATE_TIME" property="createTime"/>
+        <result column="CREATE_BY" property="createBy"/>
+        <result column="UPDATE_TIME" property="updateTime"/>
+        <result column="UPDATE_BY" property="updateBy"/>
+        <result column="IS_DELETE" property="isDelete"/>
+        <result column="ZIP_PASSWORD" property="zipPassword"/>
+        <result column="QR_TYPE" property="qrType"/>
+        <result column="FACTORY_COVER_LEVEL_TWO_ID" property="factoryCoverLevelTwoId"/>
+        <result column="INVALID" property="invalid"/>
     </resultMap>
 
     <resultMap type="com.abi.qms.platform.dao.vo.result.QrPackageVO" id="QrPackageResult">
@@ -68,12 +68,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="qrRepertoryType" column="qr_repertory_type"/>
         <result property="boxCodeFormatName" column="box_code_format_name"/>
         <!-- 码包下载记录 -->
-        <collection property="qrPackageDownloadRecordList" javaType="java.util.List" ofType="com.abi.qms.platform.dao.vo.result.QrPackageDownloadRecordVO">
+        <collection property="qrPackageDownloadRecordList" javaType="java.util.List"
+                    ofType="com.abi.qms.platform.dao.vo.result.QrPackageDownloadRecordVO">
             <result property="createTime" column="download_time"/>
             <result property="createByName" column="download_user_name"/>
         </collection>
         <!-- 码包批次列表 -->
-        <collection property="qrPackageBatchVOList" javaType="java.util.List" ofType="com.abi.qms.platform.dao.vo.result.QrPackageBatchVO">
+        <collection property="qrPackageBatchVOList" javaType="java.util.List"
+                    ofType="com.abi.qms.platform.dao.vo.result.QrPackageBatchVO">
             <result property="id" column="batch_id"/>
             <result property="packageId" column="package_id"/>
             <result property="batchNumber" column="batch_number"/>
@@ -83,24 +85,24 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 
     <select id="listQrPackage" resultType="com.abi.qms.platform.dao.vo.result.QrPackageVO">
         SELECT
-            qp.id,
-            qp.material_id,
-            qp.factory_cover_id,
-            qp.box_code_format_id,
-            qp.sap_order_no,
-            qp.qr_number,
-            qp.apply_status,
-            qp.is_download,
-            qp.create_time,
-            qp.create_by,
-            qp.qr_type,
-            bm.material_name,
-            bf.factory_name AS factory_cover_name,
-            bcf.name AS box_code_format_name,
-            ui.user_name AS create_by_name,
-            qp.invalid
+        qp.id,
+        qp.material_id,
+        qp.factory_cover_id,
+        qp.box_code_format_id,
+        qp.sap_order_no,
+        qp.qr_number,
+        qp.apply_status,
+        qp.is_download,
+        qp.create_time,
+        qp.create_by,
+        qp.qr_type,
+        bm.material_name,
+        bf.factory_name AS factory_cover_name,
+        bcf.name AS box_code_format_name,
+        ui.user_name AS create_by_name,
+        qp.invalid
         FROM
-            qr_package qp
+        qr_package qp
         LEFT JOIN qr_box_code_format bcf ON qp.box_code_format_id = bcf.id
         LEFT JOIN base_material bm ON qp.material_id = bm.id
         LEFT JOIN base_factory bf ON qp.factory_cover_id = bf.id
@@ -120,7 +122,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND qp.sap_order_no like concat('%',#{param.sapOrderNo},'%')
             </if>
             <if test="param.factoryCoverId != null">
-                AND (qp.factory_cover_id = #{param.factoryCoverId} or qp.factory_cover_level_two_id = #{param.factoryCoverId})
+                AND (qp.factory_cover_id = #{param.factoryCoverId} or qp.factory_cover_level_two_id =
+                #{param.factoryCoverId})
             </if>
             <if test="param.applyStatus != null">
                 AND qp.apply_status = #{param.applyStatus}
@@ -199,85 +202,102 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         qp.id = #{id}
     </select>
 
+    <select id="listWxQrPackage" resultType="com.abi.qms.platform.dao.vo.result.QrPackageWxVO">
+        select qp.id as packageId,qbm.index_begin,qbm.index_end,qbm.active_status,ba.active_name,bm.material_name
+        from qr_package qp
+        inner join base_material bm on bm.id=qp.material_id
+        inner join qr_box_mapping qbm on qp.id=qbm.package_id
+        inner join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id
+        inner join base_active ba on ba.id=baqpm.active_id
+        <where>
+            <if test="req.queryParam != null and req.queryParam != ''">
+                AND (qp.id like binary concat('%',#{req.queryParam},'%')
+                or ba.active_name like binary concat('%',#{req.queryParam},'%')
+                or bm.material_name like binary concat('%',#{req.queryParam},'%'))
+            </if>
+        </where>
+        order by qp.create_time desc
+    </select>
+
     <!--6.03已废弃-->
     <!--通过码活动id查询关联码包列表-->
-<!--    <select id="listPackageById" resultType="com.abi.qms.platform.dao.vo.result.ActivePackageVO">-->
-<!--    select-->
-<!--    qp.id as packageId,-->
-<!--    qp.qr_type,-->
-<!--    bb.brand_name,-->
-<!--    bb.parent_brand_name,-->
-<!--    qp.qr_number-->
-<!--    from qr_package qp-->
-<!--    inner join base_material bm on bm.id=qp.material_id-->
-<!--    inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
-<!--    left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
-<!--    left join base_active ba on ba.id = baqpm.active_id-->
-<!--    where ba.id = #{id}-->
-<!--    </select>-->
+    <!--    <select id="listPackageById" resultType="com.abi.qms.platform.dao.vo.result.ActivePackageVO">-->
+    <!--    select-->
+    <!--    qp.id as packageId,-->
+    <!--    qp.qr_type,-->
+    <!--    bb.brand_name,-->
+    <!--    bb.parent_brand_name,-->
+    <!--    qp.qr_number-->
+    <!--    from qr_package qp-->
+    <!--    inner join base_material bm on bm.id=qp.material_id-->
+    <!--    inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
+    <!--    left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
+    <!--    left join base_active ba on ba.id = baqpm.active_id-->
+    <!--    where ba.id = #{id}-->
+    <!--    </select>-->
 
 
     <!--6.03已废弃-->
     <!--&lt;!&ndash;通过品牌code查询关联码包列表&ndash;&gt;-->
     <!--<select id="listPackageByBrandCode" resultType="com.abi.qms.platform.dao.vo.result.PackageActiveSearchVO">-->
-        <!--select-->
-        <!--qp.id as packageId,-->
-        <!--qp.qr_type,-->
-        <!--bs.sku_name,-->
-        <!--bb.brand_name,-->
-        <!--bb.parent_brand_name,-->
-        <!--qp.qr_number,-->
-        <!--ba.active_name,-->
-        <!--(CASE WHEN ba.active_name IS NULL THEN '0' ELSE '1' END) AS is_join_active-->
-        <!--from qr_package qp-->
-        <!--inner join base_material bm on bm.id=qp.material_id-->
-        <!--inner join base_sku bs on bs.id=bm.sku_id-->
-        <!--inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
-        <!--left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
-        <!--left join base_active ba on ba.id = baqpm.active_id-->
-        <!--where-->
-        <!--bb.brand_code IN(-->
-        <!--<foreach collection="param.brandCodeList" separator="," item="item">-->
-            <!--#{item}-->
-        <!--</foreach>-->
-        <!--)-->
-        <!--and qp.apply_status = 1-->
-        <!--<if test="param.activeId != null">-->
-            <!--AND ba.id is null or ba.id != #{param.activeId}-->
-        <!--</if>-->
-        <!--<if test="param.packageId != null">-->
-            <!--AND qp.id = {param.packageId}-->
-        <!--</if>-->
-        <!--<if test="param.skuName != null and param.skuName != ''">-->
-            <!--AND bs.sku_name like concat('%',#{param.skuName},'%')-->
-        <!--</if>-->
-        <!--<if test="param.qrType != null">-->
-            <!--AND qp.qr_type = #{param.qrType}-->
-        <!--</if>-->
-        <!--and qp.qr_type = 2-->
-        <!--and bb.is_delete = 0-->
-        <!--order by qp.generate_time desc-->
+    <!--select-->
+    <!--qp.id as packageId,-->
+    <!--qp.qr_type,-->
+    <!--bs.sku_name,-->
+    <!--bb.brand_name,-->
+    <!--bb.parent_brand_name,-->
+    <!--qp.qr_number,-->
+    <!--ba.active_name,-->
+    <!--(CASE WHEN ba.active_name IS NULL THEN '0' ELSE '1' END) AS is_join_active-->
+    <!--from qr_package qp-->
+    <!--inner join base_material bm on bm.id=qp.material_id-->
+    <!--inner join base_sku bs on bs.id=bm.sku_id-->
+    <!--inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
+    <!--left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
+    <!--left join base_active ba on ba.id = baqpm.active_id-->
+    <!--where-->
+    <!--bb.brand_code IN(-->
+    <!--<foreach collection="param.brandCodeList" separator="," item="item">-->
+    <!--#{item}-->
+    <!--</foreach>-->
+    <!--)-->
+    <!--and qp.apply_status = 1-->
+    <!--<if test="param.activeId != null">-->
+    <!--AND ba.id is null or ba.id != #{param.activeId}-->
+    <!--</if>-->
+    <!--<if test="param.packageId != null">-->
+    <!--AND qp.id = {param.packageId}-->
+    <!--</if>-->
+    <!--<if test="param.skuName != null and param.skuName != ''">-->
+    <!--AND bs.sku_name like concat('%',#{param.skuName},'%')-->
+    <!--</if>-->
+    <!--<if test="param.qrType != null">-->
+    <!--AND qp.qr_type = #{param.qrType}-->
+    <!--</if>-->
+    <!--and qp.qr_type = 2-->
+    <!--and bb.is_delete = 0-->
+    <!--order by qp.generate_time desc-->
     <!--</select>-->
 
     <!--&lt;!&ndash;通过码活动id查询关联码包列表&ndash;&gt;-->
     <!--<select id="listPackageByActiveApplyId" resultType="com.abi.qms.platform.dao.vo.result.ActiveModifyApplyPackageVO">-->
-        <!--select-->
-        <!--qp.id as packageId,-->
-        <!--qp.qr_type,-->
-        <!--bs.sku_name,-->
-        <!--bb.brand_name,-->
-        <!--bb.parent_brand_name,-->
-        <!--qp.qr_number,-->
-        <!--IFNULL(bamaqpm.modify_type, 3) modify_type-->
-        <!--from qr_package qp-->
-        <!--inner join base_material bm on bm.id=qp.material_id-->
-        <!--inner join base_sku bs on bs.id=bm.sku_id-->
-        <!--inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
-		<!--left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
-        <!--left join base_active ba on ba.id = baqpm.active_id-->
-		<!--left join base_active_modify_apply bama on bama.active_id = ba.id and bama.is_delete = 0-->
-        <!--left join base_active_modify_apply_qr_package_mapping bamaqpm on bamaqpm.apply_id=bama.id and bamaqpm.qr_package_id = qp.id and bamaqpm.is_delete = 0-->
-        <!--where ba.id = #{activeId}-->
-        <!--ORDER BY modify_type ASC-->
+    <!--select-->
+    <!--qp.id as packageId,-->
+    <!--qp.qr_type,-->
+    <!--bs.sku_name,-->
+    <!--bb.brand_name,-->
+    <!--bb.parent_brand_name,-->
+    <!--qp.qr_number,-->
+    <!--IFNULL(bamaqpm.modify_type, 3) modify_type-->
+    <!--from qr_package qp-->
+    <!--inner join base_material bm on bm.id=qp.material_id-->
+    <!--inner join base_sku bs on bs.id=bm.sku_id-->
+    <!--inner join base_brand bb on bb.brand_code=bs.sub_brand_code-->
+    <!--left join base_active_qr_package_mapping baqpm on baqpm.qr_package_id=qp.id-->
+    <!--left join base_active ba on ba.id = baqpm.active_id-->
+    <!--left join base_active_modify_apply bama on bama.active_id = ba.id and bama.is_delete = 0-->
+    <!--left join base_active_modify_apply_qr_package_mapping bamaqpm on bamaqpm.apply_id=bama.id and bamaqpm.qr_package_id = qp.id and bamaqpm.is_delete = 0-->
+    <!--where ba.id = #{activeId}-->
+    <!--ORDER BY modify_type ASC-->
     <!--</select>-->
 </mapper>