|
|
|
@ -3,11 +3,18 @@ |
|
|
|
<mapper namespace="com.xm.core.entity.XmRecord"> |
|
|
|
|
|
|
|
|
|
|
|
<!--开始 自定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="key != null and key !='' "> </if> |
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
<!--结束 自定义sql函数区域--> |
|
|
|
|
|
|
|
|
|
|
|
@ -15,15 +22,9 @@ |
|
|
|
<!-- 通过条件查询获取数据列表 返回list<map> --> |
|
|
|
<select id="selectListMapByWhere" parameterType="HashMap" resultType="HashMap"> |
|
|
|
select * from xm_record res |
|
|
|
<where> |
|
|
|
<if test="ids != null"> and |
|
|
|
id in |
|
|
|
<foreach collection="ids" item="item" index="index" open="(" separator="," close=")" > |
|
|
|
#{item} |
|
|
|
</foreach> |
|
|
|
</if> |
|
|
|
<where> |
|
|
|
<include refid="whereForMap"/> |
|
|
|
<include refid="where"/> |
|
|
|
<if test="key != null and key !='' "> </if> |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
|
|
|
|
@ -56,11 +57,11 @@ |
|
|
|
</where> |
|
|
|
</select> |
|
|
|
<!-- 新增一条记录 主键id,--> |
|
|
|
<insert id="insert" parameterType="com.xm.core.entity.XmRecord" useGeneratedKeys="false" keyProperty="id"> |
|
|
|
<insert id="insert" parameterType="com.xm.core.entity.XmRecord" useGeneratedKeys="false" keyProperty="id"> |
|
|
|
insert into xm_record( |
|
|
|
<include refid="columns"/> |
|
|
|
) values ( |
|
|
|
#{id},#{projectId},#{operUserid},#{operUsername},#{operTime},#{objType},#{action},#{oldValue},#{newValue},#{remarks},#{taskId},#{reqNo},#{branchId},#{ip} |
|
|
|
#{id},#{projectId},#{operUserid},#{operUsername},#{operTime},#{objType},#{action},#{oldValue},#{newValue},#{remarks},#{reqNo},#{branchId},#{ip},#{bizId},#{pbizId},#{productId} |
|
|
|
) |
|
|
|
</insert> |
|
|
|
|
|
|
|
@ -74,13 +75,13 @@ |
|
|
|
|
|
|
|
<!-- 按主键删除一条记录--> |
|
|
|
<delete id="deleteByPk" parameterType="com.xm.core.entity.XmRecord"> |
|
|
|
delete from xm_record |
|
|
|
delete from xm_record |
|
|
|
where id = #{id} |
|
|
|
</delete> |
|
|
|
|
|
|
|
<!-- 根据条件修改若干条记录 --> |
|
|
|
<update id="updateSomeFieldByPk" parameterType="com.xm.core.entity.XmRecord"> |
|
|
|
update xm_record |
|
|
|
update xm_record |
|
|
|
<set> |
|
|
|
<include refid="someFieldSet"/> |
|
|
|
</set> |
|
|
|
@ -89,7 +90,7 @@ |
|
|
|
|
|
|
|
<!-- 根据主键修改一条记录 --> |
|
|
|
<update id="updateByPk" parameterType="com.xm.core.entity.XmRecord"> |
|
|
|
update xm_record |
|
|
|
update xm_record |
|
|
|
<set> |
|
|
|
<include refid="set"/> |
|
|
|
</set> |
|
|
|
@ -104,7 +105,7 @@ |
|
|
|
<!-- 批量更新 --> |
|
|
|
<update id="batchUpdate" parameterType="List"> |
|
|
|
<foreach collection="list" item="item" index="index" separator=";" > |
|
|
|
update xm_record |
|
|
|
update xm_record |
|
|
|
set |
|
|
|
<include refid="batchSet"/> |
|
|
|
where id = #{item.id} |
|
|
|
@ -112,35 +113,38 @@ |
|
|
|
</update> |
|
|
|
<!-- 批量删除 --> |
|
|
|
<delete id="batchDelete" parameterType="List"> |
|
|
|
delete from xm_record |
|
|
|
where id in |
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
|
|
#{item.id } |
|
|
|
</foreach> |
|
|
|
delete from xm_record |
|
|
|
where |
|
|
|
(id) in |
|
|
|
<foreach collection="list" item="item" index="index" open="(" separator="," close=")" > |
|
|
|
( #{item.id} ) |
|
|
|
</foreach> |
|
|
|
</delete> |
|
|
|
|
|
|
|
|
|
|
|
<!--sql片段 列--> |
|
|
|
<sql id="columns"> |
|
|
|
id,project_id,oper_userid,oper_username,oper_time,obj_type,action,old_value,new_value,remarks,task_id,req_no,branch_id,ip |
|
|
|
id,project_id,oper_userid,oper_username,oper_time,obj_type,action,old_value,new_value,remarks,req_no,branch_id,ip,biz_id,pbiz_id,product_id |
|
|
|
</sql> |
|
|
|
|
|
|
|
|
|
|
|
<!--sql片段 动态条件 YYYY-MM-DD HH24:MI:SS--> |
|
|
|
<sql id="where"> |
|
|
|
<if test="id != null and id != ''"> and res.id = #{id} </if> |
|
|
|
<if test="projectId != null and projectId != ''"> and res.project_id = #{projectId} </if> |
|
|
|
<if test="operUserid != null and operUserid != ''"> and res.oper_userid = #{operUserid} </if> |
|
|
|
<if test="operUsername != null and operUsername != ''"> and res.oper_username = #{operUsername} </if> |
|
|
|
<if test="operTime != null"> and TO_CHAR(res.oper_time,'YYYY-MM-DD') = TO_CHAR(#{operTime},'YYYY-MM-DD') </if> |
|
|
|
<if test="operTime != null"> and date_format(res.oper_time,'%Y-%m-%d') = date_format(#{operTime},'%Y-%m-%d') </if> |
|
|
|
<if test="objType != null and objType != ''"> and res.obj_type = #{objType} </if> |
|
|
|
<if test="action != null and action != ''"> and res.action = #{action} </if> |
|
|
|
<if test="oldValue != null and oldValue != ''"> and res.old_value = #{oldValue} </if> |
|
|
|
<if test="newValue != null and newValue != ''"> and res.new_value = #{newValue} </if> |
|
|
|
<if test="remarks != null and remarks != ''"> and res.remarks = #{remarks} </if> |
|
|
|
<if test="taskId != null and taskId != ''"> and res.task_id = #{taskId} </if> |
|
|
|
<if test="reqNo != null and reqNo != ''"> and res.req_no = #{reqNo} </if> |
|
|
|
<if test="branchId != null and branchId != ''"> and res.branch_id = #{branchId} </if> |
|
|
|
<if test="ip != null and ip != ''"> and res.ip = #{ip} </if> |
|
|
|
<if test="bizId != null and bizId != ''"> and res.biz_id = #{bizId} </if> |
|
|
|
<if test="pbizId != null and pbizId != ''"> and res.pbiz_id = #{pbizId} </if> |
|
|
|
<if test="productId != null and productId != ''"> and res.product_id = #{productId} </if> |
|
|
|
</sql> |
|
|
|
<!--sql片段 更新字段 --> |
|
|
|
<sql id="set"> |
|
|
|
@ -153,10 +157,12 @@ |
|
|
|
old_value = #{oldValue}, |
|
|
|
new_value = #{newValue}, |
|
|
|
remarks = #{remarks}, |
|
|
|
task_id = #{taskId}, |
|
|
|
req_no = #{reqNo}, |
|
|
|
branch_id = #{branchId}, |
|
|
|
ip = #{ip} |
|
|
|
ip = #{ip}, |
|
|
|
biz_id = #{bizId}, |
|
|
|
pbiz_id = #{pbizId}, |
|
|
|
product_id = #{productId} |
|
|
|
</sql> |
|
|
|
<sql id="someFieldSet"> |
|
|
|
<if test="projectId != null and projectId != ''"> project_id = #{projectId}, </if> |
|
|
|
@ -168,10 +174,12 @@ |
|
|
|
<if test="oldValue != null and oldValue != ''"> old_value = #{oldValue}, </if> |
|
|
|
<if test="newValue != null and newValue != ''"> new_value = #{newValue}, </if> |
|
|
|
<if test="remarks != null and remarks != ''"> remarks = #{remarks}, </if> |
|
|
|
<if test="taskId != null and taskId != ''"> task_id = #{taskId}, </if> |
|
|
|
<if test="reqNo != null and reqNo != ''"> req_no = #{reqNo}, </if> |
|
|
|
<if test="branchId != null and branchId != ''"> branch_id = #{branchId}, </if> |
|
|
|
<if test="ip != null and ip != ''"> ip = #{ip}, </if> |
|
|
|
<if test="bizId != null and bizId != ''"> biz_id = #{bizId}, </if> |
|
|
|
<if test="pbizId != null and pbizId != ''"> pbiz_id = #{pbizId}, </if> |
|
|
|
<if test="productId != null and productId != ''"> product_id = #{productId}, </if> |
|
|
|
</sql> |
|
|
|
<!--sql片段 批量更新 --> |
|
|
|
<sql id="batchSet"> |
|
|
|
@ -184,9 +192,11 @@ |
|
|
|
old_value = #{item.oldValue}, |
|
|
|
new_value = #{item.newValue}, |
|
|
|
remarks = #{item.remarks}, |
|
|
|
task_id = #{item.taskId}, |
|
|
|
req_no = #{item.reqNo}, |
|
|
|
branch_id = #{item.branchId}, |
|
|
|
ip = #{item.ip} |
|
|
|
ip = #{item.ip}, |
|
|
|
biz_id = #{item.bizId}, |
|
|
|
pbiz_id = #{item.pbizId}, |
|
|
|
product_id = #{item.productId} |
|
|
|
</sql> |
|
|
|
</mapper> |