启用或禁用员工账号
This commit is contained in:
parent
30cd5c234e
commit
7a93b2c397
|
@ -109,4 +109,18 @@ public class EmployeeController {
|
|||
PageResult pageResult = employeeService.pageQuery(employeePageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
* @param status Integer
|
||||
* @param id Long
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "启用或禁用员工账号")
|
||||
@PostMapping("/status/{status}")
|
||||
public Result<String> startOrStop(@PathVariable Integer status, Long id) {
|
||||
log.info("启用或禁用员工账号:{},{}", status, id);
|
||||
employeeService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,4 +30,10 @@ public interface EmployeeMapper {
|
|||
* @return Page<Employee>
|
||||
*/
|
||||
Page<Employee> pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
|
||||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
* @param employee Employee
|
||||
*/
|
||||
void update(Employee employee);
|
||||
}
|
||||
|
|
|
@ -23,8 +23,15 @@ public interface EmployeeService {
|
|||
|
||||
/**
|
||||
* 员工分页查询
|
||||
* @param employeeLoginDTO EmployeeService
|
||||
* @param employeePageQueryDTO EmployeePageQueryDTO
|
||||
* @return PageResult
|
||||
*/
|
||||
PageResult pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
|
||||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
* @param status Integer
|
||||
* @param id Long
|
||||
*/
|
||||
void startOrStop(Integer status, Long id);
|
||||
}
|
||||
|
|
|
@ -112,4 +112,21 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|||
|
||||
return new PageResult(total, result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
* @param status Integer
|
||||
* @param id Long
|
||||
*/
|
||||
@Override
|
||||
public void startOrStop(Integer status, Long id) {
|
||||
// 常见对象第一种方式
|
||||
// Employee employee = new Employee();
|
||||
// employee.setStatus(status);
|
||||
// employee.setId(id);
|
||||
|
||||
// 创建对象第二种方式
|
||||
Employee employee = Employee.builder().status(status).id(id).build();
|
||||
employeeMapper.update(employee);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,6 @@ sky:
|
|||
# 设置jwt签名加密时使用的秘钥
|
||||
admin-secret-key: itcast
|
||||
# 设置jwt过期时间
|
||||
admin-ttl: 7200000
|
||||
admin-ttl: 66666666666666
|
||||
# 设置前端传递过来的令牌名称
|
||||
admin-token-name: token
|
||||
|
|
|
@ -11,6 +11,17 @@
|
|||
#{updateTime}, #{createUser}, #{updateUser});
|
||||
</insert>
|
||||
|
||||
<!-- 启用或禁用员工账号 -->
|
||||
<update id="update" parameterType="Employee">
|
||||
update employee
|
||||
<set>
|
||||
<if test="status != null">
|
||||
status =#{status}
|
||||
</if>
|
||||
</set>
|
||||
where id=#{id}
|
||||
</update>
|
||||
|
||||
<!-- 员工分页查询 -->
|
||||
<select id="pageQuery" resultType="com.sky.entity.Employee">
|
||||
select * from employee
|
||||
|
|
Loading…
Reference in New Issue