Newer
Older
casic-metering / casic-metering-dao / src / main / resources / mapper / meter / MeterEquipmentApplyMapper.xml
xiezhuangz on 26 Dec 2022 2 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.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,
            su.`NAME` as 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
            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.time != null and request.time !=''">
            and DATE_FORMAT( msa.msa.time, '%Y-%m-%d' ) = #{request.time}
        </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>
        ORDER BY msa.create_time DESC
    </select>
    <select id="equipmentApplyInfo" resultType="com.casic.missiles.model.MeterEquipmentApply">
        <include refid="sql"/>
        and msa.id = #{id}
    </select>


</mapper>