| | |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
| | | import io.swagger.annotations.*; |
| | |
| | | import org.springblade.core.cache.utils.CacheUtil; |
| | | import org.springblade.core.log.annotation.ApiLog; |
| | | import org.springblade.core.mp.support.Condition; |
| | | import org.springblade.core.mp.support.Query; |
| | | import org.springblade.core.secure.BladeUser; |
| | | import org.springblade.core.secure.annotation.PreAuth; |
| | | import org.springblade.core.tenant.annotation.NonDS; |
| | |
| | | import org.springblade.core.tool.constant.BladeConstant; |
| | | import org.springblade.core.tool.constant.RoleConstant; |
| | | import org.springblade.core.tool.support.Kv; |
| | | import org.springblade.core.tool.utils.BeanUtil; |
| | | import org.springblade.core.tool.utils.Func; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.sxkj.common.node.TreeStringNode; |
| | |
| | | import org.sxkj.system.enums.DictEnum; |
| | | import org.sxkj.system.mapper.DeptMapper; |
| | | import org.sxkj.system.mapper.UserMapper; |
| | | import org.sxkj.system.param.DeptAddParam; |
| | | import org.sxkj.system.param.DeptPageParam; |
| | | import org.sxkj.system.service.IDeptService; |
| | | import org.sxkj.system.vo.DeptVO; |
| | | import org.sxkj.system.wrapper.DeptWrapper; |
| | |
| | | import javax.validation.Valid; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE; |
| | |
| | | return R.data(DeptWrapper.build().entityVO(detail)); |
| | | } |
| | | |
| | | /** |
| | | * 机构 自定义分页 |
| | | */ |
| | | @GetMapping("/page") |
| | | @ApiOperationSupport(order = 3) |
| | | @ApiOperation(value = "分页", notes = " ") |
| | | public R<IPage<DeptVO>> page(DeptPageParam deptPageParam, Query query) { |
| | | IPage<DeptVO> pages = deptService.selectDeptPage(Condition.getPage(query), deptPageParam); |
| | | return R.data(pages); |
| | | } |
| | | /** |
| | | * 列表 |
| | | */ |
| | |
| | | /** |
| | | * 新增或修改 |
| | | */ |
| | | // @PreAuth(RoleConstant.HAS_ROLE_ADMIN) |
| | | @PostMapping("/submit") |
| | | @ApiOperationSupport(order = 6) |
| | | @ApiOperation(value = "新增或修改", notes = "传入dept") |
| | | @ApiLog("组织机构信息新增或修改") |
| | | public R submit(@Valid @RequestBody Dept dept) { |
| | | if (deptService.submit(dept)) { |
| | | public R submit(@Valid @RequestBody DeptAddParam dept) { |
| | | Dept deptEntity = Objects.requireNonNull(BeanUtil.copy(dept, Dept.class)); |
| | | if (deptService.submit(deptEntity)) { |
| | | CacheUtil.clear(SYS_CACHE); |
| | | CacheUtil.clear(SYS_CACHE, Boolean.FALSE); |
| | | List<User> userList = userMapper.selectList(new LambdaQueryWrapper<User>().eq(User::getDeptId, dept.getId())); |
| | |
| | | @ApiOperation(value = "查询机构树(根据区域)") |
| | | public R deptsByAreaCode(@RequestParam(required = false) String areaCode) { |
| | | String areaCodez = HeaderUtils.getAreaCode(); |
| | | if(StringUtils.isNotBlank(areaCode)) { |
| | | areaCodez=areaCode; |
| | | if (StringUtils.isNotBlank(areaCode)) { |
| | | areaCodez = areaCode; |
| | | } |
| | | List<DeptVO> list = deptService.deptsByAreaCode(areaCodez); |
| | | return R.data(list); |