Newer
Older
casic-metering-biz-xichang / casic-metering-dao / src / main / resources / mapper / quality / BizQualityScenePlanMapper.xml
liwenhao on 17 Jan 2024 6 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.BizQualityScenePlanMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.quality.BizQualityScenePlan">
        <result column="id" property="id"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
        <result column="year_time" property="yearTime"/>
        <result column="biz_lab_code" property="bizLabCode"/>
        <result column="year_num" property="yearNum"/>
        <result column="sys_code" property="sysCode"/>
        <result column="file_code" property="fileCode"/>
        <result column="file_name" property="fileName"/>
        <result column="commander_id" property="commanderId"/>
        <result column="audit_objective" property="auditObjective"/>
        <result column="audit_scope" property="auditScope"/>
        <result column="requirements" property="requirements"/>
        <result column="divide_work" property="divideWork"/>
        <result column="group_leader" property="groupLeader"/>
        <result column="group_leader_name" property="groupLeaderName"/>
        <result column="year_no" property="yearNo"/>
        <result column="approval_status" property="approvalStatus"/>
        <result column="process_id" property="processId"/>
        <result column="commander_name" property="commanderName"/>
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id
        ,
                    create_time as createTime ,
                    update_time as updateTime ,
                    year_time as yearTime ,
                    biz_lab_code as bizLabCode ,
                    year_num as yearNum ,
                    sys_code as sysCode ,
                    file_code as fileCode ,
                    file_name as fileName ,
                    commander_id as commanderId ,
                    audit_objective as auditObjective ,
                    audit_scope as auditScope ,
            requirements ,
                    divide_work as divideWork ,
                    group_leader as groupLeader ,
                    group_leader_name as groupLeaderName ,
                    year_no as yearNo ,
                    approval_status as approvalStatus ,
                    process_id as processId ,
                    commander_name as commanderName
    </sql>
    <sql id="Base_Column_Alias">
        a
        .
        id
        ,
                a.create_time as createTime ,
                a.update_time as updateTime ,
                a.year_time as yearTime ,
                a.biz_lab_code as bizLabCode ,
                a.year_num as yearNum ,
                a.sys_code as sysCode ,
                a.file_code as fileCode ,
                a.file_name as fileName ,
                a.commander_id as commanderId ,
                a.audit_objective as auditObjective ,
                a.audit_scope as auditScope ,
                a.requirements ,
                a.divide_work as divideWork ,
                a.group_leader as groupLeader ,
                a.group_leader_name as groupLeaderName ,
                a.year_no as yearNo ,
                a.approval_status as approvalStatus ,
                a.process_id as processId ,
                a.commander_name as commanderName
    </sql>

    <select id="selectBizQualityScenePlanPage" resultType="com.casic.missiles.model.quality.BizQualityScenePlan">
        select
        <include refid="Base_Column_Alias"/>
        from biz_quality_scene_plan a
        <where>
            <if test="ew != null">
                ${ew.sqlSegment}
            </if>
        </where>
        order by a.create_time desc
    </select>

    <sql id="Base_Column_Query">
        <if test="request!=null">
            <if test="request.createTimeStart!= null and request.createTimeStart !=''">
                and a.create_time >= #{request.createTimeStart}
            </if>
            <if test="request.createTimeEnd!= null and request.createTimeEnd !=''">
                and a.create_time &lt;= #{request.createTimeEnd}
            </if>
            <if test="request.bizLabCode!= null and request.bizLabCode!=''">
                and a.biz_lab_code = #{request.bizLabCode}
            </if>
            <if test="request.fileCode!= null and request.fileCode!=''">
                and a.file_code like concat('%',#{request.fileCode},'%')
            </if>
            <if test="request.fileName!= null and request.fileName!=''">
                and a.file_name like concat('%',#{request.fileName},'%')
            </if>
            <if test="request.commanderId!= null and request.commanderId!=''">
                and a.commander_id = #{request.commanderId}
            </if>
            <if test="request.commanderName!= null and request.commanderName!=''">
                and a.commander_name like concat('%',#{request.commanderName},'%')
            </if>

            <if test="request != null and request.createUserId != null and request.createUserId !=''">
                and commander_id = #{request.createUserId}
            </if>
            <if test="request.workName!= null and request.workName!=''">
                and b.work_name like concat('%',#{request.workName},'%')
            </if>
            <if test="businessKeys != null">
                and a.id in
                <foreach collection="businessKeys" item="id" index="index" open="(" close=")" separator=",">
                    #{id}
                </foreach>
            </if>
            <if test="request != null and request.approvalStatus != null and request.approvalStatus !=''">
                and a.approval_status = #{request.approvalStatus}
            </if>
        </if>
    </sql>

    <select id="selectBatchForApprovalList" resultType="com.casic.missiles.model.quality.BizQualityScenePlan">
        select
        <include refid="Base_Column_Alias"/>,b.work_name as workName
        from biz_quality_scene_plan a left join biz_quality_internal_audit_management b on a.year_no = b.year_no
        WHERE 1=1
        <include refid="Base_Column_Query"/>
        ORDER BY a.create_time DESC
    </select>
</mapper>