maven
13 小时以前 8c8f19c87c9dfa7576f04ad80d864b37d0617786
src/main/resources/mapper/measuringinstrumentledger/MeasuringInstrumentLedgerMapper.xml
@@ -2,54 +2,48 @@
        "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerMapper">
    <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger">
    <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.dto.MeasuringInstrumentLedgerPageDto">
        SELECT
        id,
        user_id,
        user_name,
        code,
        name,
        model,
        most_date,
        valid,
        next_date,
        record_date,
        CASE
        WHEN next_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
        ELSE 2
        END AS status,
        create_user,
        create_time,
        update_user,
        update_time,
        tenant_id
        mil.id,
        mil.user_id,
        mil.user_name,
        mil.code,
        sd.dept_name,
        mil.installation_location,
        mil.unit,
        mil.cycle,
        mil.name,
        mil.model,
        mil.most_date,
        mil.valid,
        mil.next_date,
        mil.record_date,
        mil.create_user,
        mil.create_time,
        mil.update_user,
        mil.update_time,
        mil.tenant_id
        FROM
        measuring_instrument_ledger
        measuring_instrument_ledger mil
        left join sys_dept sd on sd.id = mil.dept_id
        <where>
            <!-- 查询条件同上 -->
            <if test="req.code != null and req.code != ''">
                AND code LIKE CONCAT('%', #{req.code}, '%')
                AND mil.code LIKE CONCAT('%', #{req.code}, '%')
            </if>
            <if test="req.name != null and req.name != ''">
                AND name LIKE CONCAT('%', #{req.name}, '%')
                AND mil.name LIKE CONCAT('%', #{req.name}, '%')
            </if>
            <if test="req.status != null">
                <choose>
                    <when test="req.status == 1">
                        AND next_date &gt;=  DATE_FORMAT(now(),'%Y-%m-%d')
                    </when>
                    <when test="req.status == 2">
                        AND next_date &lt;  DATE_FORMAT(now(),'%Y-%m-%d')
                    </when>
                </choose>
                AND mil.status = #{req.status}
            </if>
            <if test="req.tenantId != null">
                AND tenant_id = #{req.tenantId}
                AND mil.tenant_id = #{req.tenantId}
            </if>
            <if test="req.recordDate != null">
                AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
                AND mil.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
            </if>
        </where>
        ORDER BY update_time DESC
        ORDER BY mil.update_time DESC
    </select>
</mapper>