外卖项目day02-启用禁用员工账号_代码开发和功能测试
This commit is contained in:
@@ -99,4 +99,13 @@ public class EmployeeController {
|
||||
PageResult pageResult = employeeService.pageQuery(employeePageQueryDTO);
|
||||
return Result.success(pageResult);
|
||||
}
|
||||
|
||||
@ApiOperation("启用禁用员工")
|
||||
@PostMapping("/status/{status}")
|
||||
public Result startOrStop(@PathVariable Integer status,Long id) {
|
||||
log.info("启用禁用员工:{},{}",status,id);
|
||||
employeeService.startOrStop(status,id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,5 +26,16 @@ public interface EmployeeMapper {
|
||||
"values (#{name},#{username},#{password},#{phone},#{sex},#{idNumber},#{createTime},#{updateTime},#{createUser},#{updateUser})")
|
||||
void insert(Employee employee);
|
||||
|
||||
/**
|
||||
* 员工分页查询
|
||||
* @param epqyDTO
|
||||
* @return
|
||||
*/
|
||||
Page<Employee> pageQuery(EmployeePageQueryDTO epqyDTO);
|
||||
|
||||
/**
|
||||
* 员工修改
|
||||
* @param employee
|
||||
*/
|
||||
void update(Employee employee);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,11 @@ public interface EmployeeService {
|
||||
* @return
|
||||
*/
|
||||
PageResult pageQuery(EmployeePageQueryDTO employeePageQueryDTO);
|
||||
|
||||
/**
|
||||
* 启用禁用员工
|
||||
* @param status 员工状态:1- 启用 0- 禁用
|
||||
* @param id 生效的员工ID
|
||||
*/
|
||||
void startOrStop(Integer status, Long id);
|
||||
}
|
||||
|
||||
@@ -109,4 +109,17 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
return new PageResult(total,records);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startOrStop(Integer status, Long id) {
|
||||
//将要修改的数据保存到实体对象
|
||||
/* Employee employee = new Employee();
|
||||
//普通写法
|
||||
employee.setId(id);
|
||||
employee.setStatus(status);*/
|
||||
Employee employee = Employee.builder().id(id).status(status).build();
|
||||
//注意:启用禁用员工只是,员工修改sql中的一部分功能
|
||||
employeeMapper.update(employee);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user