From c4dfb5b30a5b2917c259f40c1c80abb28b504990 Mon Sep 17 00:00:00 2001
From: 龚焕茏 <2842157468@qq.com>
Date: 星期一, 25 三月 2024 15:41:23 +0800
Subject: [PATCH] 工单阈值

---
 ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java |   90 +++++++++++
 ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java    |   90 +++++++++++
 ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java            |   61 +++++++
 ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml                     |   79 +++++++++
 ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java             |   98 ++++++++++++
 ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java         |   62 +++++++
 6 files changed, 480 insertions(+), 0 deletions(-)

diff --git a/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
new file mode 100644
index 0000000..f6f877c
--- /dev/null
+++ b/ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
@@ -0,0 +1,98 @@
+package com.ycl.platform.domain.entity;
+
+
+import annotation.Excel;
+import com.ycl.system.entity.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * 杩愮淮闃堝�煎璞� t_yw_threshold
+ *
+ * @author gonghl
+ * @date 2024-03-25
+ */
+public class YwThreshold extends BaseEntity {
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 涓婚敭
+     */
+    private Integer id;
+
+    /**
+     * 璁惧绫诲瀷锛�1浜鸿劯 2杞﹁締 3瑙嗛
+     */
+    @Excel(name = "璁惧绫诲瀷锛�1浜鸿劯 2杞﹁締 3瑙嗛")
+    private String monitorType;
+
+    /**
+     * 瓒呮椂澶╂暟
+     */
+    @Excel(name = "瓒呮椂澶╂暟")
+    private Integer timeout;
+
+    /**
+     * 鎸囨爣json
+     */
+    @Excel(name = "鎸囨爣json")
+    private String indicator;
+
+    /**
+     * 閫昏緫鍒犻櫎锛�0鏈垹闄� 1鍒犻櫎
+     */
+    private String deleted;
+
+    public void setId(Integer id) {
+        this.id = id;
+    }
+
+    public Integer getId() {
+        return id;
+    }
+
+    public void setMonitorType(String monitorType) {
+        this.monitorType = monitorType;
+    }
+
+    public String getMonitorType() {
+        return monitorType;
+    }
+
+    public void setTimeout(Integer timeout) {
+        this.timeout = timeout;
+    }
+
+    public Integer getTimeout() {
+        return timeout;
+    }
+
+    public void setIndicator(String indicator) {
+        this.indicator = indicator;
+    }
+
+    public String getIndicator() {
+        return indicator;
+    }
+
+    public void setDeleted(String deleted) {
+        this.deleted = deleted;
+    }
+
+    public String getDeleted() {
+        return deleted;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("id", getId())
+                .append("monitorType", getMonitorType())
+                .append("timeout", getTimeout())
+                .append("indicator", getIndicator())
+                .append("createTime", getCreateTime())
+                .append("updateTime", getUpdateTime())
+                .append("deleted", getDeleted())
+                .toString();
+    }
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java b/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
new file mode 100644
index 0000000..526fa72
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
@@ -0,0 +1,90 @@
+package com.ycl.platform.controller;
+
+import annotation.Log;
+import com.ycl.platform.domain.entity.YwThreshold;
+import com.ycl.platform.service.IYwThresholdService;
+import com.ycl.system.AjaxResult;
+import com.ycl.system.controller.BaseController;
+import com.ycl.system.page.TableDataInfo;
+import com.ycl.utils.poi.ExcelUtil;
+import enumeration.BusinessType;
+import jakarta.servlet.http.HttpServletResponse;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 杩愮淮闃堝�糃ontroller
+ *
+ * @author gonghl
+ * @date 2024-03-25
+ */
+@RestController
+@RequestMapping("/ycl/threshold")
+public class YwThresholdController extends BaseController {
+    @Autowired
+    private IYwThresholdService ywThresholdService;
+
+    /**
+     * 鏌ヨ杩愮淮闃堝�煎垪琛�
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(YwThreshold ywThreshold) {
+        startPage();
+        List<YwThreshold> list = ywThresholdService.selectYwThresholdList(ywThreshold);
+        return getDataTable(list);
+    }
+
+    /**
+     * 瀵煎嚭杩愮淮闃堝�煎垪琛�
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:export')")
+    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.EXPORT)
+    @PostMapping("/export")
+    public void export(HttpServletResponse response, YwThreshold ywThreshold) {
+        List<YwThreshold> list = ywThresholdService.selectYwThresholdList(ywThreshold);
+        ExcelUtil<YwThreshold> util = new ExcelUtil<YwThreshold>(YwThreshold.class);
+        util.exportExcel(response, list, "杩愮淮闃堝�兼暟鎹�");
+    }
+
+    /**
+     * 鑾峰彇杩愮淮闃堝�艰缁嗕俊鎭�
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:query')")
+    @GetMapping(value = "/{id}")
+    public AjaxResult getInfo(@PathVariable("id") Integer id) {
+        return success(ywThresholdService.selectYwThresholdById(id));
+    }
+
+    /**
+     * 鏂板杩愮淮闃堝��
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:add')")
+    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody YwThreshold ywThreshold) {
+        return toAjax(ywThresholdService.insertYwThreshold(ywThreshold));
+    }
+
+    /**
+     * 淇敼杩愮淮闃堝��
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:edit')")
+    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody YwThreshold ywThreshold) {
+        return toAjax(ywThresholdService.updateYwThreshold(ywThreshold));
+    }
+
+    /**
+     * 鍒犻櫎杩愮淮闃堝��
+     */
+    // @PreAuthorize("@ss.hasPermi('ycl:threshold:remove')")
+    @Log(title = "杩愮淮闃堝��", businessType = BusinessType.DELETE)
+    @DeleteMapping("/{ids}")
+    public AjaxResult remove(@PathVariable Integer[] ids) {
+        return toAjax(ywThresholdService.deleteYwThresholdByIds(ids));
+    }
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
new file mode 100644
index 0000000..b4dd57f
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
@@ -0,0 +1,61 @@
+package com.ycl.platform.mapper;
+
+import com.ycl.platform.domain.entity.YwThreshold;
+
+import java.util.List;
+
+/**
+ * 杩愮淮闃堝�糓apper鎺ュ彛
+ *
+ * @author gonghl
+ * @date 2024-03-25
+ */
+public interface YwThresholdMapper {
+    /**
+     * 鏌ヨ杩愮淮闃堝��
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 杩愮淮闃堝��
+     */
+    public YwThreshold selectYwThresholdById(Integer id);
+
+    /**
+     * 鏌ヨ杩愮淮闃堝�煎垪琛�
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 杩愮淮闃堝�奸泦鍚�
+     */
+    public List<YwThreshold> selectYwThresholdList(YwThreshold ywThreshold);
+
+    /**
+     * 鏂板杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    public int insertYwThreshold(YwThreshold ywThreshold);
+
+    /**
+     * 淇敼杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    public int updateYwThreshold(YwThreshold ywThreshold);
+
+    /**
+     * 鍒犻櫎杩愮淮闃堝��
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 缁撴灉
+     */
+    public int deleteYwThresholdById(Integer id);
+
+    /**
+     * 鎵归噺鍒犻櫎杩愮淮闃堝��
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑鏁版嵁涓婚敭闆嗗悎
+     * @return 缁撴灉
+     */
+    public int deleteYwThresholdByIds(Integer[] ids);
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java b/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
new file mode 100644
index 0000000..db7356a
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
@@ -0,0 +1,62 @@
+package com.ycl.platform.service;
+
+
+import com.ycl.platform.domain.entity.YwThreshold;
+
+import java.util.List;
+
+/**
+ * 杩愮淮闃堝�糞ervice鎺ュ彛
+ *
+ * @author gonghl
+ * @date 2024-03-25
+ */
+public interface IYwThresholdService {
+    /**
+     * 鏌ヨ杩愮淮闃堝��
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 杩愮淮闃堝��
+     */
+    public YwThreshold selectYwThresholdById(Integer id);
+
+    /**
+     * 鏌ヨ杩愮淮闃堝�煎垪琛�
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 杩愮淮闃堝�奸泦鍚�
+     */
+    public List<YwThreshold> selectYwThresholdList(YwThreshold ywThreshold);
+
+    /**
+     * 鏂板杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    public int insertYwThreshold(YwThreshold ywThreshold);
+
+    /**
+     * 淇敼杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    public int updateYwThreshold(YwThreshold ywThreshold);
+
+    /**
+     * 鎵归噺鍒犻櫎杩愮淮闃堝��
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑杩愮淮闃堝�间富閿泦鍚�
+     * @return 缁撴灉
+     */
+    public int deleteYwThresholdByIds(Integer[] ids);
+
+    /**
+     * 鍒犻櫎杩愮淮闃堝�间俊鎭�
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 缁撴灉
+     */
+    public int deleteYwThresholdById(Integer id);
+}
diff --git a/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
new file mode 100644
index 0000000..0cbf737
--- /dev/null
+++ b/ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
@@ -0,0 +1,90 @@
+package com.ycl.platform.service.impl;
+
+import com.ycl.platform.domain.entity.YwThreshold;
+import com.ycl.platform.mapper.YwThresholdMapper;
+import com.ycl.platform.service.IYwThresholdService;
+import com.ycl.utils.DateUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+/**
+ * 杩愮淮闃堝�糞ervice涓氬姟灞傚鐞�
+ *
+ * @author gonghl
+ * @date 2024-03-25
+ */
+@Service
+public class YwThresholdServiceImpl implements IYwThresholdService {
+    @Autowired
+    private YwThresholdMapper ywThresholdMapper;
+
+    /**
+     * 鏌ヨ杩愮淮闃堝��
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 杩愮淮闃堝��
+     */
+    @Override
+    public YwThreshold selectYwThresholdById(Integer id) {
+        return ywThresholdMapper.selectYwThresholdById(id);
+    }
+
+    /**
+     * 鏌ヨ杩愮淮闃堝�煎垪琛�
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 杩愮淮闃堝��
+     */
+    @Override
+    public List<YwThreshold> selectYwThresholdList(YwThreshold ywThreshold) {
+        return ywThresholdMapper.selectYwThresholdList(ywThreshold);
+    }
+
+    /**
+     * 鏂板杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    @Override
+    public int insertYwThreshold(YwThreshold ywThreshold) {
+        ywThreshold.setCreateTime(DateUtils.getNowDate());
+        return ywThresholdMapper.insertYwThreshold(ywThreshold);
+    }
+
+    /**
+     * 淇敼杩愮淮闃堝��
+     *
+     * @param ywThreshold 杩愮淮闃堝��
+     * @return 缁撴灉
+     */
+    @Override
+    public int updateYwThreshold(YwThreshold ywThreshold) {
+        ywThreshold.setUpdateTime(DateUtils.getNowDate());
+        return ywThresholdMapper.updateYwThreshold(ywThreshold);
+    }
+
+    /**
+     * 鎵归噺鍒犻櫎杩愮淮闃堝��
+     *
+     * @param ids 闇�瑕佸垹闄ょ殑杩愮淮闃堝�间富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteYwThresholdByIds(Integer[] ids) {
+        return ywThresholdMapper.deleteYwThresholdByIds(ids);
+    }
+
+    /**
+     * 鍒犻櫎杩愮淮闃堝�间俊鎭�
+     *
+     * @param id 杩愮淮闃堝�间富閿�
+     * @return 缁撴灉
+     */
+    @Override
+    public int deleteYwThresholdById(Integer id) {
+        return ywThresholdMapper.deleteYwThresholdById(id);
+    }
+}
diff --git a/ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml b/ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml
new file mode 100644
index 0000000..a4384cd
--- /dev/null
+++ b/ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml
@@ -0,0 +1,79 @@
+<?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="com.ycl.platform.mapper.YwThresholdMapper">
+
+    <resultMap type="YwThreshold" id="YwThresholdResult">
+        <result property="id" column="id"/>
+        <result property="monitorType" column="monitor_type"/>
+        <result property="timeout" column="timeout"/>
+        <result property="indicator" column="indicator"/>
+        <result property="createTime" column="create_time"/>
+        <result property="updateTime" column="update_time"/>
+        <result property="deleted" column="deleted"/>
+    </resultMap>
+
+    <sql id="selectYwThresholdVo">
+        select id, monitor_type, timeout, indicator, create_time, update_time, deleted
+        from t_yw_threshold
+    </sql>
+
+    <select id="selectYwThresholdList" parameterType="YwThreshold" resultMap="YwThresholdResult">
+        <include refid="selectYwThresholdVo"/>
+        <where>
+            <if test="monitorType != null  and monitorType != ''">and monitor_type = #{monitorType}</if>
+        </where>
+    </select>
+
+    <select id="selectYwThresholdById" parameterType="Integer" resultMap="YwThresholdResult">
+        <include refid="selectYwThresholdVo"/>
+        where id = #{id}
+    </select>
+
+    <insert id="insertYwThreshold" parameterType="YwThreshold" useGeneratedKeys="true" keyProperty="id">
+        insert into t_yw_threshold
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="monitorType != null and monitorType != ''">monitor_type,</if>
+            <if test="timeout != null">timeout,</if>
+            <if test="indicator != null">indicator,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateTime != null">update_time,</if>
+            <if test="deleted != null">deleted,</if>
+        </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="monitorType != null and monitorType != ''">#{monitorType},</if>
+            <if test="timeout != null">#{timeout},</if>
+            <if test="indicator != null">#{indicator},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+            <if test="deleted != null">#{deleted},</if>
+        </trim>
+    </insert>
+
+    <update id="updateYwThreshold" parameterType="YwThreshold">
+        update t_yw_threshold
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="monitorType != null and monitorType != ''">monitor_type = #{monitorType},</if>
+            <if test="timeout != null">timeout = #{timeout},</if>
+            <if test="indicator != null">indicator = #{indicator},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+            <if test="deleted != null">deleted = #{deleted},</if>
+        </trim>
+        where id = #{id}
+    </update>
+
+    <delete id="deleteYwThresholdById" parameterType="Integer">
+        delete
+        from t_yw_threshold
+        where id = #{id}
+    </delete>
+
+    <delete id="deleteYwThresholdByIds" parameterType="String">
+        delete from t_yw_threshold where id in
+        <foreach item="id" collection="array" open="(" separator="," close=")">
+            #{id}
+        </foreach>
+    </delete>
+</mapper>
\ No newline at end of file

--
Gitblit v1.8.0