Newer
Older
casic-metering / casic-metering-dao / src / main / resources / mapper / meter / MeterEquipmentApplyMapper.xml
zhangyingjie on 6 Jan 2023 3 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.meter.MeterEquipmentApplyMapper">

    <select id="selectMaxNo" resultType="java.lang.Long">
        SELECT IFNULL(max(RIGHT(apply_no, 12)), 0) from meter_equipment_apply
    </select>
    <sql id="sql">
        SELECT
            msa.id,
            msa.apply_no,
            msa.apply_type,
            msa.approval_status,
            msa.apply_name,
            sd.SIMPLE_NAME as apply_unit_name,
            su.`NAME` as apply_person_name,
            DATE_FORMAT( msa.time, '%Y-%m-%d %H:%i' ) as time,
            msa.overhaul_person,
            msa.apply_desc,
            msa.process_id,
            msa.process_result,
            msa.remark
        FROM
            meter_equipment_apply msa
            LEFT JOIN sys_user su ON su.id = msa.apply_person
            LEFT JOIN sys_dept sd ON sd.id = msa.apply_unit
        where 1=1 and msa.is_del = 0
    </sql>
    <select id="equipmentApplyList" resultType="com.casic.missiles.model.MeterEquipmentApply">
        <include refid="sql"/>
        <if test="request.applyNo != null and request.applyNo !=''">
            and msa.apply_no like concat('%', #{request.applyNo}, '%')
        </if>
        <if test="request.applyName != null and request.applyName !=''">
            and msa.apply_name like concat('%', #{request.applyName}, '%')
        </if>
        <if test="request.applyUnit != null and request.applyUnit !=''">
            and msa.apply_unit = #{request.applyUnit}
        </if>
        <if test="request.applyPerson != null and request.applyPerson !=''">
            and msa.apply_person = #{request.applyPerson}
        </if>
        <if test="request.startTime != null and request.startTime !=''">
            and DATE_FORMAT( msa.time, '%Y-%m-%d' ) &gt;= #{request.startTime}
        </if>
        <if test="request.endTime != null and request.endTime !=''">
            and DATE_FORMAT( msa.time, '%Y-%m-%d' ) &lt;= #{request.endTime}
        </if>
        <if test="request.approvalStatus != null and request.approvalStatus !=''">
            and msa.approval_status = #{request.approvalStatus}
        </if>
        <if test="request.processResult != null and request.processResult !=''">
            and msa.process_result = #{request.processResult}
        </if>
        <if test="request.createUser != null and request.createUser !=''">
            and msa.create_user = #{request.createUser}
        </if>
        <if test="request.applyType != null and request.applyType !=''">
            and msa.apply_type = #{request.applyType}
        </if>
        <if test="request.businessKeys != null and request.businessKeys.size() > 0">
            and msa.id in
            <foreach collection='request.businessKeys' item='id' open='(' separator=',' close=')'>
                #{id}
            </foreach>
        </if>

        ORDER BY msa.create_time DESC
    </select>
    <select id="equipmentApplyInfo" resultType="com.casic.missiles.model.MeterEquipmentApply">
        SELECT
            msa.id,
            msa.apply_no,
            msa.apply_type,
            msa.approval_status,
            msa.apply_name,
            msa.apply_unit,
            msa.apply_person,
            DATE_FORMAT( msa.time, '%Y-%m-%d %H:%i' ) as time,
            msa.overhaul_person,
            msa.apply_desc,
            msa.process_id,
            msa.process_result,
            msa.remark
        FROM
            meter_equipment_apply msa
        where 1=1 and msa.is_del = 0
        and msa.id = #{id}
    </select>


</mapper>