@ -3,27 +3,66 @@
<mapper namespace= "com.mdp.form.entity.FormData" >
<mapper namespace= "com.mdp.form.entity.FormData" >
<!-- 开始 自定sql函数区域 -->
<!-- 请在此区域添加自定义函数 -->
<!-- 开始 自定sql函数区域 请在此区域添加自定义函数,其它区域尽量不要动,因为代码随时重新生成 -->
<sql id= "whereForMap" >
<if test= " ids != null" > and (res.id) in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item})
</foreach>
</if>
<if test= " cuserids !=null" > and res.cuserid in
<foreach collection= "cuserids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " flowStates !=null" > and res.flow_state in
<foreach collection= "flowStates" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " deptids !=null" > and res.deptid in
<foreach collection= "deptids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= ' fromStartTime !=null and toStartTime != null ' > and res.create_time between #{fromStartTime} and #{toStartTime}</if>
<if test= " cuserids !=null" > and res.cuserid in
<foreach collection= "cuserids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " userids !=null" > and res.userid in
<foreach collection= "userids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " tagIds !=null" > and exists ( select 1 from form.form_data_tag tag where tag.data_id = res.id and tag.tag_id in
<foreach collection= "tagIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach> )
</if>
<if test= "procInstId!=null and procInstId!=''" > and exists(select 1 from form.form_data_process_approva app where app.proc_inst_id=#{procInstId} and res.id=app.form_data_id )</if>
</sql>
<select id= "getDbFormDataByBizKey" parameterType= "String" resultType= "com.mdp.form.entity.FormData" >
<select id= "getDbFormDataByBizKey" parameterType= "String" resultType= "com.mdp.form.entity.FormData" >
select * from FORM.form_data res
select * from FORM.form_data res
where res.biz_key = #{bizKey}
where res.biz_key = #{bizKey}
</select>
</select>
<update id= "updateTagsById" parameterType= "HashMap" >
<update id= "updateTagsById" parameterType= "HashMap" >
update FORM.form_data
update FORM.form_data
set tag_ids=#{tagIds},tag_names=#{tagNames} where id=#{id}
set tag_ids=#{tagIds},tag_names=#{tagNames} where id=#{id}
</update>
</update>
<select id= "countByFormId" parameterType= "HashMap" resultType= "long" >
<select id= "countByFormId" parameterType= "HashMap" resultType= "long" >
select count(1) from FORM.form_data res where res.form_id=#{formId}
select count(1) from FORM.form_data res where res.form_id=#{formId}
</select>
</select>
<!-- 批量更新 -->
<!-- 批量更新 -->
<update id= "batchUpdateWithoutFlowState" parameterType= "List" >
<update id= "batchUpdateWithoutFlowState" parameterType= "List" >
<foreach collection= "list" item= "item" index= "index" separator= ";" >
<foreach collection= "list" item= "item" index= "index" separator= ";" >
update FORM.form_data set
two = #{item.two},
update FORM.form_data set
two = #{item.two},
three = #{item.three},
three = #{item.three},
four = #{item.four},
four = #{item.four},
five = #{item.five},
five = #{item.five},
@ -47,7 +86,7 @@
attachment_names = #{item.attachmentNames},
attachment_names = #{item.attachmentNames},
branch_id = #{item.branchId},
branch_id = #{item.branchId},
biz_key = #{item.bizKey},
biz_key = #{item.bizKey},
deptid = #{item.deptid},
deptid = #{item.deptid},
create_time = #{item.createTime},
create_time = #{item.createTime},
dqx_code = #{item.dqxCode},
dqx_code = #{item.dqxCode},
cuserid = #{item.cuserid},
cuserid = #{item.cuserid},
@ -55,78 +94,40 @@
tag_names = #{item.tagNames},
tag_names = #{item.tagNames},
cusername = #{item.cusername},
cusername = #{item.cusername},
dept_name = #{item.deptName}
dept_name = #{item.deptName}
where id = #{item.id}
</foreach>
</update>
<!-- 根据主键修改一条记录 -->
where id = #{item.id}
</foreach>
</update>
<!-- 根据主键修改一条记录 -->
<update id= "updateFlowStateByProcInst" parameterType= "HashMap" >
<update id= "updateFlowStateByProcInst" parameterType= "HashMap" >
update FORM.form_data res,FORM.form_data_process_approva app set res.flow_state=#{flowState},res.last_time=now(),app.flow_state=#{flowState},app.flow_last_time=now()
update FORM.form_data res,FORM.form_data_process_approva app set res.flow_state=#{flowState},res.last_time=now(),app.flow_state=#{flowState},app.flow_last_time=now()
<if test= ' flowState=="3" or flowState=="4" or flowState=="2"' > ,app.end_time=now()</if>
<if test= ' flowState=="3" or flowState=="4" or flowState=="2"' > ,app.end_time=now()</if>
where res.form_id=#{formId} and app.form_data_id=res.id and app.proc_inst_id=#{procInstId}
where res.form_id=#{formId} and app.form_data_id=res.id and app.proc_inst_id=#{procInstId}
</update>
</update>
<update id= "updateSomeFieldsByProcInstId" parameterType= "HashMap" >
<update id= "updateSomeFieldsByProcInstId" parameterType= "HashMap" >
update FORM.form_data res
update FORM.form_data res
<set >
<set >
<include refid= "someFieldSet" />
<include refid= "someFieldSet" />
</set>
</set>
where EXISTS ( SELECT 1 FROM FORM.form_data_process_approva a where a.proc_inst_id = #{procInstId} AND a.form_data_id = res.id )
where EXISTS ( SELECT 1 FROM FORM.form_data_process_approva a where a.proc_inst_id = #{procInstId} AND a.form_data_id = res.id )
</update>
</update>
<!-- 结束 自定义sql函数区域 -->
<!-- 结束 自定义sql函数区域 -->
<!-- 通过条件查询获取数据列表 返回list<map> -->
<!-- 通过条件查询获取数据列表 返回list<map> -->
<select id= "selectListMapByWhere" parameterType= "HashMap" resultType= "HashMap" >
<select id= "selectListMapByWhere" parameterType= "HashMap" resultType= "HashMap" >
select * from FORM.form_data res
<where >
<if test= "ids != null" > and
id in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
select * from form_data res
<where >
<include refid= "whereForMap" />
<include refid= "where" />
<include refid= "where" />
<if test= " cuserids !=null" > and res.cuserid in
<foreach collection= "cuserids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " flowStates !=null" > and res.flow_state in
<foreach collection= "flowStates" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " deptids !=null" > and res.deptid in
<foreach collection= "deptids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= ' fromStartTime !=null and toStartTime != null ' > and res.create_time between #{fromStartTime} and #{toStartTime}</if>
<if test= " cuserids !=null" > and res.cuserid in
<foreach collection= "cuserids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " userids !=null" > and res.userid in
<foreach collection= "userids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<if test= " tagIds !=null" > and exists ( select 1 from form.form_data_tag tag where tag.data_id = res.id and tag.tag_id in
<foreach collection= "tagIds" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach> )
</if>
<if test= "procInstId!=null and procInstId!=''" > and exists(select 1 from form.form_data_process_approva app where app.proc_inst_id=#{procInstId} and res.id=app.form_data_id )</if>
</where>
</where>
</select>
</select>
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> -->
<!-- 通过条件查询获取数据列表 不分页 返回 list<Object> -->
<select id= "selectListByWhere" parameterType= "com.mdp.form.entity.FormData" resultType= "com.mdp.form.entity.FormData" >
<select id= "selectListByWhere" parameterType= "com.mdp.form.entity.FormData" resultType= "com.mdp.form.entity.FormData" >
select * from FORM. form_data res
select * from form_data res
<where >
<where >
<include refid= "where" />
<include refid= "where" />
</where>
</where>
@ -134,27 +135,33 @@
<!-- 通过主键查询获取数据对象 返回object -->
<!-- 通过主键查询获取数据对象 返回object -->
<select id= "selectOneObject" parameterType= "com.mdp.form.entity.FormData" resultType= "com.mdp.form.entity.FormData" >
<select id= "selectOneObject" parameterType= "com.mdp.form.entity.FormData" resultType= "com.mdp.form.entity.FormData" >
select * from FORM. form_data res
select * from form_data res
where
where
res.id = #{id}
res.id = #{id}
</select>
</select>
<select id= "selectListByIds" parameterType= "List" resultType= "com.mdp.form.entity.FormData" >
select * from form_data res
where (res.id) in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item})
</foreach>
</select>
<!-- 通过主键查询获取数据对象 返回map -->
<!-- 通过主键查询获取数据对象 返回map -->
<select id= "selectOneMap" parameterType= "HashMap" resultType= "HashMap" >
<select id= "selectOneMap" parameterType= "HashMap" resultType= "HashMap" >
select * from FORM.form_data res
select * from form_data res
where
where
res.id = #{id}
res.id = #{id}
</select>
</select>
<!-- 获取数据条目 返回long -->
<!-- 获取数据条目 返回long -->
<select id= "countByWhere" parameterType= "com.mdp.form.entity.FormData" resultType= "long" >
<select id= "countByWhere" parameterType= "com.mdp.form.entity.FormData" resultType= "long" >
select count(1) from FORM. form_data res
select count(*) from form_data res
<where >
<where >
<include refid= "where" />
<include refid= "where" />
</where>
</where>
</select>
</select>
<!-- 新增一条记录 主键id, -->
<!-- 新增一条记录 主键id, -->
<insert id= "insert" parameterType= "com.mdp.form.entity.FormData" useGeneratedKeys= "false" keyProperty= "id" >
insert into FORM. form_data(
<insert id= "insert" parameterType= "com.mdp.form.entity.FormData" useGeneratedKeys= "false" keyProperty= "id" >
insert into form_data(
<include refid= "columns" />
<include refid= "columns" />
) values (
) values (
#{id},#{two},#{three},#{four},#{five},#{six},#{seven},#{eight},#{nine},#{ten},#{lastTime},#{one},#{zero},#{remark},#{formId},#{userid},#{eleven},#{twelve},#{thirteen},#{fourteen},#{fifteen},#{attachmentUrls},#{attachmentNames},#{branchId},#{bizKey},#{deptid},#{flowState},#{createTime},#{dqxCode},#{cuserid},#{tagIds},#{tagNames},#{cusername},#{deptName}
#{id},#{two},#{three},#{four},#{five},#{six},#{seven},#{eight},#{nine},#{ten},#{lastTime},#{one},#{zero},#{remark},#{formId},#{userid},#{eleven},#{twelve},#{thirteen},#{fourteen},#{fifteen},#{attachmentUrls},#{attachmentNames},#{branchId},#{bizKey},#{deptid},#{flowState},#{createTime},#{dqxCode},#{cuserid},#{tagIds},#{tagNames},#{cusername},#{deptName}
@ -163,7 +170,7 @@
<!-- 按条件删除若干条记录 -->
<!-- 按条件删除若干条记录 -->
<delete id= "deleteByWhere" parameterType= "com.mdp.form.entity.FormData" >
<delete id= "deleteByWhere" parameterType= "com.mdp.form.entity.FormData" >
delete from FORM. form_data res
delete from form_data res
<where >
<where >
<include refid= "where" />
<include refid= "where" />
</where>
</where>
@ -171,13 +178,13 @@
<!-- 按主键删除一条记录 -->
<!-- 按主键删除一条记录 -->
<delete id= "deleteByPk" parameterType= "com.mdp.form.entity.FormData" >
<delete id= "deleteByPk" parameterType= "com.mdp.form.entity.FormData" >
delete from FORM. form_data
delete from form_data
where id = #{id}
where id = #{id}
</delete>
</delete>
<!-- 根据条件修改若干条记录 -->
<!-- 根据条件修改若干条记录 -->
<update id= "updateSomeFieldByPk" parameterType= "com.mdp.form.entity.FormData" >
<update id= "updateSomeFieldByPk" parameterType= "com.mdp.form.entity.FormData" >
update FORM. form_data
update form_data
<set >
<set >
<include refid= "someFieldSet" />
<include refid= "someFieldSet" />
</set>
</set>
@ -186,7 +193,7 @@
<!-- 根据主键修改一条记录 -->
<!-- 根据主键修改一条记录 -->
<update id= "updateByPk" parameterType= "com.mdp.form.entity.FormData" >
<update id= "updateByPk" parameterType= "com.mdp.form.entity.FormData" >
update FORM. form_data
update form_data
<set >
<set >
<include refid= "set" />
<include refid= "set" />
</set>
</set>
@ -201,19 +208,32 @@
<!-- 批量更新 -->
<!-- 批量更新 -->
<update id= "batchUpdate" parameterType= "List" >
<update id= "batchUpdate" parameterType= "List" >
<foreach collection= "list" item= "item" index= "index" separator= ";" >
<foreach collection= "list" item= "item" index= "index" separator= ";" >
update FORM. form_data
update form_data
set
set
<include refid= "batchSet" />
<include refid= "batchSet" />
where id = #{item.id}
where id = #{item.id}
</foreach>
</foreach>
</update>
</update>
<!-- 批量修改某几个字段 -->
<delete id= "editSomeFields" parameterType= "HashMap" >
update form_data
<set >
<include refid= "someFieldSet" />
</set>
where (id) in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item})
</foreach>
</delete>
<!-- 批量删除 -->
<!-- 批量删除 -->
<delete id= "batchDelete" parameterType= "List" >
<delete id= "batchDelete" parameterType= "List" >
delete from FORM.form_data
where id in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item.id }
</foreach>
delete from form_data
where
(id) in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
( #{item.id} )
</foreach>
</delete>
</delete>
@ -221,7 +241,7 @@
<sql id= "columns" >
<sql id= "columns" >
id,two,three,four,five,six,seven,eight,nine,ten,last_time,one,zero,remark,form_id,userid,eleven,twelve,thirteen,fourteen,fifteen,attachment_urls,attachment_names,branch_id,biz_key,deptid,flow_state,create_time,dqx_code,cuserid,tag_ids,tag_names,cusername,dept_name
id,two,three,four,five,six,seven,eight,nine,ten,last_time,one,zero,remark,form_id,userid,eleven,twelve,thirteen,fourteen,fifteen,attachment_urls,attachment_names,branch_id,biz_key,deptid,flow_state,create_time,dqx_code,cuserid,tag_ids,tag_names,cusername,dept_name
</sql>
</sql>
<!-- sql片段 动态条件 YYYY - MM - DD HH24:MI:SS -->
<!-- sql片段 动态条件 YYYY - MM - DD HH24:MI:SS -->
<sql id= "where" >
<sql id= "where" >
<if test= "id != null and id != ''" > and res.id = #{id} </if>
<if test= "id != null and id != ''" > and res.id = #{id} </if>
@ -234,7 +254,7 @@
<if test= "eight != null and eight != ''" > and res.eight = #{eight} </if>
<if test= "eight != null and eight != ''" > and res.eight = #{eight} </if>
<if test= "nine != null and nine != ''" > and res.nine = #{nine} </if>
<if test= "nine != null and nine != ''" > and res.nine = #{nine} </if>
<if test= "ten != null and ten != ''" > and res.ten = #{ten} </if>
<if test= "ten != null and ten != ''" > and res.ten = #{ten} </if>
<if test= "lastTime != null" > and TO_CHAR(res.last_time,'YYYY-MM-DD') = TO_CHAR(#{lastTime},'YYYY-MM-DD ') </if>
<if test= "lastTime != null" > and date_format(res.last_time,'%Y-%m-%d') = date_format(#{lastTime},'%Y-%m-%d ') </if>
<if test= "one != null and one != ''" > and res.one = #{one} </if>
<if test= "one != null and one != ''" > and res.one = #{one} </if>
<if test= "zero != null and zero != ''" > and res.zero = #{zero} </if>
<if test= "zero != null and zero != ''" > and res.zero = #{zero} </if>
<if test= "remark != null and remark != ''" > and res.remark = #{remark} </if>
<if test= "remark != null and remark != ''" > and res.remark = #{remark} </if>
@ -251,7 +271,7 @@
<if test= "bizKey != null and bizKey != ''" > and res.biz_key = #{bizKey} </if>
<if test= "bizKey != null and bizKey != ''" > and res.biz_key = #{bizKey} </if>
<if test= "deptid != null and deptid != ''" > and res.deptid = #{deptid} </if>
<if test= "deptid != null and deptid != ''" > and res.deptid = #{deptid} </if>
<if test= "flowState != null and flowState != ''" > and res.flow_state = #{flowState} </if>
<if test= "flowState != null and flowState != ''" > and res.flow_state = #{flowState} </if>
<if test= "createTime != null" > and TO_CHAR(res.create_time,'YYYY-MM-DD') = TO_CHAR(#{createTime},'YYYY-MM-DD ') </if>
<if test= "createTime != null" > and date_format(res.create_time,'%Y-%m-%d') = date_format(#{createTime},'%Y-%m-%d ') </if>
<if test= "dqxCode != null and dqxCode != ''" > and res.dqx_code = #{dqxCode} </if>
<if test= "dqxCode != null and dqxCode != ''" > and res.dqx_code = #{dqxCode} </if>
<if test= "cuserid != null and cuserid != ''" > and res.cuserid = #{cuserid} </if>
<if test= "cuserid != null and cuserid != ''" > and res.cuserid = #{cuserid} </if>
<if test= "tagIds != null and tagIds != ''" > and res.tag_ids = #{tagIds} </if>
<if test= "tagIds != null and tagIds != ''" > and res.tag_ids = #{tagIds} </if>