ContractManagementMapper.xml
6.54 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
112
113
114
115
116
<?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.trash.office.mapper.ContractManagementMapper">
<resultMap type="ContractManagement" id="ContractManagementResult">
<result property="id" column="id" />
<result property="contractNumber" column="contract_number" />
<result property="contractName" column="contract_name" />
<result property="firstParty" column="first_party" />
<result property="secondParty" column="second_party" />
<result property="contractBeginDate" column="contract_begin_date" />
<result property="contractEndDate" column="contract_end_date" />
<result property="contractMoney" column="contract_money" />
<result property="contractState" column="contract_state" />
<result property="deptName" column="dept_name" />
<result property="signTime" column="sign_time" />
<result property="status" column="status" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectContractManagementVo">
select id, contract_number, contract_name, first_party, second_party, contract_begin_date, contract_end_date, contract_money, contract_state, dept_name, sign_time,status from office_contract_management
</sql>
<select id="selectContractManagementList" parameterType="ContractManagement" resultMap="ContractManagementResult">
<include refid="selectContractManagementVo"/>
<where>
<if test="contractNumber != null and contractNumber != ''"> and contract_number = #{contractNumber}</if>
<if test="contractName != null and contractName != ''"> and contract_name like concat('%', #{contractName}, '%')</if>
<if test="firstParty != null and firstParty != ''"> and first_party = #{firstParty}</if>
<if test="secondParty != null and secondParty != ''"> and second_party = #{secondParty}</if>
<if test="contractBeginDate != null "> and contract_begin_date = #{contractBeginDate}</if>
<if test="contractEndDate != null "> and contract_end_date = #{contractEndDate}</if>
<if test="contractMoney != null and contractMoney != ''"> and contract_money = #{contractMoney}</if>
<if test="contractState != null and contractState != ''"> and contract_state = #{contractState}</if>
<if test="deptName != null "> and dept_name = #{deptName}</if>
<if test="status != null and status != ''"> and status = #{status}</if>
</where>
</select>
<select id="selectContractManagementById" parameterType="Long" resultMap="ContractManagementResult">
<include refid="selectContractManagementVo"/>
where id = #{id}
</select>
<insert id="insertContractManagement" parameterType="ContractManagement" useGeneratedKeys="true" keyProperty="id">
insert into office_contract_management
<trim prefix="(" suffix=")" suffixOverrides=",">
create_time,
<if test="contractNumber != null">contract_number,</if>
<if test="contractName != null">contract_name,</if>
<if test="firstParty != null">first_party,</if>
<if test="secondParty != null">second_party,</if>
<if test="contractBeginDate != null">contract_begin_date,</if>
<if test="contractEndDate != null">contract_end_date,</if>
<if test="contractMoney != null">contract_money,</if>
<if test="contractState != null">contract_state,</if>
<if test="deptName != null">dept_name,</if>
<if test="status != null">status,</if>
<if test="createBy != null">create_by,</if>
<if test="signTime !=null">sign_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
now(),
<if test="contractNumber != null">#{contractNumber},</if>
<if test="contractName != null">#{contractName},</if>
<if test="firstParty != null">#{firstParty},</if>
<if test="secondParty != null">#{secondParty},</if>
<if test="contractBeginDate != null">#{contractBeginDate},</if>
<if test="contractEndDate != null">#{contractEndDate},</if>
<if test="contractMoney != null">#{contractMoney},</if>
<if test="contractState != null">#{contractState},</if>
<if test="deptName != null">#{deptName},</if>
<if test="status != null">#{status},</if>
<if test="createBy != null">#{createBy},</if>
<if test="signTime !=null">#{signTime},</if>
</trim>
</insert>
<update id="updateContractManagement" parameterType="ContractManagement">
update office_contract_management
<trim prefix="SET" suffixOverrides=",">
update_time = now(),
<if test="contractNumber != null">contract_number = #{contractNumber},</if>
<if test="contractName != null">contract_name = #{contractName},</if>
<if test="firstParty != null">first_party = #{firstParty},</if>
<if test="secondParty != null">second_party = #{secondParty},</if>
<if test="contractBeginDate != null">contract_begin_date = #{contractBeginDate},</if>
<if test="contractEndDate != null">contract_end_date = #{contractEndDate},</if>
<if test="contractMoney != null">contract_money = #{contractMoney},</if>
<if test="contractState != null">contract_state = #{contractState},</if>
<if test="deptName != null">dept_name = #{deptName},</if>
<if test="status != null">status = #{status},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="signTime != null">sign_time = #{signTime}</if>
</trim>
where id = #{id}
</update>
<delete id="deleteContractManagementById" parameterType="Long">
delete from office_contract_management where id = #{id}
</delete>
<delete id="deleteContractManagementByIds" parameterType="String">
delete from office_contract_management where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>