diff --git a/src/main/java/com/iflytop/sgs/app/controller/SolutionsController.java b/src/main/java/com/iflytop/sgs/app/controller/SolutionsController.java deleted file mode 100644 index 66f28fc..0000000 --- a/src/main/java/com/iflytop/sgs/app/controller/SolutionsController.java +++ /dev/null @@ -1,74 +0,0 @@ -package com.iflytop.sgs.app.controller; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import com.iflytop.sgs.app.model.entity.Solutions; -import com.iflytop.sgs.app.service.SolutionsService; -import com.iflytop.sgs.common.base.BasePageQuery; -import com.iflytop.sgs.common.result.PageResult; -import com.iflytop.sgs.common.result.Result; -import com.iflytop.sgs.common.result.ResultCode; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.Parameter; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.*; - -@Tag(name = "溶液管理") -@RestController -@RequestMapping("/api/sols") -@RequiredArgsConstructor -@Slf4j -public class SolutionsController { - private final SolutionsService solutionsService; - - @Operation(summary = "溶液列表") - @GetMapping("/list") - public PageResult getAllSols(BasePageQuery pageQuery) { - IPage result = solutionsService.page(new Page<>(pageQuery.getPageNum(), pageQuery.getPageSize()), null); - return PageResult.success(result); - } - - @Operation(summary = "添加新溶液") - @PostMapping("") - public Result addSolutions(@Valid @RequestBody Solutions solutions) { - Solutions existingSolutions = solutionsService.findByName(solutions.getName()); - if (existingSolutions == null) { - boolean isSuccess = solutionsService.addSolutions(solutions); - if (isSuccess) { - return Result.success(); - } - } else { - return Result.failed(ResultCode.DATA_ALREADY_EXISTS); - } - return Result.failed(); - } - - @Operation(summary = "更新溶液") - @PutMapping("") - public Result updateSolutions(@Valid @RequestBody Solutions solutions) { - Solutions existingSolutions = solutionsService.findByName(solutions.getName()); - if (existingSolutions == null) { - boolean isSuccess = solutionsService.updateSolutions(solutions); - if (isSuccess) { - return Result.success(); - } - } else { - return Result.failed(ResultCode.DATA_ALREADY_EXISTS); - } - return Result.failed(); - } - - @Operation(summary = "删除溶液") - @DeleteMapping("/{ids}") - public Result delete(@Parameter(description = "溶液ID,多个以英文逗号(,)分割") @PathVariable String ids) { - boolean isSuccess = solutionsService.deleteSolutions(ids); - if (isSuccess) { - return Result.success(); - } - return Result.failed(); - } - -} diff --git a/src/main/java/com/iflytop/sgs/app/controller/TrayController.java b/src/main/java/com/iflytop/sgs/app/controller/TrayController.java deleted file mode 100644 index 1e29f15..0000000 --- a/src/main/java/com/iflytop/sgs/app/controller/TrayController.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.iflytop.sgs.app.controller; - -import com.iflytop.sgs.app.core.device.TrayState; -import com.iflytop.sgs.app.model.vo.SetTrayTubeVO; -import com.iflytop.sgs.app.service.TrayService; -import com.iflytop.sgs.common.result.Result; -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -/** - * 托盘控制 - */ -@Tag(name = "托盘控制") -@RestController -@RequestMapping("/api/tray") -@RequiredArgsConstructor -@Slf4j -public class TrayController { - private final TrayService trayService; - - @Operation(summary = "放入新托盘") - @PostMapping("/in") - public Result trayIn() { - return Result.success(trayService.trayIn()); - } - - @Operation(summary = "拿走托盘") - @PostMapping("/out") - public Result trayOut() { - trayService.trayOut(); - return Result.success(); - } - - @Operation(summary = "设置托盘试管") - @PostMapping("/tube") - public Result setTrayTube(@RequestBody SetTrayTubeVO setTrayTubeVO) { - trayService.setTrayTube(setTrayTubeVO); - return Result.success(); - } - -} diff --git a/src/main/resources/sql/init.sql b/src/main/resources/sql/init.sql index 1b168a7..0201cd0 100644 --- a/src/main/resources/sql/init.sql +++ b/src/main/resources/sql/init.sql @@ -16,7 +16,6 @@ INSERT OR IGNORE INTO user (username, nickname, password, role, fixed_user, dele VALUES ('admin', 'Admin', '123456', 'ADMIN', 'ENABLE', 'DISABLE'), ('test', 'test', '123456', 'ADMIN', 'ENABLE', 'DISABLE'); - -- ores 矿石 表 CREATE TABLE IF NOT EXISTS ores ( @@ -25,77 +24,6 @@ CREATE TABLE IF NOT EXISTS ores create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); - - --- crafts 工艺 表 -CREATE TABLE IF NOT EXISTS crafts -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - name VARCHAR NOT NULL, - steps TEXT, - ores_id INTEGER, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - - --- container 容器 表 -CREATE TABLE IF NOT EXISTS container -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - type INTEGER, - code TEXT, - solution_id INTEGER, - pump_id TEXT, - capacity_total INTEGER, - capacity_used INTEGER, - filled REAL, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -INSERT OR IGNORE INTO container (id, type, code, solution_id, pump_id, capacity_total, capacity_used) -VALUES (1, 0, 'container_01', 1, 'acid_pump_01', 5000, 0), - (2, 0, 'container_02', 2, 'acid_pump_02', 5000, 2500), - (3, 0, 'container_03', 3, 'acid_pump_03', 5000, 2600), - (4, 0, 'container_04', 4, 'acid_pump_04', 5000, 4000), - (5, 0, 'container_05', 5, 'acid_pump_05', 5000, 2400), - (6, 0, 'container_06', 6, 'acid_pump_06', 5000, 4500), - (7, 0, 'container_07', 7, 'acid_pump_07', 5000, 4900), - (8, 0, 'container_08', 3, 'acid_pump_08', 5000, 100), - (9, 1, 'container_09', NULL, null, 5000, 0); - - --- solutions 溶液 表 -CREATE TABLE IF NOT EXISTS solutions -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - name VARCHAR NOT NULL, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -INSERT OR IGNORE INTO solutions (id, name, create_time, update_time) -VALUES (1, '硫酸', '2025-02-18 02:44:07', '2025-02-18 02:44:07'), - (2, '盐酸', '2025-02-18 02:44:07', '2025-02-18 02:44:07'), - (3, '硝酸', '2025-02-18 02:44:07', '2025-02-18 02:44:07'), - (4, '氢氟酸', '2025-02-18 02:46:23', '2025-02-18 02:46:23'), - (5, '过氧酸', '2025-02-18 02:46:35', '2025-02-18 02:46:35'), - (6, '磷酸', '2025-02-18 02:46:43', '2025-02-18 02:46:43'), - (7, '纯水', '2025-02-18 02:46:50', '2025-02-18 02:46:50'); - --- 设备配置 表 -CREATE TABLE IF NOT EXISTS device_config -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - device TEXT, - regIndex TEXT, - valueType TEXT, - value TEXT, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - -- 设备位置 表 CREATE TABLE IF NOT EXISTS device_position ( @@ -128,6 +56,28 @@ CREATE TABLE IF NOT EXISTS system_log update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP ); +-- 设备参数 表 +CREATE TABLE IF NOT EXISTS device_param_config +( + id INTEGER PRIMARY KEY AUTOINCREMENT, + mid text, + reg_index text, + reg_val INTEGER, + create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP + +); + +-- crafts 工艺 表 +CREATE TABLE IF NOT EXISTS crafts +( + id INTEGER PRIMARY KEY AUTOINCREMENT, + name VARCHAR NOT NULL, + steps TEXT, + ores_id INTEGER, + create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); -- 实验 表 CREATE TABLE IF NOT EXISTS tasks ( @@ -149,16 +99,4 @@ CREATE TABLE IF NOT EXISTS task_steps task_id INTEGER, step_description TEXT, create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP -); - --- 设备参数 表 -CREATE TABLE IF NOT EXISTS device_param_config -( - id INTEGER PRIMARY KEY AUTOINCREMENT, - mid text, - reg_index text, - reg_val INTEGER, - create_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP, - update_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP - -) \ No newline at end of file +); \ No newline at end of file