@ -3,8 +3,47 @@
<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" >
@ -73,60 +112,22 @@
</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
select * from form_data res
<where >
<where >
<if test= "ids != null" > and
id in
<foreach collection= "ids" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item}
</foreach>
</if>
<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 id= "insert" parameterType= "com.mdp.form.entity.FormData" useGeneratedKeys= "false" keyProperty= "id" >
insert into FORM. form_data(
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,18 +208,31 @@
<!-- 批量更新 -->
<!-- 批量更新 -->
<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
delete from form_data
where
(id) in
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
<foreach collection= "list" item= "item" index= "index" open= "(" separator= "," close= ")" >
#{item.id }
( #{item.id} )
</foreach>
</foreach>
</delete>
</delete>
@ -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>