| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package com.persagy.fm.department.controller;
- import com.persagy.fm.common.model.dto.EnumQueryDTO;
- import com.persagy.fm.common.model.vo.EnumVO;
- import com.persagy.fm.common.response.CommonResult;
- import com.persagy.fm.common.response.PageList;
- import com.persagy.fm.common.utils.ResultHelper;
- import com.persagy.fm.department.service.IDepEnumService;
- import io.swagger.annotations.Api;
- import io.swagger.annotations.ApiOperation;
- import org.assertj.core.util.Lists;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.validation.annotation.Validated;
- 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 javax.validation.Valid;
- import java.util.List;
- /**
- * @author lixing
- * @version V1.0 2021/3/12 6:36 下午
- **/
- @RestController
- @Validated
- @RequestMapping("/departments/enums")
- @Api(tags = "部门枚举")
- public class DepEnumController {
- @Autowired
- IDepEnumService depEnumService;
- @PostMapping("/get")
- @ApiOperation(value="查询(部门类型:dept_type,数据来源:resource_from)")
- public CommonResult<PageList<EnumVO>> queryEnum(
- @Valid @RequestBody EnumQueryDTO enumQueryDTO) {
- String type = enumQueryDTO.getType();
- List<EnumVO> resultList = Lists.newArrayList();
- switch (type){
- case "dept_type":
- resultList = depEnumService.queryDepTypeEnum();
- break;
- case "resource_from":
- resultList = depEnumService.queryDepResourceFromEnum();
- break;
- default:
- throw new IllegalArgumentException("暂不提供这种类型的枚举信息查询");
- }
- return ResultHelper.multi(resultList);
- }
- }
|