123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173 |
- <?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.QrRepertoryMapper">
- <!-- 码库 -->
- <resultMap id="QrRepertoryResult" type="com.abi.qms.platform.dao.entity.QrRepertory">
- <result property="id" column="id"/>
- <result property="name" column="name"/>
- <result property="type" column="type"/>
- <result property="status" column="status"/>
- <result property="createTime" column="create_time"/>
- <result property="createBy" column="create_by"/>
- <result property="updateTime" column="update_time"/>
- <result property="updateBy" column="update_by"/>
- <result property="isDelete" column="is_delete"/>
- <result property="isSys" column="is_sys"/>
- </resultMap>
- <!-- 码库的列 -->
- <resultMap id="QrRepertoryColumnResult" type="com.abi.qms.platform.dao.vo.result.QrRepertoryColumnVO">
- <result property="id" column="qr_repertory_column_id"/>
- <result property="qrRepertoryId" column="qr_repertory_id"/>
- <result property="qrFormatId" column="qr_format_id"/>
- <result property="qrFormatName" column="qr_format_name"/>
- <result property="qrFormatVO.id" column="qr_format_id"/>
- <result property="qrFormatVO.codeVariableBuildClass" column="code_variable_build_class"/>
- <result property="sortNumber" column="sort_number"/>
- <result property="alias" column="alias"/>
- <result property="urlType" column="url_type"/>
- <result property="remark" column="remark"/>
- </resultMap>
- <!-- 码包 -->
- <resultMap id="QrPackageResult" type="com.abi.qms.platform.dao.vo.result.QrPackageVO">
- <!-- <result property="batchNumber" column="batch_number"/>-->
- <result property="id" column="qr_package_id"/>
- <result property="qrNumber" column="qr_number"/>
- <result property="createTime" column="qr_package_create_time"/>
- <result property="createByName" column="qr_package_create_by_name"/>
- </resultMap>
- <!-- 适用于码库详情的resultMap -->
- <resultMap id="DetailResult" type="com.abi.qms.platform.dao.vo.result.QrRepertoryVO" extends="QrRepertoryResult">
- <result property="updateByName" column="update_by_name"/>
- <!-- 码库的列 -->
- <collection property="qrRepertoryColumnList" javaType="java.util.List" resultMap="QrRepertoryColumnResult"/>
- <!-- 码包 -->
- <collection property="qrPackageList" javaType="java.util.List" resultMap="QrPackageResult"/>
- </resultMap>
- <!-- 适用于分页查询的resultMap,因为IPage遇到collection会分页异常,需要使用select重新查询 -->
- <resultMap id="IPageResult" type="com.abi.qms.platform.dao.vo.result.QrRepertoryVO" extends="QrRepertoryResult">
- <result property="updateByName" column="update_by_name"/>
- <!-- 码库的列 -->
- <collection property="qrRepertoryColumnList" column="id" javaType="java.util.List"
- ofType="com.abi.qms.platform.dao.vo.result.QrRepertoryColumnVO" select="selectQrRepertoryColumn"/>
- </resultMap>
- <select id="selectQrRepertoryColumn" resultType="com.abi.qms.platform.dao.vo.result.QrRepertoryColumnVO">
- SELECT
- id,
- qr_repertory_id,
- qr_format_id,
- sort_number,
- alias,
- url_type,
- remark
- FROM qr_repertory_column
- WHERE qr_repertory_id = #{id} AND is_delete = 0
- </select>
- <select id="listQrRepertory" resultMap="IPageResult">
- SELECT
- qr.id,
- qr.name,
- qr.type,
- qr.status,
- qr.update_time,
- qr.update_by,
- ui.user_name AS update_by_name
- FROM qr_repertory qr
- LEFT JOIN user_info ui ON qr.update_by = ui.id
- <where>
- qr.is_delete = 0
- AND qr.is_sys = 0
- <if test="param.name != null and param.name != ''">
- AND qr.name LIKE CONCAT('%',#{param.name},'%')
- </if>
- <if test="param.type != null">
- AND qr.type = #{param.type}
- </if>
- <if test="param.status != null">
- AND qr.status = #{param.status}
- </if>
- <if test="param.updateByName != null and param.updateByName != ''">
- AND ui.user_name LIKE CONCAT('%',#{param.updateByName},'%')
- </if>
- <if test="param.beginUpdateTime != null and param.beginUpdateTime != ''">
- AND qr.update_time >= #{param.beginUpdateTime}
- </if>
- <if test="param.endUpdateTime != null and param.endUpdateTime != ''">
- AND qr.update_time <= #{param.endUpdateTime}
- </if>
- </where>
- order by qr.update_time desc
- </select>
- <select id="selectQrRepertoryDetailById" resultMap="DetailResult">
- SELECT
- qr.id,
- qr.name,
- qr.type,
- qr.status,
- qr.create_time,
- qr.create_by,
- qr.update_time,
- qr.update_by,
- qrc.id AS qr_repertory_column_id,
- qrc.qr_repertory_id,
- qrc.qr_format_id,
- qrc.sort_number,
- qrc.alias,
- qrc.url_type,
- qrc.remark,
- qf.code_variable_build_class,
- qf.name as qr_format_name,
- qp.id as qr_package_id,
- qp.qr_number,
- qp.create_time AS qr_package_create_time,
- ui.user_name AS qr_package_create_by_name
- FROM qr_repertory qr
- LEFT JOIN qr_repertory_column qrc ON qrc.qr_repertory_id = qr.id
- LEFT JOIN qr_format qf ON qf.id = qrc.qr_format_id
- LEFT JOIN qr_box_code_format bcf ON bcf.qr_repertory_id = qr.id
- LEFT JOIN qr_package qp ON qp.box_code_format_id = bcf.id
- LEFT JOIN user_info ui ON ui.id = qp.create_by
- WHERE qr.id = #{id} AND qrc.is_delete = 0
- </select>
- <select id="selectNotDisabledQrRepertory" resultType="java.lang.String">
- SELECT
- name
- FROM
- qr_repertory
- WHERE
- id IN ( SELECT DISTINCT qr_repertory_id FROM qr_repertory_column WHERE qr_format_id = #{qrFormatId} AND is_delete = 0 )
- AND is_delete = 0
- AND status != 40
- </select>
- <select id="listQrRepertorySelectDetail"
- resultType="com.abi.qms.platform.dao.vo.result.QrRepertorySelectDetailVO">
- select
- qr.id as repertoryId,
- qrc.id as qr_repertory_column_id,
- qrc.sort_number,
- qrc.alias
- from qr_repertory qr
- inner join qr_repertory_column qrc on qr.id=qrc.qr_repertory_id
- <where>
- <if test="id != null and id != ''">
- and qr.id = #{id}
- </if>
- and qr.is_delete = 0
- and qr.is_sys = 0
- </where>
- </select>
- </mapper>
|