update:功能
This commit is contained in:
@@ -16,5 +16,26 @@
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger.core.v3</groupId>
|
||||
<artifactId>swagger-annotations-jakarta</artifactId>
|
||||
<version>2.2.38</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- 排除Spring Boot Maven插件,因为这是一个数据模型模块,不是可执行应用程序 -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.ski.lichuan.mapper;
|
||||
|
||||
import com.ski.lichuan.model.device.Impl.SnowMachineDevice;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface SnowMachineMapper {
|
||||
|
||||
int insert(SnowMachineDevice snowMachineDevice);
|
||||
|
||||
int insertById(SnowMachineDevice snowMachineDevice);
|
||||
|
||||
List<SnowMachineDevice> selectAll();
|
||||
|
||||
SnowMachineDevice selectById(Integer id);
|
||||
|
||||
SnowMachineDevice selectByLora(String lora);
|
||||
|
||||
List<SnowMachineDevice> selectUnboundMachines();
|
||||
|
||||
int count();
|
||||
|
||||
int updateName(SnowMachineDevice snowMachineDevice);
|
||||
|
||||
int updateNameAndLora(SnowMachineDevice snowMachineDevice);
|
||||
|
||||
int deleteById(Integer id);
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.ski.lichuan.mapper;
|
||||
|
||||
import com.ski.lichuan.model.dashboard.TrailPosition;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface TrailPositionMapper {
|
||||
|
||||
List<TrailPosition> selectByTrailId(Integer trailId);
|
||||
|
||||
TrailPosition selectById(Integer id);
|
||||
|
||||
List<TrailPosition> selectAll();
|
||||
|
||||
/**
|
||||
* 获取所有未绑定雪机的雪道位置信息
|
||||
*/
|
||||
List<TrailPosition> selectUnboundPositions();
|
||||
|
||||
List<TrailPosition> selectBoundPositions();
|
||||
|
||||
int insert(TrailPosition trailPosition);
|
||||
|
||||
int update(TrailPosition trailPosition);
|
||||
|
||||
int clearSnowMachine(Integer id);
|
||||
|
||||
int updateSnowMachine(Integer id, Integer snowMachineId);
|
||||
|
||||
/**
|
||||
* 根据雪道位置ID列表查询造雪机设备ID列表
|
||||
*
|
||||
* @param trailPositionIds 雪道位置ID列表
|
||||
* @return 造雪机设备ID列表
|
||||
*/
|
||||
List<Integer> selectDeviceIdsByTrailPositionIds(List<Integer> trailPositionIds);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ski.lichuan.mapper;
|
||||
|
||||
import com.ski.lichuan.model.auth.SysUser;
|
||||
import org.apache.ibatis.annotations.*;
|
||||
|
||||
@Mapper
|
||||
public interface UserMapper {
|
||||
|
||||
@Select("SELECT id, username, password, nickname, status FROM sys_user WHERE username = #{username}")
|
||||
SysUser selectByUsername(@Param("username") String username);
|
||||
|
||||
@Insert("INSERT INTO sys_user(username, password, nickname, status) VALUES(#{username}, #{password}, #{nickname}, #{status})")
|
||||
@Options(useGeneratedKeys = true, keyProperty = "id")
|
||||
int insertUser(SysUser user);
|
||||
|
||||
@Select("SELECT id, username, password, nickname, status FROM sys_user WHERE id = #{id}")
|
||||
SysUser selectById(@Param("id") Long id);
|
||||
}
|
||||
@@ -7,12 +7,20 @@ import org.springframework.security.core.userdetails.UserDetails;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
|
||||
@Schema
|
||||
@Data
|
||||
public class SysUser implements UserDetails {
|
||||
@Schema(description = "用户ID")
|
||||
private Long id;
|
||||
@Schema(description = "用户名")
|
||||
private String username;
|
||||
@Schema(description = "密码")
|
||||
private String password;
|
||||
@Schema(description = "昵称")
|
||||
private String nickname;
|
||||
@Schema(description = "状态")
|
||||
private Integer status; // 1-正常,0-禁用
|
||||
|
||||
// 实现 UserDetails 接口方法
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ski.lichuan.model.common;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum DeviceEnum {
|
||||
SNOW_MAKER("雪机", 1),
|
||||
WATER_PUMP("水泵", 2),
|
||||
;
|
||||
private final String name;
|
||||
private final Integer value;
|
||||
|
||||
DeviceEnum(String name, Integer value) {
|
||||
this.name = name;
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,6 @@ package com.ski.lichuan.model.common;
|
||||
|
||||
|
||||
import lombok.Data;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
@Data
|
||||
public class HttpResponseData<T> {
|
||||
@@ -45,4 +44,17 @@ public class HttpResponseData<T> {
|
||||
response.setMessage(message);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
|
||||
// 增加静态方法便于使用
|
||||
public static <T> HttpResponseData<T> ok(T data) {
|
||||
return new HttpResponseData<>(data);
|
||||
}
|
||||
|
||||
public static <T> HttpResponseData<T> fail(String message) {
|
||||
return new HttpResponseData<T>().error(message);
|
||||
}
|
||||
|
||||
public static <T> HttpResponseData<T> fail(Integer code, String message) {
|
||||
return new HttpResponseData<T>().error(code, message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.ski.lichuan.model.dashboard;
|
||||
|
||||
import com.ski.lichuan.model.device.Impl.SnowMachineDevice;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "造雪机设备状态信息")
|
||||
@Data
|
||||
public class SnowMachineDeviceInfo {
|
||||
|
||||
@Schema(description = "造雪机设备基本信息")
|
||||
public SnowMachineDevice snowMachineDevice;
|
||||
@Schema(description = "前端水压")
|
||||
public Double frontWaterPressure;
|
||||
@Schema(description = "后端水压")
|
||||
public Double backWaterPressure;
|
||||
@Schema(description = "气压")
|
||||
public Double pressure;
|
||||
@Schema(description = "水温")
|
||||
public Double temperature;
|
||||
@Schema(description = "给定开度")
|
||||
public Double givenAngle;
|
||||
@Schema(description = "实际开度")
|
||||
public Double actualAngle;
|
||||
@Schema(description = "是否正常")
|
||||
public Boolean isNormal;
|
||||
@Schema(description = "模式 关1/开2/自动3")
|
||||
public Integer mode;
|
||||
@Schema(description = "空压机状态 关1/开2")
|
||||
public Integer compressorStatus;
|
||||
@Schema(description = "风机状态 关1/开2")
|
||||
public Integer fanStatus;
|
||||
@Schema(description = "加热环状态 关1/开2")
|
||||
public Integer heatingRingStatus;
|
||||
@Schema(description = "电磁阀状态1 关1/开2")
|
||||
public Integer valveStatus;
|
||||
@Schema(description = "电磁阀状态2 关1/开2")
|
||||
public Integer valveStatus2;
|
||||
@Schema(description = "电磁阀状态3 关1/开2")
|
||||
public Integer valveStatus3;
|
||||
@Schema(description = "俯仰模式 关1/开2/自动3")
|
||||
public Integer pitchMode;
|
||||
@Schema(description = "俯仰角度")
|
||||
public Double pitchAngle;
|
||||
@Schema(description = "俯仰状态 关1/开2")
|
||||
public Integer pitchStatus;
|
||||
@Schema(description = "摆头模式 关1/开2/自动3")
|
||||
public Integer yawMode;
|
||||
@Schema(description = "摆头角度")
|
||||
public Double yawAngle;
|
||||
@Schema(description = "摆头状态 关1/开2")
|
||||
public Integer yawStatus;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.ski.lichuan.model.dashboard;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "雪道位置信息")
|
||||
@Data
|
||||
public class TrailPosition {
|
||||
@Schema(description = "ID")
|
||||
public Integer id;
|
||||
@Schema(description = "雪道ID")
|
||||
public Integer trailId;
|
||||
@Schema(description = "位置")
|
||||
public Integer position;
|
||||
@Schema(description = "名称")
|
||||
public String name;
|
||||
@Schema(description = "雪机状态 0无 1正常 2停止")
|
||||
public Integer snowMachineStatus;
|
||||
@Schema(description = "造雪机ID")
|
||||
public Integer snowMachineId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ski.lichuan.model.dashboard;
|
||||
|
||||
import com.ski.lichuan.model.device.config.SnowMachineDeviceParams;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "雪道位置状态")
|
||||
@Data
|
||||
public class TrailPositionInfo {
|
||||
|
||||
@Schema(description = "雪道位置状态信息")
|
||||
public TrailPositionMonitorInfo trailPositionMonitorInfo;
|
||||
// 造雪机信息
|
||||
@Schema(description = "造雪机设备状态信息")
|
||||
public SnowMachineDeviceInfo snowMakerInfo;
|
||||
// 雪机配置
|
||||
@Schema(description = "造雪机配置信息")
|
||||
public SnowMachineDeviceParams snowMakerDeviceParams;
|
||||
// 统计信息
|
||||
@Schema(description = "统计信息")
|
||||
public TrailPositionStatisticsInfo trailPositionStatisticsInfo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.ski.lichuan.model.dashboard;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "雪道位置状态信息")
|
||||
@Data
|
||||
public class TrailPositionMonitorInfo {
|
||||
|
||||
@Schema(description = "雪道位置信息")
|
||||
public TrailPosition trailPosition;
|
||||
|
||||
// 造雪机名称
|
||||
@Schema(description = "造雪机名称")
|
||||
public String snowMakerName;
|
||||
|
||||
// 是否有造雪机
|
||||
@Schema(description = "是否有造雪机")
|
||||
public Boolean hasSnowMaker;
|
||||
// 优先级
|
||||
@Schema(description = "优先级")
|
||||
public Integer priority;
|
||||
// 环境温度
|
||||
@Schema(description = "环境温度")
|
||||
public Double environmentTemperature;
|
||||
// 环境湿度
|
||||
@Schema(description = "环境湿度")
|
||||
public Double environmentHumidity;
|
||||
// 湿球温度
|
||||
@Schema(description = "湿球温度")
|
||||
public Double wetBulbTemperature;
|
||||
|
||||
// 通讯状态
|
||||
@Schema(description = "通讯状态")
|
||||
public Boolean communicationStatus;
|
||||
// 自动模式
|
||||
@Schema(description = "自动模式")
|
||||
public Boolean autoMode;
|
||||
// 是否正常
|
||||
@Schema(description = "是否正常")
|
||||
public Boolean isNormal;
|
||||
// 正常运行
|
||||
@Schema(description = "正常运行")
|
||||
public Boolean isRunning;
|
||||
// 温度条件满足
|
||||
@Schema(description = "温度条件满足")
|
||||
public Boolean temperatureConditionSatisfied;
|
||||
// 风速
|
||||
@Schema(description = "风速")
|
||||
public Double windSpeed;
|
||||
// 风向
|
||||
@Schema(description = "风向")
|
||||
public Double windDirection;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.ski.lichuan.model.dashboard;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "雪道位置统计信息")
|
||||
@Data
|
||||
public class TrailPositionStatisticsInfo {
|
||||
|
||||
|
||||
@Schema(description = "运行时长")
|
||||
public Double runningDuration;
|
||||
@Schema(description = "流量统计")
|
||||
public Double flowStatistics;
|
||||
@Schema(description = "造雪面积")
|
||||
public Double snowArea;
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.ski.lichuan.model.device;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "设备")
|
||||
@Data
|
||||
public abstract class Device {
|
||||
@Schema(description = "设备名称")
|
||||
public String name;
|
||||
@Schema(description = "设备类型")
|
||||
public Integer type;
|
||||
@Schema(description = "设备ID")
|
||||
public Integer id;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ski.lichuan.model.device.Impl;
|
||||
|
||||
import com.ski.lichuan.model.common.DeviceEnum;
|
||||
import com.ski.lichuan.model.device.Device;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
@Schema(description = "造雪机设备")
|
||||
public class SnowMachineDevice extends Device {
|
||||
|
||||
// 设备的LORA地址
|
||||
@Schema(description = "设备的LORA地址")
|
||||
public String lora;
|
||||
|
||||
public SnowMachineDevice() {
|
||||
this.type = DeviceEnum.SNOW_MAKER.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ski.lichuan.model.device.Impl;
|
||||
|
||||
import com.ski.lichuan.model.common.DeviceEnum;
|
||||
import com.ski.lichuan.model.device.Device;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "水泵设备")
|
||||
public class WaterPumpDevice extends Device {
|
||||
|
||||
@Schema(description = "LoRa MAC地址")
|
||||
public String loraMac;
|
||||
|
||||
public WaterPumpDevice() {
|
||||
this.type = DeviceEnum.WATER_PUMP.getValue();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.ski.lichuan.model.device.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "造雪机设备参数")
|
||||
public class SnowMachineDeviceParams {
|
||||
|
||||
// 工作模式 关1/开2/自动3
|
||||
@Schema(description = "工作模式 关1/开2/自动3")
|
||||
public Integer workMode;
|
||||
// 优先级 1-5
|
||||
@Schema(description = "优先级 1-5")
|
||||
public Integer priority;
|
||||
// 雪质 1-5
|
||||
@Schema(description = "雪质 1-5")
|
||||
public Integer snowQuality;
|
||||
// 启动温度 -5.0 ~ 5.0
|
||||
@Schema(description = "启动温度 -5.0 ~ 5.0")
|
||||
public Double startTemperature;
|
||||
// 停止温度 -5.0 ~ 5.0
|
||||
@Schema(description = "停止温度 -5.0 ~ 5.0")
|
||||
public Double stopTemperature;
|
||||
// 流量调节 0 ~ 50
|
||||
@Schema(description = "流量调节 0 ~ 50")
|
||||
public Integer flowAdjustment;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ski.lichuan.model.device.config;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@Schema(description = "造雪机俯仰水平控制参数")
|
||||
public class SnowMachineDevicePitchHorizontalParams {
|
||||
|
||||
|
||||
// 雪机工作模式 关1/开2/自动3
|
||||
@Schema(description = "工作模式 关1/开2/自动3")
|
||||
public Integer workMode;
|
||||
// 俯仰工作模式 关1/开2/自动3
|
||||
@Schema(description = "俯仰工作模式 关1/开2/自动3")
|
||||
public Integer pitchWorkMode;
|
||||
// 水平工作模式 关1/开2/自动3
|
||||
@Schema(description = "水平工作模式 关1/开2/自动3")
|
||||
public Integer horizontalWorkMode;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.ski.lichuan.model.log;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Schema(description = "设备警告记录")
|
||||
public class DeviceWarningRecord {
|
||||
@Schema(description = "警告记录ID")
|
||||
public Integer id;
|
||||
@Schema(description = "警告记录内容")
|
||||
public String content;
|
||||
@Schema(description = "警告记录类型")
|
||||
public String warningType;
|
||||
@Schema(description = "警告记录设备")
|
||||
public String warningDevice;
|
||||
@Schema(description = "警告记录时间")
|
||||
public LocalDateTime warningTime;
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.ski.lichuan.model.log;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
@Schema(description = "操作记录")
|
||||
public class OperationRecord {
|
||||
|
||||
@Schema(description = "操作记录ID")
|
||||
public Integer id;
|
||||
@Schema(description = "操作记录操作人")
|
||||
public String operator;
|
||||
@Schema(description = "操作记录内容")
|
||||
public String content;
|
||||
@Schema(description = "操作记录类型")
|
||||
public String operationType;
|
||||
@Schema(description = "操作记录时间")
|
||||
public LocalDateTime operationTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ski.lichuan.mapper.SnowMachineMapper">
|
||||
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="SnowMachineResultMap" type="com.ski.lichuan.model.device.Impl.SnowMachineDevice">
|
||||
<id column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="lora" property="lora"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 插入造雪机设备 -->
|
||||
<insert id="insert" parameterType="com.ski.lichuan.model.device.Impl.SnowMachineDevice">
|
||||
INSERT INTO snow_machine (name, lora) VALUES (#{name}, #{lora})
|
||||
</insert>
|
||||
|
||||
<!-- 查询所有造雪机设备 -->
|
||||
<select id="selectAll" resultMap="SnowMachineResultMap">
|
||||
SELECT * FROM snow_machine
|
||||
</select>
|
||||
|
||||
<!-- 根据ID查询造雪机设备 -->
|
||||
<select id="selectById" parameterType="java.lang.Integer" resultMap="SnowMachineResultMap">
|
||||
SELECT * FROM snow_machine WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据Lora地址查询造雪机设备 -->
|
||||
<select id="selectByLora" parameterType="java.lang.String" resultMap="SnowMachineResultMap">
|
||||
SELECT * FROM snow_machine WHERE lora = #{lora}
|
||||
</select>
|
||||
|
||||
<!-- 查询未绑定的造雪机设备 -->
|
||||
<select id="selectUnboundMachines" resultMap="SnowMachineResultMap">
|
||||
SELECT sm.* FROM snow_machine sm LEFT JOIN trail_position tp ON sm.id = tp.snow_machine_id WHERE tp.snow_machine_id IS NULL
|
||||
</select>
|
||||
|
||||
<!-- 统计造雪机设备数量 -->
|
||||
<select id="count" resultType="int">
|
||||
SELECT count(*) FROM snow_machine
|
||||
</select>
|
||||
|
||||
<!-- 更新造雪机设备名称 -->
|
||||
<update id="updateName" parameterType="com.ski.lichuan.model.device.Impl.SnowMachineDevice">
|
||||
UPDATE snow_machine SET name = #{name} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 更新造雪机设备名称和Lora地址 -->
|
||||
<update id="updateNameAndLora" parameterType="com.ski.lichuan.model.device.Impl.SnowMachineDevice">
|
||||
UPDATE snow_machine SET name = #{name}, lora = #{lora} WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据ID删除造雪机设备 -->
|
||||
<delete id="deleteById" parameterType="java.lang.Integer">
|
||||
DELETE FROM snow_machine WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 根据ID插入造雪机设备 -->
|
||||
<insert id="insertById" parameterType="com.ski.lichuan.model.device.Impl.SnowMachineDevice">
|
||||
INSERT INTO snow_machine (id, name, lora) VALUES (#{id}, #{name}, #{lora})
|
||||
</insert>
|
||||
</mapper>
|
||||
@@ -0,0 +1,76 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ski.lichuan.mapper.TrailPositionMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.ski.lichuan.model.dashboard.TrailPosition">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="trail_id" jdbcType="INTEGER" property="trailId"/>
|
||||
<result column="position" jdbcType="VARCHAR" property="position"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="snow_machine_id" jdbcType="INTEGER" property="snowMachineId"/>
|
||||
<result column="snow_machine_status" jdbcType="INTEGER" property="snowMachineStatus"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectByTrailId" resultMap="BaseResultMap">
|
||||
SELECT * FROM trail_position WHERE trail_id = #{trailId}
|
||||
</select>
|
||||
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT * FROM trail_position WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" resultMap="BaseResultMap">
|
||||
SELECT * FROM trail_position
|
||||
</select>
|
||||
|
||||
<!-- 获取所有未绑定雪机的雪道位置信息 -->
|
||||
<select id="selectUnboundPositions" resultMap="BaseResultMap">
|
||||
SELECT * FROM trail_position WHERE snow_machine_id IS NULL
|
||||
</select>
|
||||
|
||||
<select id="selectBoundPositions" resultMap="BaseResultMap">
|
||||
SELECT * FROM trail_position WHERE snow_machine_id IS NOT NULL
|
||||
</select>
|
||||
|
||||
<insert id="insert" keyColumn="id" keyProperty="id" useGeneratedKeys="true">
|
||||
INSERT INTO trail_position (trail_id, position, name)
|
||||
VALUES (#{trailId}, #{position}, #{name})
|
||||
</insert>
|
||||
|
||||
<update id="update">
|
||||
UPDATE trail_position
|
||||
SET trail_id = #{trailId}, position = #{position}, name = #{name}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="clearSnowMachine">
|
||||
UPDATE trail_position
|
||||
SET snow_machine_status = 0, snow_machine_id = NULL
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<update id="updateSnowMachine">
|
||||
UPDATE trail_position
|
||||
SET snow_machine_id = #{snowMachineId}
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 根据雪道位置ID列表查询造雪机设备ID列表 -->
|
||||
<select id="selectDeviceIdsByTrailPositionIds" resultType="java.lang.Integer">
|
||||
SELECT snow_machine_id FROM trail_position WHERE id IN
|
||||
<foreach collection="list" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<!-- 清空指定ID列表外的绑定 -->
|
||||
<update id="clearUnboundPositions">
|
||||
UPDATE trail_position
|
||||
SET snow_machine_status = 0, snow_machine_id = NULL
|
||||
WHERE id NOT IN
|
||||
<foreach collection="list" item="id" open="(" close=")" separator=",">
|
||||
#{id}
|
||||
</foreach>
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user