standard-server/src/main/java/com/yuanchu/limslaboratory/controller/OrganizationalController.java
@@ -2,6 +2,7 @@ import com.yuanchu.limslaboratory.pojo.Organizational; import com.yuanchu.limslaboratory.service.OrganizationalService; import com.yuanchu.limslaboratory.utils.MyUtil; import com.yuanchu.limslaboratory.vo.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiImplicitParam; @@ -38,6 +39,17 @@ return Result.success(organizationalTree); } @ApiOperation(value = "根据点击Id查询部门") @ApiImplicitParams(value = { @ApiImplicitParam(value = "部门ID", name = "departmentId", dataTypeClass = Integer.class) }) @GetMapping("/table") public Result<?> getDepartmentListTable(Integer departmentId) { MyUtil.PrintLog(departmentId.toString()); List<Map<String, Object>> departmentListTable = organizationalService.getDepartmentListTable(departmentId); return Result.success(departmentListTable); } @ApiOperation(value = "添加部门") @PostMapping("/add") public Result<?> addDepartment(@RequestBody @Validated Organizational organizational) { standard-server/src/main/java/com/yuanchu/limslaboratory/mapper/OrganizationalMapper.java
@@ -17,4 +17,6 @@ public interface OrganizationalMapper extends BaseMapper<Organizational> { List<Map<String, Object>> OrganizationalTree(Integer father_id); List<Map<String, Object>> getDepartmentListTable(Integer departmentId); } standard-server/src/main/java/com/yuanchu/limslaboratory/service/OrganizationalService.java
@@ -23,4 +23,6 @@ Integer updateDepartment(Integer id, Organizational organizational); Integer deleteDepartment(Integer id); List<Map<String, Object>> getDepartmentListTable(Integer departmentId); } standard-server/src/main/java/com/yuanchu/limslaboratory/service/impl/OrganizationalServiceImpl.java
@@ -65,4 +65,9 @@ updateWrapper.set(Organizational::getState, 0); return organizationalMapper.update(new Organizational(), updateWrapper); } @Override public List<Map<String, Object>> getDepartmentListTable(Integer departmentId) { return organizationalMapper.getDepartmentListTable(departmentId); } } standard-server/src/main/resources/mapper/OrganizationalMapper.xml
@@ -11,4 +11,11 @@ <select id="OrganizationalTree" resultMap="OrganizationalMap"> SELECT o.id, o.`department` FROM organizational o where o.`father_id` = #{father_id} </select> <select id="getDepartmentListTable" resultType="map"> SELECT o.`id`, o.`department` FROM organizational o WHERE o.`father_id` = #{departmentId} AND o.`state` = 1 </select> </mapper>