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
<?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="cn.wisenergy.chnmuseum.party.mapper.DemandInfoMapper">
<!-- 通用查询映射结果 -->
<resultMap id="BaseResultMap" type="DemandInfo">
<id column="id" property="id" />
<result column="line_number" property="lineNumber" />
<result column="content" property="content" />
<result column="phone_number" property="phoneNumber" />
<result column="feedback_info" property="feedbackInfo" />
<result column="advisor_id" property="advisorId" />
<result column="type" property="type" />
<result column="create_time" property="createTime" />
<result column="feedback_link" property="feedbackLink" />
<result column="feedback_person_id" property="feedbackPersonId" />
<result column="feedback_time" property="feedbackTime" />
<result column="bank_branch_id" property="bankBranchId" />
</resultMap>
<select id="selectOneById" resultMap="BaseResultMap">
SELECT
di.*,
ep.`name` AS feedbackPersonName,
bbi.`name` AS bankBranchName
FROM
demand_info di
LEFT JOIN employee ep ON ep.id = di.feedback_person_id
LEFT JOIN bank_branch_info bbi ON bbi.id = di.bank_branch_id
<where>
<if test=" id != null and id != '' ">
di.id = #{id}
</if>
</where>
</select>
<select id="selectDemandInfoList" resultMap="BaseResultMap">
SELECT
di.*,
ep.`name` AS feedbackPersonName,
bbi.`name` AS bankBranchName
FROM
demand_info di
LEFT JOIN employee ep ON ep.id = di.feedback_person_id
LEFT JOIN bank_branch_info bbi ON bbi.id = di.bank_branch_id
<where>
1=1
<if test=" lineNumber != null and lineNumber != '' ">
AND di.line_number = #{lineNumber}
</if>
<if test=" content != null and content != '' ">
AND di.content LIKE CONCAT('%','${content}','%')
</if>
<if test=" phoneNumber != null and phoneNumber != '' ">
AND di.phone_number = #{phoneNumber}
</if>
<if test=" startDate != null and startDate != '' and endDate != null and endDate != '' ">
AND di.feedback_time BETWEEN #{startDate} AND #{endDate}
</if>
<if test=" callStartDate != null and callStartDate != '' and callEndDate != null and callEndDate != '' ">
AND di.create_time BETWEEN #{callStartDate} AND #{callEndDate}
</if>
<if test=" type != null and type != '' ">
AND di.type = #{type}
</if>
<if test=" bankBranchId != null and bankBranchId != '' ">
AND bbi.id = #{bankBranchId}
</if>
<if test="currentBankId != null and currentBankId != '' and roleId == 3 ">
AND bbi.id = #{currentBankId}
</if>
</where>
ORDER BY di.create_time DESC
</select>
</mapper>