ArchivesBorrowMapper.xml
6.03 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
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
<?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.mapper.ArchivesBorrowMapper">
<resultMap type="ArchivesBorrow" id="ArchivesBorrowResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="dept" column="dept" />
<result property="borrowDate" column="borrow_date" />
<result property="phone" column="phone" />
<result property="mode" column="mode" />
<result property="boxType" column="box_type" />
<result property="borrowName" column="borrow_name" />
<result property="borrowType" column="borrow_type" />
<result property="collectBoxId" column="collect_box_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="returnDate" column="return_date" />
<result property="returnedDate" column="returned_date" />
<result property="borrowMark" column="borrow_mark" />
<result property="status" column="status" />
</resultMap>
<resultMap type="ArchivesBorrow" id="ArchivesBorrowAndBox">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="dept" column="dept" />
<result property="borrowDate" column="borrow_date" />
<result property="phone" column="phone" />
<result property="mode" column="mode" />
<result property="boxType" column="box_type" />
<result property="borrowName" column="borrow_name" />
<result property="borrowType" column="borrow_type" />
<result property="collectBoxId" column="collect_box_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="returnDate" column="return_date" />
<result property="returnedDate" column="returned_date" />
<result property="borrowMark" column="borrow_mark" />
<result property="status" column="status" />
<result property="archivalCode" column="archival_code" />
<result property="title" column="title" />
<result property="borrowStatus" column="borrow_status" />
</resultMap>
<sql id="selectArchivesBorrowVo">
select * from archives_borrow
</sql>
<select id="selectArchivesBorrowList" parameterType="ArchivesBorrow" resultMap="ArchivesBorrowResult">
<include refid="selectArchivesBorrowVo"/>
<where>
<if test="name != null and name != ''"> and name = #{name}</if>
<if test="dept != null and dept != ''"> and dept = #{dept}</if>
<if test="borrowDate != null and borrowDate != ''"> and borrow_date = #{borrowDate}</if>
<if test="borrowDateS != null and borrowDateS != ''"> and borrow_date >= #{borrowDateS}</if>
<if test="borrowDateE != null and borrowDateE != ''"> and borrow_date <= #{borrowDateE}</if>
<if test="borrowMark != null and borrowMark != ''"> and borrow_mark = #{borrowMark}</if>
<if test="status = 'wgh'"> and status !='1'</if>
</where>
</select>
<select id="selectArchivesBorrowListByFilingDept" parameterType="ArchivesBorrow" resultMap="ArchivesBorrowAndBox">
select a.*,b.* from archives_borrow a,archives_collect_box b,archives_dept c
where a.collect_box_id=b.id and b.filing_dept=c.dept_id
<if test="name != null and name != ''"> and a.name = #{name}</if>
<if test="dept != null and dept != ''"> and a.dept = #{dept}</if>
<if test="borrowDate != null and borrowDate != ''"> and a.borrow_date = #{borrowDate}</if>
<if test="borrowDateS != null and borrowDateS != ''"> and a.borrow_date >= #{borrowDateS}</if>
<if test="borrowDateE != null and borrowDateE != ''"> and a.borrow_date <= #{borrowDateE}</if>
<if test="borrowMark != null and borrowMark != ''"> and a.borrow_mark = #{borrowMark}</if>
<if test="filingDept != null and filingDept != ''"> AND (b.filing_dept=#{filingDept} or FIND_IN_SET(#{filingDept},c.ancestors))</if>
<if test="filingDept != null and filingDept != ''"> AND (b.filing_dept=#{filingDept} or FIND_IN_SET(#{filingDept},c.ancestors))</if>
<if test="status == 'true'"> and a.status != '1'</if>
</select>
<select id="selectCollectBoxIds" parameterType="Long" resultType="Long">
select collect_box_id from archives_borrow where id in
<foreach collection="array" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</select>
<update id="updateArchivesBorrowByIds" parameterType="ArchivesBorrow">
update archives_borrow
<trim prefix="SET" suffixOverrides=",">
<if test="archivesBorrow.borrowDate != null">borrow_date = #{archivesBorrow.borrowDate},</if>
<if test="archivesBorrow.returnedDate != null">returned_date = #{archivesBorrow.returnedDate},</if>
<if test="archivesBorrow.status != null">status = #{archivesBorrow.status},</if>
</trim>
where id in
<foreach collection="ids" item="id" open="(" separator="," close=")">
#{id}
</foreach>
</update>
<update id="updateArchivesBorrowById" parameterType="ArchivesBorrow">
update archives_borrow
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status = #{status},</if>
</trim>
where id = #{id}
</update>
</mapper>