Răsfoiți Sursa

设备表需要实时同步 表重构

王苗苗 3 săptămâni în urmă
părinte
comite
8951a428ac

+ 0 - 104
ruoyi-admin/src/main/java/com/ruoyi/web/controller/business/TDeviceController.java

@@ -1,104 +0,0 @@
-package com.ruoyi.web.controller.business;
-
-import java.util.List;
-import javax.servlet.http.HttpServletResponse;
-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.common.annotation.Log;
-import com.ruoyi.common.core.controller.BaseController;
-import com.ruoyi.common.core.domain.AjaxResult;
-import com.ruoyi.common.enums.BusinessType;
-import com.ruoyi.business.domain.TDevice;
-import com.ruoyi.business.service.ITDeviceService;
-import com.ruoyi.common.utils.poi.ExcelUtil;
-import com.ruoyi.common.core.page.TableDataInfo;
-
-/**
- * 机构设备Controller
- * 
- * @author ruoyi
- * @date 2025-03-06
- */
-@RestController
-@RequestMapping("/business/device")
-public class TDeviceController extends BaseController
-{
-    @Autowired
-    private ITDeviceService tDeviceService;
-
-    /**
-     * 查询机构设备列表
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:list')")
-    @GetMapping("/list")
-    public TableDataInfo list(TDevice tDevice)
-    {
-        startPage();
-        List<TDevice> list = tDeviceService.selectTDeviceList(tDevice);
-        return getDataTable(list);
-    }
-
-    /**
-     * 导出机构设备列表
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:export')")
-    @Log(title = "机构设备", businessType = BusinessType.EXPORT)
-    @PostMapping("/export")
-    public void export(HttpServletResponse response, TDevice tDevice)
-    {
-        List<TDevice> list = tDeviceService.selectTDeviceList(tDevice);
-        ExcelUtil<TDevice> util = new ExcelUtil<TDevice>(TDevice.class);
-        util.exportExcel(response, list, "机构设备数据");
-    }
-
-    /**
-     * 获取机构设备详细信息
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:query')")
-    @GetMapping(value = "/{id}")
-    public AjaxResult getInfo(@PathVariable("id") Long id)
-    {
-        return success(tDeviceService.selectTDeviceById(id));
-    }
-
-    /**
-     * 新增机构设备
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:add')")
-    @Log(title = "机构设备", businessType = BusinessType.INSERT)
-    @PostMapping
-    public AjaxResult add(@RequestBody TDevice tDevice)
-    {
-        return toAjax(tDeviceService.insertTDevice(tDevice));
-    }
-
-    /**
-     * 修改机构设备
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:edit')")
-    @Log(title = "机构设备", businessType = BusinessType.UPDATE)
-    @PutMapping
-    public AjaxResult edit(@RequestBody TDevice tDevice)
-    {
-        return toAjax(tDeviceService.updateTDevice(tDevice));
-    }
-
-    /**
-     * 删除机构设备
-     */
-//    @PreAuthorize("@ss.hasPermi('business:device:remove')")
-    @Log(title = "机构设备", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{ids}")
-    public AjaxResult remove(@PathVariable Long[] ids)
-    {
-        return toAjax(tDeviceService.deleteTDeviceByIds(ids));
-    }
-}

+ 0 - 68
ruoyi-system/src/main/java/com/ruoyi/business/domain/TDevice.java

@@ -1,68 +0,0 @@
-package com.ruoyi.business.domain;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
-import com.ruoyi.common.annotation.Excel;
-import com.ruoyi.common.core.domain.BaseEntity;
-
-/**
- * 机构设备对象 t_device
- * 
- * @author ruoyi
- * @date 2025-03-06
- */
-@Builder
-@Data
-@AllArgsConstructor
-@NoArgsConstructor
-public class TDevice extends BaseEntity
-{
-    private static final long serialVersionUID = 1L;
-
-    /** 主键 */
-    private Long id;
-
-    /** 设备名称 */
-    @Excel(name = "设备名称")
-    private String name;
-
-    /** 设备SN */
-    @Excel(name = "设备SN")
-    private String sn;
-
-    /** 设备型号 */
-    @Excel(name = "设备型号")
-    private String model;
-
-    /** 所属水厂ID */
-    @Excel(name = "所属水厂ID")
-    private Long organizationId;
-
-    /** 设备用途(1:化验室,2:连续检测) */
-    @Excel(name = "设备用途(1:化验室,2:连续检测)")
-    private Integer usage;
-
-    /** 使用状态(0:使用;1:停用) */
-    @Excel(name = "使用状态", readConverterExp = "0=:使用;1:停用")
-    private Integer status;
-
-    /** 维护人员 */
-    @Excel(name = "维护人员")
-    private String maintainer;
-
-    /** 维护人员电话 */
-    @Excel(name = "维护人员电话")
-    private String maintainerPhone;
-
-    /** 删除标志(0代表存在 2代表删除) */
-    private Integer delFlag;
-
-    /** 乐观锁 */
-    @Excel(name = "乐观锁")
-    private Long revision;
-
-}

+ 0 - 61
ruoyi-system/src/main/java/com/ruoyi/business/mapper/TDeviceMapper.java

@@ -1,61 +0,0 @@
-package com.ruoyi.business.mapper;
-
-import java.util.List;
-import com.ruoyi.business.domain.TDevice;
-
-/**
- * 机构设备Mapper接口
- * 
- * @author ruoyi
- * @date 2025-03-06
- */
-public interface TDeviceMapper 
-{
-    /**
-     * 查询机构设备
-     * 
-     * @param id 机构设备主键
-     * @return 机构设备
-     */
-    public TDevice selectTDeviceById(Long id);
-
-    /**
-     * 查询机构设备列表
-     * 
-     * @param tDevice 机构设备
-     * @return 机构设备集合
-     */
-    public List<TDevice> selectTDeviceList(TDevice tDevice);
-
-    /**
-     * 新增机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    public int insertTDevice(TDevice tDevice);
-
-    /**
-     * 修改机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    public int updateTDevice(TDevice tDevice);
-
-    /**
-     * 删除机构设备
-     * 
-     * @param id 机构设备主键
-     * @return 结果
-     */
-    public int deleteTDeviceById(Long id);
-
-    /**
-     * 批量删除机构设备
-     * 
-     * @param ids 需要删除的数据主键集合
-     * @return 结果
-     */
-    public int deleteTDeviceByIds(Long[] ids);
-}

+ 0 - 61
ruoyi-system/src/main/java/com/ruoyi/business/service/ITDeviceService.java

@@ -1,61 +0,0 @@
-package com.ruoyi.business.service;
-
-import java.util.List;
-import com.ruoyi.business.domain.TDevice;
-
-/**
- * 机构设备Service接口
- * 
- * @author ruoyi
- * @date 2025-03-06
- */
-public interface ITDeviceService 
-{
-    /**
-     * 查询机构设备
-     * 
-     * @param id 机构设备主键
-     * @return 机构设备
-     */
-    public TDevice selectTDeviceById(Long id);
-
-    /**
-     * 查询机构设备列表
-     * 
-     * @param tDevice 机构设备
-     * @return 机构设备集合
-     */
-    public List<TDevice> selectTDeviceList(TDevice tDevice);
-
-    /**
-     * 新增机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    public int insertTDevice(TDevice tDevice);
-
-    /**
-     * 修改机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    public int updateTDevice(TDevice tDevice);
-
-    /**
-     * 批量删除机构设备
-     * 
-     * @param ids 需要删除的机构设备主键集合
-     * @return 结果
-     */
-    public int deleteTDeviceByIds(Long[] ids);
-
-    /**
-     * 删除机构设备信息
-     * 
-     * @param id 机构设备主键
-     * @return 结果
-     */
-    public int deleteTDeviceById(Long id);
-}

+ 0 - 96
ruoyi-system/src/main/java/com/ruoyi/business/service/impl/TDeviceServiceImpl.java

@@ -1,96 +0,0 @@
-package com.ruoyi.business.service.impl;
-
-import java.util.List;
-import com.ruoyi.common.utils.DateUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import com.ruoyi.business.mapper.TDeviceMapper;
-import com.ruoyi.business.domain.TDevice;
-import com.ruoyi.business.service.ITDeviceService;
-
-/**
- * 机构设备Service业务层处理
- * 
- * @author ruoyi
- * @date 2025-03-06
- */
-@Service
-public class TDeviceServiceImpl implements ITDeviceService 
-{
-    @Autowired
-    private TDeviceMapper tDeviceMapper;
-
-    /**
-     * 查询机构设备
-     * 
-     * @param id 机构设备主键
-     * @return 机构设备
-     */
-    @Override
-    public TDevice selectTDeviceById(Long id)
-    {
-        return tDeviceMapper.selectTDeviceById(id);
-    }
-
-    /**
-     * 查询机构设备列表
-     * 
-     * @param tDevice 机构设备
-     * @return 机构设备
-     */
-    @Override
-    public List<TDevice> selectTDeviceList(TDevice tDevice)
-    {
-        return tDeviceMapper.selectTDeviceList(tDevice);
-    }
-
-    /**
-     * 新增机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    @Override
-    public int insertTDevice(TDevice tDevice)
-    {
-        tDevice.setCreateTime(DateUtils.getNowDate());
-        return tDeviceMapper.insertTDevice(tDevice);
-    }
-
-    /**
-     * 修改机构设备
-     * 
-     * @param tDevice 机构设备
-     * @return 结果
-     */
-    @Override
-    public int updateTDevice(TDevice tDevice)
-    {
-        tDevice.setUpdateTime(DateUtils.getNowDate());
-        return tDeviceMapper.updateTDevice(tDevice);
-    }
-
-    /**
-     * 批量删除机构设备
-     * 
-     * @param ids 需要删除的机构设备主键
-     * @return 结果
-     */
-    @Override
-    public int deleteTDeviceByIds(Long[] ids)
-    {
-        return tDeviceMapper.deleteTDeviceByIds(ids);
-    }
-
-    /**
-     * 删除机构设备信息
-     * 
-     * @param id 机构设备主键
-     * @return 结果
-     */
-    @Override
-    public int deleteTDeviceById(Long id)
-    {
-        return tDeviceMapper.deleteTDeviceById(id);
-    }
-}

+ 0 - 120
ruoyi-system/src/main/resources/mapper/business/TDeviceMapper.xml

@@ -1,120 +0,0 @@
-<?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.business.mapper.TDeviceMapper">
-    
-    <resultMap type="TDevice" id="TDeviceResult">
-        <result property="id"    column="id"    />
-        <result property="name"    column="name"    />
-        <result property="sn"    column="sn"    />
-        <result property="model"    column="model"    />
-        <result property="organizationId"    column="organization_id"    />
-        <result property="usage"    column="usage"    />
-        <result property="status"    column="status"    />
-        <result property="maintainer"    column="maintainer"    />
-        <result property="maintainerPhone"    column="maintainer_phone"    />
-        <result property="delFlag"    column="del_flag"    />
-        <result property="revision"    column="revision"    />
-        <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="remark"    column="remark"    />
-    </resultMap>
-
-    <sql id="selectTDeviceVo">
-        select id, name, sn, model, organization_id, usage, status, maintainer, maintainer_phone, del_flag, revision, create_by, create_time, update_by, update_time, remark from t_device
-    </sql>
-
-    <select id="selectTDeviceList" parameterType="TDevice" resultMap="TDeviceResult">
-        <include refid="selectTDeviceVo"/>
-        <where>  
-            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
-            <if test="sn != null  and sn != ''"> and sn like concat('%', #{sn}, '%')</if>
-            <if test="model != null  and model != ''"> and model = #{model}</if>
-            <if test="organizationId != null "> and organization_id = #{organizationId}</if>
-            <if test="usage != null "> and usage = #{usage}</if>
-            <if test="status != null "> and status = #{status}</if>
-            <if test="maintainer != null  and maintainer != ''"> and maintainer = #{maintainer}</if>
-            <if test="maintainerPhone != null  and maintainerPhone != ''"> and maintainer_phone = #{maintainerPhone}</if>
-            <if test="revision != null "> and revision = #{revision}</if>
-        </where>
-    </select>
-    
-    <select id="selectTDeviceById" parameterType="Long" resultMap="TDeviceResult">
-        <include refid="selectTDeviceVo"/>
-        where id = #{id}
-    </select>
-
-    <insert id="insertTDevice" parameterType="TDevice" useGeneratedKeys="true" keyProperty="id">
-        insert into t_device
-        <trim prefix="(" suffix=")" suffixOverrides=",">
-            <if test="name != null">name,</if>
-            <if test="sn != null">sn,</if>
-            <if test="model != null">model,</if>
-            <if test="organizationId != null">organization_id,</if>
-            <if test="usage != null">usage,</if>
-            <if test="status != null">status,</if>
-            <if test="maintainer != null">maintainer,</if>
-            <if test="maintainerPhone != null">maintainer_phone,</if>
-            <if test="delFlag != null">del_flag,</if>
-            <if test="revision != null">revision,</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>
-            <if test="remark != null">remark,</if>
-         </trim>
-        <trim prefix="values (" suffix=")" suffixOverrides=",">
-            <if test="name != null">#{name},</if>
-            <if test="sn != null">#{sn},</if>
-            <if test="model != null">#{model},</if>
-            <if test="organizationId != null">#{organizationId},</if>
-            <if test="usage != null">#{usage},</if>
-            <if test="status != null">#{status},</if>
-            <if test="maintainer != null">#{maintainer},</if>
-            <if test="maintainerPhone != null">#{maintainerPhone},</if>
-            <if test="delFlag != null">#{delFlag},</if>
-            <if test="revision != null">#{revision},</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>
-            <if test="remark != null">#{remark},</if>
-         </trim>
-    </insert>
-
-    <update id="updateTDevice" parameterType="TDevice">
-        update t_device
-        <trim prefix="SET" suffixOverrides=",">
-            <if test="name != null">name = #{name},</if>
-            <if test="sn != null">sn = #{sn},</if>
-            <if test="model != null">model = #{model},</if>
-            <if test="organizationId != null">organization_id = #{organizationId},</if>
-            <if test="usage != null">usage = #{usage},</if>
-            <if test="status != null">status = #{status},</if>
-            <if test="maintainer != null">maintainer = #{maintainer},</if>
-            <if test="maintainerPhone != null">maintainer_phone = #{maintainerPhone},</if>
-            <if test="delFlag != null">del_flag = #{delFlag},</if>
-            <if test="revision != null">revision = #{revision},</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>
-            <if test="remark != null">remark = #{remark},</if>
-        </trim>
-        where id = #{id}
-    </update>
-
-    <delete id="deleteTDeviceById" parameterType="Long">
-        delete from t_device where id = #{id}
-    </delete>
-
-    <delete id="deleteTDeviceByIds" parameterType="String">
-        delete from t_device where id in 
-        <foreach item="id" collection="array" open="(" separator="," close=")">
-            #{id}
-        </foreach>
-    </delete>
-</mapper>

+ 8 - 0
sql/business.sql

@@ -271,3 +271,11 @@ CREATE TABLE `z_assay_result` (
                                   KEY `I_PanguSyncSourceTimestamp` (`C_PanguSyncSourceTimestamp`)
 ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci COMMENT='化验结果明细';
 
+#2025年03月07日10:39:58 设备使用原来的表 并在基础上加上新字段
+ALTER TABLE `smart-robot`.`biz_device`
+    ADD COLUMN `del_flag` tinyint NULL COMMENT '删除标志(0代表存在 2代表删除)' AFTER `type`,
+ADD COLUMN `remark` varchar(255) NULL COMMENT '备注' AFTER `del_flag`;
+
+ALTER TABLE `smart-robot`.`biz_device`
+    MODIFY COLUMN `del_flag` tinyint NULL DEFAULT 0 COMMENT '删除标志(0代表存在 2代表删除)' AFTER `type`;
+