xuhy
3 天以前 05fed078888dd5c2624751b6b29c5e16b7f1b2e6
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
140
141
142
143
<?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.TFeasibilityStudyReportMapper">
 
    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.ruoyi.system.model.TFeasibilityStudyReport">
        <id column="id" property="id" />
        <result column="team_id" property="teamId" />
        <result column="report_code" property="reportCode" />
        <result column="report_name" property="reportName" />
        <result column="report_text" property="reportText" />
        <result column="report_type" property="reportType" />
        <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="evaluate_person_id" property="evaluatePersonId" />
        <result column="evaluate_time" property="evaluateTime" />
        <result column="evaluate_score" property="evaluateScore" />
        <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, team_id, report_code, report_name, report_text, report_type, status, audit_person_id, audit_time, audit_remark, evaluate_person_id, evaluate_time, evaluate_score, create_time, update_time, create_by, update_by, disabled
    </sql>
    <select id="pageList" resultType="com.ruoyi.system.vo.TFeasibilityStudyReportVO">
        select tfsr.id, tfsr.team_id, tfsr.report_code, tfsr.report_name, tfsr.report_text, tfsr.report_type, tfsr.status,
        tfsr.audit_person_id, tfsr.audit_time, tfsr.audit_remark, tfsr.evaluate_person_id, tfsr.evaluate_time, tfsr.evaluate_score,
        tfsr.create_time, tfsr.update_time, tfsr.create_by, tfsr.update_by, tfsr.disabled, tpt.team_name as teamName
        from t_feasibility_study_report tfsr
        left join t_project_team tpt on tpt.id = tfsr.team_id
        <where>
            <if test="query.reportName != null and query.reportName != ''">
                and tfsr.report_name like concat('%', #{query.reportName}, '%')
            </if>
            <if test="query.reportCode != null and query.reportCode != ''">
                and tfsr.report_code like concat('%', #{query.reportCode}, '%')
            </if>
            <if test="query.teamName != null and query.teamName != ''">
               and tpt.team_name like concat('%', #{query.teamName})
            </if>
            <if test="query.status != null">
                and tfsr.status = #{query.status}
            </if>
            <if test="query.reportType != null">
                and tfsr.report_type = #{query.reportType}
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tfsr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.teamIds != null and query.teamIds.size() > 0">
                and tfsr.team_id in
                <foreach item="teamId" collection="query.teamIds" separator="," open="(" close=")" index="">
                    #{teamId}
                </foreach>
            </if>
            AND tfsr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tfsr.create_time DESC
    </select>
    <select id="evaluatePageList" resultType="com.ruoyi.system.vo.TFeasibilityStudyReportVO">
        select tfsr.id, tfsr.team_id, tfsr.report_code, tfsr.report_name, tfsr.report_text, tfsr.report_type, tfsr.status,
        tfsr.audit_person_id, tfsr.audit_time, tfsr.audit_remark, tfsr.evaluate_person_id, tfsr.evaluate_time, tfsr.evaluate_score,
        tfsr.create_time, tfsr.update_time, tfsr.create_by, tfsr.update_by, tfsr.disabled, tpt.team_name as teamName
        from t_feasibility_study_report tfsr
        left join t_project_team tpt on tpt.id = tfsr.team_id
        <where>
            <if test="query.reportName != null and query.reportName != ''">
                and tfsr.report_name like concat('%', #{query.reportName}, '%')
            </if>
            <if test="query.reportCode != null and query.reportCode != ''">
                and tfsr.report_code like concat('%', #{query.reportCode}, '%')
            </if>
            <if test="query.teamName != null and query.teamName != ''">
                and tpt.team_name like concat('%', #{query.teamName})
            </if>
            <if test="query.status != null">
                and tfsr.status = #{query.status}
            </if>
            <if test="query.reportType != null">
                and tfsr.report_type = #{query.reportType}
            </if>
            <if test="query.createBy != null and query.createBy != ''">
                and tfsr.createBy like concat('%', #{query.createBy})
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tfsr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.teamIds != null and query.teamIds.size() > 0">
                and tfsr.team_id in
                <foreach item="teamId" collection="query.teamIds" separator="," open="(" close=")" index="">
                    #{teamId}
                </foreach>
            </if>
            AND tfsr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
        ORDER BY tfsr.create_time DESC
    </select>
    <select id="evaluateCount" resultType="java.util.Map">
        select
        COUNT(tfsr.id) as totalCount,
        SUM(CASE WHEN tfsr.status = 2 THEN 1 ELSE 0 END) AS toEvaluatedCount,
        SUM(CASE WHEN tfsr.status = 3 THEN 1 ELSE 0 END) AS evaluatedCount,
        from t_feasibility_study_report tfsr
        left join t_project_team tpt on tpt.id = tfsr.team_id
        <where>
            <if test="query.reportName != null and query.reportName != ''">
                and tfsr.report_name like concat('%', #{query.reportName}, '%')
            </if>
            <if test="query.reportCode != null and query.reportCode != ''">
                and tfsr.report_code like concat('%', #{query.reportCode}, '%')
            </if>
            <if test="query.teamName != null and query.teamName != ''">
                and tpt.team_name like concat('%', #{query.teamName})
            </if>
            <if test="query.status != null">
                and tfsr.status = #{query.status}
            </if>
            <if test="query.reportType != null">
                and tfsr.report_type = #{query.reportType}
            </if>
            <if test="query.createBy != null and query.createBy != ''">
                and tfsr.createBy like concat('%', #{query.createBy})
            </if>
            <if test="query.startTime != null and query.startTime != '' and query.endTime != null and query.endTime != ''">
                AND tfsr.create_time BETWEEN #{query.startTime} AND #{query.endTime}
            </if>
            <if test="query.teamIds != null and query.teamIds.size() > 0">
                and tfsr.team_id in
                <foreach item="teamId" collection="query.teamIds" separator="," open="(" close=")" index="">
                    #{teamId}
                </foreach>
            </if>
            AND tfsr.disabled = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        </where>
    </select>
 
</mapper>