TshjMapper.xml
2.51 KB
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
<?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.qgutech.qgyun.zxm.mapper.TshjMapper">
<resultMap id="tshjMap" type="com.qgutech.qgyun.zxm.model.Tshj">
<result column="id" property="id"/>
<result column="book_id" property="bookId"/>
<result column="return_time" property="returnTime"/>
<result column="created_org" property="createdOrg"/>
<result column="corp_code" property="corpCode"/>
<result column="created_at" property="createdAt"/>
<result column="updated_at" property="updatedAt"/>
<result column="created_by" property="createdBy"/>
<result column="updated_by" property="updatedBy"/>
</resultMap>
<sql id="tableName">t_auto_zxm_tshj tshj</sql>
<sql id="condition">
<if test="con.id != null and con.id != ''">
and tshj.id = #{con.id}
</if>
<if test="con.bookIdList != null and con.bookIdList.size() != 0">
and tshj.book_id in
<foreach collection="con.bookIdList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="con.returnTimeLeft != null and con.returnTimeRight != null">
and tshj.return_time <![CDATA[ >= ]]> #{con.returnTimeLeft}
and tshj.return_time <![CDATA[ <= ]]> #{con.returnTimeRight}
</if>
<if test="con.createdOrgList != null and con.createdOrgList.size() != 0">
and tshj.created_org in
<foreach collection="con.createdOrgList" item="id" index="index" open="(" close=")" separator=",">
#{id}
</foreach>
</if>
<if test="con.corpCode != null and con.corpCode != ''">
and tshj.corp_code = #{con.corpCode}
</if>
<if test="con.createdAt != null">
and tshj.created_at = #{con.createdAt}
</if>
<if test="con.updatedAt != null">
and tshj.updated_at = #{con.updatedAt}
</if>
<if test="con.createdBy != null and con.createdBy != ''">
and tshj.created_by = #{con.createdBy}
</if>
<if test="con.updatedBy != null and con.updatedBy != ''">
and tshj.updated_by = #{con.updatedBy}
</if>
</sql>
<select id="search" resultMap="tshjMap">
select tshj.*
from <include refid="tableName"/>
WHERE 1=1 <include refid="condition"/>
order by tshj.created_at DESC
</select>
</mapper>