Newer
Older
casic-metering-biz-xichang / casic-metering-dao / src / main / resources / mapper / resource / BizResourceSoftwareInfoMapper.xml
<?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.resource.BizResourceSoftwareInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.resource.BizResourceSoftwareInfo">
        <id column="id" property="id" />
        <result column="report_id" property="reportId" />
        <result column="software_document" property="softwareDocument" />
        <result column="function_document" property="functionDocument" />
        <result column="source_code" property="sourceCode" />
        <result column="data_validation_record" property="dataValidationRecord" />
        <result column="remark" property="remark" />
        <result column="create_user_id" property="createUserId" />
        <result column="create_user_name" property="createUserName" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, report_id, software_document, function_document, source_code, data_validation_record, remark, create_user_id, create_user_name, create_time, update_time
    </sql>

    <select id="selectSoftwareList" resultMap="BaseResultMap">
        SELECT brsi.*, brsrr.software_name, brsrr.software_version
        FROM biz_resource_software_info brsi
        JOIN biz_resource_software_review_report brsrr ON brsi.report_id = brsrr.id
        WHERE 1=1
        <if test="request != null and request.labCode != null and request.labCode !=''">
            and brsi.lab_code = #{request.labCode}
        </if>
        <if test="request != null and request.groupCode != null and request.groupCode !=''">
            and brsi.group_code = #{request.groupCode}
        </if>
        <if test="request != null and request.softwareName != null and request.softwareName !=''">
            and brsrr.software_name like concat(#{request.softwareName},'%')
        </if>
        <if test="request != null and request.softwareVersion != null and request.softwareVersion !=''">
            and brsrr.software_version like concat(#{request.softwareVersion},'%')
        </if>
        <if test="request != null and request.createUserName != null and request.createUserName !=''">
            and brsi.create_user_name like concat('%',#{request.createUserName},'%')
        </if>
        <if test="request != null and request.updateTimeStart != null and request.updateTimeStart !=''">
            and brsi.update_time &gt;= #{request.updateTimeStart}
        </if>
        <if test="request != null and request.updateTimeEnd != null and request.updateTimeEnd !=''">
            and brsi.update_time &lt;= #{request.updateTimeEnd}
        </if>
        ORDER BY brsi.update_time DESC
    </select>

    <select id="selectDetailById" resultMap="BaseResultMap">
        SELECT brsi.*, brsrr.software_name, brsrr.software_version, brsrr.report_no
        FROM biz_resource_software_info brsi
        JOIN biz_resource_software_review_report brsrr ON brsi.report_id = brsrr.id
        WHERE brsi.id = #{id}
    </select>

    <select id="selectSoftwareBatchIds" resultMap="BaseResultMap">
        SELECT brsi.*, brsrr.software_name, brsrr.software_version
        FROM biz_resource_software_info brsi
        JOIN biz_resource_software_review_report brsrr ON brsi.report_id = brsrr.id
        WHERE brsi.id IN
        <foreach collection="ids" index="index" item="id" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
</mapper>