| | |
| | | import com.ruoyi.common.basic.PageDTO; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.exception.GlobalException; |
| | | import com.ruoyi.common.utils.BeanUtils; |
| | | import com.ruoyi.common.utils.ExcelUtil; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.system.domain.TbDept; |
| | | import com.ruoyi.system.dto.update.DeptFocusDTO; |
| | | import com.ruoyi.system.dto.update.DeptUpdateDTO; |
| | |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.util.ArrayList; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | * @param id 部门id |
| | | * @return DeptVO |
| | | */ |
| | | @GetMapping("/getById") |
| | | @GetMapping("/get-details") |
| | | @ApiOperation("根据id查询部门详情") |
| | | public R<DeptVO> getById(@RequestParam Integer id) { |
| | | public R<DeptVO> getDetails(@RequestParam Integer id) { |
| | | TbDept dept = tbDeptService.getById(id); |
| | | DeptVO deptVO = new DeptVO(); |
| | | BeanUtils.copyBeanProp(deptVO, dept); |
| | | return R.ok(deptVO); |
| | | return R.ok(BeanUtils.copyBean(dept,DeptVO.class)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @PostMapping("/edit") |
| | | @ApiOperation("编辑") |
| | | public R<Object> edit(@RequestBody DeptUpdateDTO dto){ |
| | | TbDept tbDept = new TbDept(); |
| | | BeanUtils.copyBeanProp(tbDept,dto); |
| | | TbDept tbDept = BeanUtils.copyBean(dto, TbDept.class); |
| | | tbDeptService.updateById(tbDept); |
| | | return R.ok(); |
| | | } |
| | |
| | | @PostMapping("/focus") |
| | | @ApiOperation("重点关注") |
| | | public R<Object> focus(@RequestBody DeptFocusDTO dto){ |
| | | TbDept tbDept = new TbDept(); |
| | | BeanUtils.copyBeanProp(tbDept,dto); |
| | | TbDept dept = tbDeptService.getById(dto.getId()); |
| | | if (Objects.isNull(dept)) { |
| | | throw new RuntimeException("非法参数"); |
| | | } |
| | | tbDeptService.lambdaUpdate() |
| | | .eq(TbDept::getId, dto.getId()) |
| | | .set(TbDept::getFocussed, dto.getFocussed()) |