根据id查询员工信息
This commit is contained in:
parent
7a93b2c397
commit
b94e61e388
|
@ -1,8 +1,6 @@
|
|||
package com.sky.controller.admin;
|
||||
|
||||
import com.sky.constant.JwtClaimsConstant;
|
||||
import com.sky.constant.PasswordConstant;
|
||||
import com.sky.constant.StatusConstant;
|
||||
import com.sky.dto.EmployeeDTO;
|
||||
import com.sky.dto.EmployeeLoginDTO;
|
||||
import com.sky.dto.EmployeePageQueryDTO;
|
||||
|
@ -15,15 +13,10 @@ import com.sky.utils.JwtUtil;
|
|||
import com.sky.vo.EmployeeLoginVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.DigestUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
@ -112,8 +105,9 @@ public class EmployeeController {
|
|||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
*
|
||||
* @param status Integer
|
||||
* @param id Long
|
||||
* @param id Long
|
||||
* @return Result
|
||||
*/
|
||||
@Operation(summary = "启用或禁用员工账号")
|
||||
|
@ -123,4 +117,17 @@ public class EmployeeController {
|
|||
employeeService.startOrStop(status, id);
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
*
|
||||
* @param id Integer
|
||||
* @return Result<Employee>
|
||||
*/
|
||||
@Operation(summary = "根据id查询员工信息")
|
||||
@GetMapping("/{id}")
|
||||
public Result<Employee> getById(@PathVariable Integer id) {
|
||||
Employee employee = employeeService.getById(id);
|
||||
return Result.success(employee);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@ public interface EmployeeMapper {
|
|||
|
||||
/**
|
||||
* 根据用户名查询员工
|
||||
*
|
||||
* @param username
|
||||
* @return
|
||||
*/
|
||||
|
@ -20,12 +21,14 @@ public interface EmployeeMapper {
|
|||
|
||||
/**
|
||||
* 插入员工数据
|
||||
*
|
||||
* @param employee 员工
|
||||
*/
|
||||
void insert(Employee employee);
|
||||
|
||||
/**
|
||||
* 员工分页查询
|
||||
*
|
||||
* @param employeePageQueryDTO EmployeePageQueryDTO
|
||||
* @return Page<Employee>
|
||||
*/
|
||||
|
@ -33,7 +36,14 @@ public interface EmployeeMapper {
|
|||
|
||||
/**
|
||||
* 启用或禁用员工账号
|
||||
*
|
||||
* @param employee Employee
|
||||
*/
|
||||
void update(Employee employee);
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id Integer
|
||||
*/
|
||||
Employee getById(Integer id);
|
||||
}
|
||||
|
|
|
@ -34,4 +34,11 @@ public interface EmployeeService {
|
|||
* @param id Long
|
||||
*/
|
||||
void startOrStop(Integer status, Long id);
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id Integer
|
||||
* @return Employee
|
||||
*/
|
||||
Employee getById(Integer id);
|
||||
}
|
||||
|
|
|
@ -129,4 +129,16 @@ public class EmployeeServiceImpl implements EmployeeService {
|
|||
Employee employee = Employee.builder().status(status).id(id).build();
|
||||
employeeMapper.update(employee);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询员工信息
|
||||
* @param id Integer
|
||||
* @return Employee
|
||||
*/
|
||||
@Override
|
||||
public Employee getById(Integer id) {
|
||||
Employee employee = employeeMapper.getById(id);
|
||||
employee.setPassword("密码?你也想看?");
|
||||
return employee;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,4 +32,11 @@
|
|||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<!-- 根据id查询员工信息 -->
|
||||
<select id="getById" resultType="Employee">
|
||||
select *
|
||||
from employee
|
||||
where id = #{id};
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue