Newer
Older
casic-metering-biz-xichang / casic-metering-dao / src / main / resources / mapper / business / BizBusinessDeviceMeasureItemInfoMapper.xml
wangpeng on 23 Oct 2023 4 KB 多功能校准源核查数据管理
<?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.business.BizBusinessDeviceMeasureItemInfoMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.casic.missiles.model.business.BizBusinessDeviceMeasureItemInfo">
        <id column="id" property="id" />
        <result column="device_model_id" property="deviceModelId" />
        <result column="device_type" property="deviceType" />
        <result column="belong_standard_equipment" property="belongStandardEquipment" />
        <result column="help_field_instruction" property="helpFieldInstruction" />
        <result column="item_category_id" property="itemCategoryId" />
        <result column="item_category_name" property="itemCategoryName" />
        <result column="data_sync" property="dataSync" />
        <result column="sync_time" property="syncTime" />
        <result column="appearance_function_check" property="appearanceFunctionCheck" />
        <result column="item_remark" property="itemRemark" />
        <result column="as_template" property="asTemplate" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, device_model_id, device_type, belong_standard_equipment, help_field_instruction, item_category_id, item_category_name, data_sync,
        sync_time, appearance_function_check, item_remark, as_template, create_time, update_time
    </sql>

    <select id="measureItemListPage" resultMap="BaseResultMap">
        SELECT bbdmii.*, eemi.category AS deviceType, eemi.model_no AS modelNo, eemi.equipment_name AS deviceName,
        eemi.model AS model, eemi.help_instruction AS helpInstruction, eemi.instructions_file AS instructionsFile,
        eemi.check_cycle AS checkCycle, eemi.id AS eqptDeviceModelId, eemi.category AS eqptDeviceType
        FROM eqpt_equipment_model_info eemi
        LEFT JOIN biz_business_device_measure_item_info bbdmii ON eemi.id = bbdmii.device_model_id
        WHERE 1=1
        <if test="request != null and request.modelNo != null and request.modelNo !=''">
            and eemi.model_no like concat('%',#{request.modelNo},'%')
        </if>
        <if test="request != null and request.deviceName != null and request.deviceName !=''">
            and eemi.equipment_name = #{request.deviceName}
        </if>
        <if test="request != null and request.model != null and request.model !=''">
            and eemi.model = #{request.model}
        </if>
        <if test="request != null and request.itemCategoryId != null and request.itemCategoryId !=''">
            and bbdmii.item_category_id = #{request.itemCategoryId}
        </if>
        <if test="request != null and request.asTemplate != null and request.asTemplate !=''">
            and bbdmii.as_template = #{request.asTemplate}
        </if>
        <if test="request != null and request.helpInstruction != null and request.helpInstruction !=''">
            and eemi.help_instruction = #{request.helpInstruction}
        </if>
        <if test="request != null and request.helpFieldInstruction != null and request.helpFieldInstruction !=''">
            and bbdmii.help_field_instruction = #{request.helpFieldInstruction}
        </if>
        <if test="request != null and request.deviceType != null and request.deviceType !=''">
            and bbdmii.device_type = #{request.deviceType}
        </if>
        <if test="request != null and request.dataSync != null and request.dataSync !=''">
            and bbdmii.data_sync = #{request.dataSync}
        </if>
        <if test="request != null and request.syncTimeStart != null and request.syncTimeStart !=''">
            and bbdmii.sync_time &gt;= #{request.syncTimeStart}
        </if>
        <if test="request != null and request.syncTimeEnd != null and request.syncTimeEnd !=''">
            and bbdmii.sync_time &lt;= #{request.syncTimeEnd}
        </if>
        ORDER BY eemi.create_time DESC
    </select>

    <select id="selectDetailById" resultMap="BaseResultMap">
        SELECT bbdmii.*, eemi.category AS deviceType, eemi.model_no AS modelNo, eemi.equipment_name AS deviceName,
        eemi.model AS model, eemi.help_instruction AS helpInstruction, eemi.instructions_file AS instructionsFile,
        eemi.check_cycle AS checkCycle
        FROM eqpt_equipment_model_info eemi
        LEFT JOIN biz_business_device_measure_item_info bbdmii ON eemi.id = bbdmii.device_model_id
        WHERE bbdmii.id = #{id}
    </select>

    <select id="selectBelongStandardEquipmentByItemId" resultType="java.lang.String">
        SELECT bbdmic.belong_standard_equipment
        FROM biz_business_device_measure_item_info bbdmii
        JOIN biz_business_device_measure_item_category bbdmic ON bbdmii.item_category_id = bbdmic.id
        WHERE bbdmii.id = #{itemId}
    </select>
</mapper>