Newer
Older
casic-metering-biz-xichang / casic-metering-dao / src / main / resources / mapper / quality / BizQualitySupervisionRepMapper.xml
liwenhao on 17 Jan 2024 5 KB 1.质量审批权限调整
<?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.casic.missiles.mapper.quality.BizQualitySupervisionRepMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.quality.BizQualitySupervisionRep">
        <result column="id" property="id"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="biz_lab_code" property="bizLabCode"/>
        <result column="sup_dep_id" property="supDepId"/>
        <result column="sys_code" property="sysCode"/>
        <result column="file_code" property="fileCode"/>
        <result column="file_name" property="fileName"/>
        <result column="creator" property="creator"/>
        <result column="approval_status" property="approvalStatus"/>
        <result column="process_id" property="processId"/>
        <result column="process_info" property="processInfo"/>
        <result column="better_process_desc" property="betterProcessDesc"/>
        <result column="problem_process_desc" property="problemProcessDesc"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id
        ,
            create_time as createTime ,
            update_time as updateTime ,
            biz_lab_code as bizLabCode ,
            sup_dep_id as supDepId ,
            sys_code as sysCode ,
            file_code as fileCode ,
            file_name as fileName ,
            creator ,
            approval_status as approvalStatus ,
            process_id as processId ,
            process_info as processInfo ,
            better_process_desc as betterProcessDesc ,
            problem_process_desc as problemProcessDesc
    </sql>

    <select id="selectBizQualitySupervisionRepPage"
            resultType="com.casic.missiles.model.quality.BizQualitySupervisionRep">
        select
        a.id ,
        a.create_time as createTime ,
        a.update_time as updateTime ,
        a.biz_lab_code as bizLabCode ,
        a.sup_dep_id as supDepId,
        a.sys_code as sysCode ,
        a.file_code as fileCode ,
        a.file_name as fileName ,
        a.creator ,
        a.approval_status as approvalStatus ,
        a.process_id as processId ,
        a.process_info as processInfo ,
        a.better_process_desc as betterProcessDesc ,
        a.problem_process_desc as problemProcessDesc,
        a.log_time as logTime
        from biz_quality_supervision_rep a
        <where>
            <if test="ew != null">
                ${ew.sqlSegment}
            </if>
        </where>
        order by a.create_time desc
    </select>
<!--    <select id="selectMaxNo" resultType="java.lang.Long">-->
<!--        SELECT IFNULL(max(RIGHT(file_code, 3)), 0) from biz_quality_supervision_rep-->
<!--        <where>-->
<!--            <if test="ew != null">-->
<!--                ${ew.sqlSegment}-->
<!--            </if>-->
<!--        </where>-->
<!--    </select>-->
    <select id="selectBatchForApprovalList" resultType="com.casic.missiles.model.quality.BizQualitySupervisionRep">
        select a.id,
        a.create_time as createTime,
        a.update_time as updateTime,
        a.biz_lab_code as bizLabCode,
        a.sup_dep_id as supDepId,
        a.sys_code as sysCode,
        a.file_code as fileCode,
        a.file_name as fileName,
        a.creator,
        a.creator_name as creatorName,
        a.sub_time as subTime,
        a.approval_status as approvalStatus,
        a.process_id as processId,
        a.process_info as processInfo,
        a.better_process_desc as betterProcessDesc,
        a.problem_process_desc as problemProcessDesc,
        a.log_time as logTime
        from biz_quality_supervision_rep a
        WHERE 1=1
        <if test="request != null and request.approvalStatus != null and request.approvalStatus !=''">
            and approval_status = #{request.approvalStatus}
        </if>
        <if test="businessKeys != null">
            and id in
            <foreach collection="businessKeys" item="id" index="index" open="(" close=")" separator=",">
                #{id}
            </foreach>
        </if>

        <if test="request != null and request.bizLabCode != null and request.bizLabCode !=''">
            and biz_lab_code = #{request.bizLabCode}
        </if>
        <if test="request != null and request.fileCode != null and request.fileCode !=''">
            and file_code like concat('%',#{request.fileCode},'%')
        </if>
        <if test="request != null and request.creator != null and request.creator !=''">
            and creator =  #{request.creator}
        </if>
        <if test="request != null and request.groupNo != null and request.groupNo !=''">
            and group_no  =  #{request.groupNo}
        </if>
        <if test="request != null and request.supDepId != null and request.supDepId !=''">
            and sup_dep_id =  #{request.supDepId}
        </if>
        <if test="request != null and request.isNonConformance != null and request.isNonConformance == 1">
            and exists(select 1 from biz_quality_rep_rel c INNER JOIN biz_quality_supervision_record d on c.sup_record_id = d.id where c.rep_id = a.id)
        </if>
        <if test="request != null and request.subTimeStart != null and request.subTimeStart !=''">
            and sub_time &gt;= #{request.subTimeStart}
        </if>
        <if test="request != null and request.subTimeEnd != null and request.subTimeEnd !=''">
            and sub_time &lt;= #{request.subTimeEnd}
        </if>
        <if test="request != null and request.createUserId != null and request.createUserId !=''">
            and creator = #{request.createUserId}
        </if>
        ORDER BY a.create_time DESC
    </select>

</mapper>