From a8ddac646d5129e9818ea82f404d0c0a8d2bc239 Mon Sep 17 00:00:00 2001
From: Lius <Lius2225@163.com>
Date: 星期四, 09 十一月 2023 10:39:25 +0800
Subject: [PATCH] 设备参数阈值管理接口

---
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java      |  164 +++++++++++++++++++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java                    |   61 ++++++++++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java   |   18 +++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java    |    8 +
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml           |    5 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java         |    5 
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java           |   14 ++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java              |   15 ++
 lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java |   19 +++
 9 files changed, 309 insertions(+), 0 deletions(-)

diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java
index 984bb08..3a2fe2b 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcDriveTypeParamConfigController.java
@@ -169,4 +169,12 @@
         return Result.OK(result);
     }
 
+    @AutoLog(value = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟")
+    @ApiOperation(value = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟", notes = "椹卞姩鍙傛暟閰嶇疆-鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟")
+    @GetMapping(value = "/getDriveParamOptionsByType")
+    public Result<List<OptionsDto>> getDriveParamOptionsByType(@RequestParam(name = "controlSystemType", required = true) String controlSystemType) {
+        List<OptionsDto> result = mdcDriveTypeParamConfigService.getDriveParamOptionsByType(controlSystemType);
+        return Result.OK(result);
+    }
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java
new file mode 100644
index 0000000..3010565
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/controller/MdcEquipmentThresholdController.java
@@ -0,0 +1,164 @@
+package org.jeecg.modules.mdc.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.modules.mdc.entity.MdcEquipmentThreshold;
+import org.jeecg.modules.mdc.service.IMdcEquipmentThresholdService;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.servlet.ModelAndView;
+
+import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.util.Arrays;
+
+/**
+ * @Description: 璁惧鍙傛暟闃堝�艰〃
+ * @Author: Lius
+ * @Date: 2023-11-08
+ * @Version: V1.0
+ */
+@Slf4j
+@Api(tags = "璁惧鍙傛暟闃堝�艰〃")
+@RestController
+@RequestMapping("/mdc/mdcEquipmentThreshold")
+public class MdcEquipmentThresholdController extends JeecgController<MdcEquipmentThreshold, IMdcEquipmentThresholdService> {
+
+    @Resource
+    private IMdcEquipmentThresholdService mdcEquipmentThresholdService;
+
+    /**
+     * 鍒嗛〉鍒楄〃鏌ヨ
+     *
+     * @param mdcEquipmentThreshold
+     * @param pageNo
+     * @param pageSize
+     * @param req
+     * @return
+     */
+    @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ")
+    @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ", notes = "璁惧鍙傛暟闃堝�艰〃-鍒嗛〉鍒楄〃鏌ヨ")
+    @GetMapping(value = "/list")
+    public Result<?> queryPageList(MdcEquipmentThreshold mdcEquipmentThreshold,
+                                   @RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
+                                   @RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize,
+                                   HttpServletRequest req) {
+        QueryWrapper<MdcEquipmentThreshold> queryWrapper = QueryGenerator.initQueryWrapper(mdcEquipmentThreshold, req.getParameterMap());
+        Page<MdcEquipmentThreshold> page = new Page<MdcEquipmentThreshold>(pageNo, pageSize);
+        IPage<MdcEquipmentThreshold> pageList = mdcEquipmentThresholdService.page(page, queryWrapper);
+        return Result.OK(pageList);
+    }
+
+    /**
+     * 娣诲姞
+     *
+     * @param mdcEquipmentThreshold
+     * @return
+     */
+    @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞")
+    @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-娣诲姞", notes = "璁惧鍙傛暟闃堝�艰〃-娣诲姞")
+    @PostMapping(value = "/add")
+    public Result<?> add(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) {
+        String chineseName = mdcEquipmentThreshold.getChineseName();
+        mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("(")));
+        mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1));
+        mdcEquipmentThresholdService.save(mdcEquipmentThreshold);
+        return Result.OK("娣诲姞鎴愬姛锛�");
+    }
+
+    /**
+     * 缂栬緫
+     *
+     * @param mdcEquipmentThreshold
+     * @return
+     */
+    @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫")
+    @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-缂栬緫", notes = "璁惧鍙傛暟闃堝�艰〃-缂栬緫")
+    @RequestMapping(value = "/edit", method = {RequestMethod.PUT, RequestMethod.POST})
+    public Result<?> edit(@RequestBody MdcEquipmentThreshold mdcEquipmentThreshold) {
+        String chineseName = mdcEquipmentThreshold.getChineseName();
+        mdcEquipmentThreshold.setEnglishName(chineseName.substring(0, chineseName.indexOf("(")));
+        mdcEquipmentThreshold.setChineseName(chineseName.substring(mdcEquipmentThreshold.getEnglishName().length() + 1, chineseName.length() - 1));
+        mdcEquipmentThresholdService.save(mdcEquipmentThreshold);
+        mdcEquipmentThresholdService.updateById(mdcEquipmentThreshold);
+        return Result.OK("缂栬緫鎴愬姛!");
+    }
+
+    /**
+     * 閫氳繃id鍒犻櫎
+     *
+     * @param id
+     * @return
+     */
+    @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎")
+    @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎", notes = "璁惧鍙傛暟闃堝�艰〃-閫氳繃id鍒犻櫎")
+    @DeleteMapping(value = "/delete")
+    public Result<?> delete(@RequestParam(name = "id", required = true) String id) {
+        mdcEquipmentThresholdService.removeById(id);
+        return Result.OK("鍒犻櫎鎴愬姛!");
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎
+     *
+     * @param ids
+     * @return
+     */
+    @AutoLog(value = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎")
+    @ApiOperation(value = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎", notes = "璁惧鍙傛暟闃堝�艰〃-鎵归噺鍒犻櫎")
+    @DeleteMapping(value = "/deleteBatch")
+    public Result<?> deleteBatch(@RequestParam(name = "ids", required = true) String ids) {
+        this.mdcEquipmentThresholdService.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<?> queryById(@RequestParam(name = "id", required = true) String id) {
+        MdcEquipmentThreshold mdcEquipmentThreshold = mdcEquipmentThresholdService.getById(id);
+        String englishName = mdcEquipmentThreshold.getEnglishName();
+        String chineseName = mdcEquipmentThreshold.getChineseName();
+        mdcEquipmentThreshold.setChineseName(englishName + "(" + chineseName + ")");
+        return Result.OK(mdcEquipmentThreshold);
+    }
+
+    /**
+     * 瀵煎嚭excel
+     *
+     * @param request
+     * @param mdcEquipmentThreshold
+     */
+    @RequestMapping(value = "/exportXls")
+    public ModelAndView exportXls(HttpServletRequest request, MdcEquipmentThreshold mdcEquipmentThreshold) {
+        return super.exportXls(request, mdcEquipmentThreshold, MdcEquipmentThreshold.class, "璁惧鍙傛暟闃堝�艰〃");
+    }
+
+    /**
+     * 閫氳繃excel瀵煎叆鏁版嵁
+     *
+     * @param request
+     * @param response
+     * @return
+     */
+    @RequestMapping(value = "/importExcel", method = RequestMethod.POST)
+    public Result<?> importExcel(HttpServletRequest request, HttpServletResponse response) {
+        return super.importExcel(request, response, MdcEquipmentThreshold.class);
+    }
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java
new file mode 100644
index 0000000..f21a23f
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/entity/MdcEquipmentThreshold.java
@@ -0,0 +1,61 @@
+package org.jeecg.modules.mdc.entity;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.jeecg.common.system.base.entity.JeecgEntity;
+import org.jeecgframework.poi.excel.annotation.Excel;
+
+import java.io.Serializable;
+
+/**
+ * @Description: 璁惧鍙傛暟闃堝�艰〃
+ * @Author: Lius
+ * @Date: 2023-11-08
+ * @Version: V1.0
+ */
+@Data
+@TableName("mdc_equipment_threshold")
+@EqualsAndHashCode(callSuper = false)
+@Accessors(chain = true)
+@ApiModel(value = "mdc_equipment_threshold瀵硅薄", description = "璁惧鍙傛暟闃堝�艰〃")
+public class MdcEquipmentThreshold extends JeecgEntity implements Serializable {
+
+    private static final long serialVersionUID = 8899682324080635365L;
+
+    /**
+     * 鎺у埗绯荤粺绫诲瀷
+     */
+    @Excel(name = "鎺у埗绯荤粺绫诲瀷", width = 15)
+    @ApiModelProperty(value = "鎺у埗绯荤粺绫诲瀷")
+    private String controlSystemType;
+    /**
+     * 涓枃鍚嶇О
+     */
+    @Excel(name = "涓枃鍚嶇О", width = 15)
+    @ApiModelProperty(value = "涓枃鍚嶇О")
+    private String chineseName;
+    /**
+     * 鑻辨枃鍚嶇О
+     */
+    @Excel(name = "鑻辨枃鍚嶇О", width = 15)
+    @ApiModelProperty(value = "鑻辨枃鍚嶇О")
+    private String englishName;
+    /**
+     * 涓婇檺
+     */
+    @Excel(name = "涓婇檺", width = 15)
+    @ApiModelProperty(value = "涓婇檺")
+    private Integer maxThreshold;
+    /**
+     * 涓嬮檺
+     */
+    @Excel(name = "涓嬮檺", width = 15)
+    @ApiModelProperty(value = "涓嬮檺")
+    private Integer minThreshold;
+
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java
new file mode 100644
index 0000000..64fe360
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/MdcEquipmentThresholdMapper.java
@@ -0,0 +1,15 @@
+package org.jeecg.modules.mdc.mapper;
+
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold;
+
+/**
+ * @Description: 璁惧鍙傛暟闃堝�艰〃
+ * @Author: Lius
+ * @Date:   2023-11-08
+ * @Version: V1.0
+ */
+public interface MdcEquipmentThresholdMapper extends BaseMapper<MdcEquipmentThreshold> {
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml
new file mode 100644
index 0000000..9e6876b
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/mapper/xml/MdcEquipmentThresholdMapper.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="org.jeecg.modules.mdc.mapper.MdcEquipmentThresholdMapper">
+
+</mapper>
\ No newline at end of file
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java
index efcac99..27e26e5 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcDriveTypeParamConfigService.java
@@ -34,4 +34,9 @@
      */
     List<OptionsDto> getDriveParamOptions();
 
+    /**
+     * 鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟
+     */
+    List<OptionsDto> getDriveParamOptionsByType(String controlSystemType);
+
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java
new file mode 100644
index 0000000..e0f6077
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/IMdcEquipmentThresholdService.java
@@ -0,0 +1,14 @@
+package org.jeecg.modules.mdc.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold;
+
+/**
+ * @Description: 璁惧鍙傛暟闃堝�艰〃
+ * @Author: Lius
+ * @Date: 2023-11-08
+ * @Version: V1.0
+ */
+public interface IMdcEquipmentThresholdService extends IService<MdcEquipmentThreshold> {
+
+}
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java
index f9d398c..e04fc94 100644
--- a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcDriveTypeParamConfigServiceImpl.java
@@ -1,5 +1,6 @@
 package org.jeecg.modules.mdc.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.jeecg.common.constant.CommonConstant;
 import org.jeecg.modules.mdc.dto.OptionsDto;
@@ -59,4 +60,22 @@
         }
         return result;
     }
+
+    /**
+     * 鏍规嵁鎺у埗绯荤粺绫诲瀷鑾峰彇鍙傛暟
+     */
+    @Override
+    public List<OptionsDto> getDriveParamOptionsByType(String controlSystemType) {
+        List<OptionsDto> result = new ArrayList<>();
+        List<MdcDriveTypeParamConfig> mdcDriveTypeParamConfigList = super.list(new LambdaQueryWrapper<MdcDriveTypeParamConfig>().eq(MdcDriveTypeParamConfig::getControlSystemType, controlSystemType).eq(MdcDriveTypeParamConfig::getCurveGenerationFlags, CommonConstant.YN_Y));
+        if (mdcDriveTypeParamConfigList != null && !mdcDriveTypeParamConfigList.isEmpty()) {
+            for (MdcDriveTypeParamConfig mdcDriveTypeParamConfig : mdcDriveTypeParamConfigList) {
+                OptionsDto optionsDto = new OptionsDto();
+                optionsDto.setLabel(mdcDriveTypeParamConfig.getEnglishName() + "(" + mdcDriveTypeParamConfig.getChineseName() + ")");
+                optionsDto.setValue(mdcDriveTypeParamConfig.getEnglishName() + "(" + mdcDriveTypeParamConfig.getChineseName() + ")");
+                result.add(optionsDto);
+            }
+        }
+        return result;
+    }
 }
diff --git a/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java
new file mode 100644
index 0000000..80c3b92
--- /dev/null
+++ b/lxzn-module-mdc/src/main/java/org/jeecg/modules/mdc/service/impl/MdcEquipmentThresholdServiceImpl.java
@@ -0,0 +1,18 @@
+package org.jeecg.modules.mdc.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.jeecg.modules.mdc.entity.MdcEquipmentThreshold;
+import org.jeecg.modules.mdc.mapper.MdcEquipmentThresholdMapper;
+import org.jeecg.modules.mdc.service.IMdcEquipmentThresholdService;
+import org.springframework.stereotype.Service;
+
+/**
+ * @Description: 璁惧鍙傛暟闃堝�艰〃
+ * @Author: Lius
+ * @Date:   2023-11-08
+ * @Version: V1.0
+ */
+@Service
+public class MdcEquipmentThresholdServiceImpl extends ServiceImpl<MdcEquipmentThresholdMapper, MdcEquipmentThreshold> implements IMdcEquipmentThresholdService {
+
+}

--
Gitblit v1.9.3