yaowanxin
2025-08-11 8238b458d6a3bec147fd4b639ed0427de7cf8be4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<?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.ruoyi.measuringinstrumentledger.mapper.MeasuringInstrumentLedgerRecordMapper">
 
    <select id="listPage"
            resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord">
        SELECT
        t1.id,
        t1.user_id,
        t1.user_name,
        t2.code,
        t2.name,
        t2.model,
        t1.valid,
        t1.record_date,
        t1.entry_date
        FROM
        measuring_instrument_ledger_record t1
        left join measuring_instrument_ledger t2 on t1.measuring_instrument_ledger_id = t2.id
        <where>
            <!-- 查询条件同上 -->
            <if test="req.code != null and req.code != ''">
                AND t2.code LIKE CONCAT('%', #{req.code}, '%')
            </if>
            <if test="req.name != null and req.name != ''">
                AND t2.name LIKE CONCAT('%', #{req.name}, '%')
            </if>
            <if test="req.entryDate != null">
                AND t1.entry_date = DATE_FORMAT(#{req.entryDate},'%Y-%m-%d')
            </if>
            <if test="req.recordDate != null">
                AND t1.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
            </if>
        </where>
        ORDER BY t1.update_time DESC
    </select>
    <select id="list" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedgerRecord">
        SELECT
        t1.id,
        t1.user_id,
        t1.user_name,
        t2.code,
        t2.name,
        t2.model,
        t1.valid,
        t1.record_date,
        t1.entry_date
        FROM
        measuring_instrument_ledger_record t1
        left join measuring_instrument_ledger t2 on t1.measuring_instrument_ledger_id = t2.id
        <where>
            <!-- 查询条件同上 -->
            <if test="req.code != null and req.code != ''">
                AND t2.code LIKE CONCAT('%', #{req.code}, '%')
            </if>
            <if test="req.name != null and req.name != ''">
                AND t2.name LIKE CONCAT('%', #{req.name}, '%')
            </if>
            <if test="req.entryDate != null">
                AND t1.entry_date = DATE_FORMAT(#{req.entryDate},'%Y-%m-%d')
            </if>
            <if test="req.recordDate != null">
                AND t1.record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
            </if>
        </where>
        ORDER BY t1.update_time DESC
    </select>
</mapper>