|
@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
+import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.annotation.XjrLog;
|
|
|
import com.xjrsoft.common.constant.GlobalConstant;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.StringPool;
|
|
@@ -31,6 +32,7 @@ import com.xjrsoft.module.student.vo.CadreDeptPageVo;
|
|
|
|
|
|
import com.xjrsoft.module.student.vo.CadreDeptTreeVo;
|
|
|
import com.xjrsoft.module.student.vo.CadreDeptVo;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.AllArgsConstructor;
|
|
@@ -60,11 +62,13 @@ public class CadreDeptController {
|
|
|
@SaCheckPermission("cadredept:detail")
|
|
|
public RT<PageOutput<CadreDeptPageVo>> page(@Valid CadreDeptPageDto dto){
|
|
|
|
|
|
- LambdaQueryWrapper<CadreDept> queryWrapper = new LambdaQueryWrapper<>();
|
|
|
+ MPJLambdaWrapper<CadreDept> queryWrapper = new MPJLambdaWrapper<>();
|
|
|
queryWrapper
|
|
|
- .orderByDesc(CadreDept::getId)
|
|
|
- .select(CadreDept.class,x -> VoToColumnUtil.fieldsToColumns(CadreDeptPageVo.class).contains(x.getProperty()));
|
|
|
- IPage<CadreDept> page = cadreDeptService.page(ConventPage.getPage(dto), queryWrapper);
|
|
|
+ .selectAs(XjrUser::getName, CadreDeptTreeVo::getInstructorUserIdCN)
|
|
|
+ .select(CadreDept.class, x -> VoToColumnUtil.fieldsToColumns(CadreDeptPageVo.class).contains(x.getProperty()))
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, CadreDept::getInstructorUserId)
|
|
|
+ .orderByDesc(CadreDept::getId);
|
|
|
+ IPage<CadreDeptPageVo> page = cadreDeptService.selectJoinListPage(ConventPage.getPage(dto),CadreDeptPageVo.class, queryWrapper);
|
|
|
PageOutput<CadreDeptPageVo> pageOutput = ConventPage.getPageOutput(page, CadreDeptPageVo.class);
|
|
|
return RT.ok(pageOutput);
|
|
|
}
|
|
@@ -73,15 +77,18 @@ public class CadreDeptController {
|
|
|
@ApiOperation(value = "干部部门树")
|
|
|
@SaCheckPermission("cadredept:detail")
|
|
|
public RT<List<CadreDeptTreeVo>> tree(CadreDeptTreeDto dto) {
|
|
|
-
|
|
|
- List<CadreDept> list = cadreDeptService.list(Wrappers.<CadreDept>lambdaQuery()
|
|
|
- .select(CadreDept.class, x -> VoToColumnUtil.fieldsToColumns(CadreDeptTreeVo.class).contains(x.getProperty())));
|
|
|
-
|
|
|
- List<CadreDeptTreeVo> voList = BeanUtil.copyToList(list, CadreDeptTreeVo.class);
|
|
|
- List<CadreDeptTreeVo> treeVoList = TreeUtil.build(voList);
|
|
|
+ List<CadreDeptTreeVo> treeVoList = cadreDeptService.getCadreDeptTree(dto);
|
|
|
return RT.ok(treeVoList);
|
|
|
}
|
|
|
|
|
|
+ @PutMapping("/updateInstructorUser")
|
|
|
+ @ApiOperation(value = "部门(添加/修改)部门指导教师用户编号")
|
|
|
+ @SaCheckPermission("cadredept:edit")
|
|
|
+ public RT<Boolean> updateInstructorUser(@Valid @RequestBody UpdateCadreDeptDto dto){
|
|
|
+ CadreDept cadreDept = BeanUtil.toBean(dto, CadreDept.class);
|
|
|
+ return RT.ok(cadreDeptService.updateById(cadreDept));
|
|
|
+ }
|
|
|
+
|
|
|
@GetMapping(value = "/info")
|
|
|
@ApiOperation(value="根据id查询干部部门信息")
|
|
|
@SaCheckPermission("cadredept:detail")
|
|
@@ -93,7 +100,6 @@ public class CadreDeptController {
|
|
|
return RT.ok(BeanUtil.toBean(cadreDept, CadreDeptVo.class));
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@PostMapping
|
|
|
@ApiOperation(value = "新增干部部门")
|
|
|
@SaCheckPermission("cadredept:add")
|
|
@@ -125,7 +131,6 @@ public class CadreDeptController {
|
|
|
}
|
|
|
CadreDept cadreDept = BeanUtil.toBean(dto, CadreDept.class);
|
|
|
return RT.ok(cadreDeptService.updateById(cadreDept));
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@DeleteMapping
|