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
| <?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.MeasuringInstrumentLedgerMapper">
|
| <select id="listPage" resultType="com.ruoyi.measuringinstrumentledger.pojo.MeasuringInstrumentLedger">
| SELECT
| id,
| user_id,
| user_name,
| code,
| name,
| model,
| most_date,
| valid,
| next_date,
| record_date,
| CASE
| WHEN next_date >= DATE_FORMAT(now(),'%Y-%m-%d') THEN 1
| ELSE 2
| END AS status,
| create_user,
| create_time,
| update_user,
| update_time,
| tenant_id
| FROM
| measuring_instrument_ledger
| <where>
| <!-- 查询条件同上 -->
| <if test="req.code != null and req.code != ''">
| AND code LIKE CONCAT('%', #{req.code}, '%')
| </if>
| <if test="req.name != null and req.name != ''">
| AND name LIKE CONCAT('%', #{req.name}, '%')
| </if>
| <if test="req.status != null">
| <choose>
| <when test="req.status == 1">
| AND next_date >= DATE_FORMAT(now(),'%Y-%m-%d')
| </when>
| <when test="req.status == 2">
| AND next_date < DATE_FORMAT(now(),'%Y-%m-%d')
| </when>
| </choose>
| </if>
| <if test="req.tenantId != null">
| AND tenant_id = #{req.tenantId}
| </if>
| <if test="req.recordDate != null">
| AND record_date = DATE_FORMAT(#{req.recordDate},'%Y-%m-%d')
| </if>
| </where>
| ORDER BY update_time DESC
| </select>
| </mapper>
|
|