根据查询到详情,进行回想到弹窗,然后修改信息,保存更新用户信息
实现效果
代码实现
- controller代码
/**
* 修改员工
*/
@PutMapping
public Result update(@RequestBody Emp emp) {
log.info("修改员工操作 {}", emp);
empService.update(emp);
return Result.success();
}
- mapper代码
<!--更新员工-->
<update id="update">
update emp
<set>
<if test="username != null and username != ''">
username = #{username},
</if>
<if test="password != null and password != ''">
password = #{password},
</if>
<if test="name != null and name != ''">
name = #{name},
</if>
<if test="gender != null">
gender = #{gender},
</if>
<if test="image != null and image != ''">
image = #{image},
</if>
<if test="job != null">
job = #{job},
</if>
<if test="entrydate != null">
entrydate = #{entrydate},
</if>
<if test="deptId != null">
dept_id = #{deptId},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
</if>
</set>
where id = #{id}
</update>
- service代码
@Override
public void update(Emp emp) {
emp.setUpdateTime(LocalDateTime.now());
empMapper.update(emp);
}
需要更新下修改时间
这样我们就实现了,更新用户信息的操作