|
@@ -0,0 +1,160 @@
|
|
|
+package org.king.modules.ad.controller;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import org.king.common.system.base.controller.KingController;
|
|
|
+import org.king.common.api.vo.Result;
|
|
|
+import org.king.common.system.query.QueryGenerator;
|
|
|
+import org.king.common.aspect.annotation.AutoLog;
|
|
|
+import org.king.modules.ad.entity.AdDeviceFaultReport;
|
|
|
+import org.king.modules.ad.service.IAdDeviceFaultReportService;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 设备故障
|
|
|
+ * @Author: king-boot
|
|
|
+ * @Date: 2021-06-15
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@Api(tags = "设备故障")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/ad/adDeviceFaultReport")
|
|
|
+public class AdDeviceFaultReportController extends KingController<AdDeviceFaultReport, IAdDeviceFaultReportService> {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IAdDeviceFaultReportService adDeviceFaultReportService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param adDeviceFaultReport
|
|
|
+ * @param pageNo 页码
|
|
|
+ * @param pageSize 每页条数
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-分页列表查询")
|
|
|
+ @ApiOperation(value = "设备故障-分页列表查询", notes = "设备故障-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<?> queryPageList(AdDeviceFaultReport adDeviceFaultReport,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<AdDeviceFaultReport> queryWrapper = QueryGenerator.initQueryWrapper(adDeviceFaultReport, req.getParameterMap());
|
|
|
+ Page<AdDeviceFaultReport> page = new Page<>(pageNo, pageSize);
|
|
|
+ IPage<AdDeviceFaultReport> pageList = adDeviceFaultReportService.page(page, queryWrapper);
|
|
|
+ return Result.ok(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param adDeviceFaultReport
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-添加")
|
|
|
+ @ApiOperation(value = "设备故障-添加", notes = "设备故障-添加")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<?> add(@RequestBody AdDeviceFaultReport adDeviceFaultReport) {
|
|
|
+ adDeviceFaultReportService.save(adDeviceFaultReport);
|
|
|
+ return Result.ok("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param adDeviceFaultReport
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-编辑")
|
|
|
+ @ApiOperation(value = "设备故障-编辑", notes = "设备故障-编辑")
|
|
|
+ @PutMapping(value = "/edit")
|
|
|
+ public Result<?> edit(@RequestBody AdDeviceFaultReport adDeviceFaultReport) {
|
|
|
+ adDeviceFaultReportService.updateById(adDeviceFaultReport);
|
|
|
+ return Result.ok("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id 主键id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-通过id删除")
|
|
|
+ @ApiOperation(value = "设备故障-通过id删除", notes = "设备故障-通过id删除")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<?> delete(@RequestParam(name="id") String id) {
|
|
|
+ adDeviceFaultReportService.removeById(id);
|
|
|
+ return Result.ok("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids 主键id集合
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-批量删除")
|
|
|
+ @ApiOperation(value = "设备故障-批量删除", notes = "设备故障-批量删除")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<?> deleteBatch(@RequestParam(name="ids") String ids) {
|
|
|
+ this.adDeviceFaultReportService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.ok("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id 主键id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-通过id查询")
|
|
|
+ @ApiOperation(value = "设备故障-通过id查询", notes = "设备故障-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<?> queryById(@RequestParam(name="id") String id) {
|
|
|
+ AdDeviceFaultReport adDeviceFaultReport = adDeviceFaultReportService.getById(id);
|
|
|
+ if (adDeviceFaultReport==null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.ok(adDeviceFaultReport);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param adDeviceFaultReport
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-导出excel")
|
|
|
+ @ApiOperation(value = "设备故障-导出excel", notes = "设备故障-导出excel")
|
|
|
+ @RequestMapping(value = "/exportXls", method = {RequestMethod.GET, RequestMethod.POST})
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, AdDeviceFaultReport adDeviceFaultReport) {
|
|
|
+ return super.exportXls(request, adDeviceFaultReport, AdDeviceFaultReport.class, "设备故障");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备故障-通过excel导入数据")
|
|
|
+ @ApiOperation(value = "设备故障-通过excel导入数据", notes = "设备故障-通过excel导入数据")
|
|
|
+ @PostMapping(value = "/importExcel")
|
|
|
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ return super.importExcel(request, response, AdDeviceFaultReport.class);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|