ard-admin/src/main/java/com/ard/web/controller/inspection/ArdInspectionGroupController.java
@@ -44,23 +44,9 @@ @ApiOperation("查询精细化巡检分组列表") @PreAuthorize("@ss.hasPermi('inspection:group:list')") @GetMapping("/list") public TableDataInfo list(ArdInspectionGroup ardInspectionGroup) { startPage(); public AjaxResult list(ArdInspectionGroup ardInspectionGroup) { List<ArdInspectionGroup> list = ardInspectionGroupService.selectArdInspectionGroupList(ardInspectionGroup); return getDataTable(list); } /** * 导出精细化巡检分组列表 */ @ApiOperation("导出精细化巡检分组列表") @PreAuthorize("@ss.hasPermi('inspection:group:export')") @Log(title = "精细化巡检分组", businessType = BusinessType.EXPORT) @PostMapping("/export") public void export(HttpServletResponse response, ArdInspectionGroup ardInspectionGroup) { List<ArdInspectionGroup> list = ardInspectionGroupService.selectArdInspectionGroupList(ardInspectionGroup); ExcelUtil<ArdInspectionGroup> util = new ExcelUtil<ArdInspectionGroup>(ArdInspectionGroup.class); util.exportExcel(response, list, "精细化巡检分组数据"); return success(list); } /** @@ -70,7 +56,7 @@ @PreAuthorize("@ss.hasPermi('inspection:group:query')") @GetMapping(value = "/{groupId}") public AjaxResult getInfo(@PathVariable("groupId") Long groupId) { ardInspectionGroupService.checkInspectionGroupDataScope(groupId); //ardInspectionGroupService.checkInspectionGroupDataScope(groupId); return success(ardInspectionGroupService.selectArdInspectionGroupByGroupId(groupId)); } @@ -119,10 +105,10 @@ if (ardInspectionGroupService.hasChildByInspectionGroupId(groupId)){ return warn("存在下级分组,不允许删除"); } if (ardInspectionGroupService.checkInspectionGroupExistUser(groupId)){ return warn("分组存在用户,不允许删除"); } ardInspectionGroupService.checkInspectionGroupDataScope(groupId); //if (ardInspectionGroupService.checkInspectionGroupExistUser(groupId)){ // return warn("分组存在用户,不允许删除"); //} //ardInspectionGroupService.checkInspectionGroupDataScope(groupId); return toAjax(ardInspectionGroupService.deleteArdInspectionGroupByGroupId(groupId)); } ard-inspection/src/main/java/com/ard/inspection/service/impl/ArdInspectionGroupServiceImpl.java
@@ -46,7 +46,6 @@ * @return 精细化巡检分组 */ @Override @DataScope(deptAlias = "d") public List<ArdInspectionGroup> selectArdInspectionGroupList(ArdInspectionGroup ardInspectionGroup) { return ardInspectionGroupMapper.selectArdInspectionGroupList(ardInspectionGroup); } @@ -59,6 +58,8 @@ */ @Override public int insertArdInspectionGroup(ArdInspectionGroup ardInspectionGroup) { ArdInspectionGroup inspectionGroup = ardInspectionGroupMapper.selectArdInspectionGroupByGroupId(ardInspectionGroup.getGroupParentId()); ardInspectionGroup.setAncestors(inspectionGroup.getAncestors() + "," + ardInspectionGroup.getGroupParentId()); ardInspectionGroup.setCreateTime(DateUtils.getNowDate()); return ardInspectionGroupMapper.insertArdInspectionGroup(ardInspectionGroup); } @@ -71,7 +72,6 @@ */ @Override public int updateArdInspectionGroup(ArdInspectionGroup ardInspectionGroup) { ArdInspectionGroup newGroup = ardInspectionGroupMapper.selectArdInspectionGroupByGroupId(ardInspectionGroup.getGroupParentId()); ArdInspectionGroup oldGroup = ardInspectionGroupMapper.selectArdInspectionGroupByGroupId(ardInspectionGroup.getGroupId()); if(StringUtils.isNotNull(newGroup) && StringUtils.isNotNull(oldGroup)){ ard-inspection/src/main/resources/mapper/ArdInspectionGroupMapper.xml
@@ -14,6 +14,7 @@ <result property="createTime" column="create_time" /> <result property="updateBy" column="update_by" /> <result property="updateTime" column="update_time" /> <result property="parentName" column="parent_name" /> </resultMap> <sql id="selectArdInspectionGroupVo"> @@ -31,22 +32,44 @@ <select id="selectArdInspectionGroupList" parameterType="ArdInspectionGroup" resultMap="ArdInspectionGroupResult"> <include refid="selectArdInspectionGroupVo"/> <where> <if test="groupParentId != null "> and group_parent_id = #{groupParentId}</if> <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if> <if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%')</if> <if test="orderNum != null "> and order_num = #{orderNum}</if> <where> <if test="groupId != null "> and group_id = #{groupId} </if> <if test="groupParentId != null "> and group_parent_id = #{groupParentId} </if> <if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors} </if> <if test="groupName != null and groupName != ''"> and group_name like concat('%', #{groupName}, '%') </if> <if test="orderNum != null "> and order_num = #{orderNum} </if> </where> order by group_parent_id, order_num </select> <select id="selectArdInspectionGroupByGroupId" parameterType="Long" resultMap="ArdInspectionGroupResult"> <include refid="selectArdInspectionGroupVo"/> where group_id = #{groupId} SELECT g.group_id, g.group_parent_id, g.ancestors, g.group_name, g.order_num, ( SELECT group_name FROM ard_inspection_group WHERE group_id = g.group_parent_id) parent_name FROM ard_inspection_group g WHERE g.group_id = #{groupId} </select> <insert id="insertArdInspectionGroup" parameterType="ArdInspectionGroup" useGeneratedKeys="true" keyProperty="groupId"> <insert id="insertArdInspectionGroup" parameterType="ArdInspectionGroup"> insert into ard_inspection_group <trim prefix="(" suffix=")" suffixOverrides=","> <if test="groupId != null">group_id,</if> <if test="groupParentId != null">group_parent_id,</if> <if test="ancestors != null">ancestors,</if> <if test="groupName != null">group_name,</if> @@ -57,6 +80,7 @@ <if test="updateTime != null">update_time,</if> </trim> <trim prefix="values (" suffix=")" suffixOverrides=","> <if test="groupId != null">#{groupId},</if> <if test="groupParentId != null">#{groupParentId},</if> <if test="ancestors != null">#{ancestors},</if> <if test="groupName != null">#{groupName},</if> @@ -97,8 +121,7 @@ <select id="checkInspectionGroupNameUnique" resultMap="ArdInspectionGroupResult"> <include refid="selectArdInspectionGroupVo"/> where group_name=#{groupName} and group_parent_id = #{groupParentId} and del_flag = '0' limit 1 and group_parent_id = #{groupParentId} limit 1 </select> <select id="selectChildrenInspectionGroupById" parameterType="Long" resultMap="ArdInspectionGroupResult">