wenminjie
2026-07-13 0220811fbcffd4bd4df334502a2af272ae29f1e3
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?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.TExperimentSchemeMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TExperimentScheme">
        <id column="id" property="id" />
        <result column="dispatch_id" property="dispatchId" />
        <result column="experiment_date" property="experimentDate" />
        <result column="experiment_objective" property="experimentObjective" />
        <result column="experiment_param_route" property="experimentParamRoute" />
        <result column="experiment_material" property="experimentMaterial" />
        <result column="experiment_device" property="experimentDevice" />
        <result column="experiment_step_record" property="experimentStepRecord" />
        <result column="stop_reason" property="stopReason" />
        <result column="stop_file" property="stopFile" />
        <result column="stop_file_name" property="stopFileName" />
        <result column="commit_sign" property="commitSign" />
        <result column="status" property="status" />
        <result column="audit_person_id" property="auditPersonId" />
        <result column="audit_time" property="auditTime" />
        <result column="audit_remark" property="auditRemark" />
        <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" />
        <result column="new_experiment_material" property="newExperimentMaterial" />
        <result column="new_experiment_device" property="newExperimentDevice" />
        <result column="new_experiment_step_record" property="newExperimentStepRecord" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, dispatch_id, experiment_date, experiment_objective, experiment_param_route, experiment_material, experiment_device,
          experiment_step_record, stop_reason, stop_file,stop_file_name, commit_sign, status, audit_person_id, audit_time, audit_remark,
          create_time, update_time, create_by, update_by, disabled,new_experiment_material,new_experiment_device,new_experiment_step_record
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TExperimentSchemeVO">
        select tes.id, tes.dispatch_id, tes.experiment_date, tes.experiment_objective, tes.experiment_param_route,
        tes.experiment_material, tes.experiment_device, tes.experiment_step_record, tes.stop_reason, tes.stop_file,tes.stop_file_name,
        tes.commit_sign, tes.status, tes.audit_person_id, tes.audit_time, tes.audit_remark, tes.create_time, tes.update_time,
        tes.create_by, tes.update_by, tes.disabled,tes.new_experiment_material,tes.new_experiment_device,tes.new_experiment_step_record,
        tpp.project_name as projectName,tpp.project_code as projectCode,ted.experiment_code as experimentCode,
        ted.experiment_name as experimentName
        from t_experiment_scheme tes
        left join t_experiment_dispatch ted on tes.dispatch_id = ted.id
        left join t_project_proposal tpp on ted.proposal_id = tpp.id
        <where>
            <if test="query.status != null">
                and tes.status = #{query.status}
            </if>
            <if test="query.projectName != null and query.projectName != ''">
                and tpp.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.projectCode != null and query.projectCode != ''">
                and tpp.project_code like concat('%',#{query.projectCode},'%')
            </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 tes.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.dispatchIds != null and query.dispatchIds.size() > 0">
                and tes.dispatch_id in
                <foreach item="item" collection="query.dispatchIds" separator="," close=")" index="index" open="(">
                    #{item}
                </foreach>
            </if>
            <if test="query.roleType != null and (query.roleType == 3 or query.roleType == 4 or query.roleType == 5)">
                AND tes.status != 5
            </if>
            <if test="query.roleType != null and query.roleType == 5">
                AND tes.status != 6
            </if>
            <if test="query.status == null">
                and tes.status != -1
            </if>
            <if test="query.status == null and query.roleType == 5">
                and tes.status != -2
            </if>
            AND tes.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tes.create_time DESC
    </select>
    <select id="auditPageList" resultType="com.ruoyi.system.vo.TExperimentSchemeVO">
        select tes.id, tes.dispatch_id, tes.experiment_date, tes.experiment_objective, tes.experiment_param_route,
        tes.experiment_material, tes.experiment_device, tes.experiment_step_record, tes.stop_reason, tes.stop_file,tes.stop_file_name,
        tes.commit_sign, tes.status, tes.audit_person_id, tes.audit_time, tes.audit_remark, tes.create_time, tes.update_time,
        tes.create_by, tes.update_by, tes.disabled,tes.new_experiment_material,tes.new_experiment_device,tes.new_experiment_step_record,
        tpp.project_name as projectName,tpp.project_code as projectCode,ted.experiment_code as experimentCode,
        ted.experiment_name as experimentName
        from t_experiment_scheme tes
        left join t_experiment_dispatch ted on tes.dispatch_id = ted.id
        left join t_project_proposal tpp on ted.proposal_id = tpp.id
        <where>
            <if test="query.status != null">
                and tes.status = #{query.status}
            </if>
            <if test="query.projectName != null and query.projectName != ''">
                and tpp.project_name like concat('%', #{query.projectName}, '%')
            </if>
            <if test="query.projectCode != null and query.projectCode != ''">
                and tpp.project_code like concat('%',#{query.projectCode},'%')
            </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 tes.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.dispatchIds != null and query.dispatchIds.size() > 0">
                and tes.dispatch_id in
                <foreach item="item" collection="query.dispatchIds" separator="," close=")" index="index" open="(">
                    #{item}
                </foreach>
            </if>
            AND tes.status IN (2,3,4)
            AND tes.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tes.create_time DESC
    </select>
    <select id="getList" resultType="com.ruoyi.system.vo.TExperimentSchemeVO">
        select tes.id, tes.dispatch_id, tes.experiment_date, tes.experiment_objective, tes.experiment_param_route,
               tes.experiment_material, tes.experiment_device, tes.experiment_step_record, tes.stop_reason, tes.stop_file,tes.stop_file_name,
               tes.commit_sign, tes.status, tes.audit_person_id, tes.audit_time, tes.audit_remark, tes.create_time, tes.update_time,
               tes.create_by, tes.update_by, tes.disabled,tes.new_experiment_material,tes.new_experiment_device,tes.new_experiment_step_record,
               tpp.project_name as projectName,tpp.project_code AS projectCode,ted.experiment_code as experimentCode,
               ted.experiment_name as experimentName
        from t_experiment_scheme tes
                 left join t_experiment_dispatch ted on tes.dispatch_id = ted.id
                 left join t_project_proposal tpp on ted.proposal_id = tpp.id
             WHERE tes.dispatch_id = #{dispatchId}
                AND tes.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
                ORDER BY tes.create_time DESC
    </select>
 
</mapper>