|
@@ -0,0 +1,196 @@
|
|
|
+package org.jeecg.modules.equipmentHealthSection.controller;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jeecg.common.api.vo.Result;
|
|
|
+import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
+import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
+import org.jeecg.common.system.query.QueryGenerator;
|
|
|
+import org.jeecg.common.util.DateUtils;
|
|
|
+import org.jeecg.modules.equipmentHealthSection.entity.EquipmentHealthSection;
|
|
|
+import org.jeecg.modules.equipmentHealthSection.service.IEquipmentHealthSectionService;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import org.springframework.web.servlet.ModelAndView;
|
|
|
+
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Description: 设备健康时间段
|
|
|
+ * @Author: jeecg-boot
|
|
|
+ * @Date: 2024-12-03
|
|
|
+ * @Version: V1.0
|
|
|
+ */
|
|
|
+@Api(tags="设备健康时间段")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/EquipmentHealthSection/equipmentHealthSection")
|
|
|
+@Slf4j
|
|
|
+public class EquipmentHealthSectionController extends JeecgController<EquipmentHealthSection, IEquipmentHealthSectionService> {
|
|
|
+ @Autowired
|
|
|
+ private IEquipmentHealthSectionService equipmentHealthSectionService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页列表查询
|
|
|
+ *
|
|
|
+ * @param equipmentHealthSection
|
|
|
+ * @param pageNo
|
|
|
+ * @param pageSize
|
|
|
+ * @param req
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "设备健康时间段-分页列表查询")
|
|
|
+ @ApiOperation(value="设备健康时间段-分页列表查询", notes="设备健康时间段-分页列表查询")
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+ public Result<IPage<EquipmentHealthSection>> queryPageList(EquipmentHealthSection equipmentHealthSection,
|
|
|
+ @RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
+ @RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
+ HttpServletRequest req) {
|
|
|
+ QueryWrapper<EquipmentHealthSection> queryWrapper = QueryGenerator.initQueryWrapper(equipmentHealthSection, req.getParameterMap());
|
|
|
+ Page<EquipmentHealthSection> page = new Page<EquipmentHealthSection>(pageNo, pageSize);
|
|
|
+ IPage<EquipmentHealthSection> pageList = equipmentHealthSectionService.page(page, queryWrapper);
|
|
|
+ return Result.OK(pageList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 添加
|
|
|
+ *
|
|
|
+ * @param equipmentHealthSection
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备健康时间段-添加")
|
|
|
+ @ApiOperation(value="设备健康时间段-添加", notes="设备健康时间段-添加")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:tpm_equipment_health_section:add")
|
|
|
+ @PostMapping(value = "/add")
|
|
|
+ public Result<String> add(@RequestBody EquipmentHealthSection equipmentHealthSection) {
|
|
|
+ equipmentHealthSectionService.save(equipmentHealthSection);
|
|
|
+ return Result.OK("添加成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 编辑
|
|
|
+ *
|
|
|
+ * @param equipmentHealthSection
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备健康时间段-编辑")
|
|
|
+ @ApiOperation(value="设备健康时间段-编辑", notes="设备健康时间段-编辑")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:tpm_equipment_health_section:edit")
|
|
|
+ @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
|
|
|
+ public Result<String> edit(@RequestBody EquipmentHealthSection equipmentHealthSection) {
|
|
|
+ equipmentHealthSectionService.updateById(equipmentHealthSection);
|
|
|
+ return Result.OK("编辑成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id删除
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备健康时间段-通过id删除")
|
|
|
+ @ApiOperation(value="设备健康时间段-通过id删除", notes="设备健康时间段-通过id删除")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:tpm_equipment_health_section:delete")
|
|
|
+ @DeleteMapping(value = "/delete")
|
|
|
+ public Result<String> delete(@RequestParam(name="id",required=true) String id) {
|
|
|
+ equipmentHealthSectionService.removeById(id);
|
|
|
+ return Result.OK("删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 批量删除
|
|
|
+ *
|
|
|
+ * @param ids
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "设备健康时间段-批量删除")
|
|
|
+ @ApiOperation(value="设备健康时间段-批量删除", notes="设备健康时间段-批量删除")
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:tpm_equipment_health_section:deleteBatch")
|
|
|
+ @DeleteMapping(value = "/deleteBatch")
|
|
|
+ public Result<String> deleteBatch(@RequestParam(name="ids",required=true) String ids) {
|
|
|
+ this.equipmentHealthSectionService.removeByIds(Arrays.asList(ids.split(",")));
|
|
|
+ return Result.OK("批量删除成功!");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过id查询
|
|
|
+ *
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "设备健康时间段-通过id查询")
|
|
|
+ @ApiOperation(value="设备健康时间段-通过id查询", notes="设备健康时间段-通过id查询")
|
|
|
+ @GetMapping(value = "/queryById")
|
|
|
+ public Result<EquipmentHealthSection> queryById(@RequestParam(name="id",required=true) String id) {
|
|
|
+ EquipmentHealthSection equipmentHealthSection = equipmentHealthSectionService.getById(id);
|
|
|
+ if(equipmentHealthSection==null) {
|
|
|
+ return Result.error("未找到对应数据");
|
|
|
+ }
|
|
|
+ return Result.OK(equipmentHealthSection);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 导出excel
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param equipmentHealthSection
|
|
|
+ */
|
|
|
+ //@RequiresPermissions("org.jeecg.modules:tpm_equipment_health_section:exportXls")
|
|
|
+ @RequestMapping(value = "/exportXls")
|
|
|
+ public ModelAndView exportXls(HttpServletRequest request, EquipmentHealthSection equipmentHealthSection) {
|
|
|
+ return super.exportXls(request, equipmentHealthSection, EquipmentHealthSection.class, "设备健康时间段");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 通过excel导入数据
|
|
|
+ *
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@RequiresPermissions("tpm_equipment_health_section:importExcel")
|
|
|
+ @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
|
|
|
+ public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
|
|
|
+ return super.importExcel(request, response, EquipmentHealthSection.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按年度查询汇总查月状态时长汇总
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "设备健康时间段-按年度查询汇总查月状态时长汇总")
|
|
|
+ @ApiOperation(value="设备健康时间段-按年度查询汇总查月状态时长汇总", notes="设备健康时间段-按年度查询汇总查月状态时长汇总")
|
|
|
+ @GetMapping(value = "/statusgroup")
|
|
|
+ public Result<List<EquipmentHealthSection>> selectStatusGroupByMonth(@RequestParam(name="year") String year) {
|
|
|
+ if (year.equals("") || year == null) {
|
|
|
+ year = DateUtils.getYear() + "";
|
|
|
+ }
|
|
|
+ List<EquipmentHealthSection> healthList = equipmentHealthSectionService.selectStatusGroupByYear(year);
|
|
|
+ return Result.OK(healthList);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 按年度查询汇总查月状态时长汇总
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ //@AutoLog(value = "设备健康时间段-按年月、状态分组查询")
|
|
|
+ @ApiOperation(value="设备健康时间段-按年月、状态分组查询", notes="设备健康时间段-按年月、状态分组查询")
|
|
|
+ @GetMapping(value = "/statusbyyearmonth")
|
|
|
+ public Result<List<EquipmentHealthSection>> selectStatusByYearmonth(@RequestParam(name="yearmonth") String yearmonth) {
|
|
|
+ if (yearmonth.equals("") || yearmonth == null) {
|
|
|
+ yearmonth = DateUtils.formatDate(new Date(), "yyyy-MM");
|
|
|
+ }
|
|
|
+ List<EquipmentHealthSection> healthList = equipmentHealthSectionService.selectStatusByYearmonth(yearmonth);
|
|
|
+ return Result.OK(healthList);
|
|
|
+ }
|
|
|
+
|
|
|
+}
|