wangggziwen преди 2 години
родител
ревизия
ee334cc3d8

+ 117 - 0
master/src/main/java/com/ruoyi/project/production/controller/TSaiController.java

@@ -0,0 +1,117 @@
+package com.ruoyi.project.production.controller;
+
+import java.util.List;
+
+import com.ruoyi.project.production.controller.vo.SaiQueryVO;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.PutMapping;
+import org.springframework.web.bind.annotation.DeleteMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
+import com.ruoyi.project.production.domain.TSai;
+import com.ruoyi.project.production.service.ITSaiService;
+import com.ruoyi.framework.web.controller.BaseController;
+import com.ruoyi.framework.web.domain.AjaxResult;
+import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.framework.web.page.TableDataInfo;
+
+/**
+ * SAI信息Controller
+ *
+ * @author ruoyi
+ * @date 2023-03-08
+ */
+@RestController
+@RequestMapping("/production/sai")
+public class TSaiController extends BaseController
+{
+    @Autowired
+    private ITSaiService tSaiService;
+
+    /**
+     * 查询SAI信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:list')")
+    @GetMapping("/listByYear")
+    public TableDataInfo listYear(SaiQueryVO tSai)
+    {
+        startPage();
+        List<TSai> list = tSaiService.selectTSaiListByYear(tSai);
+        return getDataTable(list);
+    }
+
+    /**
+     * 查询SAI信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:list')")
+    @GetMapping("/list")
+    public TableDataInfo list(TSai tSai)
+    {
+        startPage();
+        List<TSai> list = tSaiService.selectTSaiList(tSai);
+        return getDataTable(list);
+    }
+
+    /**
+     * 导出SAI信息列表
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:export')")
+    @Log(title = "SAI信息", businessType = BusinessType.EXPORT)
+    @GetMapping("/export")
+    public AjaxResult export(TSai tSai)
+    {
+        List<TSai> list = tSaiService.selectTSaiList(tSai);
+        ExcelUtil<TSai> util = new ExcelUtil<TSai>(TSai.class);
+        return util.exportExcel(list, "sai");
+    }
+
+    /**
+     * 获取SAI信息详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:query')")
+    @GetMapping(value = "/{saiId}")
+    public AjaxResult getInfo(@PathVariable("saiId") Long saiId)
+    {
+        return AjaxResult.success(tSaiService.selectTSaiById(saiId));
+    }
+
+    /**
+     * 新增SAI信息
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:add')")
+    @Log(title = "SAI信息", businessType = BusinessType.INSERT)
+    @PostMapping
+    public AjaxResult add(@RequestBody TSai tSai)
+    {
+        return toAjax(tSaiService.insertTSai(tSai));
+    }
+
+    /**
+     * 修改SAI信息
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:edit')")
+    @Log(title = "SAI信息", businessType = BusinessType.UPDATE)
+    @PutMapping
+    public AjaxResult edit(@RequestBody TSai tSai)
+    {
+        return toAjax(tSaiService.updateTSai(tSai));
+    }
+
+    /**
+     * 删除SAI信息
+     */
+    @PreAuthorize("@ss.hasPermi('production:sai:remove')")
+    @Log(title = "SAI信息", businessType = BusinessType.DELETE)
+	@DeleteMapping("/{saiIds}")
+    public AjaxResult remove(@PathVariable Long[] saiIds)
+    {
+        return toAjax(tSaiService.deleteTSaiByIds(saiIds));
+    }
+}

+ 194 - 0
master/src/main/java/com/ruoyi/project/production/controller/vo/SaiQueryVO.java

