You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.8 KiB
54 lines
1.8 KiB
5 years ago
|
package com.epmet.controller;
|
||
|
|
||
|
import com.epmet.commons.tools.utils.Result;
|
||
|
import com.epmet.commons.tools.validator.ValidatorUtils;
|
||
|
import com.epmet.dto.GovStaffRoleDTO;
|
||
|
import com.epmet.dto.StaffRoleDTO;
|
||
|
import com.epmet.dto.form.StaffRoleFormDTO;
|
||
|
import com.epmet.entity.GovStaffRoleEntity;
|
||
|
import com.epmet.service.GovStaffRoleService;
|
||
|
import org.springframework.beans.BeanUtils;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
import java.util.ArrayList;
|
||
|
import java.util.List;
|
||
|
|
||
|
/**
|
||
|
* @return
|
||
|
* 工作人员相关api
|
||
|
* @Author wxz
|
||
|
* @Description
|
||
|
* @Date 2020/4/22 22:44
|
||
|
**/
|
||
|
@RestController
|
||
|
@RequestMapping("staffrole")
|
||
|
public class StaffRoleController {
|
||
|
|
||
|
@Autowired
|
||
|
private GovStaffRoleService govStaffRoleService;
|
||
|
|
||
|
/**
|
||
|
* 根据工作人员查询工作人员具有的角色列表
|
||
|
* @return
|
||
|
*/
|
||
|
@PostMapping("staffRoles")
|
||
|
public Result<List<GovStaffRoleDTO>> getRolesOfStaff(@RequestBody StaffRoleFormDTO staffRoleFormDTO) {
|
||
|
ValidatorUtils.validateEntity(staffRoleFormDTO);
|
||
|
String staffId = staffRoleFormDTO.getStaffId();
|
||
|
String orgId = staffRoleFormDTO.getOrgId();
|
||
|
List<GovStaffRoleEntity> staffRoleEntities = govStaffRoleService.listRolesByStaffId(staffId, orgId);
|
||
|
List<GovStaffRoleDTO> staffRoleDTOS = new ArrayList<>();
|
||
|
staffRoleEntities.forEach(role -> {
|
||
|
GovStaffRoleDTO dto = new GovStaffRoleDTO();
|
||
|
BeanUtils.copyProperties(role, dto);
|
||
|
staffRoleDTOS.add(dto);
|
||
|
});
|
||
|
return new Result<List<GovStaffRoleDTO>>().ok(staffRoleDTOS);
|
||
|
}
|
||
|
|
||
|
}
|