xuhy
8 天以前 61d85c788d4d966886617ccdf3335c6a55896878
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.system.mapper.TSamplingRecordMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TSamplingRecord">
        <id column="id" property="id" />
        <result column="dispatch_id" property="dispatchId" />
        <result column="sampling_code" property="samplingCode" />
        <result column="remark" property="remark" />
        <result column="status" property="status" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="create_by" property="createBy" />
        <result column="update_by" property="updateBy" />
        <result column="disabled" property="disabled" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, dispatch_id, sampling_code, remark, status, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TSamplingRecordVO">
        select
            tsr.id, tsr.dispatch_id, tsr.sampling_code, tsr.remark, tsr.status, tsr.create_time, tsr.update_time,
            tsr.create_by, tsr.update_by, tsr.disabled, ted.experiment_code AS experimentCode,ted.experiment_name AS experimentName,
            tpp.project_name AS projectName
        from t_sampling_record tsr
        left join t_experiment_dispatch ted on ted.id = tsr.dispatch_id
        left join t_project_proposal tpp on ted.proposal_id = tpp.id
        <where>
            <if test="query.projectName != null and query.projectName != ''">
                and tpp.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.experimentName != null and query.experimentName != ''">
                and ted.experiment_name like concat('%', #{query.experimentName}, '%')
            </if>
            <if test="query.experimentCode != null and query.experimentCode !=''">
                and ted.experiment_code like concat('%', #{query.experimentCode}, '%')
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tsr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.status != null">
                and tsr.status = #{query.status}
            </if>
            <if test="query.createBy != null and query.createBy !=''">
                and tsr.create_by like concat('%', #{query.createBy}, '%')
            </if>
            AND tsr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tsr.create_time DESC
    </select>
 
</mapper>