package com.gk.hotwork.Controller;
|
|
import com.alibaba.fastjson.JSONObject;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.gk.hotwork.Controller.Base.BaseController;
|
import com.gk.hotwork.Domain.ElementManagement;
|
import com.gk.hotwork.Domain.ElementTree;
|
import com.gk.hotwork.Domain.Utils.FilterObject;
|
import com.gk.hotwork.Domain.Utils.Msg;
|
import com.gk.hotwork.Service.ElementManagementService;
|
import io.swagger.annotations.Api;
|
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiOperation;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
import java.util.List;
|
|
|
@Api(tags = "安全生产标准化_要素管理")
|
@RestController
|
@RequestMapping("/elementManagement")
|
public class ElementManagementController extends BaseController {
|
|
@Autowired
|
private ElementManagementService elementManagementService;
|
|
@ApiOperation("分页")
|
@PostMapping("/page")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "pageIndex",value = "当前页码"),
|
@ApiImplicitParam(name = "pageSize",value = "每页行数"),
|
@ApiImplicitParam(name = "filter.name",value = "{}"),
|
})
|
public Msg selectPage(@RequestBody FilterObject filterObject) {
|
Integer pageIndex = filterObject.getPageIndex();
|
Integer pageSize = filterObject.getPageSize();
|
IPage page = elementManagementService.selectPage(new Page<>(pageIndex, pageSize), filterObject.getFilter(), getUser());
|
return success(page);
|
}
|
|
@ApiOperation("获取父要素列表")
|
@PostMapping("/getParentElement")
|
public Msg getParentElement() {
|
List<ElementManagement> list = elementManagementService.getParentElement();
|
return success(list);
|
}
|
|
@ApiOperation("获取要素树")
|
@PostMapping("/getElementTree")
|
public Msg getElementTree() {
|
List<ElementTree> elementTreeList = elementManagementService.getElementTree();
|
return success(elementTreeList);
|
}
|
|
@ApiOperation("/新增")
|
@PostMapping("/add")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "name",value = "要素名称"),
|
@ApiImplicitParam(name = "type",value = "要素级别"),
|
@ApiImplicitParam(name = "parentId",value = "父级要素"),
|
@ApiImplicitParam(name = "remark",value = "要素备注"),
|
|
})
|
public Msg add(@RequestBody ElementManagement param) {
|
elementManagementService.addOne(param, getUser());
|
return success();
|
}
|
|
@ApiOperation("/修改")
|
@PostMapping("/mod")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "id"),
|
@ApiImplicitParam(name = "name",value = "应急预案名称"),
|
@ApiImplicitParam(name = "fileType",value = "应急预案文件类型"),
|
@ApiImplicitParam(name = "fileList",value = "应急预案文件"),
|
@ApiImplicitParam(name = "remark",value = "应急预案备注"),
|
})
|
public Msg mod(@RequestBody ElementManagement param) {
|
elementManagementService.modOne(param, getUser());
|
return success();
|
}
|
|
@ApiOperation("/删除")
|
@PostMapping("/del")
|
@ApiImplicitParams({
|
@ApiImplicitParam(name = "id",value = "id"),
|
})
|
public Msg mod(@RequestBody JSONObject jsonObject) {
|
Long id = jsonObject.getLong("id");
|
elementManagementService.delOne(id, getUser());
|
return success();
|
}
|
|
|
}
|