Commit bef4eb97 authored by huyuchen's avatar huyuchen

huych-档案更新优化

parent 6d784999
......@@ -710,47 +710,20 @@
</insert>
<update id="updateReduceEmpProject" parameterType="java.util.List">
update t_employee_project
<trim prefix="set" suffixOverrides=",">
<trim prefix="EMP_LABEL =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then #{i.empLabel}
</foreach>
</trim>
<trim prefix="LEAVE_TIME =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then now()
</foreach>
</trim>
<trim prefix="LEAVE_REASON =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.leaveReason!=null">
when ID=#{i.id} then #{i.leaveReason}
</if>
</foreach>
</trim>
<trim prefix="LEAVE_USER =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.leaveUser!=null">
when ID=#{i.id} then #{i.leaveUser}
</if>
</foreach>
</trim>
<trim prefix="LEAVE_REMARK =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.leaveRemark!=null">
when ID=#{i.id} then #{i.leaveRemark}
</if>
</foreach>
</trim>
<trim prefix="PROJECT_STATUS =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when ID=#{i.id} then 1
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
ID=#{i.id}
<set>
<foreach collection="list" item="i" separator=",">
EMP_LABEL = COALESCE(#{i.empLabel}, EMP_LABEL),
PROJECT_STATUS = 1,
LEAVE_TIME = now(),
LEAVE_REASON = COALESCE(#{i.leaveReason}, LEAVE_REASON),
LEAVE_USER = COALESCE(#{i.leaveUser}, LEAVE_USER),
LEAVE_REMARK = COALESCE(#{i.leaveRemark}, LEAVE_REMARK)
</foreach>
</set>
where id in
<foreach item="i" index="index" collection="list" open="("
separator="," close=")">
#{i.id}
</foreach>
</update>
<!--查询部门编码和最大员工数-->
......
......@@ -233,58 +233,21 @@
<update id="batchUpdateUser" parameterType="java.util.List">
update sys_user
<trim prefix="set" suffixOverrides=",">
<trim prefix="phone =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.telephoneNumber!=null">
when username=#{i.uid} then #{i.telephoneNumber}
</if>
</foreach>
</trim>
<trim prefix="email =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.email!=null">
when username=#{i.uid} then #{i.email}
</if>
</foreach>
</trim>
<trim prefix="nickname =case" suffix="end," >
<foreach collection="list" item="i" index="index">
<if test="i.personName!=null">
when username=#{i.uid} then #{i.personName}
</if>
</foreach>
</trim>
<trim prefix="password =case" suffix="end," >
<foreach collection="list" item="i" index="index">
<if test="i.password!=null">
when username=#{i.uid} then #{i.password}
</if>
</foreach>
</trim>
<trim prefix="update_time =case" suffix="end,">
<foreach collection="list" item="i" index="index">
when username=#{i.uid} then now()
</foreach>
</trim>
<trim prefix="dept_id =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptId!=null">
when username=#{i.uid} then #{i.deptId}
</if>
</foreach>
</trim>
<trim prefix="dept_name =case" suffix="end,">
<foreach collection="list" item="i" index="index">
<if test="i.deptName!=null">
when username=#{i.uid} then #{i.deptName}
</if>
</foreach>
</trim>
</trim>
where
<foreach collection="list" separator="or" item="i" index="index" >
username=#{i.uid}
<set>
<foreach collection="list" item="i" separator=",">
phone = COALESCE(#{i.telephoneNumber}, phone),
update_time = now(),
email = COALESCE(#{i.email}, email),
nickname = COALESCE(#{i.personName}, nickname),
password = COALESCE(#{i.password}, password),
dept_id = COALESCE(#{i.deptId}, dept_id),
dept_name = COALESCE(#{i.deptName}, dept_name)
</foreach>
</set>
where username in
<foreach item="i" index="index" collection="list" open="("
separator="," close=")">
#{i.uid}
</foreach>
</update>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment