启用禁用员工账号业务代码开发
This commit is contained in:
@@ -104,4 +104,20 @@ public class EmployeeController {
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 启用禁用员工账号
|
||||
* @param status
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/status/{status}")
|
||||
@ApiOperation("启用禁用员工账号")
|
||||
public Result startOrStop(@PathVariable Integer status, Long id){
|
||||
|
||||
log.info("启用禁用员工账号:{},{}", status, id);
|
||||
employeeService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -36,4 +36,11 @@ public interface EmployeeMapper {
|
||||
*/
|
||||
|
||||
Page<Employee> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 启用禁用员工
|
||||
* @param employee
|
||||
*/
|
||||
void update(Employee employee);
|
||||
}
|
||||
|
||||
@@ -29,4 +29,12 @@ public interface EmployeeService {
|
||||
* @return
|
||||
*/
|
||||
PageResult pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
|
||||
|
||||
|
||||
/**
|
||||
* 启用禁用员工账号
|
||||
* @param status
|
||||
* @param id
|
||||
*/
|
||||
void startOrStop(Integer status, Long id);
|
||||
}
|
||||
|
||||
@@ -109,4 +109,24 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
return new PageResult(total, records);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 启用禁用员工账号
|
||||
* @param status
|
||||
* @param id
|
||||
*/
|
||||
public void startOrStop(Integer status, Long id) {
|
||||
|
||||
/* Employee employee = new Employee();
|
||||
employee.setStatus(status);
|
||||
employee.setId(id);*/
|
||||
|
||||
//builder构造器
|
||||
Employee employee = Employee.builder()
|
||||
.status(status)
|
||||
.id(id)
|
||||
.build();
|
||||
employeeMapper.update(employee);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,4 +14,21 @@
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<update id="update" parameterType="Employee">
|
||||
update employee
|
||||
<set>
|
||||
<if test="name != null and name != ''">name = #{name}</if>
|
||||
<if test="username != null">username = #{username}</if>
|
||||
<if test="password != null">password = #{password}</if>
|
||||
<if test="phone != null">phone = #{phone}</if>
|
||||
<if test="sex != null">sex = #{sex}</if>
|
||||
<if test="idNumber != null">id_number = #{idNumber}</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime}</if>
|
||||
<if test="createTime != null">create_time = #{createTime}</if>
|
||||
<if test="status != null">status = #{status}</if>
|
||||
</set>
|
||||
where id = #{id}
|
||||
</update>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user