| | |
| | | package com.ard.web.controller.inspection; |
| | | |
| | | import java.util.List; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ard.common.annotation.Log; |
| | | import com.ard.common.core.controller.BaseController; |
| | | import com.ard.common.core.domain.AjaxResult; |
| | | import com.ard.common.core.page.TableDataInfo; |
| | | import com.ard.common.enums.BusinessType; |
| | | import com.ard.common.utils.poi.ExcelUtil; |
| | | import com.ard.inspection.domain.ArdInspectionGroup; |
| | | import com.ard.inspection.service.IArdInspectionGroupService; |
| | | import io.swagger.annotations.Api; |
| | |
| | | * 查询精细化巡检分组列表 |
| | | */ |
| | | @ApiOperation("查询精细化巡检分组列表") |
| | | @PreAuthorize("@ss.hasPermi('inspection:group:list')") |
| | | //@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); |
| | | } |
| | | |
| | | /** |
| | | * 获取精细化巡检分组详细信息 |
| | | */ |
| | | @ApiOperation("获取精细化巡检分组详细信息") |
| | | @PreAuthorize("@ss.hasPermi('inspection:group:query')") |
| | | //@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)); |
| | | } |
| | | |
| | |
| | | * 新增精细化巡检分组 |
| | | */ |
| | | @ApiOperation("新增精细化巡检分组") |
| | | @PreAuthorize("@ss.hasPermi('inspection:group:add')") |
| | | //@PreAuthorize("@ss.hasPermi('inspection:group:add')") |
| | | @Log(title = "精细化巡检分组", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult add(@RequestBody ArdInspectionGroup ardInspectionGroup) { |
| | | if (ardInspectionGroupService.checkInspectionGroupNameUnique(ardInspectionGroup)){ |
| | | if (!ardInspectionGroupService.checkInspectionGroupNameUnique(ardInspectionGroup)){ |
| | | return error("新增分组'" + ardInspectionGroup.getGroupName() + "'失败,分组名称已存在"); |
| | | } |
| | | ardInspectionGroup.setCreateBy(getUsername()); |
| | |
| | | * 修改精细化巡检分组 |
| | | */ |
| | | @ApiOperation("修改精细化巡检分组") |
| | | @PreAuthorize("@ss.hasPermi('inspection:group:edit')") |
| | | //@PreAuthorize("@ss.hasPermi('inspection:group:edit')") |
| | | @Log(title = "精细化巡检分组", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult edit(@RequestBody ArdInspectionGroup ardInspectionGroup) { |
| | |
| | | * 删除精细化巡检分组 |
| | | */ |
| | | @ApiOperation("删除精细化巡检分组") |
| | | @PreAuthorize("@ss.hasPermi('inspection:group:remove')") |
| | | //@PreAuthorize("@ss.hasPermi('inspection:group:remove')") |
| | | @Log(title = "精细化巡检分组", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{groupId}") |
| | | public AjaxResult remove(@PathVariable Long groupId) { |
| | | 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)); |
| | | } |
| | | |
| | | /** |
| | | * 获取巡检分组树列表 |
| | | */ |
| | | @ApiOperation("获取巡检分组树列表") |
| | | //@PreAuthorize("@ss.hasPermi('inspection:group:groupTree')") |
| | | @GetMapping("/groupTree") |
| | | public AjaxResult deptTree(ArdInspectionGroup ardInspectionGroup) { |
| | | return success(ardInspectionGroupService.selectGroupTreeList(ardInspectionGroup)); |
| | | } |
| | | |
| | | } |