You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
66 lines
2.5 KiB
Java
66 lines
2.5 KiB
Java
package com.glxp.api.controller.auth;
|
|
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.glxp.api.annotation.AuthRuleAnnotation;
|
|
import com.glxp.api.annotation.Log;
|
|
import com.glxp.api.constant.BusinessType;
|
|
import com.glxp.api.entity.auth.DeptEntity;
|
|
import com.glxp.api.entity.auth.DeptUserEntity;
|
|
import com.glxp.api.req.auth.FilterDeptUserReqeust;
|
|
import com.glxp.api.req.auth.FilterInvWarehouseRequest;
|
|
import com.glxp.api.res.PageSimpleResponse;
|
|
import com.glxp.api.res.auth.DeptUserResponse;
|
|
import com.glxp.api.service.auth.DeptService;
|
|
import com.glxp.api.service.auth.DeptUserService;
|
|
import com.glxp.api.common.res.BaseResponse;
|
|
import com.glxp.api.common.util.ResultVOUtils;
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import javax.annotation.Resource;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
public class DeptUserController {
|
|
|
|
|
|
@Resource
|
|
DeptUserService deptUserService;
|
|
@Resource
|
|
DeptService deptService;
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
@GetMapping("udi/auth/dept/user/filter")
|
|
public BaseResponse filterList(FilterDeptUserReqeust filterDeptUserReqeust) {
|
|
//获取部门id
|
|
Long idByCode = deptService.getIdByCode(filterDeptUserReqeust.getDeptId());
|
|
DeptEntity deptEntity = deptService.selectById(idByCode + "");
|
|
if (deptEntity.getLevel() == 1) {
|
|
filterDeptUserReqeust.setDeptId(null);
|
|
} else {
|
|
filterDeptUserReqeust.setDeptId(idByCode);
|
|
}
|
|
List<DeptUserResponse> deptEntityList = deptUserService.selectJoinDeptUser(filterDeptUserReqeust);
|
|
PageInfo<DeptUserResponse> pageInfo = new PageInfo<>(deptEntityList);
|
|
PageSimpleResponse<DeptUserResponse> deptEntityPageSimpleResponse = new PageSimpleResponse<>();
|
|
deptEntityPageSimpleResponse.setTotal(pageInfo.getTotal());
|
|
deptEntityPageSimpleResponse.setList(deptEntityList);
|
|
return ResultVOUtils.success(deptEntityPageSimpleResponse);
|
|
}
|
|
|
|
|
|
@AuthRuleAnnotation("")
|
|
@PostMapping("udi/auth/dept/user/delete")
|
|
@Log(title = "用户管理", businessType = BusinessType.DELETE)
|
|
public BaseResponse delete(@RequestBody DeptUserEntity deptUserEntity) {
|
|
boolean b = deptUserService.delete(deptUserEntity.getDeptId(), deptUserEntity.getUserId());
|
|
if (b)
|
|
return ResultVOUtils.success("移除成功!");
|
|
return ResultVOUtils.error(500, "移除失败!");
|
|
}
|
|
|
|
}
|