|
@@ -0,0 +1,120 @@
|
|
|
+package com.ruoyi.web.controller.zhdd;
|
|
|
+
|
|
|
+import com.ruoyi.common.annotation.Log;
|
|
|
+import com.ruoyi.common.annotation.RepeatSubmit;
|
|
|
+import com.ruoyi.common.core.controller.BaseController;
|
|
|
+import com.ruoyi.common.core.domain.AjaxResult;
|
|
|
+import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
+import com.ruoyi.common.core.validate.AddGroup;
|
|
|
+import com.ruoyi.common.core.validate.EditGroup;
|
|
|
+import com.ruoyi.common.core.validate.QueryGroup;
|
|
|
+import com.ruoyi.common.enums.BusinessType;
|
|
|
+import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
+import com.ruoyi.zhdd.domain.bo.ChemicalDataBo;
|
|
|
+import com.ruoyi.zhdd.domain.vo.ChemicalDataVo;
|
|
|
+import com.ruoyi.zhdd.service.IChemicalDataService;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.DeleteMapping;
|
|
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import javax.validation.constraints.NotEmpty;
|
|
|
+import javax.validation.constraints.NotNull;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 危化品信息Controller
|
|
|
+ *
|
|
|
+ * @author xintong
|
|
|
+ * @date 2022-01-14
|
|
|
+ */
|
|
|
+@Validated
|
|
|
+@Api(value = "危化品信息控制器", tags = {"危化品信息管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/zhdd/chemicalData")
|
|
|
+public class ChemicalDataController extends BaseController {
|
|
|
+
|
|
|
+ private final IChemicalDataService iChemicalDataService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询危化品信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询危化品信息列表")
|
|
|
+// @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:list')")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<ChemicalDataVo> list(@Validated(QueryGroup.class) ChemicalDataBo bo) {
|
|
|
+ return iChemicalDataService.queryPageList(bo);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出危化品信息列表
|
|
|
+ */
|
|
|
+ @ApiOperation("导出危化品信息列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:export')")
|
|
|
+ @Log(title = "危化品信息", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public void export(@Validated ChemicalDataBo bo, HttpServletResponse response) {
|
|
|
+ List<ChemicalDataVo> list = iChemicalDataService.queryList(bo);
|
|
|
+ ExcelUtil.exportExcel(list, "危化品信息", ChemicalDataVo.class, response);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取危化品信息详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取危化品信息详细信息")
|
|
|
+ @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:query')")
|
|
|
+ @GetMapping("/{id}")
|
|
|
+ public AjaxResult<ChemicalDataVo> getInfo(@NotNull(message = "主键不能为空")
|
|
|
+ @PathVariable("id") String id) {
|
|
|
+ return AjaxResult.success(iChemicalDataService.queryById(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增危化品信息
|
|
|
+ */
|
|
|
+ @ApiOperation("新增危化品信息")
|
|
|
+// @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:add')")
|
|
|
+ @Log(title = "危化品信息", businessType = BusinessType.INSERT)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@Validated(AddGroup.class) @RequestBody ChemicalDataBo bo) {
|
|
|
+ return toAjax(iChemicalDataService.insertByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改危化品信息
|
|
|
+ */
|
|
|
+ @ApiOperation("修改危化品信息")
|
|
|
+// @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:edit')")
|
|
|
+ @Log(title = "危化品信息", businessType = BusinessType.UPDATE)
|
|
|
+ @RepeatSubmit()
|
|
|
+ @PutMapping()
|
|
|
+ public AjaxResult<Void> edit(@Validated(EditGroup.class) @RequestBody ChemicalDataBo bo) {
|
|
|
+ return toAjax(iChemicalDataService.updateByBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除危化品信息
|
|
|
+ */
|
|
|
+ @ApiOperation("删除危化品信息")
|
|
|
+// @PreAuthorize("@ss.hasPermi('zhdd:chemicalData:remove')")
|
|
|
+ @Log(title = "危化品信息", businessType = BusinessType.DELETE)
|
|
|
+ @DeleteMapping("/{ids}")
|
|
|
+ public AjaxResult<Void> remove(@NotEmpty(message = "主键不能为空")
|
|
|
+ @PathVariable String[] ids) {
|
|
|
+ return toAjax(iChemicalDataService.deleteWithValidByIds(Arrays.asList(ids), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+}
|