wenminjie
2026-07-15 999e0159112d9405bad7fcd839b339e006a3530d
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
<?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.TTrainLibraryMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TTrainLibrary">
        <result column="id" property="id" />
        <result column="strain_code" property="strainCode" />
        <result column="strain_name" property="strainName" />
        <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="is_draft" property="isDraft" />
        <result column="strain_source" property="strainSource" />
        <result column="appraisal_method" property="appraisalMethod" />
        <result column="features" property="features" />
        <result column="save_method" property="saveMethod" />
        <result column="save_location" property="saveLocation" />
        <result column="stock" property="stock" />
        <result column="remark" property="remark" />
        <result column="status" property="status" />
        <result column="type" property="type" />
        <result column="signature" property="signature" />
        <result column="project_id" property="projectId" />
    </resultMap>
 
    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        id, strain_code, strain_name, project_id, create_time, update_time, create_by, update_by, disabled, strain_source, appraisal_method, features, save_method, save_location, stock, remark, status, `type`, signature,is_draft
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TTrainLibraryVO">
        select
        <include refid="Base_Column_List"/>
        from t_train_library
        <where>
            <if test="query.strainCode != null and query.strainCode != ''">
                and strain_code like concat('%', #{query.strainCode}, '%')
            </if>
            <if test="query.strainName != null and query.strainName != ''">
                and strain_name like concat('%', #{query.strainName}, '%')
            </if>
            <if test="query.status != null">
                and status = #{query.status}
            </if>
            <if test="query.type != null">
                and `type` = #{query.type}
            </if>
        <if test="query.isDraft != null">
                and is_draft = #{query.isDraft}
            </if>
            <if test="query.projectIds != null and query.projectIds.size() > 0">
                and project_id in
                <foreach item="item" collection="query.projectIds" separator="," open="(" close=")" index="">
                    #{item}
                </foreach>
            </if>
            AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        order by strain_code desc
    </select>
    <select id="getDetailById" resultType="com.ruoyi.system.vo.TTrainLibraryWarehousingVO">
        select t1.* from t_train_library_warehousing t1
        where
            t1.train_library_id = #{query.id}
          AND t1.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        order by create_time desc
    </select>
 
    <!-- 新增:查询所有数据(不分页) -->
    <select id="listAll" resultType="com.ruoyi.system.vo.TTrainLibraryVO">
        select
        <include refid="Base_Column_List"/>
        from t_train_library
        <where>
            <if test="query.strainCode != null and query.strainCode != ''">
                and strain_code like concat('%', #{query.strainCode}, '%')
            </if>
            <if test="query.strainName != null and query.strainName != ''">
                and strain_name like concat('%', #{query.strainName}, '%')
            </if>
            <if test="query.status != null">
                and status = #{query.status}
            </if>
            <if test="query.type != null">
                and `type` = #{query.type}
            </if>
            <if test="query.isDraft != null">
                and is_draft = #{query.isDraft}
            </if>
            <if test="query.projectIds != null and query.projectIds.size() > 0">
                and project_id in
                <foreach item="item" collection="query.projectIds" separator="," open="(" close=")" index="">
                    #{item}
                </foreach>
            </if>
            <!-- 时间范围查询 -->
            <if test="query.startTime != null and query.startTime != ''">
                and create_time >= #{query.startTime}
            </if>
            <if test="query.endTime != null and query.endTime != ''">
                and create_time &lt;= #{query.endTime}
            </if>
            AND disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        order by strain_code desc
    </select>
 
</mapper>