2026-4-30:
1.后端代码2次更新
This commit is contained in:
@@ -38,6 +38,7 @@
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>${lombok.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -46,12 +47,7 @@
|
||||
<version>5.3.3</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>2.2.21</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
@@ -69,14 +65,18 @@
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-models-jakarta</artifactId>
|
||||
<version>2.2.19</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter-api</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- 这里可以添加PLC通信相关的依赖 -->
|
||||
<!-- 这里可以添加PLC通信相关的依赖 -->
|
||||
<!-- 例如:
|
||||
<dependency>
|
||||
<groupId>com.github.s7connector</groupId>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.rczn.rcznautoplc.controller;
|
||||
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.DevInfo;
|
||||
import com.rczn.rcznautoplc.service.DevInfoService;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
@@ -25,7 +26,7 @@ import java.util.Map;
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/devInfo")
|
||||
@Tag(name = "设备管理", description = "设备增删改查+分页查询+全量查询接口")
|
||||
@Tag(name = "动作单元管理", description = "设备增删改查+分页查询+全量查询接口")
|
||||
public class DevInfoController {
|
||||
|
||||
@Autowired
|
||||
@@ -35,15 +36,15 @@ public class DevInfoController {
|
||||
* 新增设备
|
||||
*/
|
||||
@PostMapping(value = "/add", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "新增设备", description = "设备名称为必填项,其他字段可选(非空则入库)")
|
||||
@Operation(summary = "新增动作单元", description = "动作单元名称为必填项,其他字段可选(非空则入库)")
|
||||
public ResponseEntity<Map<String, Object>> addDevInfo(
|
||||
@Parameter(name = "设备信息", description = "设备新增请求参数", required = true)
|
||||
@Parameter(name = "动作单元信息", description = "动作单元新增请求参数", required = true)
|
||||
@RequestBody DevInfo devInfo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean success = devInfoService.addDevInfo(devInfo);
|
||||
result.put("success", success);
|
||||
result.put("message", success ? "设备新增成功" : "设备新增失败");
|
||||
result.put("message", success ? "动作单元新增成功" : "动作单元新增失败");
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (IllegalArgumentException e) {
|
||||
result.put("success", false);
|
||||
@@ -60,15 +61,15 @@ public class DevInfoController {
|
||||
* 根据ID删除设备(逻辑删除)
|
||||
*/
|
||||
@DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "删除设备", description = "逻辑删除(设置delSign=1,不物理删除数据)")
|
||||
@Operation(summary = "删除动作单元", description = "逻辑删除(设置delSign=1,不物理删除数据)")
|
||||
public ResponseEntity<Map<String, Object>> removeDevInfoById(
|
||||
@Parameter(name = "id", description = "设备ID", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "动作单元ID", required = true, example = "1")
|
||||
@PathVariable Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean success = devInfoService.removeDevInfoById(id);
|
||||
result.put("success", success);
|
||||
result.put("message", success ? "设备删除成功" : "设备不存在或已删除");
|
||||
result.put("message", success ? "动作单元删除成功" : "动作单元不存在或已删除");
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (IllegalArgumentException e) {
|
||||
result.put("success", false);
|
||||
@@ -85,15 +86,15 @@ public class DevInfoController {
|
||||
* 更新设备
|
||||
*/
|
||||
@PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "修改设备", description = "需传入设备ID,其他字段可选(非空则更新)")
|
||||
@Operation(summary = "修改动作单元", description = "需传入动作单元ID,其他字段可选(非空则更新)")
|
||||
public ResponseEntity<Map<String, Object>> updateDevInfo(
|
||||
@Parameter(name = "设备信息", description = "设备修改请求参数(含ID)", required = true)
|
||||
@Parameter(name = "动作单元信息", description = "动作单元修改请求参数(含ID)", required = true)
|
||||
@RequestBody DevInfo devInfo) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
boolean success = devInfoService.updateDevInfo(devInfo);
|
||||
result.put("success", success);
|
||||
result.put("message", success ? "设备更新成功" : "设备不存在或已删除");
|
||||
result.put("message", success ? "动作单元更新成功" : "动作单元不存在或已删除");
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (IllegalArgumentException e) {
|
||||
result.put("success", false);
|
||||
@@ -107,12 +108,12 @@ public class DevInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询设备
|
||||
* 根据ID查询动作单元
|
||||
*/
|
||||
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "查询单个设备", description = "根据设备ID查询设备完整信息")
|
||||
@Operation(summary = "查询单个动作单元", description = "根据动作单元ID查询动作单元完整信息")
|
||||
public ResponseEntity<Map<String, Object>> getDevInfoById(
|
||||
@Parameter(name = "id", description = "设备ID", required = true, example = "1")
|
||||
@Parameter(name = "id", description = "动作单元ID", required = true, example = "1")
|
||||
@PathVariable Long id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
@@ -122,7 +123,7 @@ public class DevInfoController {
|
||||
result.put("data", devInfo);
|
||||
} else {
|
||||
result.put("success", false);
|
||||
result.put("message", "设备不存在或已删除");
|
||||
result.put("message", "动作单元不存在或已删除");
|
||||
}
|
||||
return ResponseEntity.ok(result);
|
||||
} catch (IllegalArgumentException e) {
|
||||
@@ -137,33 +138,29 @@ public class DevInfoController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询设备
|
||||
* 示例:/devInfo/listPage?pageNum=1&pageSize=10&devName=设备1&status=0
|
||||
* 分页查询动作单元
|
||||
* 示例:/devInfo/listPage?pageNum=1&pageSize=10&devName=动作单元1&status=0
|
||||
*/
|
||||
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "分页查询设备", description = "支持设备名称、型号、IP、状态等多条件过滤,默认查询未删除设备")
|
||||
@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)
|
||||
})
|
||||
public ResponseEntity<Map<String, Object>> getDevInfoPage(
|
||||
public Result getDevInfoPage(
|
||||
@ParameterObject // 核心注解:标记该实体类从查询参数取值
|
||||
@Schema(description = "设备查询条件(可选)") // 补充描述
|
||||
DevInfo devInfo, // 接收查询条件(devName、status等)
|
||||
@RequestParam Integer pageNum,
|
||||
@RequestParam Integer pageSize) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
try {
|
||||
PageInfo<DevInfo> pageInfo = devInfoService.getDevInfoPage(devInfo, pageNum, pageSize);
|
||||
result.put("success", true);
|
||||
result.put("data", pageInfo);
|
||||
return ResponseEntity.ok(result);
|
||||
Result<PageInfo<DevInfo>> success = Result.success(pageInfo);
|
||||
return success;
|
||||
} catch (Exception e) {
|
||||
result.put("success", false);
|
||||
result.put("message", "服务器异常:" + e.getMessage());
|
||||
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(result);
|
||||
return Result.error("数据库异常!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.DevParam;
|
||||
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
|
||||
import com.rczn.rcznautoplc.service.DevParamService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
@@ -33,6 +34,7 @@ public class DevParamController {
|
||||
@Parameter(name = "pageNum", description = "页码(必填)", required = true, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "devId", description = "设备ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramTypeData", description = "参数类型(可选,模糊查询)", required = false, example = "耗材,通用", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramName", description = "参数名称(可选,模糊查询)", required = false, example = "温度", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramValue", description = "参数值(可选,模糊查询)", required = false, example = "25", in = ParameterIn.QUERY)
|
||||
})
|
||||
@@ -40,9 +42,10 @@ public class DevParamController {
|
||||
@RequestParam Integer pageNum,
|
||||
@RequestParam Integer pageSize,
|
||||
@RequestParam(required = false) Integer devId,
|
||||
@RequestParam(required = false) String paramTypeData,
|
||||
@RequestParam(required = false) String paramName,
|
||||
@RequestParam(required = false) String paramValue) {
|
||||
PageInfo<DevParam> pageBean = devParamService.selectPage(pageNum, pageSize, devId, paramName, paramValue);
|
||||
PageInfo<DevParam> pageBean = devParamService.selectPage(pageNum, pageSize, devId,paramTypeData, paramName, paramValue);
|
||||
return Result.success(pageBean);
|
||||
}
|
||||
|
||||
@@ -53,17 +56,57 @@ public class DevParamController {
|
||||
@Operation(summary = "查询设备参数", description = "支持设备ID精准查询、参数名称/值模糊查询")
|
||||
@Parameters({
|
||||
@Parameter(name = "devId", description = "设备ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramTypeData", description = "参数类型(可选,模糊查询)", required = false, example = "耗材,通用", 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 paramTypeData,
|
||||
@RequestParam(required = false) String paramName,
|
||||
@RequestParam(required = false) String paramValue) {
|
||||
List<DevParam> pageBean = devParamService.selectList( devId, paramName, paramValue);
|
||||
|
||||
DevParamQuery query = new DevParamQuery();
|
||||
query.setDevId(devId);
|
||||
query.setParamTypeData(paramTypeData);
|
||||
query.setParamName(paramName);
|
||||
query.setParamValue(paramValue);
|
||||
List<DevParam> pageBean = devParamService.selectList( query);
|
||||
return Result.success(pageBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件,查询设备参数
|
||||
*/
|
||||
@PostMapping(value = "/addDevId", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "为参数增加设备的devId", description = "为参数增加设备的devId")
|
||||
@Parameters({
|
||||
@Parameter(name = "devId", description = "设备ID", required = true, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramId", description = "参数Id", required = true, example = "1", in = ParameterIn.QUERY)
|
||||
})
|
||||
public Result addDevId(
|
||||
@RequestParam(required = true) Integer devId,
|
||||
@RequestParam(required = true) Integer paramId) {
|
||||
Boolean result = devParamService.addDevId( devId, paramId );
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件,查询设备参数
|
||||
*/
|
||||
@PostMapping(value = "/delDevId", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "为参数减少设备的devId", description = "为参数减少设备的devId")
|
||||
@Parameters({
|
||||
@Parameter(name = "devId", description = "设备ID", required = true, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "paramId", description = "参数Id", required = true, example = "1", in = ParameterIn.QUERY)
|
||||
})
|
||||
public Result delDevId(
|
||||
@RequestParam(required = true) Integer devId,
|
||||
@RequestParam(required = true) Integer paramId) {
|
||||
Boolean result = devParamService.reduceDevId( devId, paramId );
|
||||
return Result.success(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询设备参数
|
||||
*/
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
package com.rczn.rcznautoplc.controller;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.FlowInfo;
|
||||
import com.rczn.rcznautoplc.domain.ManageLog;
|
||||
import com.rczn.rcznautoplc.domain.UserBusy;
|
||||
import com.rczn.rcznautoplc.service.FlowInfoService;
|
||||
import com.rczn.rcznautoplc.service.ManageLogService;
|
||||
import com.rczn.utils.ThreadLocalUtil;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
@@ -14,7 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/flowInfo")
|
||||
@@ -24,7 +30,6 @@ public class FlowInfoController {
|
||||
@Autowired
|
||||
FlowInfoService flowInfoService;
|
||||
|
||||
|
||||
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "分页查询流程信息", description = "支持流程排序精准查询、流程名称/岛屿ID列表模糊查询")
|
||||
@Parameters({
|
||||
@@ -71,6 +76,23 @@ public class FlowInfoController {
|
||||
public Result addFlowInfo(@RequestBody FlowInfo flowInfo) {
|
||||
try {
|
||||
Long flowInfoId = flowInfoService.insert(flowInfo);
|
||||
//记录操作样品执行SOP操作日志:
|
||||
LocalDateTime loginTime = LocalDateTime.now();
|
||||
ManageLog info = new ManageLog();
|
||||
// ========== 修复开始 ==========
|
||||
Map<String, Object> mapClaims = ThreadLocalUtil.get();
|
||||
UserBusy userBusy = new UserBusy();
|
||||
userBusy.setId(Long.valueOf( mapClaims.get("id").toString()));
|
||||
userBusy.setUserName((String) mapClaims.get("username"));
|
||||
// ========== 修复结束 ==========
|
||||
info.setCreateId(userBusy.getId());
|
||||
info.setLogName("基础数据操作日志");
|
||||
info.setLogType("基础数据操作日志");//1:登录日志、2:SOP操作日志、3:基础数据操作日志
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("用户名:").append(userBusy.getUserName()).append(",SOP配置添加操作时间:").append(loginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
info.setLogContent(stringBuilder.toString());
|
||||
info.setCreateTime(loginTime);
|
||||
manageLogService.insert(info);
|
||||
return Result.success(flowInfoId);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
@@ -88,11 +110,31 @@ public class FlowInfoController {
|
||||
}
|
||||
}
|
||||
|
||||
@Autowired
|
||||
ManageLogService manageLogService;
|
||||
|
||||
@DeleteMapping(value = "/del/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "删除流程信息", description = "逻辑删除(设置delSign=1,不物理删除数据)")
|
||||
public Result deleteFlowInfo(@PathVariable Long id) {
|
||||
try {
|
||||
Boolean success = flowInfoService.deleteById(id);
|
||||
//记录操作样品执行SOP操作日志:
|
||||
LocalDateTime loginTime = LocalDateTime.now();
|
||||
ManageLog info = new ManageLog();
|
||||
// ========== 修复开始 ==========
|
||||
Map<String, Object> mapClaims = ThreadLocalUtil.get();
|
||||
UserBusy userBusy = new UserBusy();
|
||||
userBusy.setId(Long.valueOf( mapClaims.get("id").toString()));
|
||||
userBusy.setUserName((String) mapClaims.get("username"));
|
||||
// ========== 修复结束 ==========
|
||||
info.setCreateId(userBusy.getId());
|
||||
info.setLogName("基础数据操作日志");
|
||||
info.setLogType("基础数据操作日志");//1:登录日志、2:SOP操作日志、3:基础数据操作日志
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
stringBuilder.append("用户名:").append(userBusy.getUserName()).append(",SOP配置删除操作时间:").append(loginTime.format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
info.setLogContent(stringBuilder.toString());
|
||||
info.setCreateTime(loginTime);
|
||||
manageLogService.insert(info);
|
||||
return success ? Result.success(true) : Result.error("删除失败(流程信息不存在或已删除)");
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
|
||||
@@ -4,16 +4,21 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
|
||||
import com.rczn.rcznautoplc.service.GoodsFlowStatusService;
|
||||
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.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/goodsFlowStatus")
|
||||
@Tag(name = "样品流程信息管理", description = "样品流程状态增删改查+分页查询接口")
|
||||
@@ -28,22 +33,29 @@ public class GoodsFlowStatusController {
|
||||
@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 = "goodsId", description = "样品ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "flowId", description = "流程ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "islandId", description = "岛屿ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "status", description = "状态(可选,精准查询:0-未执行,1-执行,10-通过,11-失败)", required = false, example = "10", in = ParameterIn.QUERY)
|
||||
})
|
||||
public Result getGoodsFlowStatusPage(
|
||||
@RequestParam Integer pageNum,
|
||||
@RequestParam Integer pageSize,
|
||||
@RequestParam(required = false) Integer goodsId,
|
||||
@RequestParam(required = false) Integer flowId,
|
||||
@RequestParam(required = false) Integer islandId,
|
||||
@RequestParam(required = false) Integer status) {
|
||||
PageInfo<GoodsFlowStatus> pageBean = goodsFlowStatusService.selectPage(pageNum, pageSize, goodsId, flowId, islandId, status);
|
||||
@ParameterObject
|
||||
@Schema(description = "样品ID、流程ID、岛屿ID、状态精准查询条件")
|
||||
GoodsFlowStatusQuery goodsFlowStatus) {
|
||||
PageInfo<GoodsFlowStatus> pageBean = goodsFlowStatusService.selectPage(pageNum, pageSize, goodsFlowStatus);
|
||||
return Result.success(pageBean);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "查询样品流程状态", description = "支持样品ID、流程ID、岛屿ID、状态等精准查询")
|
||||
@Parameters({
|
||||
})
|
||||
public Result getList(
|
||||
@ParameterObject
|
||||
@Schema(description = "样品ID、流程ID、岛屿ID、状态等精准查询条件")
|
||||
GoodsFlowStatusQuery goodsFlowStatus) {
|
||||
List<GoodsFlowStatus> list = goodsFlowStatusService.selectList( goodsFlowStatus);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@GetMapping(value = "/getById/{id}", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "查询单个样品流程状态", description = "根据样品流程状态ID查询详情")
|
||||
public Result getGoodsFlowStatusById(@PathVariable Long id) {
|
||||
|
||||
@@ -4,16 +4,21 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.GoodsInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
|
||||
import com.rczn.rcznautoplc.service.GoodsInfoService;
|
||||
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.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/goodsInfo")
|
||||
@Tag(name = "样品信息管理", description = "样品信息增删改查+分页查询接口")
|
||||
@@ -29,23 +34,37 @@ public class GoodsInfoController {
|
||||
@Operation(summary = "分页查询样品信息", description = "支持样品名称/类型/来源模糊查询、批次精准查询")
|
||||
@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 = "goodsName", description = "样品名称(可选,模糊查询)", required = false, example = "手机", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "goodsType", description = "样品类型(可选,模糊查询)", required = false, example = "电子产品", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "goodFrom", description = "样品来源(可选,模糊查询)", required = false, example = "深圳", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "goodBatch", description = "样品批次(可选,精准查询)", required = false, example = "202501", in = ParameterIn.QUERY)
|
||||
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
|
||||
// @Parameter(name = "goodsName", description = "样品名称(可选,模糊查询)", required = false, example = "手机", in = ParameterIn.QUERY),
|
||||
// @Parameter(name = "goodsType", description = "样品类型(可选,模糊查询)", required = false, example = "电子产品", in = ParameterIn.QUERY),
|
||||
// @Parameter(name = "goodFrom", description = "样品来源(可选,模糊查询)", required = false, example = "深圳", in = ParameterIn.QUERY),
|
||||
// @Parameter(name = "goodBatch", description = "样品批次(可选,精准查询)", required = false, example = "202501", in = ParameterIn.QUERY)
|
||||
})
|
||||
public Result getGoodsInfoPage(
|
||||
@RequestParam Integer pageNum,
|
||||
@RequestParam Integer pageSize,
|
||||
@RequestParam(required = false) String goodsName,
|
||||
@RequestParam(required = false) String goodsType,
|
||||
@RequestParam(required = false) String goodFrom,
|
||||
@RequestParam(required = false) Integer goodBatch) {
|
||||
PageInfo<GoodsInfo> pageBean = goodsInfoService.selectPage(pageNum, pageSize, goodsName, goodsType, goodFrom, goodBatch);
|
||||
@ParameterObject
|
||||
@Schema(description = "样品信息查询条件(可选)", name = "goodsInfo", required = false)
|
||||
GoodsInfoQuery goodsInfo) {
|
||||
PageInfo<GoodsInfo> pageBean = goodsInfoService.selectPage(pageNum, pageSize, goodsInfo);
|
||||
return Result.success(pageBean);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询样品信息
|
||||
*/
|
||||
@GetMapping(value = "/list", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "查询样品信息", description = "支持样品名称/类型/来源模糊查询、批次精准查询")
|
||||
@Parameters({
|
||||
})
|
||||
public Result getList(
|
||||
@ParameterObject
|
||||
@Schema(description = "样品信息查询条件(可选)", name = "goodsInfo", required = false)
|
||||
GoodsInfoQuery goodsInfo) {
|
||||
List<GoodsInfo> list = goodsInfoService.selectList( goodsInfo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID查询样品信息
|
||||
*/
|
||||
@@ -70,6 +89,21 @@ public class GoodsInfoController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码新增样品信息
|
||||
* 扫码信息:样品类型、样品编码、样品名称、样品点位
|
||||
*/
|
||||
@PostMapping(value = "/scanAdd", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "扫描新增样品", description = "样品名称、类型、编码、点位为必填项")
|
||||
public Result scanAdd(@RequestBody GoodsInfo goodsInfo) {
|
||||
try {
|
||||
GoodsInfo goodInfoResult = goodsInfoService.insertByScan(goodsInfo);
|
||||
return Result.success(goodInfoResult);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改样品信息
|
||||
*/
|
||||
|
||||
@@ -4,12 +4,15 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.domain.Result;
|
||||
import com.rczn.rcznautoplc.domain.StepInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
|
||||
import com.rczn.rcznautoplc.service.StepInfoService;
|
||||
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.MediaType;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -24,35 +27,31 @@ public class StepInfoController {
|
||||
@Autowired
|
||||
StepInfoService stepInfoService;
|
||||
|
||||
|
||||
@GetMapping(value = "/listPage", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "分页查询步骤信息", description = "支持岛屿ID精准查询、步骤名称模糊查询")
|
||||
@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 = "islandId", description = "岛屿ID(可选,精准查询)", required = false, example = "1", in = ParameterIn.QUERY),
|
||||
@Parameter(name = "stepName", description = "步骤名称(可选,模糊查询)", required = false, example = "检测", in = ParameterIn.QUERY)
|
||||
@Parameter(name = "pageSize", description = "每页条数(必填)", required = true, example = "10", in = ParameterIn.QUERY)
|
||||
})
|
||||
public Result getStepInfoPage(
|
||||
@ParameterObject // 核心注解:标记该实体类从查询参数取值
|
||||
@Schema(description = "设备查询条件(可选)") // 补充描述
|
||||
StepInfoQuery stepInfo,
|
||||
@RequestParam Integer pageNum,
|
||||
@RequestParam Integer pageSize,
|
||||
@RequestParam(required = false) Integer islandId,
|
||||
@RequestParam(required = false) String stepName) {
|
||||
PageInfo<StepInfo> pageBean = stepInfoService.selectPage(pageNum, pageSize, islandId, stepName);
|
||||
@RequestParam Integer pageSize
|
||||
) {
|
||||
PageInfo<StepInfo> pageBean = stepInfoService.selectPage(pageNum, pageSize, stepInfo);
|
||||
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);
|
||||
@ParameterObject // 核心注解:标记该实体类从查询参数取值
|
||||
@Schema(description = "设备查询条件(可选)") // 补充描述
|
||||
StepInfoQuery stepInfo) {
|
||||
List<StepInfo> list = stepInfoService.selectList( stepInfo);
|
||||
return Result.success(list);
|
||||
}
|
||||
|
||||
@@ -74,6 +73,30 @@ public class StepInfoController {
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping(value = "/batchAdd", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "批量新增步骤信息", description = "岛屿ID、步骤名称为必填项")
|
||||
public Result batchAddStepInfo(@RequestBody List<StepInfo> stepInfoList) {
|
||||
try {
|
||||
stepInfoService.insertBatch(stepInfoList);
|
||||
return Result.success(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//批量更新步骤信息
|
||||
@PostMapping(value = "/batchUpdate", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "批量更新步骤信息", description = "岛屿ID、步骤名称为必填项")
|
||||
public Result batchUpdateStepInfo(@RequestBody List<StepInfo> stepInfoList) {
|
||||
try {
|
||||
stepInfoService.updateBatch(stepInfoList);
|
||||
return Result.success(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@PutMapping(value = "/update", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "修改步骤信息", description = "需传入步骤信息ID,其他字段可选(非空则更新)")
|
||||
public Result updateStepInfo(@RequestBody StepInfo stepInfo) {
|
||||
@@ -95,4 +118,16 @@ public class StepInfoController {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
//批量删除步骤信息
|
||||
@DeleteMapping(value = "/batchDel", produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
@Operation(summary = "批量删除步骤信息", description = "逻辑删除(设置delSign=1,不物理删除数据)")
|
||||
public Result batchDeleteStepInfo(@RequestBody List<Long> ids) {
|
||||
try {
|
||||
stepInfoService.deleteBatchByIds(ids);
|
||||
return Result.success(true);
|
||||
} catch (IllegalArgumentException e) {
|
||||
return Result.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -15,6 +17,9 @@ public class DevInfo extends BaseBean {
|
||||
//设备型号
|
||||
private String devModel;
|
||||
|
||||
//plc映射地址
|
||||
private Integer plcAddr;
|
||||
|
||||
//设备IP地址
|
||||
private String ipAddr;
|
||||
|
||||
@@ -26,6 +31,8 @@ public class DevInfo extends BaseBean {
|
||||
|
||||
private Integer status; // 0-空闲,1-运行,4-故障
|
||||
|
||||
private Integer runModel;//0-手动模式,1-自动模式
|
||||
|
||||
private String devDesc;
|
||||
|
||||
public DevInfo() {
|
||||
@@ -59,6 +66,14 @@ public class DevInfo extends BaseBean {
|
||||
this.devModel = devModel;
|
||||
}
|
||||
|
||||
public Integer getPlcAddr() {
|
||||
return plcAddr;
|
||||
}
|
||||
|
||||
public void setPlcAddr(Integer plcAddr) {
|
||||
this.plcAddr = plcAddr;
|
||||
}
|
||||
|
||||
public String getIpAddr() {
|
||||
return ipAddr;
|
||||
}
|
||||
@@ -99,6 +114,14 @@ public class DevInfo extends BaseBean {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Integer getRunModel() {
|
||||
return runModel;
|
||||
}
|
||||
|
||||
public void setRunModel(Integer runModel) {
|
||||
this.runModel = runModel;
|
||||
}
|
||||
|
||||
public String getDevDesc() {
|
||||
return devDesc;
|
||||
}
|
||||
|
||||
@@ -1,13 +1,21 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class DevParam extends BaseBean {
|
||||
private Integer devId;
|
||||
private String devIds;
|
||||
|
||||
//字典类型-参数分类id
|
||||
private Integer dicDataId;
|
||||
|
||||
private String paramName;
|
||||
//plc映射地址
|
||||
private Integer plcAddr;
|
||||
|
||||
private String paramValue;
|
||||
|
||||
@@ -16,8 +24,10 @@ public class DevParam extends BaseBean {
|
||||
private String paramUnit;
|
||||
|
||||
private String formType;
|
||||
|
||||
private String paramDesc;
|
||||
|
||||
@JsonIgnore
|
||||
private DevInfo devInfo;
|
||||
|
||||
public DevParam() {
|
||||
@@ -27,12 +37,12 @@ public class DevParam extends BaseBean {
|
||||
super(id, createId, createTime, updateId, updateTime, delSign, remark);
|
||||
}
|
||||
|
||||
public Integer getDevId() {
|
||||
return devId;
|
||||
public String getDevIds() {
|
||||
return devIds;
|
||||
}
|
||||
|
||||
public void setDevId(Integer devId) {
|
||||
this.devId = devId;
|
||||
public void setDevIds(String devIds) {
|
||||
this.devIds = devIds;
|
||||
}
|
||||
|
||||
public String getParamName() {
|
||||
@@ -59,6 +69,22 @@ public class DevParam extends BaseBean {
|
||||
this.paramType = paramType;
|
||||
}
|
||||
|
||||
public Integer getPlcAddr() {
|
||||
return plcAddr;
|
||||
}
|
||||
|
||||
public void setPlcAddr(Integer plcAddr) {
|
||||
this.plcAddr = plcAddr;
|
||||
}
|
||||
|
||||
public Integer getDicDataId() {
|
||||
return dicDataId;
|
||||
}
|
||||
|
||||
public void setDicDataId(Integer dicDataId) {
|
||||
this.dicDataId = dicDataId;
|
||||
}
|
||||
|
||||
public String getParamUnit() {
|
||||
return paramUnit;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -11,6 +14,8 @@ public class GoodsFlowStatus extends BaseBean {
|
||||
|
||||
private Integer islandId;
|
||||
|
||||
private Integer devId;
|
||||
|
||||
private Integer flowSort;
|
||||
|
||||
private Integer status; // 0-未执行,1-执行,10-通过,11-失败
|
||||
@@ -60,6 +65,14 @@ public class GoodsFlowStatus extends BaseBean {
|
||||
this.flowSort = flowSort;
|
||||
}
|
||||
|
||||
public Integer getDevId() {
|
||||
return devId;
|
||||
}
|
||||
|
||||
public void setDevId(Integer devId) {
|
||||
this.devId = devId;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.models.security.SecurityScheme;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -16,15 +20,25 @@ public class GoodsInfo extends BaseBean {
|
||||
|
||||
private Integer goodBatch;
|
||||
|
||||
//进样点位
|
||||
private Integer pointNum;
|
||||
|
||||
//目标监测物
|
||||
private String goalDetect;
|
||||
|
||||
//条码
|
||||
private String barCode;
|
||||
|
||||
//国标id
|
||||
private Integer flowId;
|
||||
|
||||
private Integer goodsStatus;
|
||||
|
||||
private String desc;
|
||||
|
||||
public GoodsInfo() {
|
||||
}
|
||||
|
||||
public GoodsInfo(Long id, Long createId, LocalDateTime createTime, Long updateId, LocalDateTime updateTime, boolean delSign, String remark) {
|
||||
super(id, createId, createTime, updateId, updateTime, delSign, remark);
|
||||
}
|
||||
|
||||
public String getGoodsName() {
|
||||
return goodsName;
|
||||
}
|
||||
@@ -65,6 +79,46 @@ public class GoodsInfo extends BaseBean {
|
||||
this.goodBatch = goodBatch;
|
||||
}
|
||||
|
||||
public Integer getPointNum() {
|
||||
return pointNum;
|
||||
}
|
||||
|
||||
public void setPointNum(Integer pointNum) {
|
||||
this.pointNum = pointNum;
|
||||
}
|
||||
|
||||
public String getGoalDetect() {
|
||||
return goalDetect;
|
||||
}
|
||||
|
||||
public void setGoalDetect(String goalDetect) {
|
||||
this.goalDetect = goalDetect;
|
||||
}
|
||||
|
||||
public String getBarCode() {
|
||||
return barCode;
|
||||
}
|
||||
|
||||
public void setBarCode(String barCode) {
|
||||
this.barCode = barCode;
|
||||
}
|
||||
|
||||
public Integer getFlowId() {
|
||||
return flowId;
|
||||
}
|
||||
|
||||
public void setFlowId(Integer flowId) {
|
||||
this.flowId = flowId;
|
||||
}
|
||||
|
||||
public Integer getGoodsStatus() {
|
||||
return goodsStatus;
|
||||
}
|
||||
|
||||
public void setGoodsStatus(Integer goodsStatus) {
|
||||
this.goodsStatus = goodsStatus;
|
||||
}
|
||||
|
||||
public String getDesc() {
|
||||
return desc;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,9 @@ public class IslandInfo extends BaseBean {
|
||||
|
||||
private String islandCode;
|
||||
|
||||
//plc映射地址
|
||||
private Integer plcAddr;
|
||||
|
||||
private String islandLogo;
|
||||
|
||||
private String desc;
|
||||
@@ -17,10 +20,6 @@ public class IslandInfo extends BaseBean {
|
||||
public IslandInfo() {
|
||||
}
|
||||
|
||||
public IslandInfo(Long id, Long createId, LocalDateTime createTime, Long updateId, LocalDateTime updateTime, boolean delSign, String remark) {
|
||||
super(id, createId, createTime, updateId, updateTime, delSign, remark);
|
||||
}
|
||||
|
||||
public String getIslandName() {
|
||||
return islandName;
|
||||
}
|
||||
@@ -37,6 +36,14 @@ public class IslandInfo extends BaseBean {
|
||||
this.islandCode = islandCode;
|
||||
}
|
||||
|
||||
public Integer getPlcAddr() {
|
||||
return plcAddr;
|
||||
}
|
||||
|
||||
public void setPlcAddr(Integer plcAddr) {
|
||||
this.plcAddr = plcAddr;
|
||||
}
|
||||
|
||||
public String getIslandLogo() {
|
||||
return islandLogo;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -19,8 +22,10 @@ public class IslandParam extends BaseBean {
|
||||
|
||||
private String formType;
|
||||
|
||||
@JsonIgnore
|
||||
private IslandInfo islandInfo;
|
||||
|
||||
@JsonIgnore
|
||||
private StepInfo stepInfo;
|
||||
|
||||
public IslandParam() {
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.rczn.rcznautoplc.domain;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.rczn.domain.BaseBean;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@@ -17,10 +20,12 @@ public class StepInfo extends BaseBean {
|
||||
private String paramValue;
|
||||
private String formType;
|
||||
|
||||
private Integer stepOrder;
|
||||
private String stepName;
|
||||
|
||||
private String stepDesc;
|
||||
|
||||
@JsonIgnore
|
||||
private IslandInfo islandInfo;
|
||||
|
||||
public StepInfo() {
|
||||
@@ -94,6 +99,14 @@ public class StepInfo extends BaseBean {
|
||||
this.islandId = islandId;
|
||||
}
|
||||
|
||||
public Integer getStepOrder() {
|
||||
return stepOrder;
|
||||
}
|
||||
|
||||
public void setStepOrder(Integer stepOrder) {
|
||||
this.stepOrder = stepOrder;
|
||||
}
|
||||
|
||||
public String getStepName() {
|
||||
return stepName;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.DevInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -23,6 +24,8 @@ public interface DevInfoMapper {
|
||||
// 根据ID查询设备(未删除)
|
||||
DevInfo selectById(@Param("id") Long id);
|
||||
|
||||
//根据设备信息,查询设备信息列表
|
||||
List<DevInfo> selectList(DevInfoQuery devInfo);
|
||||
// 分页查询设备(支持多条件过滤)
|
||||
List<DevInfo> selectPage(DevInfo devInfo);
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.DevParam;
|
||||
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -31,5 +32,9 @@ public interface DevParamMapper {
|
||||
/**
|
||||
* 分页查询设备参数(支持条件过滤)
|
||||
*/
|
||||
List<DevParam> selectPage(DevParam devParam);
|
||||
List<DevParam> selectPage(DevParamQuery devParam);
|
||||
|
||||
Boolean addDevId(@Param("devId") Integer devId,@Param("paramId") Integer paramId);
|
||||
|
||||
Boolean delDevId(@Param("devId")Integer devId,@Param("paramId") Integer paramId);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -12,5 +13,5 @@ public interface GoodsFlowStatusMapper {
|
||||
Boolean update(GoodsFlowStatus goodsFlowStatus);
|
||||
Boolean deleteById(@Param("id") Long id);
|
||||
GoodsFlowStatus selectById(@Param("id") Long id);
|
||||
List<GoodsFlowStatus> selectPage(GoodsFlowStatus goodsFlowStatus);
|
||||
List<GoodsFlowStatus> selectPage(GoodsFlowStatusQuery goodsFlowStatus);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.GoodsInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -9,8 +10,16 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface GoodsInfoMapper {
|
||||
Long insert(GoodsInfo goodsInfo);
|
||||
|
||||
//批量插入样品数据:
|
||||
// Long batchInsert(List<GoodsInfo> goodsInfoList);
|
||||
Boolean update(GoodsInfo goodsInfo);
|
||||
Boolean deleteById(@Param("id") Long id);
|
||||
|
||||
GoodsInfo selectById(@Param("id") Long id);
|
||||
List<GoodsInfo> selectPage(GoodsInfo goodsInfo);
|
||||
|
||||
List<GoodsInfo> selectByIdList(@Param("idList") List<Integer> idList);
|
||||
|
||||
GoodsInfo selectByBarCode(@Param("barCode") String barCode);
|
||||
List<GoodsInfo> selectPage(GoodsInfoQuery goodsInfo);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.IslandInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -12,5 +13,10 @@ public interface IslandInfoMapper {
|
||||
Boolean update(IslandInfo islandInfo);
|
||||
Boolean deleteById(@Param("id") Long id);
|
||||
IslandInfo selectById(@Param("id") Long id);
|
||||
|
||||
/**
|
||||
* 查询功能岛信息List
|
||||
*/
|
||||
List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery);
|
||||
List<IslandInfo> selectPage(IslandInfo islandInfo);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.mapper;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.StepInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -11,6 +12,13 @@ public interface StepInfoMapper {
|
||||
Long insert(StepInfo stepInfo);
|
||||
Boolean update(StepInfo stepInfo);
|
||||
Boolean deleteById(@Param("id") Long id);
|
||||
|
||||
Long deleteBatchByIds(List<Long> ids);
|
||||
StepInfo selectById(@Param("id") Long id);
|
||||
List<StepInfo> selectPage(StepInfo stepInfo);
|
||||
List<StepInfo> selectList(StepInfo stepInfo);
|
||||
List<StepInfo> selectPage(StepInfoQuery stepInfo);
|
||||
|
||||
Long insertBatch(List<StepInfo> stepInfoList);
|
||||
|
||||
Long updateBatch(List<StepInfo> stepInfoList);
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.rczn.rcznautoplc.service;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.DevInfo;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -21,6 +22,15 @@ public interface DevInfoService {
|
||||
// 根据ID查询设备
|
||||
DevInfo getDevInfoById(Long id);
|
||||
|
||||
//根据设备信息查询设备列表数据
|
||||
|
||||
/**
|
||||
* Retrieves a list of device information based on the provided query parameters.
|
||||
*
|
||||
* @param devInfo The query parameters used to filter device information
|
||||
* @return List<DevInfo> A list of device information objects that match the query criteria
|
||||
*/
|
||||
List<DevInfo> getDevInfoList(DevInfoQuery devInfo);
|
||||
// 分页查询设备
|
||||
PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.DevParam;
|
||||
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,9 +11,9 @@ public interface DevParamService {
|
||||
/**
|
||||
* 分页查询
|
||||
*/
|
||||
PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramName, String paramValue);
|
||||
PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId,String paramTypeData, String paramName, String paramValue);
|
||||
|
||||
List<DevParam> selectList(Integer devId, String paramName, String paramValue);
|
||||
List<DevParam> selectList(DevParamQuery queryParam);
|
||||
|
||||
/**
|
||||
* 根据ID查询
|
||||
@@ -29,6 +30,16 @@ public interface DevParamService {
|
||||
*/
|
||||
Boolean update(DevParam devParam);
|
||||
|
||||
/**
|
||||
* 为参数增加devId值
|
||||
*/
|
||||
Boolean addDevId(Integer devId, Integer paramId);
|
||||
|
||||
/**
|
||||
* 根据paramId,减少devIds中的devId
|
||||
*/
|
||||
Boolean reduceDevId(Integer devId, Integer paramId);
|
||||
|
||||
/**
|
||||
* 逻辑删除
|
||||
*/
|
||||
|
||||
@@ -3,9 +3,13 @@ package com.rczn.rcznautoplc.service;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GoodsFlowStatusService {
|
||||
PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, Integer goodsId, Integer flowId, Integer islandId, Integer status);
|
||||
PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, GoodsFlowStatusQuery goodsFlowStatus);
|
||||
List<GoodsFlowStatus> selectList( GoodsFlowStatusQuery goodsFlowStatus);
|
||||
GoodsFlowStatus selectById(Long id);
|
||||
Long insert(GoodsFlowStatus goodsFlowStatus);
|
||||
Boolean update(GoodsFlowStatus goodsFlowStatus);
|
||||
|
||||
@@ -1,25 +1,42 @@
|
||||
package com.rczn.rcznautoplc.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.GoodsInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface GoodsInfoService {
|
||||
/**
|
||||
* 分页查询货物信息
|
||||
*/
|
||||
PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, String goodsName, String goodsType, String goodFrom, Integer goodBatch);
|
||||
PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, GoodsInfoQuery goodsInfo);
|
||||
|
||||
/**
|
||||
* 查询样品信息List
|
||||
*/
|
||||
List<GoodsInfo> selectList(GoodsInfoQuery goodsInfo);
|
||||
|
||||
/**
|
||||
* 根据ID查询货物信息
|
||||
*/
|
||||
GoodsInfo selectById(Long id);
|
||||
|
||||
/**
|
||||
* 根据ID列表查询货物列表信息
|
||||
*/
|
||||
List<GoodsInfo> selectByIdList(List<Integer> ids);
|
||||
|
||||
/**
|
||||
* 新增货物信息
|
||||
*/
|
||||
Long insert(GoodsInfo goodsInfo);
|
||||
|
||||
/**
|
||||
* 扫码新增货物信息
|
||||
*/
|
||||
GoodsInfo insertByScan(GoodsInfo goodsInfo);
|
||||
|
||||
/**
|
||||
* 修改货物信息
|
||||
*/
|
||||
|
||||
@@ -2,11 +2,22 @@ package com.rczn.rcznautoplc.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.GoodsInfo;
|
||||
import com.rczn.rcznautoplc.domain.IslandInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
|
||||
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IslandInfoService {
|
||||
PageInfo<IslandInfo> selectPage(Integer pageNum, Integer pageSize, String islandName, String islandCode);
|
||||
IslandInfo selectById(Long id);
|
||||
|
||||
/**
|
||||
* 查询功能岛信息List
|
||||
*/
|
||||
List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery);
|
||||
|
||||
Long insert(IslandInfo islandInfo);
|
||||
Boolean update(IslandInfo islandInfo);
|
||||
Boolean deleteById(Long id);
|
||||
|
||||
@@ -2,14 +2,32 @@ package com.rczn.rcznautoplc.service;
|
||||
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.rcznautoplc.domain.StepInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
|
||||
|
||||
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);
|
||||
PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, StepInfoQuery stepInfo);
|
||||
List<StepInfo> selectList( StepInfoQuery stepInfo);
|
||||
StepInfo selectById(Long id);
|
||||
Long insert(StepInfo stepInfo);
|
||||
|
||||
Long insertBatch(List<StepInfo> stepInfoList);
|
||||
Boolean update(StepInfo stepInfo);
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
* @param stepInfoList
|
||||
* @return
|
||||
*/
|
||||
Long updateBatch(List<StepInfo> stepInfoList);
|
||||
Boolean deleteById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param ids
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
Long deleteBatchByIds(List<Long> ids);
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.rczn.rcznautoplc.service.impl;
|
||||
|
||||
import com.rczn.rcznautoplc.domain.DevInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.DevInfoQuery;
|
||||
import com.rczn.rcznautoplc.mapper.DevInfoMapper;
|
||||
import com.rczn.rcznautoplc.service.DevInfoService;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -29,6 +30,18 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||
if (devInfo.getCreateTime() == null) {
|
||||
devInfo.setCreateTime(java.time.LocalDateTime.now());
|
||||
}
|
||||
//判断设备是否是PLC,PLC设备只有一个主PLC:company-主站
|
||||
if(devInfo.getDevModel().equals("PLC")&&devInfo.getCompany().equals("主站")){
|
||||
//查询出devModel为PLC,company为“主站”的设备
|
||||
DevInfoQuery devInfo1 = new DevInfoQuery();
|
||||
devInfo1.setDevModel("PLC");
|
||||
devInfo1.setCompany("主站");
|
||||
List<DevInfo> devInfoList = devInfoMapper.selectList(devInfo1);
|
||||
if(devInfoList.size()>0){
|
||||
//如果存在,报错抛出异常
|
||||
throw new RuntimeException("主站PLC设备只能有一个");
|
||||
}
|
||||
}
|
||||
// 调用Mapper新增
|
||||
return devInfoMapper.insert(devInfo) > 0;
|
||||
}
|
||||
@@ -51,6 +64,25 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||
if (devInfo.getUpdateTime() == null) {
|
||||
devInfo.setUpdateTime(java.time.LocalDateTime.now());
|
||||
}
|
||||
|
||||
//判断设备是否是PLC,PLC设备只有一个主PLC:company-主站
|
||||
if(devInfo.getDevModel().equals("PLC")&&devInfo.getCompany().equals("主站")){
|
||||
//查询出devModel为PLC,company为“主站”的设备
|
||||
DevInfoQuery devInfo1 = new DevInfoQuery();
|
||||
devInfo1.setDevModel("PLC");
|
||||
devInfo1.setCompany("主站");
|
||||
List<DevInfo> devInfoList = devInfoMapper.selectList(devInfo1);
|
||||
if(devInfoList.size()>0){
|
||||
for (DevInfo devInfo2 : devInfoList)
|
||||
if(devInfo2.getId().equals(devInfo.getId()))
|
||||
continue;
|
||||
else {
|
||||
//如果存在,报错抛出异常
|
||||
throw new RuntimeException("主站PLC设备只能有一个");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
// 调用Mapper更新
|
||||
return devInfoMapper.updateById(devInfo) > 0;
|
||||
}
|
||||
@@ -61,6 +93,11 @@ public class DevInfoServiceImpl implements DevInfoService {
|
||||
return devInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevInfo> getDevInfoList(DevInfoQuery devInfo) {
|
||||
return devInfoMapper.selectList(devInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<DevInfo> getDevInfoPage(DevInfo devInfo, Integer pageNum, Integer pageSize) {
|
||||
// 分页参数默认值
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.DevParam;
|
||||
import com.rczn.rcznautoplc.domain.query.DevParamQuery;
|
||||
import com.rczn.rcznautoplc.mapper.DevParamMapper;
|
||||
import com.rczn.rcznautoplc.service.DevParamService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,12 +19,13 @@ public class DevParamServiceImpl implements DevParamService {
|
||||
DevParamMapper devParamMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramName, String paramValue) {
|
||||
public PageInfo<DevParam> selectPage(Integer pageNum, Integer pageSize, Integer devId, String paramTypeData, String paramName, String paramValue) {
|
||||
// 1. 开启分页
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
// 2. 构建查询条件
|
||||
DevParam queryParam = new DevParam();
|
||||
DevParamQuery queryParam = new DevParamQuery();
|
||||
queryParam.setDevId(devId);
|
||||
queryParam.setParamTypeData(paramTypeData);
|
||||
queryParam.setParamName(paramName);
|
||||
queryParam.setParamValue(paramValue);
|
||||
// 3. 执行查询
|
||||
@@ -40,12 +42,7 @@ public class DevParamServiceImpl implements DevParamService {
|
||||
* @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);
|
||||
public List<DevParam> selectList(DevParamQuery queryParam) {
|
||||
// 3. 执行查询
|
||||
List<DevParam> list = devParamMapper.selectPage(queryParam);
|
||||
return list;
|
||||
@@ -61,8 +58,8 @@ public class DevParamServiceImpl implements DevParamService {
|
||||
|
||||
@Override
|
||||
public Long insert(DevParam devParam) {
|
||||
if (devParam.getDevId() == null) {
|
||||
throw new IllegalArgumentException("设备ID不能为空");
|
||||
if (devParam.getDevIds() == null) {
|
||||
devParam.setDevIds(";");
|
||||
}
|
||||
if (devParam.getParamName() == null || devParam.getParamName().isEmpty()) {
|
||||
throw new IllegalArgumentException("参数名称不能为空");
|
||||
@@ -78,6 +75,28 @@ public class DevParamServiceImpl implements DevParamService {
|
||||
return devParamMapper.update(devParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 为参数增加devId值
|
||||
*
|
||||
* @param devId
|
||||
* @param paramId
|
||||
*/
|
||||
@Override
|
||||
public Boolean addDevId(Integer devId, Integer paramId) {
|
||||
return devParamMapper.addDevId(devId, paramId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据paramId,减少devIds中的devId
|
||||
*
|
||||
* @param devId
|
||||
* @param paramId
|
||||
*/
|
||||
@Override
|
||||
public Boolean reduceDevId(Integer devId, Integer paramId) {
|
||||
return devParamMapper.delDevId(devId, paramId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteById(Long id) {
|
||||
if (id == null) {
|
||||
|
||||
@@ -56,10 +56,8 @@ public class FlowInfoServiceImpl implements FlowInfoService {
|
||||
if (flowInfo.getFlowName() == null || flowInfo.getFlowName().isEmpty()) {
|
||||
throw new IllegalArgumentException("流程名称不能为空");
|
||||
}
|
||||
if (flowInfo.getFlowIndex() == null) {
|
||||
throw new IllegalArgumentException("流程排序不能为空");
|
||||
}
|
||||
return flowInfoMapper.insert(flowInfo);
|
||||
Long result = flowInfoMapper.insert(flowInfo);
|
||||
return flowInfo.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.GoodsFlowStatus;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsFlowStatusQuery;
|
||||
import com.rczn.rcznautoplc.mapper.GoodsFlowStatusMapper;
|
||||
import com.rczn.rcznautoplc.service.GoodsFlowStatusService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,17 +19,19 @@ public class GoodsFlowStatusServiceImpl implements GoodsFlowStatusService {
|
||||
GoodsFlowStatusMapper goodsFlowStatusMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, Integer goodsId, Integer flowId, Integer islandId, Integer status) {
|
||||
public PageInfo<GoodsFlowStatus> selectPage(Integer pageNum, Integer pageSize, GoodsFlowStatusQuery goodsFlowStatus){
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
GoodsFlowStatus queryParam = new GoodsFlowStatus();
|
||||
queryParam.setGoodsId(goodsId);
|
||||
queryParam.setFlowId(flowId);
|
||||
queryParam.setIslandId(islandId);
|
||||
queryParam.setStatus(status);
|
||||
List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(queryParam);
|
||||
|
||||
List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(goodsFlowStatus);
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<GoodsFlowStatus> selectList(GoodsFlowStatusQuery goodsFlowStatus) {
|
||||
List<GoodsFlowStatus> list = goodsFlowStatusMapper.selectPage(goodsFlowStatus);
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoodsFlowStatus selectById(Long id) {
|
||||
if (id == null) throw new IllegalArgumentException("ID不能为空");
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.domain.PageBean;
|
||||
import com.rczn.rcznautoplc.domain.GoodsInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.GoodsInfoQuery;
|
||||
import com.rczn.rcznautoplc.mapper.GoodsInfoMapper;
|
||||
import com.rczn.rcznautoplc.service.GoodsInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,21 +19,29 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
|
||||
GoodsInfoMapper goodsInfoMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, String goodsName, String goodsType, String goodFrom, Integer goodBatch) {
|
||||
public PageInfo<GoodsInfo> selectPage(Integer pageNum, Integer pageSize, GoodsInfoQuery goodsInfo) {
|
||||
// 开启分页
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
// 构建查询条件
|
||||
GoodsInfo queryParam = new GoodsInfo();
|
||||
queryParam.setGoodsName(goodsName);
|
||||
queryParam.setGoodsType(goodsType);
|
||||
queryParam.setGoodFrom(goodFrom);
|
||||
queryParam.setGoodBatch(goodBatch);
|
||||
|
||||
// 执行查询
|
||||
List<GoodsInfo> list = goodsInfoMapper.selectPage(queryParam);
|
||||
List<GoodsInfo> list = goodsInfoMapper.selectPage(goodsInfo);
|
||||
// 包装分页结果
|
||||
return new PageInfo<>(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询样品信息
|
||||
*
|
||||
* @param goodsInfo
|
||||
*/
|
||||
@Override
|
||||
public List<GoodsInfo> selectList(GoodsInfoQuery goodsInfo) {
|
||||
// 执行查询
|
||||
List<GoodsInfo> list = goodsInfoMapper.selectPage(goodsInfo);
|
||||
// 包装分页结果
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GoodsInfo selectById(Long id) {
|
||||
if (id == null) {
|
||||
@@ -41,6 +50,16 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
|
||||
return goodsInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据ID列表查询货物列表信息
|
||||
*
|
||||
* @param ids
|
||||
*/
|
||||
@Override
|
||||
public List<GoodsInfo> selectByIdList(List<Integer> ids) {
|
||||
return goodsInfoMapper.selectByIdList(ids);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long insert(GoodsInfo goodsInfo) {
|
||||
if (goodsInfo.getGoodsName() == null || goodsInfo.getGoodsName().isEmpty()) {
|
||||
@@ -55,6 +74,35 @@ public class GoodsInfoServiceImpl implements GoodsInfoService {
|
||||
return goodsInfoMapper.insert(goodsInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扫码新增货物信息
|
||||
*
|
||||
* @param goodsInfo
|
||||
*/
|
||||
@Override
|
||||
public GoodsInfo insertByScan(GoodsInfo goodsInfo) {
|
||||
//根据业务扫码录入样品信息有:样品编码,样品类型,样品名称,样品录入时间,点位号
|
||||
|
||||
//根据样品编码查询数据库样品信息
|
||||
GoodsInfo goodsInfo1 = goodsInfoMapper.selectByBarCode(goodsInfo.getBarCode());
|
||||
|
||||
if(goodsInfo1 != null){
|
||||
return goodsInfo1;
|
||||
}
|
||||
|
||||
if (goodsInfo.getGoodsName() == null || goodsInfo.getGoodsName().isEmpty()) {
|
||||
throw new IllegalArgumentException("货物名称不能为空");
|
||||
}
|
||||
if (goodsInfo.getGoodsType() == null || goodsInfo.getGoodsType().isEmpty()) {
|
||||
throw new IllegalArgumentException("货物类型不能为空");
|
||||
}
|
||||
if (goodsInfo.getIncomeTime() == null) {
|
||||
throw new IllegalArgumentException("入库时间不能为空");
|
||||
}
|
||||
goodsInfoMapper.insert(goodsInfo);
|
||||
return goodsInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(GoodsInfo goodsInfo) {
|
||||
if (goodsInfo.getId() == null) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.rcznautoplc.domain.IslandInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.IslandInfoQuery;
|
||||
import com.rczn.rcznautoplc.mapper.IslandInfoMapper;
|
||||
import com.rczn.rcznautoplc.service.IslandInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -32,6 +33,16 @@ public class IslandInfoServiceImpl implements IslandInfoService {
|
||||
return islandInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询功能岛信息List
|
||||
*
|
||||
* @param islandInfoQuery
|
||||
*/
|
||||
@Override
|
||||
public List<IslandInfo> selectList(IslandInfoQuery islandInfoQuery) {
|
||||
return islandInfoMapper.selectList(islandInfoQuery);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long insert(IslandInfo islandInfo) {
|
||||
if (islandInfo.getIslandName() == null || islandInfo.getIslandName().isEmpty()) {
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.rczn.rcznautoplc.service.impl;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.rczn.rcznautoplc.domain.StepInfo;
|
||||
import com.rczn.rcznautoplc.domain.query.StepInfoQuery;
|
||||
import com.rczn.rcznautoplc.mapper.StepInfoMapper;
|
||||
import com.rczn.rcznautoplc.service.StepInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -17,21 +18,15 @@ public class StepInfoServiceImpl implements StepInfoService {
|
||||
StepInfoMapper stepInfoMapper;
|
||||
|
||||
@Override
|
||||
public PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, Integer islandId, String stepName) {
|
||||
public PageInfo<StepInfo> selectPage(Integer pageNum, Integer pageSize, StepInfoQuery stepInfo) {
|
||||
PageHelper.startPage(pageNum, pageSize);
|
||||
StepInfo queryParam = new StepInfo();
|
||||
queryParam.setIslandId(islandId);
|
||||
queryParam.setStepName(stepName);
|
||||
List<StepInfo> list = stepInfoMapper.selectPage(queryParam);
|
||||
List<StepInfo> list = stepInfoMapper.selectPage(stepInfo);
|
||||
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);
|
||||
public List<StepInfo> selectList(StepInfoQuery stepInfo) {
|
||||
List<StepInfo> list = stepInfoMapper.selectPage(stepInfo);
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -41,6 +36,8 @@ public class StepInfoServiceImpl implements StepInfoService {
|
||||
return stepInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Long insert(StepInfo stepInfo) {
|
||||
if (stepInfo.getIslandId() == null) throw new IllegalArgumentException("岛屿ID不能为空");
|
||||
@@ -50,15 +47,43 @@ public class StepInfoServiceImpl implements StepInfoService {
|
||||
return stepInfoMapper.insert(stepInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long insertBatch(List<StepInfo> stepInfoList) {
|
||||
return stepInfoMapper.insertBatch(stepInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean update(StepInfo stepInfo) {
|
||||
if (stepInfo.getId() == null) throw new IllegalArgumentException("ID不能为空");
|
||||
return stepInfoMapper.update(stepInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量更新
|
||||
*
|
||||
* @param stepInfoList
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long updateBatch(List<StepInfo> stepInfoList) {
|
||||
return stepInfoMapper.updateBatch(stepInfoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean deleteById(Long id) {
|
||||
if (id == null) throw new IllegalArgumentException("ID不能为空");
|
||||
return stepInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
*
|
||||
* @param ids
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@Override
|
||||
public Long deleteBatchByIds(List<Long> ids) {
|
||||
return stepInfoMapper.deleteBatchByIds(ids);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<!-- 设备专属字段 -->
|
||||
<sql id="devColumn">
|
||||
island_id, dev_name, dev_model, ip_addr, port, protocol_type, company, status, dev_desc
|
||||
island_id, dev_name, dev_model,plc_addr, ip_addr, port, protocol_type, company, status,run_model, dev_desc
|
||||
</sql>
|
||||
|
||||
<!-- 结果集映射(下划线转驼峰已开启,可简化) -->
|
||||
@@ -25,11 +25,13 @@
|
||||
<result column="island_id" property="islandId"/>
|
||||
<result column="dev_name" property="devName"/>
|
||||
<result column="dev_model" property="devModel"/>
|
||||
<result column="plc_addr" property="plcAddr"/>
|
||||
<result column="ip_addr" property="ipAddr"/>
|
||||
<result column="port" property="port"/>
|
||||
<result column="protocol_type" property="protocolType"/>
|
||||
<result column="company" property="company"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="run_model" property="runModel"/>
|
||||
<result column="dev_desc" property="devDesc"/>
|
||||
</resultMap>
|
||||
|
||||
@@ -41,11 +43,13 @@
|
||||
<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="plcAddr != null">plc_addr,</if>
|
||||
<if test="ipAddr != null and ipAddr != ''">ip_addr,</if>
|
||||
<if test="port != null">port,</if>
|
||||
<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="runModel != null">run_model,</if>
|
||||
<if test="devDesc != null and devDesc != ''">`dev_desc`,</if> <!-- 核心修正:dev_desc → devDesc + 反引号 -->
|
||||
<!-- 通用字段(仅保留必要的人工传入字段,时间字段由数据库/代码自动生成) -->
|
||||
<if test="createId != null">create_id,</if>
|
||||
@@ -61,11 +65,13 @@
|
||||
<if test="islandId != null">#{islandId},</if>
|
||||
<if test="devName != null and devName != ''">#{devName},</if>
|
||||
<if test="devModel != null and devModel != ''">#{devModel},</if>
|
||||
<if test="plcAddr != null ">#{plcAddr},</if>
|
||||
<if test="ipAddr != null and ipAddr != ''">#{ipAddr},</if>
|
||||
<if test="port != null">#{port},</if>
|
||||
<if test="protocolType != null and protocolType != ''">#{protocolType},</if>
|
||||
<if test="company != null and company != ''">#{company},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="runModel != null">#{runModel},</if>
|
||||
<if test="devDesc != null and devDesc != ''">#{devDesc},</if> <!-- 核心修正:dev_desc → devDesc -->
|
||||
<!-- 通用字段(与上方字段一一对应) -->
|
||||
<if test="createId != null">#{createId},</if>
|
||||
@@ -78,7 +84,6 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
|
||||
<!-- 逻辑删除设备 -->
|
||||
<update id="deleteById">
|
||||
UPDATE tb_dev_info
|
||||
@@ -94,11 +99,13 @@
|
||||
<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="plcAddr != null">plc_addr = #{plcAddr},</if>
|
||||
<if test="ipAddr != null and ipAddr != ''">ip_addr = #{ipAddr},</if>
|
||||
<if test="port != null">port = #{port},</if>
|
||||
<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="runModel != null and runModel != ''">#{runModel},</if>
|
||||
<!-- 核心修正:dev_desc → devDesc + 反引号转义 -->
|
||||
<if test="devDesc != null and devDesc != ''">`dev_desc` = #{devDesc},</if>
|
||||
<!-- 通用字段 -->
|
||||
@@ -113,6 +120,7 @@
|
||||
<if test="!(islandId != null
|
||||
or (devName != null and devName != '')
|
||||
or (devModel != null and devModel != '')
|
||||
or plcAddr != null
|
||||
or (ipAddr != null and ipAddr != '')
|
||||
or port != null
|
||||
or (protocolType != null and protocolType != '')
|
||||
@@ -154,6 +162,9 @@
|
||||
<if test="devModel != null and devModel != ''">
|
||||
AND dev_model LIKE CONCAT('%', #{devModel}, '%')
|
||||
</if>
|
||||
<if test="plcAddr != null">
|
||||
and plc_addr = #{plcAddr}
|
||||
</if>
|
||||
<!-- IP地址精准查询 -->
|
||||
<if test="ipAddr != null and ipAddr != ''">
|
||||
AND ip_addr = #{ipAddr}
|
||||
@@ -162,6 +173,9 @@
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="runModel != null and runModel != ''">
|
||||
and run_model = #{runModel}
|
||||
</if>
|
||||
<!-- 协议类型精准查询 -->
|
||||
<if test="protocolType != null and protocolType != ''">
|
||||
AND protocol_type = #{protocolType}
|
||||
@@ -183,12 +197,18 @@
|
||||
<if test="devModel != null and devModel != ''">
|
||||
AND dev_model LIKE CONCAT('%', #{devModel}, '%')
|
||||
</if>
|
||||
<if test="plcAddr != null">
|
||||
and plc_addr = #{plcAddr}
|
||||
</if>
|
||||
<if test="ipAddr != null and ipAddr != ''">
|
||||
AND ip_addr = #{ipAddr}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="runModel != null">
|
||||
AND run_model = #{runModel}
|
||||
</if>
|
||||
<if test="protocolType != null and protocolType != ''">
|
||||
AND protocol_type = #{protocolType}
|
||||
</if>
|
||||
@@ -203,4 +223,44 @@
|
||||
WHERE del_sign = 0
|
||||
ORDER BY id ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据devinfo信息 -->
|
||||
<select id="selectList" resultType="com.rczn.rcznautoplc.domain.DevInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="devColumn"/>
|
||||
FROM tb_dev_info
|
||||
WHERE del_sign = 0
|
||||
<!-- 设备名称模糊查询 -->
|
||||
<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>
|
||||
<if test="plcAddr != null">
|
||||
and plc_addr = #{plcAddr}
|
||||
</if>
|
||||
<!-- IP地址精准查询 -->
|
||||
<if test="ipAddr != null and ipAddr != ''">
|
||||
AND ip_addr = #{ipAddr}
|
||||
</if>
|
||||
<!-- 设备状态精准查询 -->
|
||||
<if test="status != null">
|
||||
AND status = #{status}
|
||||
</if>
|
||||
<if test="runModel != null and runModel != ''">
|
||||
and run_model = #{runModel}
|
||||
</if>
|
||||
<!-- 协议类型精准查询 -->
|
||||
<if test="protocolType != null and protocolType != ''">
|
||||
AND protocol_type = #{protocolType}
|
||||
</if>
|
||||
ORDER BY update_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -8,45 +8,56 @@
|
||||
|
||||
<!-- DevParam 业务字段 -->
|
||||
<sql id="devParamColumn">
|
||||
dev_id, param_name, param_value,param_type,param_unit,form_type, param_desc
|
||||
dev_ids, param_name, plc_addr, dic_data_id, param_value, param_type, param_unit, form_type, param_desc
|
||||
</sql>
|
||||
|
||||
<!-- 新增 -->
|
||||
<!-- 新增:修复逗号缺失问题,统一格式 -->
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_dev_param (
|
||||
<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 (
|
||||
<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>
|
||||
<trim suffixOverrides=",">
|
||||
<if test="devIds != null">dev_ids,</if>
|
||||
<if test="plcAddr != null">plc_addr,</if>
|
||||
<if test="dicDataId != null">dic_data_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 (
|
||||
<trim suffixOverrides=",">
|
||||
<if test="devIds != null">#{devIds},</if>
|
||||
<if test="plcAddr != null">#{plcAddr},</if>
|
||||
<if test="dicDataId != null">#{dicDataId},</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>
|
||||
|
||||
<!-- 更新 -->
|
||||
<!-- 更新:无语法错误,保留原有逻辑 -->
|
||||
<update id="update">
|
||||
UPDATE tb_dev_param
|
||||
<set>
|
||||
<if test="devId != null">dev_id = #{devId},</if>
|
||||
<if test="devIds != null">dev_ids = #{devIds},</if>
|
||||
<if test="plcAddr != null">plc_addr = #{plcAddr},</if>
|
||||
<if test="dicDataId != null">dic_data_id = #{dicDataId},</if>
|
||||
<if test="paramName != null and paramName != ''">param_name = #{paramName},</if>
|
||||
<if test="paramValue != null and paramValue != ''">param_value = #{paramValue},</if>
|
||||
<if test="paramType != null and paramType != ''">param_type = #{paramType},</if>
|
||||
@@ -54,19 +65,21 @@
|
||||
<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>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</update>
|
||||
|
||||
<!-- 逻辑删除 -->
|
||||
<!-- 逻辑删除:增加id非空判断,防止全表更新 -->
|
||||
<update id="deleteById">
|
||||
UPDATE tb_dev_param
|
||||
SET del_sign = 1, update_time = NOW()
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
<if test="id == null">AND 1=2</if>
|
||||
</update>
|
||||
|
||||
<!-- 根据ID查询 -->
|
||||
<!-- 根据ID查询:无语法错误 -->
|
||||
<select id="selectById" resultType="com.rczn.rcznautoplc.domain.DevParam">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
@@ -75,16 +88,39 @@
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</select>
|
||||
|
||||
<!-- 分页查询(条件过滤) -->
|
||||
<!-- 分页查询:修复参数名devId→devIds,优化模糊匹配逻辑 -->
|
||||
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.DevParam">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="devParamColumn"/>
|
||||
FROM tb_dev_param
|
||||
WHERE del_sign = 0
|
||||
<if test="devId != null">AND dev_id = #{devId}</if>
|
||||
<if test="devId != null">
|
||||
AND dev_ids LIKE CONCAT('%;', #{devId}, ';%')
|
||||
</if>
|
||||
|
||||
<if test="paramTypeData != null and paramTypeData != ''">AND dic_data_id in (SELECT id FROM sys_dic_data WHERE dic_value LIKE CONCAT('%', #{paramTypeData}, '%'))</if>
|
||||
<if test="paramName != null and paramName != ''">AND param_name LIKE CONCAT('%', #{paramName}, '%')</if>
|
||||
<if test="paramValue != null and paramValue != ''">AND param_value LIKE CONCAT('%', #{paramValue}, '%')</if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 新增devId:优化分隔符,避免重复拼接; -->
|
||||
<update id="addDevId">
|
||||
UPDATE tb_dev_param
|
||||
SET dev_ids = CASE
|
||||
WHEN dev_ids IS NULL OR dev_ids = '' THEN CONCAT(#{devId}, ';')
|
||||
ELSE CONCAT(dev_ids, #{devId}, ';')
|
||||
END
|
||||
WHERE id = #{paramId}
|
||||
<if test="paramId == null">AND 1=2</if>
|
||||
</update>
|
||||
|
||||
<!-- 删除devId:兼容全匹配场景,清理空字符串 -->
|
||||
<update id="delDevId">
|
||||
UPDATE tb_dev_param
|
||||
SET dev_ids = REPLACE(dev_ids, CONCAT(#{devId}, ';'), '')
|
||||
WHERE id = #{paramId}
|
||||
<if test="paramId == null">AND 1=2</if>
|
||||
</update>
|
||||
</mapper>
|
||||
@@ -6,7 +6,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="goodsFlowStatusColumn">
|
||||
goods_id, flow_id, island_id, flow_sort, status
|
||||
goods_id, flow_id, island_id,dev_id, flow_sort, status
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -14,7 +14,7 @@
|
||||
<include refid="goodsFlowStatusColumn"/>,
|
||||
create_id, create_time, update_id, update_time, del_sign
|
||||
) VALUES (
|
||||
#{goodsId}, #{flowId}, #{islandId}, #{flowSort}, #{status},
|
||||
#{goodsId}, #{flowId}, #{islandId},#{devId}, #{flowSort}, #{status},
|
||||
#{createId}, NOW(), #{updateId}, NOW(), 0
|
||||
)
|
||||
</insert>
|
||||
@@ -26,6 +26,7 @@
|
||||
<if test="flowId != null">flow_id = #{flowId},</if>
|
||||
<if test="islandId != null">island_id = #{islandId},</if>
|
||||
<if test="flowSort != null">flow_sort = #{flowSort},</if>
|
||||
<if test="devId != null">dev_id = #{devId},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="updateId != null">update_id = #{updateId},</if>
|
||||
update_time = NOW()
|
||||
@@ -56,6 +57,7 @@
|
||||
<if test="goodsId != null">AND goods_id = #{goodsId}</if>
|
||||
<if test="flowId != null">AND flow_id = #{flowId}</if>
|
||||
<if test="islandId != null">AND island_id = #{islandId}</if>
|
||||
<if test="devId != null">AND dev_id = #{devId}</if>
|
||||
<if test="status != null">AND status = #{status}</if>
|
||||
ORDER BY flow_sort ASC
|
||||
</select>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="goodsInfoColumn">
|
||||
goods_name, goods_type, income_time, good_from, good_batch, `desc`
|
||||
goods_name, goods_type, income_time, good_from, good_batch,point_num ,goal_detect,bar_code,flow_id,goods_status, `desc`
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -14,7 +14,7 @@
|
||||
<include refid="goodsInfoColumn"/>,
|
||||
create_id, create_time, update_id, update_time, del_sign
|
||||
) VALUES (
|
||||
#{goodsName}, #{goodsType}, #{incomeTime}, #{goodFrom}, #{goodBatch}, #{desc},
|
||||
#{goodsName}, #{goodsType}, #{incomeTime}, #{goodFrom}, #{goodBatch},#{pointNum},#{goalDetect}, #{barCode}, #{flowId}, #{goodsStatus}, #{desc},
|
||||
#{createId}, NOW(), #{updateId}, NOW(), 0
|
||||
)
|
||||
</insert>
|
||||
@@ -27,6 +27,11 @@
|
||||
<if test="incomeTime != null">income_time = #{incomeTime},</if>
|
||||
<if test="goodFrom != null and goodFrom != ''">good_from = #{goodFrom},</if>
|
||||
<if test="goodBatch != null">good_batch = #{goodBatch},</if>
|
||||
<if test="pointNum != null">point_num = #{pointNum},</if>
|
||||
<if test="goalDetect != null">goal_detect = #{goalDetect},</if>
|
||||
<if test="barCode != null and barCode != ''">bar_code = #{barCode},</if>
|
||||
<if test="flowId != null">flow_id = #{flowId},</if>
|
||||
<if test="goodsStatus != null and goodsStatus != ''">goods_status = #{goodsStatus},</if>
|
||||
<if test="desc != null and desc != ''">`desc` = #{desc},</if>
|
||||
<if test="updateId != null">update_id = #{updateId},</if>
|
||||
update_time = NOW()
|
||||
@@ -48,6 +53,20 @@
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</select>
|
||||
|
||||
<!-- 批量根据ID列表查询(新增) -->
|
||||
<select id="selectByIdList" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="goodsInfoColumn"/>
|
||||
FROM tb_goods_info
|
||||
WHERE del_sign = 0
|
||||
AND id IN
|
||||
<foreach collection="idList" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
ORDER BY income_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
@@ -58,6 +77,21 @@
|
||||
<if test="goodsType != null and goodsType != ''">AND goods_type LIKE CONCAT('%', #{goodsType}, '%')</if>
|
||||
<if test="goodFrom != null and goodFrom != ''">AND good_from LIKE CONCAT('%', #{goodFrom}, '%')</if>
|
||||
<if test="goodBatch != null">AND good_batch = #{goodBatch}</if>
|
||||
ORDER BY income_time DESC
|
||||
<if test="pointNum != null">AND point_num = #{pointNum}</if>
|
||||
<if test="goalDetect != null">AND goal_detect = #{goalDetect}</if>
|
||||
<if test="barCode != null and barCode != ''">AND bar_code LIKE CONCAT('%', #{barCode}, '%')</if>
|
||||
<if test="flowId != null and flowId != ''">AND flow_id LIKE CONCAT('%', #{flowId}, '%')</if>
|
||||
<if test="incomeTime != null and incomeTime!=''" >AND income_time = #{incomeTime}</if>
|
||||
<if test="startTime != null" >AND income_time >= #{startTime}</if>
|
||||
<if test="endTime != null" >AND income_time <= #{endTime}</if>
|
||||
<if test="goodsStatus != null and goodsStatus != ''">AND goods_status LIKE CONCAT('%', #{goodsStatus}, '%')</if>
|
||||
ORDER BY income_time,point_num DESC
|
||||
</select>
|
||||
<select id="selectByBarCode" resultType="com.rczn.rcznautoplc.domain.GoodsInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="goodsInfoColumn"/>
|
||||
FROM tb_goods_info
|
||||
WHERE bar_code = #{barCode} AND del_sign = 0
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,7 +6,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="islandInfoColumn">
|
||||
island_name, island_code, island_logo, `desc`
|
||||
island_name, island_code, plc_addr, island_logo, `desc`
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -14,7 +14,7 @@
|
||||
<include refid="islandInfoColumn"/>,
|
||||
create_id, create_time, update_id, update_time, del_sign
|
||||
) VALUES (
|
||||
#{islandName}, #{islandCode}, #{islandLogo}, #{desc},
|
||||
#{islandName}, #{islandCode},#{plcAddr}, #{islandLogo}, #{desc},
|
||||
#{createId}, NOW(), #{updateId}, NOW(), 0
|
||||
)
|
||||
</insert>
|
||||
@@ -24,6 +24,7 @@
|
||||
<set>
|
||||
<if test="islandName != null and islandName != ''">island_name = #{islandName},</if>
|
||||
<if test="islandCode != null and islandCode != ''">island_code = #{islandCode},</if>
|
||||
<if test="plcAddr != null and plcAddr != ''">plc_addr = #{plcAddr},</if>
|
||||
<if test="islandLogo != null and islandLogo != ''">island_logo = #{islandLogo},</if>
|
||||
<if test="desc != null and desc != ''">`desc` = #{desc},</if>
|
||||
<if test="updateId != null">update_id = #{updateId},</if>
|
||||
@@ -46,6 +47,20 @@
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</select>
|
||||
|
||||
<!-- selectList:根据IslandInfo条件查询记录 -->
|
||||
<select id="selectList" resultType="com.rczn.rcznautoplc.domain.query.IslandInfoQuery">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="islandInfoColumn"/>
|
||||
FROM tb_island_info
|
||||
WHERE del_sign = 0
|
||||
<if test="islandName != null and islandName != ''">AND island_name LIKE CONCAT('%', #{islandName}, '%')</if>
|
||||
<if test="islandCode != null and islandCode != ''">AND island_code LIKE CONCAT('%', #{islandCode}, '%')</if>
|
||||
<if test="plcAddr != null ">AND plc_addr = #{plcAddr} </if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- selectPage:根据IslandInfo条件查询分页记录 -->
|
||||
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.IslandInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
@@ -54,6 +69,7 @@
|
||||
WHERE del_sign = 0
|
||||
<if test="islandName != null and islandName != ''">AND island_name LIKE CONCAT('%', #{islandName}, '%')</if>
|
||||
<if test="islandCode != null and islandCode != ''">AND island_code LIKE CONCAT('%', #{islandCode}, '%')</if>
|
||||
<if test="plcAddr != null ">AND plc_addr = #{plcAddr} </if>
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -6,7 +6,7 @@
|
||||
</sql>
|
||||
|
||||
<sql id="stepInfoColumn">
|
||||
island_id,dev_id, step_name, step_desc,flow_id,param_name,param_type,param_unit,param_value,form_type
|
||||
island_id,dev_id,step_order ,step_name, step_desc,flow_id,param_name,param_type,param_unit,param_value,form_type
|
||||
</sql>
|
||||
|
||||
<insert id="insert" useGeneratedKeys="true" keyProperty="id">
|
||||
@@ -21,6 +21,7 @@
|
||||
<!-- 步骤表字段 -->
|
||||
<if test="islandId != null">island_id, </if>
|
||||
<if test="devId != null">dev_id, </if>
|
||||
<if test="stepOrder != null" >step_order, </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>
|
||||
@@ -43,6 +44,7 @@
|
||||
<!-- 步骤表字段 -->
|
||||
<if test="islandId != null">#{islandId}, </if>
|
||||
<if test="devId != null">#{devId}, </if>
|
||||
<if test="stepOrder != null" >#{stepOrder}, </if>
|
||||
<if test="stepName != null and stepName != ''">#{stepName}, </if>
|
||||
<if test="stepDesc != null and stepDesc != ''">#{stepDesc}, </if>
|
||||
<if test="flowId != null">#{flowId}, </if>
|
||||
@@ -57,11 +59,178 @@
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 新增:批量插入SQL -->
|
||||
<insert id="insertBatch" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_step_info (
|
||||
<trim suffixOverrides=",">
|
||||
create_id,
|
||||
create_time,
|
||||
update_id,
|
||||
update_time,
|
||||
remark,
|
||||
del_sign,
|
||||
island_id,
|
||||
dev_id,
|
||||
step_order,
|
||||
step_name,
|
||||
step_desc,
|
||||
flow_id,
|
||||
param_name,
|
||||
param_type,
|
||||
param_unit,
|
||||
param_value,
|
||||
form_type
|
||||
</trim>
|
||||
) VALUES
|
||||
<foreach collection="stepInfoList" item="item" separator=",">
|
||||
(
|
||||
<trim suffixOverrides=",">
|
||||
#{item.createId,jdbcType=BIGINT},
|
||||
NOW(),
|
||||
#{item.updateId,jdbcType=BIGINT},
|
||||
NOW(),
|
||||
<if test="item.remark != null and item.remark != ''">#{item.remark},</if>
|
||||
<if test="item.remark == null or item.remark == ''">null,</if>
|
||||
0,
|
||||
<if test="item.islandId != null">#{item.islandId,jdbcType=INTEGER},</if>
|
||||
<if test="item.islandId == null">null,</if>
|
||||
<if test="item.devId != null">#{item.devId,jdbcType=INTEGER},</if>
|
||||
<if test="item.devId == null">null,</if>
|
||||
<if test="item.stepOrder != null">#{item.stepOrder,jdbcType=INTEGER},</if>
|
||||
<if test="item.stepOrder == null">null,</if>
|
||||
<if test="item.stepName != null and item.stepName != ''">#{item.stepName},</if>
|
||||
<if test="item.stepName == null or item.stepName == ''">null,</if>
|
||||
<if test="item.stepDesc != null and item.stepDesc != ''">#{item.stepDesc},</if>
|
||||
<if test="item.stepDesc == null or item.stepDesc == ''">null,</if>
|
||||
<if test="item.flowId != null">#{item.flowId,jdbcType=INTEGER},</if>
|
||||
<if test="item.flowId == null">null,</if>
|
||||
<if test="item.paramName != null and item.paramName != ''">#{item.paramName},</if>
|
||||
<if test="item.paramName == null or item.paramName == ''">null,</if>
|
||||
<if test="item.paramType != null and item.paramType != ''">#{item.paramType},</if>
|
||||
<if test="item.paramType == null or item.paramType == ''">null,</if>
|
||||
<if test="item.paramUnit != null and item.paramUnit != ''">#{item.paramUnit},</if>
|
||||
<if test="item.paramUnit == null or item.paramUnit == ''">null,</if>
|
||||
<if test="item.paramValue != null and item.paramValue != ''">#{item.paramValue},</if>
|
||||
<if test="item.paramValue == null or item.paramValue == ''">null,</if>
|
||||
<if test="item.formType != null and item.formType != ''">#{item.formType},</if>
|
||||
<if test="item.formType == null or item.formType == ''">null,</if>
|
||||
</trim>
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<update id="updateBatch">
|
||||
<foreach collection="stepInfoList" item="item" separator=";">
|
||||
UPDATE tb_step_info
|
||||
<set>
|
||||
<if test="item.updateId != null">update_id = #{item.updateId,jdbcType=BIGINT},</if>
|
||||
<if test="item.remark != null and item.remark != ''">remark = #{item.remark},</if>
|
||||
|
||||
<if test="item.islandId != null">island_id = #{item.islandId,jdbcType=INTEGER},</if>
|
||||
<if test="item.devId != null">dev_id = #{item.devId,jdbcType=INTEGER},</if>
|
||||
<if test="item.stepOrder != null">step_order = #{item.stepOrder,jdbcType=INTEGER},</if>
|
||||
<if test="item.stepName != null and item.stepName != ''">step_name = #{item.stepName},</if>
|
||||
<if test="item.stepDesc != null and item.stepDesc != ''">step_desc = #{item.stepDesc},</if>
|
||||
<if test="item.flowId != null">flow_id = #{item.flowId,jdbcType=INTEGER},</if>
|
||||
<if test="item.paramName != null and item.paramName != ''">param_name = #{item.paramName},</if>
|
||||
<if test="item.paramType != null and item.paramType != ''">param_type = #{item.paramType},</if>
|
||||
<if test="item.paramUnit != null and item.paramUnit != ''">param_unit = #{item.paramUnit},</if>
|
||||
<if test="item.paramValue != null and item.paramValue != ''">param_value = #{item.paramValue},</if>
|
||||
<if test="item.formType != null and item.formType != ''">form_type = #{item.formType},</if>
|
||||
|
||||
update_time = NOW()
|
||||
</set>
|
||||
WHERE id = #{item.id,jdbcType=BIGINT}
|
||||
AND del_sign = 0
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
<!-- <update id="updateBatch">-->
|
||||
<!-- UPDATE tb_step_info-->
|
||||
<!-- <trim prefix="SET" suffixOverrides=",">-->
|
||||
<!-- <!– 批量更新核心:用CASE WHEN匹配id赋值 –>-->
|
||||
<!-- update_id = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.updateId,jdbcType=BIGINT}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- remark = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.remark}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- island_id = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.islandId,jdbcType=INTEGER}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- dev_id = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.devId,jdbcType=INTEGER}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- step_order = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepOrder,jdbcType=INTEGER}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- step_name = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepName}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- step_desc = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.stepDesc}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- flow_id = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.flowId,jdbcType=INTEGER}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- param_name = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramName}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- param_type = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramType}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- param_unit = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramUnit}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- param_value = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.paramValue}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- form_type = CASE-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" separator="">-->
|
||||
<!-- WHEN id = #{item.id,jdbcType=BIGINT} THEN #{item.formType}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- END,-->
|
||||
<!-- -- 所有记录统一更新update_time-->
|
||||
<!-- update_time = NOW()-->
|
||||
<!-- </trim>-->
|
||||
<!-- <!– 只更新传入的id列表 –>-->
|
||||
<!-- WHERE id IN-->
|
||||
<!-- <foreach collection="stepInfoList" item="item" open="(" separator="," close=")">-->
|
||||
<!-- #{item.id,jdbcType=BIGINT}-->
|
||||
<!-- </foreach>-->
|
||||
<!-- AND del_sign = 0-->
|
||||
<!-- </update>-->
|
||||
|
||||
<update id="update">
|
||||
UPDATE tb_step_info
|
||||
<set>
|
||||
<if test="islandId != null">island_id = #{islandId},</if>
|
||||
<if test="devId != null">dev_id = #{devId},</if>
|
||||
<if test="stepOrder != null" >step_order = #{stepOrder},</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>
|
||||
@@ -83,6 +252,19 @@
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</update>
|
||||
|
||||
<update id="deleteBatchByIds">
|
||||
<if test="ids != null and ids.size() > 0">
|
||||
UPDATE tb_step_info
|
||||
SET del_sign = 1, update_time = NOW()
|
||||
WHERE id in
|
||||
<foreach collection="ids" item="id" separator="," open="(" close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
AND del_sign = 0
|
||||
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<select id="selectById" resultType="com.rczn.rcznautoplc.domain.StepInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
@@ -91,6 +273,39 @@
|
||||
WHERE id = #{id} AND del_sign = 0
|
||||
</select>
|
||||
|
||||
<!-- 适配 List<StepInfo> selectList(StepInfo stepInfo) 接口的SQL -->
|
||||
<select id="selectList" parameterType="com.rczn.rcznautoplc.domain.StepInfo" resultType="com.rczn.rcznautoplc.domain.StepInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
<include refid="stepInfoColumn"/>
|
||||
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="flowId != null">
|
||||
AND flow_id = #{flowId}
|
||||
</if>
|
||||
<if test="stepName != null and stepName != ''">
|
||||
AND step_name LIKE CONCAT('%', #{stepName}, '%')
|
||||
</if>
|
||||
<if test="paramName != null and paramName != ''">
|
||||
AND param_name LIKE CONCAT('%', #{paramName}, '%')
|
||||
</if>
|
||||
<if test="formType != null and formType != ''">
|
||||
AND form_type = #{formType}
|
||||
</if>
|
||||
<if test="stepOrder != null">
|
||||
AND step_order = #{stepOrder}
|
||||
</if>
|
||||
<!-- 排序:按步骤顺序升序、创建时间降序 -->
|
||||
ORDER BY step_order ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<select id="selectPage" resultType="com.rczn.rcznautoplc.domain.StepInfo">
|
||||
SELECT
|
||||
<include refid="baseColumn"/>,
|
||||
|
||||
Reference in New Issue
Block a user