新曾业务bean和相关数据持久化,controller restful 接口

This commit is contained in:
2026-01-04 14:35:22 +08:00
parent 8053508565
commit c3a9de112d
22 changed files with 542 additions and 53 deletions

View File

@@ -95,3 +95,34 @@ openapi:
description: 本地开发环境
- url: http://47.116.126.33:9090 # 测试环境地址
description: 测试环境
# Spring Boot 日志核心配置
logging:
# 1. 全局日志级别(可细化到包/类)
level:
root: INFO # 根日志级别(默认)
com.rczn.rcznautoplc: DEBUG # 自定义包级别(调试业务代码)
org.springframework: INFO # Spring 框架日志级别(减少冗余)
com.zaxxer.hikari: ERROR # 数据库连接池日志级别(仅输出错误)
mybatis: DEBUG # MyBatis SQL 日志级别(输出执行的 SQL
# 2. 日志输出配置(控制台 + 文件)
pattern:
# console: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n" # 控制台格式
file: "%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n" # 文件格式
# 3. 文件输出配置
file:
name: ./logs/rczn-autoplc.log # 日志文件路径(相对路径/绝对路径)
max-size: 10MB # 单个日志文件大小上限(超过则分割)
max-history: 30 # 日志文件保留天数
total-size-cap: 1GB # 日志文件总大小上限
clean-history-on-start: false # 启动时是否清理历史日志
# 4. 日志分割(按大小/时间Logback 原生支持)
logback:
rollingpolicy:
file-name-pattern: ./logs/rczn-autoplc-%d{yyyy-MM-dd}.%i.log # 分割后的文件名(%i 是序号,处理同天多文件)
max-file-size: 100MB # 单个文件大小(覆盖上面的 max-size
max-history: 30 # 保留天数
total-size-cap: 1GB # 总大小

View File

@@ -69,6 +69,12 @@
<version>7.11.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-common</artifactId>
<version>2.3.0</version>
<scope>compile</scope>
</dependency>
<!-- 这里可以添加PLC通信相关的依赖 -->
<!-- 例如:

View File

