龚焕茏
2024-03-25 c4dfb5b30a5b2917c259f40c1c80abb28b504990
工单阈值
6个文件已添加
480 ■■■■■ 已修改文件
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java 98 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java 61 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java 62 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java 90 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ycl-pojo/src/main/java/com/ycl/platform/domain/entity/YwThreshold.java
New file
@@ -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();
    }
}
ycl-server/src/main/java/com/ycl/platform/controller/YwThresholdController.java
New file
@@ -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;
/**
 * 运维阈值Controller
 *
 * @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));
    }
}
ycl-server/src/main/java/com/ycl/platform/mapper/YwThresholdMapper.java
New file
@@ -0,0 +1,61 @@
package com.ycl.platform.mapper;
import com.ycl.platform.domain.entity.YwThreshold;
import java.util.List;
/**
 * 运维阈值Mapper接口
 *
 * @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);
}
ycl-server/src/main/java/com/ycl/platform/service/IYwThresholdService.java
New file
@@ -0,0 +1,62 @@
package com.ycl.platform.service;
import com.ycl.platform.domain.entity.YwThreshold;
import java.util.List;
/**
 * 运维阈值Service接口
 *
 * @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);
}
ycl-server/src/main/java/com/ycl/platform/service/impl/YwThresholdServiceImpl.java
New file
@@ -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;
/**
 * 运维阈值Service业务层处理
 *
 * @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);
    }
}
ycl-server/src/main/resources/mapper/ycl/YwThresholdMapper.xml
New file
@@ -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>