123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
- <?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">
- <mapper namespace="com.abi.qms.platform.dao.mapper.QrBoxMappingMapper">
- <!-- 通用查询映射结果 -->
- <resultMap id="BaseResultMap" type="com.abi.qms.platform.dao.entity.QrBoxMapping">
- <id column="ID" property="id"/>
- <result column="BOX_CODE" property="boxCode"/>
- <result column="INDEX_BEGIN" property="indexBegin"/>
- <result column="INDEX_END" property="indexEnd"/>
- <result column="BEGIN_QR_CODE" property="beginQrCode"/>
- <result column="END_QR_CODE" property="endQrCode"/>
- <result column="QR_CODE_COUNT" property="qrCodeCount"/>
- <result column="ACTIVE_STATUS" property="activeStatus"/>
- <result column="ACTIVE_TIME" property="activeTime"/>
- <result column="ACTIVE_USER_ID" property="activeUserId"/>
- <result column="ACTIVE_USER_NAME" property="activeUserName"/>
- <result column="PACKAGE_ID" property="packageId"/>
- <result column="PROJECT_NO" property="projectNo"/>
- <result column="BOARD_NO" property="boardNo"/>
- <result column="REMARK" property="remark"/>
- <result column="CREATE_USER_NAME" property="createUserName"/>
- <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="invalid" property="invalid"/>
- <result column="production_line_name" property="productionLineName"/>
- <result column="production_time" property="productionTime"/>
- </resultMap>
- <!-- 通用查询结果列 -->
- <sql id="Base_Column_List">
- id, box_code, index_begin, index_end, begin_qr_code, end_qr_code, qr_code_count, active_status, active_time,
- active_user_id, active_user_name, package_id, project_no, board_no, remark, create_user_name, create_time,
- create_by, update_time, update_by, is_delete, invalid,production_line_name,production_time
- </sql>
- <select id="listQrBoxCodeMapping" resultType="com.abi.qms.platform.dao.vo.result.QrBoxMappingVO">
- select
- qbm.id,qbm.box_code,qbm.index_begin,qbm.index_end,qbm.qr_code_count,qbm.project_no,qbm.board_no,qbm.remark,
- qbm.create_user_name,qbm.create_time,qbm.active_time,qbm.active_user_name,qbm.active_status,qbm.package_id,
- qbm.invalid,bf.factory_name
- from qr_box_mapping qbm
- inner join qr_package qp on qp.id=qbm.package_id
- left join base_factory bf on bf.id=qp.factory_beer_id
- <where>
- qbm.is_delete = 0
- <if test="req.activeStatus != null ">
- AND qbm.active_status = #{req.activeStatus}
- </if>
- </where>
- order by qbm.create_time
- </select>
- <select id="getPrintingDetail" resultType="com.abi.qms.platform.dao.vo.result.PrintingDetailVO">
- select
- qbm.begin_qr_code,qbm.end_qr_code,qbm.create_time,qbm.box_code,qbm.qr_code_count,
- qp.factory_cover_level_two_id,qp.factory_beer_id,bm.material_name
- from qr_box_mapping qbm
- inner join qr_package qp on qp.id=qbm.package_id
- inner join base_material bm on bm.id=qp.material_id
- <where>
- <if test="boxCode != null and boxCode!='' ">
- qbm.box_code = #{boxCode}
- </if>
- </where>
- </select>
- <select id="getIndexQrBoxCodeMappingOne" resultType="com.abi.qms.platform.dao.entity.QrBoxMapping">
- SELECT
- <include refid="Base_Column_List"/>
- FROM
- qr_box_mapping
- <where>
- <if test="req.packageId != null and req.packageId !='' ">
- AND package_id = #{req.packageId}
- </if>
- <if test="req.qrIndex != null and req.qrIndex != '' ">
- AND index_begin <= #{req.qrIndex} AND index_end >= #{req.qrIndex}
- </if>
- </where>
- AND is_delete = 0
- LIMIT 1
- </select>
- <select id="queryWxQrBoxMappingDetails"
- resultType="com.abi.qms.platform.dao.vo.result.QueryWxQrBoxMappingDetailsVO">
- SELECT
- mapping.box_code ,
- material.material_name,
- active.active_name,
- case when qpckage.qr_type = 2 then qpckage.qr_number else 0 end AS qrCodeCount
- FROM
- qr_box_mapping AS mapping
- LEFT JOIN qr_package AS qpckage ON qpckage.id = mapping.package_id
- LEFT JOIN base_material AS material ON material.id = qpckage.material_id
- LEFT JOIN base_active AS active ON active.id = material.active_id
- WHERE mapping.box_code = #{req.boxCode} AND mapping.is_delete = 0
- </select>
- <select id="getActivationRecord" resultType="com.abi.qms.platform.dao.vo.result.ActivationRecordVO">
- select qbm.box_code,ba.active_name,bm.material_name,
- qbm.active_time,ui.employee_no as activeAccount
- from qr_box_mapping qbm
- left join qr_package qp on qbm.package_id=qp.id
- left join base_material bm on bm.id = qp.material_id
- left join base_active ba on ba.id =bm.active_id
- left join user_info ui on ui.id=qbm.create_by
- <where>
- qbm.active_status=1
- <if test="req.month != null and req.month !=''">
- AND DATE_FORMAT(qbm.active_time,'%Y-%m') = #{req.month}
- </if>
- </where>
- </select>
- <select id="getActivateDetail" resultType="com.abi.qms.platform.dao.vo.result.ActivateDetailVo">
- select qbm.box_code,ba.active_name,bm.material_name,
- case when qp.qr_type = 2 then qp.qr_number else 0 end as capNum
- from qr_box_mapping qbm
- left join qr_package qp on qbm.package_id=qp.id
- left join base_material bm on bm.id = qp.material_id
- left join base_active ba on ba.id =bm.active_id
- <where>
- <if test="boxCode != null and boxCode !=''">
- qbm.box_code = #{boxCode}
- </if>
- </where>
- </select>
- </mapper>
|