@@ -7,7 +7,9 @@ import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Parameters;
import io.swagger.v3.oas.annotations.enums.ParameterIn;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springdoc.core.annotations.ParameterObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
@@ -142,14 +144,13 @@ public class DevInfoController {
@Operation(summary = "分页查询设备", description = "支持设备名称、型号、IP、状态等多条件过滤默认查询未删除设备")
@Parameters({
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY),
@Parameter(name = "devName", description = "设备名称(可选,模糊查询)", required = false, example = "PLC设备", in = ParameterIn.QUERY),
@Parameter(name = "devModel", description = "设备型号(可选,模糊查询)", required = false, example = "S7-1200", in = ParameterIn.QUERY),
@Parameter(name = "ipAddr", description = "IP地址可选精准查询", required = false, example = "192.168.1.100", in = ParameterIn.QUERY),
@Parameter(name = "status", description = "设备状态可选精准查询0-空闲1-运行4-故障)", required = false, example = "0", in = ParameterIn.QUERY),
@Parameter(name = "protocolType", description = "协议类型(可选,精准查询)", required = false, example = "Modbus", in = ParameterIn.QUERY)
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
// @Parameter(name = "devName", description = "设备名称(可选,模糊查询)", required = false, example = "PLC设备", in = ParameterIn.QUERY),
// @Parameter(name = "devModel", description = "设备型号(可选,模糊查询)", required = false, example = "S7-1200", in = ParameterIn.QUERY)
})
public ResponseEntity<Map<String, Object>> getDevInfoPage(
@ParameterObject // 核心注解:标记该实体类从查询参数取值
@Schema(description = "设备查询条件(可选)") // 补充描述
DevInfo devInfo, // 接收查询条件devName、status等
@RequestParam Integer pageNum,
@RequestParam Integer pageSize) {

View File

@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/devParam")
@Tag(name = "设备参数管理", description = "设备参数增删改查+分页查询接口")
@@ -44,6 +46,24 @@ public class DevParamController {
return Result.success(pageBean);
}
/**
* 根据条件,查询设备参数
*/
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询设备参数", description = "支持设备ID精准查询、参数名称/值模糊查询")
@Parameters({
@Parameter(name = "devId", description = "设备ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY),
@Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY)
})
public Result getDevParamPage(
@RequestParam(required = false) Integer devId,
@RequestParam(required = false) String paramName,
@RequestParam(required = false) String paramValue) {
List<DevParam> pageBean = devParamService.selectList( devId, paramName, paramValue);
return Result.success(pageBean);
}
/**
* 根据ID查询设备参数
*/

View File

@@ -14,9 +14,11 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/flowInfo")
@Tag(name = "流程信息管理", description = "流程信息增删改查+分页查询接口")
@Tag(name = "标准流程管理", description = "流程信息增删改查+分页查询接口")
public class FlowInfoController {
@Autowired
@@ -42,6 +44,21 @@ public class FlowInfoController {
return Result.success(pageBean);
}
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询流程信息", description = "支持流程排序精准查询、流程名称/岛屿ID列表模糊查询")
@Parameters({
@Parameter(name = "flowIndex", description = "流程排序(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "flowName", description = "流程名称(可选,模糊查询)", required = false, example = "检测流程", in = ParameterIn.QUERY),
@Parameter(name = "islandIdList", description = "岛屿ID列表可选模糊查询", required = false, example = "1,2,3", in = ParameterIn.QUERY)
})
public Result getFlowInfoList(
@RequestParam(required = false) Integer flowIndex,
@RequestParam(required = false) String flowName,
@RequestParam(required = false) String islandIdList) {
List<FlowInfo> list = flowInfoService.selectList( flowIndex, flowName, islandIdList);
return Result.success(list);
}
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询单个流程信息", description = "根据流程信息ID查询详情")
public Result getFlowInfoById(@PathVariable Long id) {

View File

@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("/goodsFlowStatus")
@Tag(name = "样品流程状态管理", description = "样品流程状态增删改查+分页查询接口")
@Tag(name = "样品流程信息管理", description = "样品流程状态增删改查+分页查询接口")
public class GoodsFlowStatusController {
@Autowired

View File

@@ -14,6 +14,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@RestController
@RequestMapping("/stepInfo")
@Tag(name = "步骤信息管理", description = "步骤信息增删改查+分页查询接口")
@@ -40,6 +42,20 @@ public class StepInfoController {
return Result.success(pageBean);
}
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询")
@Parameters({
@Parameter(name = "islandId", description = "岛屿ID可选精准查询", required = false, example = "1", in = ParameterIn.QUERY),
@Parameter(name = "stepName", description = "步骤名称(可选,模糊查询)", required = false, example = "检测", in = ParameterIn.QUERY)
})
public Result getStepInfoList(
@RequestParam(required = false) Integer islandId,
@RequestParam(required = false) String stepName) {
List<StepInfo> list = stepInfoService.selectList( islandId, stepName);
return Result.success(list);
}
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
@Operation(summary = "查询单个步骤信息", description = "根据步骤信息ID查询详情")
public Result getStepInfoById(@PathVariable Long id) {

View File

@@ -5,10 +5,17 @@ import com.rczn.domain.BaseBean;
import java.time.LocalDateTime;
public class DevInfo extends BaseBean {
//功能岛外键
private Integer islandId;
//设备名称
private String devName;
//设备型号
private String devModel;
//设备IP地址
private String ipAddr;
private Integer port;
@@ -19,7 +26,7 @@ public class DevInfo extends BaseBean {
private Integer status; // 0-空闲1-运行4-故障
private String desc;
private String devDesc;
public DevInfo() {
}
@@ -28,6 +35,14 @@ public class DevInfo extends BaseBean {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
public Integer getIslandId() {
return islandId;
}
public void setIslandId(Integer islandId) {
this.islandId = islandId;
}
public String getDevName() {
return devName;
}
@@ -84,11 +99,11 @@ public class DevInfo extends BaseBean {
this.status = status;
}
public String getDesc() {
return desc;
public String getDevDesc() {
return devDesc;
}
public void setDesc(String desc) {
this.desc = desc;
public void setDevDesc(String devDesc) {
this.devDesc = devDesc;
}
}

View File

@@ -11,7 +11,12 @@ public class DevParam extends BaseBean {
private String paramValue;
private String desc;
private String paramType;
private String paramUnit;
private String formType;
private String paramDesc;
private DevInfo devInfo;
@@ -46,12 +51,36 @@ public class DevParam extends BaseBean {
this.paramValue = paramValue;
}
public String getDesc() {
return desc;
public String getParamType() {
return paramType;
}
public void setDesc(String desc) {
this.desc = desc;
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getParamUnit() {
return paramUnit;
}
public void setParamUnit(String paramUnit) {
this.paramUnit = paramUnit;
}
public String getFormType() {
return formType;
}
public void setFormType(String formType) {
this.formType = formType;
}
public String getParamDesc() {
return paramDesc;
}
public void setParamDesc(String paramDesc) {
this.paramDesc = paramDesc;
}
public DevInfo getDevInfo() {

View File

@@ -11,6 +11,20 @@ public class FlowInfo extends BaseBean {
private String islandIdList;
private String busyCode;
private String goodsCode;
private String goodsName;
private String checkCode; // 校验码
private String programName; // 程序名称
private String testMethod; // 测试方法
private String scanNum; //扫描编号
public FlowInfo() {
}
@@ -18,6 +32,62 @@ public class FlowInfo extends BaseBean {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
public String getBusyCode() {
return busyCode;
}
public void setBusyCode(String busyCode) {
this.busyCode = busyCode;
}
public String getGoodsCode() {
return goodsCode;
}
public void setGoodsCode(String goodsCode) {
this.goodsCode = goodsCode;
}
public String getGoodsName() {
return goodsName;
}
public void setGoodsName(String goodsName) {
this.goodsName = goodsName;
}
public String getCheckCode() {
return checkCode;
}
public void setCheckCode(String checkCode) {
this.checkCode = checkCode;
}
public String getProgramName() {
return programName;
}
public void setProgramName(String programName) {
this.programName = programName;
}
public String getTestMethod() {
return testMethod;
}
public void setTestMethod(String testMethod) {
this.testMethod = testMethod;
}
public String getScanNum() {
return scanNum;
}
public void setScanNum(String scanNum) {
this.scanNum = scanNum;
}
public Integer getFlowIndex() {
return flowIndex;
}

View File

@@ -7,6 +7,16 @@ import java.time.LocalDateTime;
public class StepInfo extends BaseBean {
private Integer islandId;
//设备id
private Integer devId;
private Integer flowId;
private String paramName;
private String paramType;
private String paramUnit;
private String paramValue;
private String formType;
private String stepName;
private String stepDesc;
@@ -20,6 +30,62 @@ public class StepInfo extends BaseBean {
super(id, createId, createTime, updateId, updateTime, delSign, remark);
}
public Integer getFlowId() {
return flowId;
}
public void setFlowId(Integer flowId) {
this.flowId = flowId;
}
public Integer getDevId() {
return devId;
}
public void setDevId(Integer devId) {
this.devId = devId;
}
public String getParamName() {
return paramName;
}
public void setParamName(String paramName) {
this.paramName = paramName;
}
public String getParamType() {
return paramType;
}
public void setParamType(String paramType) {
this.paramType = paramType;
}
public String getParamUnit() {
return paramUnit;
}
public void setParamUnit(String paramUnit) {
this.paramUnit = paramUnit;
}
public String getParamValue() {
return paramValue;
}
public void setParamValue(String paramValue) {
this.paramValue = paramValue;
}
public String getFormType() {
return formType;
}
public void setFormType(String formType) {
this.formType = formType;
}
public Integer getIslandId() {
return islandId;
}

View File

@@ -4,12 +4,16 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.DevParam;
import java.util.List;
public interface DevParamService {
/**
* 分页查询
*/
PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramName, String paramValue);
List<DevParam> selectList(Integer devId, String paramName, String paramValue);
/**
* 根据ID查询
*/

View File

@@ -4,8 +4,11 @@ import com.github.pagehelper.PageInfo;
import com.rczn.domain.PageBean;
import com.rczn.rcznautoplc.domain.FlowInfo;
import java.util.List;
public interface FlowInfoService {
PageInfo<FlowInfo> selectPage(Integer pageNum, Integer pageSize, Integer flowIndex, String flowName, String islandIdList);
List<FlowInfo> selectList( Integer flowIndex, String flowName, String islandIdList);
FlowInfo selectById(Long id);
Long insert(FlowInfo flowInfo);
Boolean update(FlowInfo flowInfo);

View File

@@ -3,8 +3,11 @@ package com.rczn.rcznautoplc.service;
import com.github.pagehelper.PageInfo;
import com.rczn.rcznautoplc.domain.StepInfo;
import java.util.List;
public interface StepInfoService {
PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, Integer islandId, String stepName);
List<StepInfo> selectList( Integer islandId, String stepName);
StepInfo selectById(Long id);
Long insert(StepInfo stepInfo);
Boolean update(StepInfo stepInfo);

View File

@@ -32,6 +32,25 @@ public class DevParamServiceImpl implements DevParamService {
return new PageInfo<>(list);
}
/**
* 根据条件查询设备参数列表
* @param devId
* @param paramName
* @param paramValue
* @return
*/
@Override
public List<DevParam> selectList(Integer devId, String paramName, String paramValue) {
// 1. 构建查询条件
DevParam queryParam = new DevParam();
queryParam.setDevId(devId);
queryParam.setParamName(paramName);
queryParam.setParamValue(paramValue);
// 3. 执行查询
List<DevParam> list = devParamMapper.selectPage(queryParam);
return list;
}
@Override
public DevParam selectById(Long id) {
if (id == null) {

View File

@@ -28,6 +28,23 @@ public class FlowInfoServiceImpl implements FlowInfoService {
return new PageInfo<>(list);
}
/**
* 查询列表g根据国标流程
* @param flowIndex
* @param flowName
* @param islandIdList
* @return
*/
@Override
public List<FlowInfo> selectList(Integer flowIndex, String flowName, String islandIdList) {
FlowInfo queryParam = new FlowInfo();
queryParam.setFlowIndex(flowIndex);
queryParam.setFlowName(flowName);
queryParam.setIslandIdList(islandIdList);
List<FlowInfo> list = flowInfoMapper.selectPage(queryParam);
return list;
}
@Override
public FlowInfo selectById(Long id) {
if (id == null) throw new IllegalArgumentException("ID不能为空");

View File

@@ -26,6 +26,15 @@ public class StepInfoServiceImpl implements StepInfoService {
return new PageInfo<>(list);
}
@Override
public List<StepInfo> selectList(Integer islandId, String stepName) {
StepInfo queryParam = new StepInfo();
queryParam.setIslandId(islandId);
queryParam.setStepName(stepName);
List<StepInfo> list = stepInfoMapper.selectPage(queryParam);
return list;
}
@Override
public StepInfo selectById(Long id) {
if (id == null) throw new IllegalArgumentException("ID不能为空");

View File

@@ -8,7 +8,7 @@
<!-- 设备专属字段 -->
<sql id="devColumn">
dev_name, dev_model, ip_addr, port, protocol_type, company, status, `desc`
island_id, dev_name, dev_model, ip_addr, port, protocol_type, company, status, dev_desc
</sql>
<!-- 结果集映射(下划线转驼峰已开启,可简化) -->
@@ -22,6 +22,7 @@
<result column="del_sign" property="delSign"/>
<result column="remark" property="remark"/>
<!-- 设备专属字段 -->
<result column="island_id" property="islandId"/>
<result column="dev_name" property="devName"/>
<result column="dev_model" property="devModel"/>
<result column="ip_addr" property="ipAddr"/>
@@ -29,14 +30,15 @@
<result column="protocol_type" property="protocolType"/>
<result column="company" property="company"/>
<result column="status" property="status"/>
<result column="`desc`" property="desc"/> <!-- desc是MySQL关键字需用反引号包裹 -->
<result column="dev_desc" property="devDesc"/>
</resultMap>
<!-- 新增设备(空字段忽略) -->
<!-- 新增设备(空字段忽略,规范优化版 -->
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_dev_info (
<trim prefix="" suffix="" suffixOverrides=",">
<!-- 专属字段 -->
<!-- 设备专属字段(修正 test 表达式 + 关键字转义) -->
<if test="islandId != null">island_id,</if>
<if test="devName != null and devName != ''">dev_name,</if>
<if test="devModel != null and devModel != ''">dev_model,</if>
<if test="ipAddr != null and ipAddr != ''">ip_addr,</if>
@@ -44,17 +46,19 @@
<if test="protocolType != null and protocolType != ''">protocol_type,</if>
<if test="company != null and company != ''">company,</if>
<if test="status != null">status,</if>
<if test="desc != null and desc != ''">`desc`,</if>
<!-- 通用字段 -->
<if test="devDesc != null and devDesc != ''">`dev_desc`,</if> <!-- 核心修正dev_desc → devDesc + 反引号 -->
<!-- 通用字段(仅保留必要的人工传入字段,时间字段由数据库/代码自动生成) -->
<if test="createId != null">create_id,</if>
<if test="createTime != null">create_time,</if>
<if test="updateId != null">update_id,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
<!-- 固定写入:创建/更新时间由数据库生成删除标识默认0 -->
create_time,
update_time,
del_sign
</trim>
) VALUES (
<trim prefix="" suffix="" suffixOverrides=",">
<!-- 专属字段 -->
<!-- 设备专属字段(与上方字段一一对应) -->
<if test="islandId != null">#{islandId},</if>
<if test="devName != null and devName != ''">#{devName},</if>
<if test="devModel != null and devModel != ''">#{devModel},</if>
<if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if>
@@ -62,17 +66,19 @@
<if test="protocolType != null and protocolType != ''">#{protocolType},</if>
<if test="company != null and company != ''">#{company},</if>
<if test="status != null">#{status},</if>
<if test="desc != null and desc != ''">#{desc},</if>
<!-- 通用字段 -->
<if test="devDesc != null and devDesc != ''">#{devDesc},</if> <!-- 核心修正dev_desc → devDesc -->
<!-- 通用字段(与上方字段一一对应) -->
<if test="createId != null">#{createId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateId != null">#{updateId},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
<!-- 固定值:创建/更新时间用数据库当前时间删除标识默认0 -->
NOW(),
NOW(),
0
</trim>
)
</insert>
<!-- 逻辑删除设备 -->
<update id="deleteById">
UPDATE tb_dev_info
@@ -80,10 +86,12 @@
WHERE id = #{id} AND del_sign = 0
</update>
<!-- 根据ID更新设备非空字段才更新 -->
<!-- 根据ID更新设备非空字段才更新,规范优化版 -->
<update id="updateById">
UPDATE tb_dev_info
<set>
<!-- 设备专属字段修正test表达式 + 关键字转义 + 规范空格 -->
<if test="islandId != null">island_id = #{islandId},</if>
<if test="devName != null and devName != ''">dev_name = #{devName},</if>
<if test="devModel != null and devModel != ''">dev_model = #{devModel},</if>
<if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
@@ -91,14 +99,33 @@
<if test="protocolType != null and protocolType != ''">protocol_type = #{protocolType},</if>
<if test="company != null and company != ''">company = #{company},</if>
<if test="status != null">status = #{status},</if>
<if test="desc != null and desc != ''">`desc` = #{desc},</if>
<!-- 核心修正dev_desc → devDesc + 反引号转义 -->
<if test="devDesc != null and devDesc != ''">`dev_desc` = #{devDesc},</if>
<!-- 通用字段 -->
<if test="updateId != null">update_id = #{updateId},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
<!-- 固定更新时间:无论是否有其他字段更新,都刷新更新时间 -->
update_time = NOW()
</set>
<!-- 条件ID精准匹配 + 未删除,防止更新已删除数据 -->
WHERE id = #{id} AND del_sign = 0
<!-- 兜底:确保至少有一个业务字段更新(避免仅更新时间) -->
<if test="!(islandId != null
or (devName != null and devName != '')
or (devModel != null and devModel != '')
or (ipAddr != null and ipAddr != '')
or port != null
or (protocolType != null and protocolType != '')
or (company != null and company != '')
or status != null
or (devDesc != null and devDesc != '')
or updateId != null
or (remark != null and remark != ''))">
AND 1 = 0 <!-- 无更新字段时让SQL条件不成立避免无效更新 -->
</if>
</update>
<!-- 根据ID查询设备 -->
<select id="selectById" resultMap="DevResultMap">
SELECT
@@ -119,6 +146,10 @@
<if test="devName != null and devName != ''">
AND dev_name LIKE CONCAT('%', #{devName}, '%')
</if>
<!-- 设备所属岛屿精准查询 -->
<if test="islandId != null">
AND island_id = #{islandId}
</if>
<!-- 设备型号模糊查询 -->
<if test="devModel != null and devModel != ''">
AND dev_model LIKE CONCAT('%', #{devModel}, '%')
@@ -146,6 +177,9 @@
<if test="devName != null and devName != ''">
AND dev_name LIKE CONCAT('%', #{devName}, '%')
</if>
<if test="islandId != null">
AND island_id = #{islandId}
</if>
<if test="devModel != null and devModel != ''">
AND dev_model LIKE CONCAT('%', #{devModel}, '%')
</if>

View File

@@ -8,17 +8,37 @@
<!-- DevParam 业务字段 -->
<sql id="devParamColumn">
dev_id, param_name, param_value, `desc`
dev_id, param_name, param_value,param_type,param_unit,form_type, param_desc
</sql>
<!-- 新增 -->
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_dev_param (
<include refid="devParamColumn"/>,
create_id, create_time, update_id, update_time, del_sign
<trim suffixOverrides=",">
<if test="devId != null">dev_id, </if>
<if test="paramName != null and paramName != ''">param_name, </if>
<if test="paramValue != null and paramValue != ''">param_value, </if>
<if test="paramType != null and paramType != ''">param_type, </if>
<if test="paramUnit != null and paramUnit != ''">param_unit, </if>
<if test="formType != null and formType != ''">form_type, </if>
<if test="paramDesc != null and paramDesc != ''">param_desc, </if>
<if test="createId != null">create_id, </if>
<if test="updateId != null">update_id, </if>
create_time, update_time, del_sign
</trim>
) VALUES (
#{devId}, #{paramName}, #{paramValue}, #{desc},
#{createId}, NOW(), #{updateId}, NOW(), 0
<trim suffixOverrides=",">
<if test="devId != null">#{devId}, </if>
<if test="paramName != null and paramName != ''">#{paramName}, </if>
<if test="paramValue != null and paramValue != ''">#{paramValue}, </if>
<if test="paramType != null and paramType != ''">#{paramType}, </if>
<if test="paramUnit != null and paramUnit != ''">#{paramUnit}, </if>
<if test="formType != null and formType != ''">#{formType}, </if>
<if test="paramDesc != null and paramDesc != ''">#{paramDesc}, </if>
<if test="createId != null">#{createId}, </if>
<if test="updateId != null">#{updateId}, </if>
NOW(), NOW(), 0
</trim>
)
</insert>
@@ -29,7 +49,10 @@
<if test="devId != null">dev_id = #{devId},</if>
<if test="paramName != null and paramName != ''">param_name = #{paramName},</if>
<if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if>
<if test="desc != null and desc != ''">`desc` = #{desc},</if>
<if test="paramType != null and paramType != ''">param_type = #{paramType},</if>
<if test="paramUnit != null and paramUnit != ''">param_unit = #{paramUnit},</if>
<if test="formType != null and formType != ''">form_type = #{formType},</if>
<if test="paramDesc != null and paramDesc != ''">param_desc = #{paramDesc},</if>
<if test="updateId != null">update_id = #{updateId},</if>
update_time = NOW()
</set>

View File

@@ -6,16 +6,53 @@
</sql>
<sql id="flowInfoColumn">
flow_index, flow_name, island_id_list
flow_index, flow_name, island_id_list,busy_code,goods_code,goods_name,check_code,program_name,test_method,scan_num
</sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_flow_info (
<include refid="flowInfoColumn"/>,
create_id, create_time, update_id, update_time, del_sign
<trim suffixOverrides=",">
<!-- 以下是基础表字段 -->
<if test="createId != null" >create_id, </if>
<if test="updateId != null" >update_id, </if>
<if test="createTime != null" >create_time, </if>
<if test="updateTime != null" >update_time, </if>
<if test="remark != null" >remark, </if>
<!-- 以下是表本身字段 -->
<if test="flowIndex != null" >flow_index, </if>
<if test="flowName != null and flowName != ''" >flow_name, </if>
<if test="islandIdList != null and islandIdList != ''" >island_id_list, </if>
<if test="busyCode != null and busyCode != ''" >busy_code, </if>
<if test="goodsCode != null and goodsCode != ''" >goods_code, </if>
<if test="goodsName != null and goodsName != ''" >goods_name, </if>
<if test="checkCode != null and checkCode != ''" >check_code, </if>
<if test="programName != null and programName != ''" >program_name, </if>
<if test="testMethod != null and testMethod != ''" >test_method, </if>
<if test="scanNum != null and scanNum != ''" >scan_num, </if>
</trim>
) VALUES (
#{flowIndex}, #{flowName}, #{islandIdList},
#{createId}, NOW(), #{updateId}, NOW(), 0
<trim suffixOverrides=",">
<if test="createId != null" >#{createId}, </if>
<if test="updateId != null" >#{updateId}, </if>
<if test="createTime != null" >#{createTime}, </if>
<if test="updateTime != null" >#{updateTime}, </if>
<if test="remark != null" >#{remark}, </if>
<!-- 以下是表本身字段 -->
<if test="flowIndex != null" >#{flowIndex}, </if>
<if test="flowName != null and flowName != ''" >#{flowName}, </if>
<if test="islandIdList != null and islandIdList != ''" >#{islandIdList}, </if>
<if test="busyCode != null and busyCode != ''" >#{busyCode}, </if>
<if test="goodsCode != null and goodsCode != ''" >#{goodsCode}, </if>
<if test="goodsName != null and goodsName != ''" >#{goodsName}, </if>
<if test="checkCode != null and checkCode != ''" >#{checkCode}, </if>
<if test="programName != null and programName != ''" >#{programName}, </if>
<if test="testMethod != null and testMethod != ''" >#{testMethod}, </if>
<if test="scanNum != null and scanNum != ''" >#{scanNum}, </if>
</trim>
)
</insert>
@@ -25,7 +62,16 @@
<if test="flowIndex != null">flow_index = #{flowIndex},</if>
<if test="flowName != null and flowName != ''">flow_name = #{flowName},</if>
<if test="islandIdList != null and islandIdList != ''">island_id_list = #{islandIdList},</if>
<if test="busyCode!=null and busyCode != ''">busy_code = #{busyCode},</if>
<if test="goodsCode!=null and goodsCode != ''">goods_code = #{goodsCode},</if>
<if test="goodsName!=null and goodsName != ''">goods_name = #{goodsName},</if>
<if test="checkCode!=null and checkCode != ''">check_code = #{checkCode},</if>
<if test="programName!=null and programName != ''">program_name = #{programName},</if>
<if test="testMethod!=null and testMethod != ''">test_method = #{testMethod},</if>
<if test="scanNum!=null and scanNum != ''">scan_num = #{scanNum},</if>
<if test="updateId != null">update_id = #{updateId},</if>
update_time = NOW()
</set>
WHERE id = #{id} AND del_sign = 0
@@ -54,6 +100,13 @@
<if test="flowIndex != null">AND flow_index = #{flowIndex}</if>
<if test="flowName != null and flowName != ''">AND flow_name LIKE CONCAT('%', #{flowName}, '%')</if>
<if test="islandIdList != null and islandIdList != ''">AND island_id_list LIKE CONCAT('%', #{islandIdList}, '%')</if>
<if test="busyCode != null and busyCode != ''">AND busy_code LIKE CONCAT('%', #{busyCode}, '%')</if>
<if test="goodsCode != null and goodsCode != ''">AND goods_code LIKE CONCAT('%', #{goodsCode}, '%')</if>
<if test="goodsName != null and goodsName != ''">AND goods_name LIKE CONCAT('%', #{goodsName}, '%')</if>
<if test="checkCode != null and checkCode != ''">AND check_code LIKE CONCAT('%', #{checkCode}, '%')</if>
<if test="programName != null and programName != ''">AND program_name LIKE CONCAT('%', #{programName}, '%')</if>
<if test="testMethod != null and testMethod != ''">AND test_method LIKE CONCAT('%', #{testMethod}, '%')</if>
<if test="scanNum != null and scanNum != ''">AND scan_num LIKE CONCAT('%', #{scanNum}, '%')</if>
ORDER BY flow_index ASC
</select>
</mapper>

View File

@@ -6,16 +6,54 @@
</sql>
<sql id="stepInfoColumn">
island_id, step_name, step_desc
island_id,dev_id, step_name, step_desc,flow_id,param_name,param_type,param_unit,param_value,form_type
</sql>
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
INSERT INTO tb_step_info (
<include refid="stepInfoColumn"/>,
create_id, create_time, update_id, update_time, del_sign
<trim suffixOverrides=",">
<!-- 基础表字段 -->
<if test="createId != null">create_id, </if>
<if test="createTime != null">create_time, </if>
<if test="updateId != null">update_id, </if>
<if test="updateTime != null">update_time, </if>
<if test="remark != null ">remark, </if>
<!-- 步骤表字段 -->
<if test="islandId != null">island_id, </if>
<if test="devId != null">dev_id, </if>
<if test="stepName != null and stepName != ''">step_name, </if>
<if test="stepDesc != null and stepDesc != ''">step_desc, </if>
<if test="flowId != null">flow_id, </if>
<if test="paramName != null and paramName != ''">param_name, </if>
<if test="paramType != null and paramType != ''">param_type, </if>
<if test="paramUnit != null and paramUnit != ''">param_unit, </if>
<if test="paramValue != null and paramValue != ''">param_value, </if>
<if test="formType != null and formType != ''">form_type, </if>
</trim>
) VALUES (
#{islandId}, #{stepName}, #{stepDesc},
#{createId}, NOW(), #{updateId}, NOW(), 0
<trim suffixOverrides=",">
<!-- 基础表字段 -->
<if test="createId != null">#{createId}, </if>
<if test="createTime != null">#{createTime}, </if>
<if test="updateId != null">#{updateId}, </if>
<if test="updateTime != null">#{updateTime}, </if>
<if test="remark != null ">#{remark}, </if>
<!-- 步骤表字段 -->
<if test="islandId != null">#{islandId}, </if>
<if test="devId != null">#{devId}, </if>
<if test="stepName != null and stepName != ''">#{stepName}, </if>
<if test="stepDesc != null and stepDesc != ''">#{stepDesc}, </if>
<if test="flowId != null">#{flowId}, </if>
<if test="paramName != null and paramName != ''">#{paramName}, </if>
<if test="paramType != null and paramType != ''">#{paramType}, </if>
<if test="paramUnit != null and paramUnit != ''">#{paramUnit}, </if>
<if test="paramValue != null and paramValue != ''">#{paramValue}, </if>
<if test="formType != null and formType != ''">#{formType}, </if>
</trim>
)
</insert>
@@ -23,9 +61,17 @@
UPDATE tb_step_info
<set>
<if test="islandId != null">island_id = #{islandId},</if>
<if test="devId != null">dev_id = #{devId},</if>
<if test="stepName != null and stepName != ''">step_name = #{stepName},</if>
<if test="stepDesc != null and stepDesc != ''">step_desc = #{stepDesc},</if>
<if test="updateId != null">update_id = #{updateId},</if>
<if test="remark != null ">remark = #{remark},</if>
<if test="flowId != null">flow_id = #{flowId},</if>
<if test="paramName != null and paramName != ''">param_name = #{paramName},</if>
<if test="paramType != null and paramType != ''">param_type = #{paramType},</if>
<if test="paramUnit != null and paramUnit != ''">param_unit = #{paramUnit},</if>
<if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if>
<if test="formType != null and formType != ''">form_type = #{formType},</if>
update_time = NOW()
</set>
WHERE id = #{id} AND del_sign = 0
@@ -52,7 +98,13 @@
FROM tb_step_info
WHERE del_sign = 0
<if test="islandId != null">AND island_id = #{islandId}</if>
<if test="devId != null">AND dev_id = #{devId}</if>
<if test="stepName != null and stepName != ''">AND step_name LIKE CONCAT('%', #{stepName}, '%')</if>
<if test="flowId != null">AND flow_id = #{flowId}</if>
<if test="paramName != null and paramName != ''">AND param_name LIKE CONCAT('%', #{paramName}, '%')</if>
<if test="paramType != null and paramType != ''">AND param_type LIKE CONCAT('%', #{paramType}, '%')</if>
<if test="paramUnit != null and paramUnit != ''">AND param_unit LIKE CONCAT('%', #{paramUnit}, '%')</if>
<if test="paramValue != null and paramValue != ''">AND param_value LIKE CONCAT('%', #{paramValue}, '%')</if>
ORDER BY create_time DESC
</select>
</mapper>

View File

@@ -4,6 +4,7 @@ import com.rczn.utils.JwtUtil;
import com.rczn.utils.ThreadLocalUtil;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;
import java.util.Map;