@@ -0,0 +1,194 @@
+package com.ruoyi.project.production.controller.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+import java.util.Date;
+
+/**
+ * @author Wang Zi Wen
+ * @email wangggziwen@163.com
+ * @date 2023/03/08 13:50:50
+ */
+public class SaiQueryVO extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @Excel(name = "主键")
+    private Long saiId;
+
+    /** 检查的装置/设施 */
+    @Excel(name = "检查的装置/设施")
+    private String plantId;
+
+    /** 检查日期/时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    @Excel(name = "检查日期/时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date inspectionDate;
+
+    /** 识别出的安全问题 */
+    @Excel(name = "识别出的安全问题")
+    private String dificiency;
+
+    /** 级别 */
+    @Excel(name = "级别")
+    private Long saiLevel;
+
+    /** 类别 */
+    @Excel(name = "类别")
+    private String category;
+
+    /** 采取或要采取的措施 */
+    @Excel(name = "采取或要采取的措施")
+    private String actions;
+
+    /** 用户 */
+    @Excel(name = "用户")
+    private String userDept;
+
+    /** 数据来源 */
+    @Excel(name = "数据来源")
+    private String source;
+
+    /** 删除状态 */
+    private String delFlag;
+
+    /** 部门编号 */
+    private Long deptId;
+
+    /* 年份 */
+    private int saiYear;
+
+    public void setSaiId(Long saiId)
+    {
+        this.saiId = saiId;
+    }
+
+    public Long getSaiId()
+    {
+        return saiId;
+    }
+    public void setPlantId(String plantId)
+    {
+        this.plantId = plantId;
+    }
+
+    public String getPlantId()
+    {
+        return plantId;
+    }
+    public void setInspectionDate(Date inspectionDate)
+    {
+        this.inspectionDate = inspectionDate;
+    }
+
+    public Date getInspectionDate()
+    {
+        return inspectionDate;
+    }
+
+    public String getDificiency()
+    {
+        return dificiency;
+    }
+    public void setSaiLevel(Long saiLevel)
+    {
+        this.saiLevel = saiLevel;
+    }
+
+    public Long getSaiLevel()
+    {
+        return saiLevel;
+    }
+    public void setCategory(String category)
+    {
+        this.category = category;
+    }
+
+    public String getCategory()
+    {
+        return category;
+    }
+    public void setActions(String actions)
+    {
+        this.actions = actions;
+    }
+
+    public String getActions()
+    {
+        return actions;
+    }
+    public void setUserDept(String userDept)
+    {
+        this.userDept = userDept;
+    }
+
+    public String getUserDept()
+    {
+        return userDept;
+    }
+    public void setSource(String source)
+    {
+        this.source = source;
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag()
+    {
+        return delFlag;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public void setDificiency(String dificiency) {
+        this.dificiency = dificiency;
+    }
+
+    public int getSaiYear() {
+        return saiYear;
+    }
+
+    public void setSaiYear(int saiYear) {
+        this.saiYear = saiYear;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("saiId", getSaiId())
+                .append("plantId", getPlantId())
+                .append("inspectionDate", getInspectionDate())
+                .append("dificiency", getDificiency())
+                .append("saiLevel", getSaiLevel())
+                .append("category", getCategory())
+                .append("actions", getActions())
+                .append("userDept", getUserDept())
+                .append("source", getSource())
+                .append("delFlag", getDelFlag())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("deptId", getDeptId())
+                .append("saiYear", getSaiYear())
+                .toString();
+    }
+}

+ 182 - 0
master/src/main/java/com/ruoyi/project/production/domain/TSai.java

@@ -0,0 +1,182 @@
+package com.ruoyi.project.production.domain;
+
+import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.ruoyi.framework.aspectj.lang.annotation.Excel;
+import com.ruoyi.framework.web.domain.BaseEntity;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.ToStringStyle;
+
+/**
+ * SAI信息对象 t_sai
+ *
+ * @author ruoyi
+ * @date 2023-03-08
+ */
+public class TSai extends BaseEntity
+{
+    private static final long serialVersionUID = 1L;
+
+    /** 主键 */
+    @Excel(name = "主键")
+    private Long saiId;
+
+    /** 检查的装置/设施 */
+    @Excel(name = "检查的装置/设施")
+    private String plantId;
+
+    /** 检查日期/时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd" , timezone = "GMT+8")
+    @Excel(name = "检查日期/时间", width = 30, dateFormat = "yyyy-MM-dd")
+    private Date inspectionDate;
+
+    /** 识别出的安全问题 */
+    @Excel(name = "识别出的安全问题")
+    private String dificiency;
+
+    /** 级别 */
+    @Excel(name = "级别")
+    private Long saiLevel;
+
+    /** 类别 */
+    @Excel(name = "类别")
+    private String category;
+
+    /** 采取或要采取的措施 */
+    @Excel(name = "采取或要采取的措施")
+    private String actions;
+
+    /** 用户 */
+    @Excel(name = "用户")
+    private String userDept;
+
+    /** 数据来源 */
+    @Excel(name = "数据来源")
+    private String source;
+
+    /** 删除状态 */
+    private String delFlag;
+
+    /** 部门编号 */
+    private Long deptId;
+
+    public void setSaiId(Long saiId)
+    {
+        this.saiId = saiId;
+    }
+
+    public Long getSaiId()
+    {
+        return saiId;
+    }
+    public void setPlantId(String plantId)
+    {
+        this.plantId = plantId;
+    }
+
+    public String getPlantId()
+    {
+        return plantId;
+    }
+    public void setInspectionDate(Date inspectionDate)
+    {
+        this.inspectionDate = inspectionDate;
+    }
+
+    public Date getInspectionDate()
+    {
+        return inspectionDate;
+    }
+
+    public String getDificiency()
+    {
+        return dificiency;
+    }
+    public void setSaiLevel(Long saiLevel)
+    {
+        this.saiLevel = saiLevel;
+    }
+
+    public Long getSaiLevel()
+    {
+        return saiLevel;
+    }
+    public void setCategory(String category)
+    {
+        this.category = category;
+    }
+
+    public String getCategory()
+    {
+        return category;
+    }
+    public void setActions(String actions)
+    {
+        this.actions = actions;
+    }
+
+    public String getActions()
+    {
+        return actions;
+    }
+    public void setUserDept(String userDept)
+    {
+        this.userDept = userDept;
+    }
+
+    public String getUserDept()
+    {
+        return userDept;
+    }
+    public void setSource(String source)
+    {
+        this.source = source;
+    }
+
+    public String getSource()
+    {
+        return source;
+    }
+    public void setDelFlag(String delFlag)
+    {
+        this.delFlag = delFlag;
+    }
+
+    public String getDelFlag()
+    {
+        return delFlag;
+    }
+
+    public Long getDeptId() {
+        return deptId;
+    }
+
+    public void setDeptId(Long deptId) {
+        this.deptId = deptId;
+    }
+
+    public void setDificiency(String dificiency) {
+        this.dificiency = dificiency;
+    }
+
+    @Override
+    public String toString() {
+        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
+            .append("saiId", getSaiId())
+            .append("plantId", getPlantId())
+            .append("inspectionDate", getInspectionDate())
+            .append("dificiency", getDificiency())
+            .append("saiLevel", getSaiLevel())
+            .append("category", getCategory())
+            .append("actions", getActions())
+            .append("userDept", getUserDept())
+            .append("source", getSource())
+            .append("delFlag", getDelFlag())
+            .append("createBy", getCreateBy())
+            .append("createTime", getCreateTime())
+            .append("updateBy", getUpdateBy())
+            .append("updateTime", getUpdateTime())
+            .append("deptId", getDeptId())
+            .toString();
+    }
+}

+ 73 - 0
master/src/main/java/com/ruoyi/project/production/mapper/TSaiMapper.java

@@ -0,0 +1,73 @@
+package com.ruoyi.project.production.mapper;
+
+import java.util.List;
+import com.ruoyi.framework.aspectj.lang.annotation.DataScope;
+import com.ruoyi.project.production.controller.vo.SaiQueryVO;
+import com.ruoyi.project.production.domain.TSai;
+
+/**
+ * SAI信息Mapper接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-08
+ */
+public interface TSaiMapper 
+{
+    /**
+     * 查询SAI信息
+     * 
+     * @param saiId SAI信息ID
+     * @return SAI信息
+     */
+    public TSai selectTSaiById(Long saiId);
+
+    /**
+     * 查询SAI信息列表
+     *
+     * @param tSai SAI信息
+     * @return SAI信息集合
+     */
+    @DataScope(deptAlias = "d")
+    public List<TSai> selectTSaiListByYear(SaiQueryVO tSai);
+
+    /**
+     * 查询SAI信息列表
+     * 
+     * @param tSai SAI信息
+     * @return SAI信息集合
+     */
+    @DataScope(deptAlias = "d")
+    public List<TSai> selectTSaiList(TSai tSai);
+
+    /**
+     * 新增SAI信息
+     * 
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    public int insertTSai(TSai tSai);
+
+    /**
+     * 修改SAI信息
+     * 
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    public int updateTSai(TSai tSai);
+
+    /**
+     * 删除SAI信息
+     * 
+     * @param saiId SAI信息ID
+     * @return 结果
+     */
+    public int deleteTSaiById(Long saiId);
+
+    /**
+     * 批量删除SAI信息
+     * 
+     * @param saiIds 需要删除的数据ID
+     * @return 结果
+     */
+    public int deleteTSaiByIds(Long[] saiIds);
+}

+ 71 - 0
master/src/main/java/com/ruoyi/project/production/service/ITSaiService.java

@@ -0,0 +1,71 @@
+package com.ruoyi.project.production.service;
+
+import java.util.List;
+
+import com.ruoyi.project.production.controller.vo.SaiQueryVO;
+import com.ruoyi.project.production.domain.TSai;
+
+/**
+ * SAI信息Service接口
+ * 
+ * @author ruoyi
+ * @date 2023-03-08
+ */
+public interface ITSaiService 
+{
+    /**
+     * 查询SAI信息
+     * 
+     * @param saiId SAI信息ID
+     * @return SAI信息
+     */
+    public TSai selectTSaiById(Long saiId);
+
+    /**
+     * 查询SAI信息列表
+     *
+     * @param tSai SAI信息
+     * @return SAI信息集合
+     */
+    public List<TSai> selectTSaiListByYear(SaiQueryVO tSai);
+
+    /**
+     * 查询SAI信息列表
+     * 
+     * @param tSai SAI信息
+     * @return SAI信息集合
+     */
+    public List<TSai> selectTSaiList(TSai tSai);
+
+    /**
+     * 新增SAI信息
+     * 
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    public int insertTSai(TSai tSai);
+
+    /**
+     * 修改SAI信息
+     * 
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    public int updateTSai(TSai tSai);
+
+    /**
+     * 批量删除SAI信息
+     * 
+     * @param saiIds 需要删除的SAI信息ID
+     * @return 结果
+     */
+    public int deleteTSaiByIds(Long[] saiIds);
+
+    /**
+     * 删除SAI信息信息
+     * 
+     * @param saiId SAI信息ID
+     * @return 结果
+     */
+    public int deleteTSaiById(Long saiId);
+}

+ 109 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TSaiServiceImpl.java

@@ -0,0 +1,109 @@
+package com.ruoyi.project.production.service.impl;
+
+import java.util.List;
+import com.ruoyi.common.utils.DateUtils;
+import com.ruoyi.project.production.controller.vo.SaiQueryVO;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import com.ruoyi.project.production.mapper.TSaiMapper;
+import com.ruoyi.project.production.domain.TSai;
+import com.ruoyi.project.production.service.ITSaiService;
+
+/**
+ * SAI信息Service业务层处理
+ *
+ * @author ruoyi
+ * @date 2023-03-08
+ */
+@Service
+public class TSaiServiceImpl implements ITSaiService
+{
+    @Autowired
+    private TSaiMapper tSaiMapper;
+
+    /**
+     * 查询SAI信息
+     *
+     * @param saiId SAI信息ID
+     * @return SAI信息
+     */
+    @Override
+    public TSai selectTSaiById(Long saiId)
+    {
+        return tSaiMapper.selectTSaiById(saiId);
+    }
+
+    /**
+     * 查询SAI信息列表
+     *
+     * @param tSai SAI信息
+     * @return SAI信息
+     */
+    @Override
+    public List<TSai> selectTSaiListByYear(SaiQueryVO tSai)
+    {
+        return tSaiMapper.selectTSaiListByYear(tSai);
+    }
+
+    /**
+     * 查询SAI信息列表
+     *
+     * @param tSai SAI信息
+     * @return SAI信息
+     */
+    @Override
+    public List<TSai> selectTSaiList(TSai tSai)
+    {
+        return tSaiMapper.selectTSaiList(tSai);
+    }
+
+    /**
+     * 新增SAI信息
+     *
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    @Override
+    public int insertTSai(TSai tSai)
+    {
+        tSai.setCreateTime(DateUtils.getNowDate());
+        return tSaiMapper.insertTSai(tSai);
+    }
+
+    /**
+     * 修改SAI信息
+     *
+     * @param tSai SAI信息
+     * @return 结果
+     */
+    @Override
+    public int updateTSai(TSai tSai)
+    {
+        tSai.setUpdateTime(DateUtils.getNowDate());
+        return tSaiMapper.updateTSai(tSai);
+    }
+
+    /**
+     * 批量删除SAI信息
+     *
+     * @param saiIds 需要删除的SAI信息ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTSaiByIds(Long[] saiIds)
+    {
+        return tSaiMapper.deleteTSaiByIds(saiIds);
+    }
+
+    /**
+     * 删除SAI信息信息
+     *
+     * @param saiId SAI信息ID
+     * @return 结果
+     */
+    @Override
+    public int deleteTSaiById(Long saiId)
+    {
+        return tSaiMapper.deleteTSaiById(saiId);
+    }
+}

+ 134 - 0
master/src/main/resources/mybatis/production/TSaiMapper.xml

@@ -0,0 +1,134 @@
+<?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.ruoyi.project.production.mapper.TSaiMapper">
+    
+    <resultMap type="TSai" id="TSaiResult">
+        <result property="saiId"    column="sai_id"    />
+        <result property="plantId"    column="plant_id"    />
+        <result property="inspectionDate"    column="inspection_date"    />
+        <result property="dificiency"    column="dificiency"    />
+        <result property="saiLevel"    column="sai_level"    />
+        <result property="category"    column="category"    />
+        <result property="actions"    column="actions"    />
+        <result property="userDept"    column="user_dept"    />
+        <result property="source"    column="source"    />
+        <result property="delFlag"    column="del_flag"    />
+        <result property="createBy"    column="create_by"    />
+        <result property="createTime"    column="create_time"    />
+        <result property="updateBy"    column="update_by"    />
+        <result property="updateTime"    column="update_time"    />
+        <result property="deptName" column="dept_name" />
+    </resultMap>
+
+    <sql id="selectTSaiVo">
+        select d.sai_id, d.plant_id, d.inspection_date, d.dificiency, d.sai_level, d.category, d.actions, d.user_dept, d.source, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time ,s.dept_name from t_sai d
+      left join sys_dept s on s.dept_id = d.dept_id
+    </sql>
+
+    <select id="selectTSaiListByYear" parameterType="com.ruoyi.project.production.controller.vo.SaiQueryVO" resultMap="TSaiResult">
+        <include refid="selectTSaiVo"/>
+        <where>
+            <if test="saiYear != null "> and extract(year from inspection_date) = #{saiYear} </if>
+            <if test="source != null  and source != ''"> and source like concat(concat('%', #{source}), '%') </if>
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+
+    <select id="selectTSaiList" parameterType="TSai" resultMap="TSaiResult">
+        <include refid="selectTSaiVo"/>
+        <where>  
+            <if test="saiId != null "> and sai_id = #{saiId}</if>
+            <if test="plantId != null  and plantId != ''"> and plant_id = #{plantId}</if>
+            <if test="inspectionDate != null "> and inspection_date = #{inspectionDate}</if>
+            <if test="dificiency != null  and dificiency != ''"> and dificiency = #{dificiency}</if>
+            <if test="saiLevel != null "> and sai_level = #{saiLevel}</if>
+            <if test="category != null  and category != ''"> and category = #{category}</if>
+            <if test="actions != null  and actions != ''"> and actions = #{actions}</if>
+            <if test="userDept != null  and userDept != ''"> and user_dept = #{userDept}</if>
+            <if test="source != null  and source != ''"> and source = #{source}</if>
+            and d.del_flag = 0
+        </where>
+        <!-- 数据范围过滤 -->
+        ${params.dataScope}
+    </select>
+    
+    <select id="selectTSaiById" parameterType="Long" resultMap="TSaiResult">
+        <include refid="selectTSaiVo"/>
+        where sai_id = #{saiId}
+    </select>
+        
+    <insert id="insertTSai" parameterType="TSai">
+        <selectKey keyProperty="saiId" resultType="long" order="BEFORE">
+            SELECT seq_t_sai.NEXTVAL as saiId FROM DUAL
+        </selectKey>
+        insert into t_sai
+        <trim prefix="(" suffix=")" suffixOverrides=",">
+            <if test="saiId != null">sai_id,</if>
+            <if test="plantId != null">plant_id,</if>
+            <if test="inspectionDate != null">inspection_date,</if>
+            <if test="dificiency != null">dificiency,</if>
+            <if test="saiLevel != null">sai_level,</if>
+            <if test="category != null">category,</if>
+            <if test="actions != null">actions,</if>
+            <if test="userDept != null">user_dept,</if>
+            <if test="source != null">source,</if>
+            <if test="delFlag != null">del_flag,</if>
+            <if test="createBy != null">create_by,</if>
+            <if test="createTime != null">create_time,</if>
+            <if test="updateBy != null">update_by,</if>
+            <if test="updateTime != null">update_time,</if>
+         </trim>
+        <trim prefix="values (" suffix=")" suffixOverrides=",">
+            <if test="saiId != null">#{saiId},</if>
+            <if test="plantId != null">#{plantId},</if>
+            <if test="inspectionDate != null">#{inspectionDate},</if>
+            <if test="dificiency != null">#{dificiency},</if>
+            <if test="saiLevel != null">#{saiLevel},</if>
+            <if test="category != null">#{category},</if>
+            <if test="actions != null">#{actions},</if>
+            <if test="userDept != null">#{userDept},</if>
+            <if test="source != null">#{source},</if>
+            <if test="delFlag != null">#{delFlag},</if>
+            <if test="createBy != null">#{createBy},</if>
+            <if test="createTime != null">#{createTime},</if>
+            <if test="updateBy != null">#{updateBy},</if>
+            <if test="updateTime != null">#{updateTime},</if>
+         </trim>
+    </insert>
+
+    <update id="updateTSai" parameterType="TSai">
+        update t_sai
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="plantId != null">plant_id = #{plantId},</if>
+            <if test="inspectionDate != null">inspection_date = #{inspectionDate},</if>
+            <if test="dificiency != null">dificiency = #{dificiency},</if>
+            <if test="saiLevel != null">sai_level = #{saiLevel},</if>
+            <if test="category != null">category = #{category},</if>
+            <if test="actions != null">actions = #{actions},</if>
+            <if test="userDept != null">user_dept = #{userDept},</if>
+            <if test="source != null">source = #{source},</if>
+            <if test="delFlag != null">del_flag = #{delFlag},</if>
+            <if test="createBy != null">create_by = #{createBy},</if>
+            <if test="createTime != null">create_time = #{createTime},</if>
+            <if test="updateBy != null">update_by = #{updateBy},</if>
+            <if test="updateTime != null">update_time = #{updateTime},</if>
+        </trim>
+        where sai_id = #{saiId}
+    </update>
+
+    <update id="deleteTSaiById" parameterType="Long">
+        update t_sai set del_flag = 2 where sai_id = #{saiId}
+    </update>
+
+    <update id="deleteTSaiByIds" parameterType="String">
+        update t_sai set del_flag = 2 where sai_id in
+        <foreach item="saiId" collection="array" open="(" separator="," close=")">
+            #{saiId}
+        </foreach>
+    </update>
+    
+</mapper>

+ 62 - 0
ui/src/api/production/sai.js

@@ -0,0 +1,62 @@
+import request from '@/utils/request'
+
+// 查询SAI信息列表
+export function listSaiByYear(query) {
+  return request({
+    url: '/production/sai/listByYear',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询SAI信息列表
+export function listSai(query) {
+  return request({
+    url: '/production/sai/list',
+    method: 'get',
+    params: query
+  })
+}
+
+// 查询SAI信息详细
+export function getSai(saiId) {
+  return request({
+    url: '/production/sai/' + saiId,
+    method: 'get'
+  })
+}
+
+// 新增SAI信息
+export function addSai(data) {
+  return request({
+    url: '/production/sai',
+    method: 'post',
+    data: data
+  })
+}
+
+// 修改SAI信息
+export function updateSai(data) {
+  return request({
+    url: '/production/sai',
+    method: 'put',
+    data: data
+  })
+}
+
+// 删除SAI信息
+export function delSai(saiId) {
+  return request({
+    url: '/production/sai/' + saiId,
+    method: 'delete'
+  })
+}
+
+// 导出SAI信息
+export function exportSai(query) {
+  return request({
+    url: '/production/sai/export',
+    method: 'get',
+    params: query
+  })
+}

+ 440 - 0
ui/src/views/production/sai/index.vue

@@ -0,0 +1,440 @@
+<template>
+  <div class="app-container">
+    <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
+      <el-form-item label="年份" prop="saiYear">
+        <el-date-picker clearable size="small" style="width: 200px"
+          v-model="queryParams.saiYear"
+          type="year"
+          value-format="yyyy"
+          placeholder="选择年份"
+          @change="handleQuery">
+        </el-date-picker>
+      </el-form-item>
+      <el-form-item label="数据来源" prop="source">
+        <el-input
+          v-model="queryParams.source"
+          placeholder="请输入数据来源"
+          clearable
+          size="small"
+          @keyup.enter.native="handleQuery"
+        />
+      </el-form-item>
+      <el-form-item>
+        <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
+        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
+      </el-form-item>
+    </el-form>
+
+    <el-row :gutter="10" class="mb8">
+      <el-col :span="1.5">
+        <el-button
+          type="primary"
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['production:sai:add']"
+        >新增</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="success"
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['production:sai:edit']"
+        >修改</el-button>
+      </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="danger"
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['production:sai:remove']"
+        >删除</el-button>
+      </el-col>
+        <el-col :span="1.5">
+            <el-button
+                    type="info"
+                    icon="el-icon-upload2"
+                    size="mini"
+                    @click="handleImport"
+                    v-hasPermi="['production:sai:edit']"
+            >导入</el-button>
+        </el-col>
+      <el-col :span="1.5">
+        <el-button
+          type="warning"
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['production:sai:export']"
+        >导出</el-button>
+      </el-col>
+	  <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
+    </el-row>
+
+    <el-table v-loading="loading" :data="saiList" @selection-change="handleSelectionChange" :height="clientHeight" border>
+      <el-table-column type="selection" width="55" align="center" />
+      <el-table-column label="检查的装置/设施" align="center" prop="plantId" :show-overflow-tooltip="true"/>
+      <el-table-column label="检查日期/时间" align="center" prop="inspectionDate" width="100">
+        <template slot-scope="scope">
+          <span>{{ parseTime(scope.row.inspectionDate, '{y}-{m}-{d}') }}</span>
+        </template>
+      </el-table-column>
+      <el-table-column label="识别出的安全问题" align="center" prop="dificiency" :show-overflow-tooltip="true"/>
+      <el-table-column label="级别" align="center" prop="saiLevel" :show-overflow-tooltip="true"/>
+      <el-table-column label="类别" align="center" prop="category" :show-overflow-tooltip="true"/>
+      <el-table-column label="采取或要采取的措施" align="center" prop="actions" :show-overflow-tooltip="true"/>
+      <el-table-column label="用户" align="center" prop="userDept" :show-overflow-tooltip="true"/>
+      <el-table-column label="数据来源" align="center" prop="source" :show-overflow-tooltip="true"/>
+      <el-table-column label="操作" align="center" fixed="right" width="120" class-name="small-padding fixed-width">
+        <template slot-scope="scope">
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['production:sai:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['production:sai:remove']"
+          >删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
+
+    <!-- 添加或修改SAI信息对话框 -->
+    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
+      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
+        <el-form-item label="检查的装置/设施" prop="plantId">
+          <el-input v-model="form.plantId" placeholder="请输入检查的装置/设施" />
+        </el-form-item>
+        <el-form-item label="检查日期/时间" prop="inspectionDate">
+          <el-date-picker clearable size="small" style="width: 200px"
+            v-model="form.inspectionDate"
+            type="date"
+            value-format="yyyy-MM-dd"
+            placeholder="选择检查日期/时间">
+          </el-date-picker>
+        </el-form-item>
+        <el-form-item label="识别出的安全问题" prop="dificiency">
+          <el-input v-model="form.dificiency" placeholder="请输入识别出的安全问题" />
+        </el-form-item>
+        <el-form-item label="级别" prop="saiLevel">
+          <el-input v-model="form.saiLevel" placeholder="请输入级别" />
+        </el-form-item>
+        <el-form-item label="类别" prop="category">
+          <el-input v-model="form.category" placeholder="请输入类别" />
+        </el-form-item>
+        <el-form-item label="采取或要采取的措施" prop="actions">
+          <el-input v-model="form.actions" placeholder="请输入采取或要采取的措施" />
+        </el-form-item>
+        <el-form-item label="用户" prop="userDept">
+          <el-input v-model="form.userDept" placeholder="请输入用户" />
+        </el-form-item>
+        <el-form-item label="数据来源" prop="source">
+          <el-input v-model="form.source" placeholder="请输入数据来源" />
+        </el-form-item>
+          <el-form-item label="归属部门" prop="deptId">
+              <treeselect v-model="form.deptId" :options="deptOptions" :show-count="true" placeholder="请选择归属部门" />
+          </el-form-item>
+      </el-form>
+      <div slot="footer" class="dialog-footer">
+        <el-button type="primary" @click="submitForm">确 定</el-button>
+        <el-button @click="cancel">取 消</el-button>
+      </div>
+    </el-dialog>
+
+    <!-- 用户导入对话框 -->
+    <el-dialog :title="upload.title" :visible.sync="upload.open" width="400px" append-to-body>
+          <el-upload
+                  ref="upload"
+                  :limit="1"
+                  accept=".xlsx, .xls"
+                  :headers="upload.headers"
+                  :action="upload.url + '?updateSupport=' + upload.updateSupport"
+                  :disabled="upload.isUploading"
+                  :on-progress="handleFileUploadProgress"
+                  :on-success="handleFileSuccess"
+                  :auto-upload="false"
+                  drag
+          >
+              <i class="el-icon-upload"></i>
+              <div class="el-upload__text">
+                  将文件拖到此处,或
+                  <em>点击上传</em>
+              </div>
+              <div class="el-upload__tip" slot="tip">
+                  <!--<el-checkbox v-model="upload.updateSupport" />是否更新已经存在的用户数据-->
+                  <el-link type="info" style="font-size:12px" @click="importTemplate">下载模板</el-link>
+              </div>
+              <div class="el-upload__tip" style="color:red" slot="tip">提示:仅允许导入“xls”或“xlsx”格式文件!</div>
+          </el-upload>
+          <div slot="footer" class="dialog-footer">
+              <el-button type="primary" @click="submitFileForm">确 定</el-button>
+              <el-button @click="upload.open = false">取 消</el-button>
+          </div>
+      </el-dialog>
+  </div>
+</template>
+
+<script>
+import { listSai, listSaiByYear, getSai, delSai, addSai, updateSai, exportSai, importTemplate} from "@/api/production/sai";
+import { treeselect } from "@/api/system/dept";
+import { getToken } from "@/utils/auth";
+import Treeselect from "@riophae/vue-treeselect";
+import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+
+export default {
+  name: "Sai",
+  components: { Treeselect },
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // SAI信息表格数据
+      saiList: [],
+      // 弹出层标题
+      title: "",
+      // 部门树选项
+      deptOptions: undefined,
+      clientHeight:300,
+      // 是否显示弹出层
+      open: false,
+        // 用户导入参数
+        upload: {
+            // 是否显示弹出层(用户导入)
+            open: false,
+            // 弹出层标题(用户导入)
+            title: "",
+            // 是否禁用上传
+            isUploading: false,
+            // 是否更新已经存在的用户数据
+            updateSupport: 0,
+            // 设置上传的请求头部
+            headers: { Authorization: "Bearer " + getToken() },
+            // 上传的地址
+            url: process.env.VUE_APP_BASE_API + "/production/sai/importData"
+        },
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 20,
+        saiId: null,
+        plantId: null,
+        inspectionDate: null,
+        dificiency: null,
+        saiLevel: null,
+        category: null,
+        actions: null,
+        userDept: null,
+        source: null,
+        saiYear: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+      }
+    };
+  },
+  watch: {
+        // 根据名称筛选部门树
+        deptName(val) {
+            this.$refs.tree.filter(val);
+        }
+   },
+  created() {
+      //设置表格高度对应屏幕高度
+      this.$nextTick(() => {
+          this.clientHeight = document.body.clientHeight -250
+      })
+    // this.getList();
+    this.getListByYear();
+    this.getTreeselect();
+  },
+  methods: {
+    /** 查询SAI信息列表 */
+    getListByYear() {
+      this.loading = true;
+      console.log(this.queryParams);
+      listSaiByYear(this.queryParams).then(response => {
+        this.saiList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    getList() {
+      this.loading = true;
+      console.log(this.queryParams);
+      listSai(this.queryParams).then(response => {
+        this.saiList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+     /** 查询部门下拉树结构 */
+     getTreeselect() {
+          treeselect().then(response => {
+              this.deptOptions = response.data;
+          });
+     },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        saiId: null,
+        plantId: null,
+        inspectionDate: null,
+        dificiency: null,
+        saiLevel: null,
+        category: null,
+        actions: null,
+        userDept: null,
+        source: null,
+        delFlag: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null
+      };
+      this.resetForm("form");
+    },
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
+      this.getList();
+    },
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.saiId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加SAI信息";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const saiId = row.saiId || this.ids
+      getSai(saiId).then(response => {
+        this.form = response.data;
+        this.open = true;
+        this.title = "修改SAI信息";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.saiId != null) {
+            updateSai(this.form).then(response => {
+              this.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addSai(this.form).then(response => {
+              this.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
+          }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const saiIds = row.saiId || this.ids;
+      this.$confirm('是否确认删除?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return delSai(saiIds);
+        }).then(() => {
+          this.getList();
+          this.msgSuccess("删除成功");
+        })
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      const queryParams = this.queryParams;
+      this.$confirm('是否确认导出所有SAI信息数据项?', "警告", {
+          confirmButtonText: "确定",
+          cancelButtonText: "取消",
+          type: "warning"
+        }).then(function() {
+          return exportSai(queryParams);
+        }).then(response => {
+          this.download(response.msg);
+        })
+    },
+      /** 导入按钮操作 */
+      handleImport() {
+          this.upload.title = "用户导入";
+          this.upload.open = true;
+      },
+      /** 下载模板操作 */
+      importTemplate() {
+          importTemplate().then(response => {
+              this.download(response.msg);
+          });
+      },
+      // 文件上传中处理
+      handleFileUploadProgress(event, file, fileList) {
+          this.upload.isUploading = true;
+      },
+      // 文件上传成功处理
+      handleFileSuccess(response, file, fileList) {
+          this.upload.open = false;
+          this.upload.isUploading = false;
+          this.$refs.upload.clearFiles();
+          this.$alert(response.msg, "导入结果", { dangerouslyUseHTMLString: true });
+          this.getList();
+      },
+      // 提交上传文件
+      submitFileForm() {
+          this.$refs.upload.submit();
+      }
+  }
+};
+</script>