FundMainMapper.xml
9.36 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
<?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.chinagas.modules.zjwjsb.mapper.FundMainMapper">
<resultMap id="fundMainResult" type="FundMain">
<id property="mainId" column="main_id"/>
<result property="headId" column="head_id"/>
<result property="title" column="title"/>
<result property="status" column="status"/>
<result property="statusName" column="status_name"/>
<result property="bizId" column="biz_id"/>
<result property="paySum" column="pay_sum"/>
<result property="deptId" column="dept_id"/>
<result property="deptName" column="dept_name"/>
<result property="applyDate" column="apply_date"/>
<result property="applyBy" column="apply_by"/>
<result property="approvalDate" column="approval_date"/>
<result property="remark" column="remark"/>
<collection property="fundDetailList" column="main_id" javaType="java.util.List" ofType="FundDetail" select="selectFundDetail" />
<collection property="attachmentList" column="main_id" javaType="java.util.List" ofType="Attachment" select="selectAttachmentByMainId" />
</resultMap>
<resultMap id="fundDetailResult" type="FundDetail">
<id property="id" column="id"/>
<id property="mainId" column="main_id"/>
<id property="bizId" column="biz_id"/>
<id property="payNo" column="pay_no"/>
<id property="title" column="title"/>
<id property="approval" column="approval"/>
<id property="hasPay" column="has_pay"/>
<id property="waitForPay" column="wait_for_pay"/>
<id property="approvalForPay" column="approval_for_pay"/>
<id property="itemClass" column="item_class"/>
<id property="itemClassName" column="item_class_name"/>
<id property="applyDate" column="apply_date"/>
<id property="status" column="status"/>
<id property="statusName" column="status_name"/>
<id property="delFlag" column="del_flag"/>
<result property="createTime" column="create_time"/>
<result property="createBy" column="create_by"/>
<result property="updateTime" column="update_time"/>
<result property="updateBy" column="update_by"/>
</resultMap>
<sql id="selectFundMainVo" >
select
p.main_id,
p.head_id,
p.title,
p.status,
p.status_name,
p.biz_id,
p.pay_sum,
p.dept_id,
p.dept_name,
p.apply_date,
p.apply_by,
p.approval_date,
p.remark
from ta_fund_main p
</sql>
<select id="selectFundDetail" resultMap="fundDetailResult">
select d.id,d.main_id,d.biz_id,d.pay_no,d.title,d.approval,d.has_pay,d.wait_for_pay,d.approval_for_pay,d.item_class,d.item_class_name,
d.apply_date,d.status,d.status_name,d.del_flag,d.create_time,d.create_by,d.update_time,d.update_by
from ta_fund_main m join ta_fund_detail d on m.main_id = d.main_id where m.main_id = #{mainId} and d.del_flag = '0'
</select>
<select id="selectAttachmentByMainId" resultType="Attachment">
select attachment_id,attachment_name,url,process_id,path,final_path,attachment_type from zjwjsb_attachment where process_id = #{mainId}
</select>
<select id="selectFundMainList" parameterType="FundMain" resultMap="fundMainResult">
<include refid="selectFundMainVo"/>
where 1 = 1
<if test="mainId != null and mainId != ''">
and p.main_id like concat('%',#{mainId},'%')
</if>
<if test="headId != null and headId != ''">
and p.head_id like concat('%',#{headId},'%')
</if>
<if test="title != null and title != ''">
and p.title like concat('%',#{title},'%')
</if>
<if test="status != null and status != ''">
and p.status = #{status}
</if>
<if test="statusName != null and statusName != ''">
and p.status_name = #{statusName}
</if>
<if test="bizId != null and bizId != ''">
and p.biz_id = #{bizId}
</if>
<if test="paySum != null and paySum != ''">
and p.pay_sum = #{paySum}
</if>
<if test="deptId != null and deptId != ''">
and p.dept_id = #{deptId}
</if>
<if test="deptName != null and deptName != ''">
and p.dept_name = #{deptName}
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(p.apply_date,'%y%m%d') >= date_format(#{params.beginTime},'%y%m%d')
</if>
<if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 -->
AND date_format(p.apply_date,'%y%m%d') <= date_format(#{params.endTime},'%y%m%d')
</if>
<if test="applyBy != null and applyBy != ''">
and p.apply_by = #{applyBy}
</if>
<if test="params.approvalBeginTime != null and params.approvalBeginTime != ''"><!-- 开始时间检索 -->
AND date_format(p.approval_date,'%y%m%d') >= date_format(#{params.approvalBeginTime},'%y%m%d')
</if>
<if test="params.approvalEndTime != null and params.approvalEndTime != ''"><!-- 结束时间检索 -->
AND date_format(p.approval_date,'%y%m%d') <= date_format(#{params.approvalEndTime},'%y%m%d')
</if>
<if test="remark != null and remark != ''">
and p.remark like concat('%',#{remark},'%')
</if>
${params.dataScope}
order by p.apply_date desc
</select>
<insert id="insertFundMain" parameterType="FundMain">
insert into ta_fund_main(
<trim suffix="" suffixOverrides=",">
<if test="mainId != null and mainId != ''">main_id,</if>
<if test="headId != null and headId != ''">head_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="status != null">status,</if>
<if test="statusName != null and statusName != ''">status_name,</if>
<if test="bizId != null and bizId != ''">biz_id,</if>
<if test="paySum != null">pay_sum,</if>
<if test="deptId != null and deptId != ''">dept_id,</if>
<if test="deptName != null and deptName != ''">dept_name,</if>
<if test="applyDate != null">apply_date,</if>
<if test="applyBy != null and applyBy != ''">apply_by,</if>
<if test="approvalDate != null">approval_date,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
) values(
<trim suffix="" suffixOverrides=",">
<if test="mainId != null and mainId != ''">#{mainId},</if>
<if test="headId != null and headId != ''">#{headId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="status != null">#{status},</if>
<if test="statusName != null and statusName != ''">#{statusName},</if>
<if test="bizId != null and bizId != ''">#{bizId},</if>
<if test="paySum != null">#{paySum},</if>
<if test="deptId != null and deptId != ''">#{deptId},</if>
<if test="deptName != null and deptName != ''">#{deptName},</if>
<if test="applyDate != null">#{applyDate, jdbcType=TIMESTAMP},</if>
<if test="applyBy != null and applyBy != ''">#{applyBy},</if>
<if test="approvalDate != null">#{approvalDate, jdbcType=TIMESTAMP},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
)
</insert>
<update id="updateFundMain" parameterType="FundMain">
update ta_fund_main
<trim prefix="SET" suffixOverrides=",">
<if test="headId != null and headId != ''">head_id = #{headId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="status != null">status = #{status},</if>
<if test="statusName != null and statusName != ''">status_name = #{statusName},</if>
<if test="bizId != null and bizId != ''">biz_id = #{bizId},</if>
<if test="paySum != null">pay_sum = #{paySum},</if>
<if test="deptId != null and deptId != ''">dept_id = #{deptId},</if>
<if test="deptName != null and deptName != ''">dept_name = #{deptName},</if>
<if test="applyDate != null">apply_date = #{applyDate, jdbcType=TIMESTAMP},</if>
<if test="applyBy != null and applyBy != ''">apply_by = #{applyBy},</if>
<if test="approvalDate != null">approval_date = #{approvalDate, jdbcType=TIMESTAMP},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where main_id = #{mainId}
</update>
<select id="selectFundMainByMainId" parameterType="String" resultMap="fundMainResult">
<include refid="selectFundMainVo"/> where main_id = #{mainId}
</select>
<select id="selectFundMainByHeadId" parameterType="String" resultMap="fundMainResult">
<include refid="selectFundMainVo"/> where head_id = #{headId}
</select>
<select id="ifFundMainExist" resultType="int" parameterType="String">
select count(1) from ta_fund_main where main_id = #{mainId}
</select>
</mapper>