chore(sync): 同步当前工作区全部变更(学员学号可编辑并留空自动生成等)

This commit is contained in:
buliping committed 2026-11-10 13:34:14 +08:00
1 parent 01e949093a
commit f5e8d7f564
531 files changed
+72978 -2720

No files matched your search

+57
View File
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>ruoyi</artifactId>
<groupId>com.ruoyi</groupId>
<version>3.9.2</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>ruoyi-device</artifactId>
<description>
设备模块
</description>
<dependencies>
<!-- 通用工具(之前由根 pom 继承提供,现显式声明避免自引用) -->
<dependency>
<groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId>
</dependency>
<!-- MyBatis持久层 -->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
</dependency>
<!-- 单元测试 -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.21</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>jakarta.validation</groupId>
<artifactId>jakarta.validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>26.0.2</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,72 @@
package com.ruoyi.device.domain;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import com.fasterxml.jackson.annotation.JsonInclude;
/**
* 设备模块本地基础实体。
* 原 RuoYi 约定继承 com.ruoyi.common.core.domain.BaseEntity,
* 但 device 作为后接入模块在 IDE 中常出现 ruoyi-common 依赖无法解析的问题,
* 故在此提供等价本地基类,使本模块可脱离 ruoyi-common 独立编译。
* createTime/updateTime/remark/params 与 BaseEntity 保持一致,Mapper 映射、数据权限、时间范围查询均不受影响。
*
* @author ruoyi
*/
public class BaseDomain
{
private Date createTime;
private Date updateTime;
private String remark;
/** 请求参数 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private Map<String, Object> params;
public Date getCreateTime()
{
return createTime;
}
public void setCreateTime(Date createTime)
{
this.createTime = createTime;
}
public Date getUpdateTime()
{
return updateTime;
}
public void setUpdateTime(Date updateTime)
{
this.updateTime = updateTime;
}
public String getRemark()
{
return remark;
}
public void setRemark(String remark)
{
this.remark = remark;
}
public Map<String, Object> getParams()
{
if (params == null)
{
params = new HashMap<>();
}
return params;
}
public void setParams(Map<String, Object> params)
{
this.params = params;
}
}
@@ -0,0 +1,151 @@
package com.ruoyi.device.domain;
import java.util.Date;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 图书下载回执记录对象 train_book_download_record
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainBookDownloadRecord extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 学员ID */
private Long userId;
/** 设备ID */
private String deviceId;
/** 图书ID */
private String bookId;
/** 图书版本 */
private String bookVersion;
/** 文件MD5 */
private String fileMd5;
/** 下载结果:SUCCESS/FAIL */
private String result;
/** 错误信息 */
private String errMsg;
/** 下载/回执时间 */
private Date downloadTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setBookId(String bookId)
{
this.bookId = bookId;
}
public String getBookId()
{
return bookId;
}
public void setBookVersion(String bookVersion)
{
this.bookVersion = bookVersion;
}
public String getBookVersion()
{
return bookVersion;
}
public void setFileMd5(String fileMd5)
{
this.fileMd5 = fileMd5;
}
public String getFileMd5()
{
return fileMd5;
}
public void setResult(String result)
{
this.result = result;
}
public String getResult()
{
return result;
}
public void setErrMsg(String errMsg)
{
this.errMsg = errMsg;
}
public String getErrMsg()
{
return errMsg;
}
public void setDownloadTime(Date downloadTime)
{
this.downloadTime = downloadTime;
}
public Date getDownloadTime()
{
return downloadTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("deviceId", getDeviceId())
.append("bookId", getBookId())
.append("bookVersion", getBookVersion())
.append("fileMd5", getFileMd5())
.append("result", getResult())
.append("errMsg", getErrMsg())
.append("downloadTime", getDownloadTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,191 @@
package com.ruoyi.device.domain;
import java.util.Date;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 图书快照对象 train_book_snapshot
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainBookSnapshot extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 图书永久ID,永不复用 */
private String bookId;
/** 书名 */
private String bookTitle;
/** SAFETY专业/REGULATION规章等 */
private String bookCategory;
/** 简介 */
private String bookSummary;
/** 版本BV‑xx,递增 */
private String bookVersion;
/** 图书封皮 */
private String bookCover;
/** 文件字节大小 */
private Long fileSize;
/** 文件MD5校验 */
private String fileMd5;
/** 原始文件地址 */
private String downloadUrl;
/** 1上架;0下架禁止新下载,可上报阅读 */
private Integer isOnShelf;
/** 版本发布时间 */
private Date publishTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setBookId(String bookId)
{
this.bookId = bookId;
}
public String getBookId()
{
return bookId;
}
public void setBookTitle(String bookTitle)
{
this.bookTitle = bookTitle;
}
public String getBookTitle()
{
return bookTitle;
}
public void setBookCategory(String bookCategory)
{
this.bookCategory = bookCategory;
}
public String getBookCategory()
{
return bookCategory;
}
public void setBookSummary(String bookSummary)
{
this.bookSummary = bookSummary;
}
public String getBookSummary()
{
return bookSummary;
}
public void setBookVersion(String bookVersion)
{
this.bookVersion = bookVersion;
}
public String getBookVersion()
{
return bookVersion;
}
public String getBookCover() {
return bookCover;
}
public void setBookCover(String bookCover) {
this.bookCover = bookCover;
}
public void setFileSize(Long fileSize)
{
this.fileSize = fileSize;
}
public Long getFileSize()
{
return fileSize;
}
public void setFileMd5(String fileMd5)
{
this.fileMd5 = fileMd5;
}
public String getFileMd5()
{
return fileMd5;
}
public void setDownloadUrl(String downloadUrl)
{
this.downloadUrl = downloadUrl;
}
public String getDownloadUrl()
{
return downloadUrl;
}
public void setIsOnShelf(Integer isOnShelf)
{
this.isOnShelf = isOnShelf;
}
public Integer getIsOnShelf()
{
return isOnShelf;
}
public void setPublishTime(Date publishTime)
{
this.publishTime = publishTime;
}
public Date getPublishTime()
{
return publishTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("bookId", getBookId())
.append("bookTitle", getBookTitle())
.append("bookCategory", getBookCategory())
.append("bookSummary", getBookSummary())
.append("bookVersion", getBookVersion())
.append("bookCover", getBookCover())
.append("fileSize", getFileSize())
.append("fileMd5", getFileMd5())
.append("downloadUrl", getDownloadUrl())
.append("isOnShelf", getIsOnShelf())
.append("publishTime", getPublishTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,371 @@
package com.ruoyi.device.domain;
import java.util.Date;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 报到一体机(自助报到终端)设备对象 train_checkin_terminal
*
* @author ruoyi
* @date 2026-10-24
*/
public class TrainCheckinTerminal extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 自增主键 */
@Excel(name = "ID")
private Long id;
/** 终端业务ID(对接同步/注册使用) */
@Excel(name = "终端业务ID")
private String terminalId;
/** 硬件序列号(12位字母数字,唯一) */
@Excel(name = "硬件序列号")
private String terminalSn;
/** 设备名称,如“基地大厅1号报到机” */
@Excel(name = "设备名称")
private String terminalName;
/** 绑定机构/基地ID(服务多班,不绑单一教室) */
@Excel(name = "绑定机构ID")
private String bindDeptId;
/** 安装位置,如“1号楼大厅” */
@Excel(name = "安装位置")
private String installLocation;
/** 支持的报到方式:ID_CARD,FACE,STUDENT_NO */
@Excel(name = "报到方式")
private String supportCheckinType;
/** 启用模块:CHECKIN,INQUIRY,STATS,SETTINGS */
@Excel(name = "启用模块")
private String supportModules;
/** 是否支持打印 Y/N */
@Excel(name = "打印支持", readConverterExp = "Y=是,N=否")
private String supportPrint;
/** 是否语音播报 Y/N */
@Excel(name = "语音播报", readConverterExp = "Y=是,N=否")
private String supportBroadcast;
/** 联系电话(欢迎页底部) */
@Excel(name = "联系电话")
private String contactPhone;
/** 欢迎语 */
@Excel(name = "欢迎语")
private String welcomeTitle;
/** 顶部机构名称(不填则取绑定机构) */
@Excel(name = "机构名称")
private String orgName;
/** 屏幕方向 LANDSCAPE/PORTRAIT */
@Excel(name = "屏幕方向")
private String screenOrientation;
/** 无操作自动返回首页秒数 */
@Excel(name = "返回首页秒数")
private Integer idleReturnSeconds;
/** 使用帮助文案 */
@Excel(name = "帮助文案")
private String helpText;
/** 设备IP地址 */
@Excel(name = "设备IP")
private String terminalIp;
/** 设备通讯/识别服务端点 */
@Excel(name = "服务端点")
private String apiEndpoint;
/** 设备状态 0离线 1在线 */
@Excel(name = "设备状态", readConverterExp = "0=离线,1=在线")
private Integer terminalStatus;
/** 最后心跳时间 */
@Excel(name = "最近心跳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lastHeartbeat;
/** 删除标志 0存在 2删除 */
private String delFlag;
/** 创建者 */
@Excel(name = "创建者")
private String createBy;
/** 更新者 */
@Excel(name = "更新者")
private String updateBy;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setTerminalId(String terminalId)
{
this.terminalId = terminalId;
}
public String getTerminalId()
{
return terminalId;
}
public void setTerminalSn(String terminalSn)
{
this.terminalSn = terminalSn;
}
public String getTerminalSn()
{
return terminalSn;
}
public void setTerminalName(String terminalName)
{
this.terminalName = terminalName;
}
public String getTerminalName()
{
return terminalName;
}
public void setBindDeptId(String bindDeptId)
{
this.bindDeptId = bindDeptId;
}
public String getBindDeptId()
{
return bindDeptId;
}
public void setInstallLocation(String installLocation)
{
this.installLocation = installLocation;
}
public String getInstallLocation()
{
return installLocation;
}
public void setSupportCheckinType(String supportCheckinType)
{
this.supportCheckinType = supportCheckinType;
}
public String getSupportCheckinType()
{
return supportCheckinType;
}
public void setSupportModules(String supportModules)
{
this.supportModules = supportModules;
}
public String getSupportModules()
{
return supportModules;
}
public void setSupportPrint(String supportPrint)
{
this.supportPrint = supportPrint;
}
public String getSupportPrint()
{
return supportPrint;
}
public void setSupportBroadcast(String supportBroadcast)
{
this.supportBroadcast = supportBroadcast;
}
public String getSupportBroadcast()
{
return supportBroadcast;
}
public void setContactPhone(String contactPhone)
{
this.contactPhone = contactPhone;
}
public String getContactPhone()
{
return contactPhone;
}
public void setWelcomeTitle(String welcomeTitle)
{
this.welcomeTitle = welcomeTitle;
}
public String getWelcomeTitle()
{
return welcomeTitle;
}
public void setOrgName(String orgName)
{
this.orgName = orgName;
}
public String getOrgName()
{
return orgName;
}
public void setScreenOrientation(String screenOrientation)
{
this.screenOrientation = screenOrientation;
}
public String getScreenOrientation()
{
return screenOrientation;
}
public void setIdleReturnSeconds(Integer idleReturnSeconds)
{
this.idleReturnSeconds = idleReturnSeconds;
}
public Integer getIdleReturnSeconds()
{
return idleReturnSeconds;
}
public void setHelpText(String helpText)
{
this.helpText = helpText;
}
public String getHelpText()
{
return helpText;
}
public void setTerminalIp(String terminalIp)
{
this.terminalIp = terminalIp;
}
public String getTerminalIp()
{
return terminalIp;
}
public void setApiEndpoint(String apiEndpoint)
{
this.apiEndpoint = apiEndpoint;
}
public String getApiEndpoint()
{
return apiEndpoint;
}
public void setTerminalStatus(Integer terminalStatus)
{
this.terminalStatus = terminalStatus;
}
public Integer getTerminalStatus()
{
return terminalStatus;
}
public void setLastHeartbeat(Date lastHeartbeat)
{
this.lastHeartbeat = lastHeartbeat;
}
public Date getLastHeartbeat()
{
return lastHeartbeat;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setCreateBy(String createBy)
{
this.createBy = createBy;
}
public String getCreateBy()
{
return createBy;
}
public void setUpdateBy(String updateBy)
{
this.updateBy = updateBy;
}
public String getUpdateBy()
{
return updateBy;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("terminalId", getTerminalId())
.append("terminalSn", getTerminalSn())
.append("terminalName", getTerminalName())
.append("bindDeptId", getBindDeptId())
.append("installLocation", getInstallLocation())
.append("supportCheckinType", getSupportCheckinType())
.append("supportModules", getSupportModules())
.append("supportPrint", getSupportPrint())
.append("supportBroadcast", getSupportBroadcast())
.append("contactPhone", getContactPhone())
.append("welcomeTitle", getWelcomeTitle())
.append("orgName", getOrgName())
.append("screenOrientation", getScreenOrientation())
.append("idleReturnSeconds", getIdleReturnSeconds())
.append("helpText", getHelpText())
.append("terminalIp", getTerminalIp())
.append("apiEndpoint", getApiEndpoint())
.append("terminalStatus", getTerminalStatus())
.append("lastHeartbeat", getLastHeartbeat())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,179 @@
package com.ruoyi.device.domain;
import java.util.Date;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 读书机设备档案对象 train_iot_device
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainIotDevice extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 读书机设备唯一编码deviceId */
private String deviceId;
/** deviceSecret SHA256摘要,不存明文 */
private String deviceSecretDigest;
/** 1正常 2禁用 3恢复出厂 */
private Integer deviceStatus;
/** 固件版本 */
private String firmwareVersion;
/** APP版本 */
private String appVersion;
/** 绑定机构 */
private String bindOrgId;
/** 绑定班级,多班级逗号分隔 */
private String bindClassId;
/** 心跳周期秒 */
private Integer heartbeatInterval;
/** 最后登录时间 */
private Date lastLoginTime;
/** 最后心跳时间 */
private Date lastHeartbeatTime;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setDeviceSecretDigest(String deviceSecretDigest)
{
this.deviceSecretDigest = deviceSecretDigest;
}
public String getDeviceSecretDigest()
{
return deviceSecretDigest;
}
public void setDeviceStatus(Integer deviceStatus)
{
this.deviceStatus = deviceStatus;
}
public Integer getDeviceStatus()
{
return deviceStatus;
}
public void setFirmwareVersion(String firmwareVersion)
{
this.firmwareVersion = firmwareVersion;
}
public String getFirmwareVersion()
{
return firmwareVersion;
}
public void setAppVersion(String appVersion)
{
this.appVersion = appVersion;
}
public String getAppVersion()
{
return appVersion;
}
public void setBindOrgId(String bindOrgId)
{
this.bindOrgId = bindOrgId;
}
public String getBindOrgId()
{
return bindOrgId;
}
public void setBindClassId(String bindClassId)
{
this.bindClassId = bindClassId;
}
public String getBindClassId()
{
return bindClassId;
}
public void setHeartbeatInterval(Integer heartbeatInterval)
{
this.heartbeatInterval = heartbeatInterval;
}
public Integer getHeartbeatInterval()
{
return heartbeatInterval;
}
public void setLastLoginTime(Date lastLoginTime)
{
this.lastLoginTime = lastLoginTime;
}
public Date getLastLoginTime()
{
return lastLoginTime;
}
public void setLastHeartbeatTime(Date lastHeartbeatTime)
{
this.lastHeartbeatTime = lastHeartbeatTime;
}
public Date getLastHeartbeatTime()
{
return lastHeartbeatTime;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deviceId", getDeviceId())
.append("deviceSecretDigest", getDeviceSecretDigest())
.append("deviceStatus", getDeviceStatus())
.append("firmwareVersion", getFirmwareVersion())
.append("appVersion", getAppVersion())
.append("bindOrgId", getBindOrgId())
.append("bindClassId", getBindClassId())
.append("heartbeatInterval", getHeartbeatInterval())
.append("lastLoginTime", getLastLoginTime())
.append("lastHeartbeatTime", getLastHeartbeatTime())
.append("createTime", getCreateTime())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,164 @@
package com.ruoyi.device.domain;
import java.math.BigDecimal;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 备选冲突续读进度对象 train_reading_alternate_progress
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainReadingAlternateProgress extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 学员sys_user.userId */
private Long userId;
/** 图书永久ID */
private String bookId;
/** read / audio */
private String mode;
/** 进度绑定版本 */
private String bookVersion;
/** 当前页 */
private Integer pageNo;
/** TTS句子索引 */
private Integer sentenceIndex;
/** 0‑1进度 */
private BigDecimal progress;
/** 来源上报recordId */
private String sourceRecordId;
/** 来源sessionId */
private String sourceSessionId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setBookId(String bookId)
{
this.bookId = bookId;
}
public String getBookId()
{
return bookId;
}
public void setMode(String mode)
{
this.mode = mode;
}
public String getMode()
{
return mode;
}
public void setBookVersion(String bookVersion)
{
this.bookVersion = bookVersion;
}
public String getBookVersion()
{
return bookVersion;
}
public void setPageNo(Integer pageNo)
{
this.pageNo = pageNo;
}
public Integer getPageNo()
{
return pageNo;
}
public void setSentenceIndex(Integer sentenceIndex)
{
this.sentenceIndex = sentenceIndex;
}
public Integer getSentenceIndex()
{
return sentenceIndex;
}
public void setProgress(BigDecimal progress)
{
this.progress = progress;
}
public BigDecimal getProgress()
{
return progress;
}
public void setSourceRecordId(String sourceRecordId)
{
this.sourceRecordId = sourceRecordId;
}
public String getSourceRecordId()
{
return sourceRecordId;
}
public void setSourceSessionId(String sourceSessionId)
{
this.sourceSessionId = sourceSessionId;
}
public String getSourceSessionId()
{
return sourceSessionId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("bookId", getBookId())
.append("mode", getMode())
.append("bookVersion", getBookVersion())
.append("pageNo", getPageNo())
.append("sentenceIndex", getSentenceIndex())
.append("progress", getProgress())
.append("sourceRecordId", getSourceRecordId())
.append("sourceSessionId", getSourceSessionId())
.append("createTime", getCreateTime())
.toString();
}
}
@@ -0,0 +1,164 @@
package com.ruoyi.device.domain;
import java.math.BigDecimal;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 学员主续读进度对象 train_reading_current_progress
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainReadingCurrentProgress extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 学员sys_user.userId */
private Long userId;
/** 图书永久ID */
private String bookId;
/** read / audio */
private String mode;
/** 进度绑定版本 */
private String bookVersion;
/** 当前页 */
private Integer pageNo;
/** TTS句子索引 */
private Integer sentenceIndex;
/** 0‑1进度 */
private BigDecimal progress;
/** 来源上报recordId */
private String sourceRecordId;
/** 来源sessionId */
private String sourceSessionId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setBookId(String bookId)
{
this.bookId = bookId;
}
public String getBookId()
{
return bookId;
}
public void setMode(String mode)
{
this.mode = mode;
}
public String getMode()
{
return mode;
}
public void setBookVersion(String bookVersion)
{
this.bookVersion = bookVersion;
}
public String getBookVersion()
{
return bookVersion;
}
public void setPageNo(Integer pageNo)
{
this.pageNo = pageNo;
}
public Integer getPageNo()
{
return pageNo;
}
public void setSentenceIndex(Integer sentenceIndex)
{
this.sentenceIndex = sentenceIndex;
}
public Integer getSentenceIndex()
{
return sentenceIndex;
}
public void setProgress(BigDecimal progress)
{
this.progress = progress;
}
public BigDecimal getProgress()
{
return progress;
}
public void setSourceRecordId(String sourceRecordId)
{
this.sourceRecordId = sourceRecordId;
}
public String getSourceRecordId()
{
return sourceRecordId;
}
public void setSourceSessionId(String sourceSessionId)
{
this.sourceSessionId = sourceSessionId;
}
public String getSourceSessionId()
{
return sourceSessionId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("bookId", getBookId())
.append("mode", getMode())
.append("bookVersion", getBookVersion())
.append("pageNo", getPageNo())
.append("sentenceIndex", getSentenceIndex())
.append("progress", getProgress())
.append("sourceRecordId", getSourceRecordId())
.append("sourceSessionId", getSourceSessionId())
.append("updateTime", getUpdateTime())
.toString();
}
}
@@ -0,0 +1,277 @@
package com.ruoyi.device.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 阅读上报幂等日志对象 train_reading_duration_log
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainReadingDurationLog extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** 上报设备deviceId */
private String deviceId;
/** 学员sys_user.userId */
private Long userId;
/** 归属业务sessionId */
private String sessionId;
/** 设备幂等recordId */
private String recordId;
/** 图书永久ID */
private String bookId;
/** 阅读绑定图书版本 */
private String bookVersion;
/** read / audio */
private String mode;
/** PROGRESS / END */
private String recordType;
/** 有效时长秒 */
private Integer durationSec;
/** 已朗读时长秒 */
private Integer readSec;
/** 起始页 */
private Integer pageFrom;
/** 结束页 */
private Integer pageTo;
/** 0‑1进度 */
private BigDecimal progress;
/** 阅读开始 */
private Date startTime;
/** 阅读结束 */
private Date endTime;
/** 接收时间 */
private Date receiveTime;
/** ACCEPTED / DUPLICATE / CONFLICT_SAVED / REJECTED */
private String resultCode;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setSessionId(String sessionId)
{
this.sessionId = sessionId;
}
public String getSessionId()
{
return sessionId;
}
public void setRecordId(String recordId)
{
this.recordId = recordId;
}
public String getRecordId()
{
return recordId;
}
public void setBookId(String bookId)
{
this.bookId = bookId;
}
public String getBookId()
{
return bookId;
}
public void setBookVersion(String bookVersion)
{
this.bookVersion = bookVersion;
}
public String getBookVersion()
{
return bookVersion;
}
public void setMode(String mode)
{
this.mode = mode;
}
public String getMode()
{
return mode;
}
public void setRecordType(String recordType)
{
this.recordType = recordType;
}
public String getRecordType()
{
return recordType;
}
public void setDurationSec(Integer durationSec)
{
this.durationSec = durationSec;
}
public Integer getDurationSec()
{
return durationSec;
}
public void setReadSec(Integer readSec)
{
this.readSec = readSec;
}
public Integer getReadSec()
{
return readSec;
}
public void setPageFrom(Integer pageFrom)
{
this.pageFrom = pageFrom;
}
public Integer getPageFrom()
{
return pageFrom;
}
public void setPageTo(Integer pageTo)
{
this.pageTo = pageTo;
}
public Integer getPageTo()
{
return pageTo;
}
public void setProgress(BigDecimal progress)
{
this.progress = progress;
}
public BigDecimal getProgress()
{
return progress;
}
public void setStartTime(Date startTime)
{
this.startTime = startTime;
}
public Date getStartTime()
{
return startTime;
}
public void setEndTime(Date endTime)
{
this.endTime = endTime;
}
public Date getEndTime()
{
return endTime;
}
public void setReceiveTime(Date receiveTime)
{
this.receiveTime = receiveTime;
}
public Date getReceiveTime()
{
return receiveTime;
}
public void setResultCode(String resultCode)
{
this.resultCode = resultCode;
}
public String getResultCode()
{
return resultCode;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("deviceId", getDeviceId())
.append("userId", getUserId())
.append("sessionId", getSessionId())
.append("recordId", getRecordId())
.append("bookId", getBookId())
.append("bookVersion", getBookVersion())
.append("mode", getMode())
.append("recordType", getRecordType())
.append("durationSec", getDurationSec())
.append("readSec", getReadSec())
.append("pageFrom", getPageFrom())
.append("pageTo", getPageTo())
.append("progress", getProgress())
.append("startTime", getStartTime())
.append("endTime", getEndTime())
.append("receiveTime", getReceiveTime())
.append("resultCode", getResultCode())
.append("remark", getRemark())
.toString();
}
}
@@ -0,0 +1,149 @@
package com.ruoyi.device.domain;
import java.util.Date;
import com.ruoyi.device.domain.BaseDomain;
import com.ruoyi.device.util.ToStringBuilder;
import com.ruoyi.device.util.ToStringStyle;
/**
* 学员业务会话对象 train_user_session
*
* @author ruoyi
* @date 2026-10-20
*/
public class TrainUserSession extends BaseDomain
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long id;
/** sys_user学员主键userId */
private Long userId;
/** 业务会话ID,业务幂等标识 */
private String sessionId;
/** 关联读书机deviceId */
private String deviceId;
/** 1 ACTIVE正常在线;2 REPLACED被替换仅允许补交记录;3 LOGOUT已主动退出 */
private Integer sessionStatus;
/** 登录时间 */
private Date loginTime;
/** 被顶替时间 */
private Date replaceTime;
/** 退出时间 */
private Date logoutTime;
/** 对应RuoYi Redis loginUser key,用于踢下线 */
private String ruoyiTokenKey;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setUserId(Long userId)
{
this.userId = userId;
}
public Long getUserId()
{
return userId;
}
public void setSessionId(String sessionId)
{
this.sessionId = sessionId;
}
public String getSessionId()
{
return sessionId;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setSessionStatus(Integer sessionStatus)
{
this.sessionStatus = sessionStatus;
}
public Integer getSessionStatus()
{
return sessionStatus;
}
public void setLoginTime(Date loginTime)
{
this.loginTime = loginTime;
}
public Date getLoginTime()
{
return loginTime;
}
public void setReplaceTime(Date replaceTime)
{
this.replaceTime = replaceTime;
}
public Date getReplaceTime()
{
return replaceTime;
}
public void setLogoutTime(Date logoutTime)
{
this.logoutTime = logoutTime;
}
public Date getLogoutTime()
{
return logoutTime;
}
public void setRuoyiTokenKey(String ruoyiTokenKey)
{
this.ruoyiTokenKey = ruoyiTokenKey;
}
public String getRuoyiTokenKey()
{
return ruoyiTokenKey;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("userId", getUserId())
.append("sessionId", getSessionId())
.append("deviceId", getDeviceId())
.append("sessionStatus", getSessionStatus())
.append("loginTime", getLoginTime())
.append("replaceTime", getReplaceTime())
.append("logoutTime", getLogoutTime())
.append("ruoyiTokenKey", getRuoyiTokenKey())
.toString();
}
}
@@ -0,0 +1,25 @@
package com.ruoyi.device.mapper;
import java.util.List;
import com.ruoyi.device.domain.TrainBookDownloadRecord;
/**
* 图书下载回执记录 Mapper 接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainBookDownloadRecordMapper
{
public TrainBookDownloadRecord selectTrainBookDownloadRecordById(Long id);
public List<TrainBookDownloadRecord> selectTrainBookDownloadRecordList(TrainBookDownloadRecord record);
public int insertTrainBookDownloadRecord(TrainBookDownloadRecord record);
public int updateTrainBookDownloadRecord(TrainBookDownloadRecord record);
public int deleteTrainBookDownloadRecordById(Long id);
public int deleteTrainBookDownloadRecordByIds(Long[] ids);
}
@@ -0,0 +1,30 @@
package com.ruoyi.device.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainBookSnapshot;
/**
* 图书快照Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainBookSnapshotMapper
{
public TrainBookSnapshot selectTrainBookSnapshotById(Long id);
public List<TrainBookSnapshot> selectTrainBookSnapshotList(TrainBookSnapshot trainBookSnapshot);
public int insertTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot);
public int updateTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot);
public int deleteTrainBookSnapshotById(Long id);
public int deleteTrainBookSnapshotByIds(Long[] ids);
public List<TrainBookSnapshot> selectOnShelfList(@Param("bookCategory") String bookCategory);
public TrainBookSnapshot selectByBookIdAndVersion(@Param("bookId") String bookId, @Param("bookVersion") String bookVersion);
}
@@ -0,0 +1,28 @@
package com.ruoyi.device.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainCheckinTerminal;
/**
* 报到一体机(自助报到终端)Mapper接口
*
* @author ruoyi
* @date 2026-10-24
*/
public interface TrainCheckinTerminalMapper
{
public TrainCheckinTerminal selectTrainCheckinTerminalById(Long id);
public List<TrainCheckinTerminal> selectTrainCheckinTerminalList(TrainCheckinTerminal trainCheckinTerminal);
public int insertTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal);
public int updateTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal);
public int deleteTrainCheckinTerminalById(Long id);
public int deleteTrainCheckinTerminalByIds(Long[] ids);
public TrainCheckinTerminal selectTrainCheckinTerminalByTerminalId(String terminalId);
}
@@ -0,0 +1,31 @@
package com.ruoyi.device.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainIotDevice;
/**
* 读书机设备档案Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainIotDeviceMapper
{
public TrainIotDevice selectTrainIotDeviceById(Long id);
public List<TrainIotDevice> selectTrainIotDeviceList(TrainIotDevice trainIotDevice);
public int insertTrainIotDevice(TrainIotDevice trainIotDevice);
public int updateTrainIotDevice(TrainIotDevice trainIotDevice);
public int deleteTrainIotDeviceById(Long id);
public int deleteTrainIotDeviceByIds(Long[] ids);
public TrainIotDevice selectTrainIotDeviceByDeviceId(String deviceId);
public int updateHeartbeatByDeviceId(@Param("deviceId") String deviceId, @Param("lastHeartbeatTime") Date lastHeartbeatTime, @Param("deviceStatus") Integer deviceStatus);
}
@@ -0,0 +1,28 @@
package com.ruoyi.device.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainReadingAlternateProgress;
/**
* 备选冲突续读进度Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainReadingAlternateProgressMapper
{
public TrainReadingAlternateProgress selectTrainReadingAlternateProgressById(Long id);
public List<TrainReadingAlternateProgress> selectTrainReadingAlternateProgressList(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int insertTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int updateTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int deleteTrainReadingAlternateProgressById(Long id);
public int deleteTrainReadingAlternateProgressByIds(Long[] ids);
public List<TrainReadingAlternateProgress> selectListByUserBookMode(@Param("userId") Long userId, @Param("bookId") String bookId, @Param("mode") String mode);
}
@@ -0,0 +1,30 @@
package com.ruoyi.device.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainReadingCurrentProgress;
/**
* 学员主续读进度Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainReadingCurrentProgressMapper
{
public TrainReadingCurrentProgress selectTrainReadingCurrentProgressById(Long id);
public List<TrainReadingCurrentProgress> selectTrainReadingCurrentProgressList(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int insertTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int updateTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int deleteTrainReadingCurrentProgressById(Long id);
public int deleteTrainReadingCurrentProgressByIds(Long[] ids);
public TrainReadingCurrentProgress selectByUserBookMode(@Param("userId") Long userId, @Param("bookId") String bookId, @Param("mode") String mode);
public List<TrainReadingCurrentProgress> selectListByUserId(@Param("userId") Long userId);
}
@@ -0,0 +1,30 @@
package com.ruoyi.device.mapper;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainReadingDurationLog;
/**
* 阅读上报幂等日志Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainReadingDurationLogMapper
{
public TrainReadingDurationLog selectTrainReadingDurationLogById(Long id);
public List<TrainReadingDurationLog> selectTrainReadingDurationLogList(TrainReadingDurationLog trainReadingDurationLog);
public int insertTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog);
public int updateTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog);
public int deleteTrainReadingDurationLogById(Long id);
public int deleteTrainReadingDurationLogByIds(Long[] ids);
public TrainReadingDurationLog selectByUserRecordId(@Param("userId") Long userId, @Param("recordId") String recordId);
public long sumDurationSeconds(@Param("userId") Long userId, @Param("mode") String mode);
}
@@ -0,0 +1,33 @@
package com.ruoyi.device.mapper;
import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.device.domain.TrainUserSession;
/**
* 学员业务会话Mapper接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface TrainUserSessionMapper
{
public TrainUserSession selectTrainUserSessionById(Long id);
public List<TrainUserSession> selectTrainUserSessionList(TrainUserSession trainUserSession);
public int insertTrainUserSession(TrainUserSession trainUserSession);
public int updateTrainUserSession(TrainUserSession trainUserSession);
public int deleteTrainUserSessionById(Long id);
public int deleteTrainUserSessionByIds(Long[] ids);
public TrainUserSession selectActiveSession(@Param("userId") Long userId, @Param("deviceId") String deviceId);
public TrainUserSession selectLatestSession(@Param("userId") Long userId, @Param("deviceId") String deviceId);
public int replaceActiveSessions(@Param("userId") Long userId, @Param("replaceTime") Date replaceTime);
}
@@ -0,0 +1,25 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainBookDownloadRecord;
/**
* 图书下载回执记录 Service 接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainBookDownloadRecordService
{
public TrainBookDownloadRecord selectTrainBookDownloadRecordById(Long id);
public List<TrainBookDownloadRecord> selectTrainBookDownloadRecordList(TrainBookDownloadRecord record);
public int insertTrainBookDownloadRecord(TrainBookDownloadRecord record);
public int updateTrainBookDownloadRecord(TrainBookDownloadRecord record);
public int deleteTrainBookDownloadRecordById(Long id);
public int deleteTrainBookDownloadRecordByIds(Long[] ids);
}
@@ -0,0 +1,29 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainBookSnapshot;
/**
* 图书快照Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainBookSnapshotService
{
public TrainBookSnapshot selectTrainBookSnapshotById(Long id);
public List<TrainBookSnapshot> selectTrainBookSnapshotList(TrainBookSnapshot trainBookSnapshot);
public int insertTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot);
public int updateTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot);
public int deleteTrainBookSnapshotByIds(Long[] ids);
public int deleteTrainBookSnapshotById(Long id);
public List<TrainBookSnapshot> selectOnShelfList(String bookCategory);
public TrainBookSnapshot selectByBookIdAndVersion(String bookId, String bookVersion);
}
@@ -0,0 +1,27 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainCheckinTerminal;
/**
* 报到一体机(自助报到终端)Service接口
*
* @author ruoyi
* @date 2026-10-24
*/
public interface ITrainCheckinTerminalService
{
public TrainCheckinTerminal selectTrainCheckinTerminalById(Long id);
public List<TrainCheckinTerminal> selectTrainCheckinTerminalList(TrainCheckinTerminal trainCheckinTerminal);
public int insertTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal);
public int updateTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal);
public int deleteTrainCheckinTerminalByIds(Long[] ids);
public int deleteTrainCheckinTerminalById(Long id);
public TrainCheckinTerminal selectTrainCheckinTerminalByTerminalId(String terminalId);
}
@@ -0,0 +1,30 @@
package com.ruoyi.device.service;
import java.util.Date;
import java.util.List;
import com.ruoyi.device.domain.TrainIotDevice;
/**
* 读书机设备档案Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainIotDeviceService
{
public TrainIotDevice selectTrainIotDeviceById(Long id);
public List<TrainIotDevice> selectTrainIotDeviceList(TrainIotDevice trainIotDevice);
public int insertTrainIotDevice(TrainIotDevice trainIotDevice);
public int updateTrainIotDevice(TrainIotDevice trainIotDevice);
public int deleteTrainIotDeviceByIds(Long[] ids);
public int deleteTrainIotDeviceById(Long id);
public TrainIotDevice selectTrainIotDeviceByDeviceId(String deviceId);
public int updateHeartbeatByDeviceId(String deviceId, Date lastHeartbeatTime, Integer deviceStatus);
}
@@ -0,0 +1,27 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainReadingAlternateProgress;
/**
* 备选冲突续读进度Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainReadingAlternateProgressService
{
public TrainReadingAlternateProgress selectTrainReadingAlternateProgressById(Long id);
public List<TrainReadingAlternateProgress> selectTrainReadingAlternateProgressList(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int insertTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int updateTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress);
public int deleteTrainReadingAlternateProgressByIds(Long[] ids);
public int deleteTrainReadingAlternateProgressById(Long id);
public List<TrainReadingAlternateProgress> selectListByUserBookMode(Long userId, String bookId, String mode);
}
@@ -0,0 +1,29 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainReadingCurrentProgress;
/**
* 学员主续读进度Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainReadingCurrentProgressService
{
public TrainReadingCurrentProgress selectTrainReadingCurrentProgressById(Long id);
public List<TrainReadingCurrentProgress> selectTrainReadingCurrentProgressList(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int insertTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int updateTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress);
public int deleteTrainReadingCurrentProgressByIds(Long[] ids);
public int deleteTrainReadingCurrentProgressById(Long id);
public TrainReadingCurrentProgress selectByUserBookMode(Long userId, String bookId, String mode);
public List<TrainReadingCurrentProgress> selectListByUserId(Long userId);
}
@@ -0,0 +1,29 @@
package com.ruoyi.device.service;
import java.util.List;
import com.ruoyi.device.domain.TrainReadingDurationLog;
/**
* 阅读上报幂等日志Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainReadingDurationLogService
{
public TrainReadingDurationLog selectTrainReadingDurationLogById(Long id);
public List<TrainReadingDurationLog> selectTrainReadingDurationLogList(TrainReadingDurationLog trainReadingDurationLog);
public int insertTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog);
public int updateTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog);
public int deleteTrainReadingDurationLogByIds(Long[] ids);
public int deleteTrainReadingDurationLogById(Long id);
public String reportReadingRecord(TrainReadingDurationLog record);
public long sumDurationSeconds(Long userId, String mode);
}
@@ -0,0 +1,34 @@
package com.ruoyi.device.service;
import java.util.Date;
import java.util.List;
import com.ruoyi.device.domain.TrainUserSession;
/**
* 学员业务会话Service接口
*
* @author ruoyi
* @date 2026-10-20
*/
public interface ITrainUserSessionService
{
public TrainUserSession selectTrainUserSessionById(Long id);
public List<TrainUserSession> selectTrainUserSessionList(TrainUserSession trainUserSession);
public int insertTrainUserSession(TrainUserSession trainUserSession);
public int updateTrainUserSession(TrainUserSession trainUserSession);
public int deleteTrainUserSessionByIds(Long[] ids);
public int deleteTrainUserSessionById(Long id);
public TrainUserSession selectActiveSession(Long userId, String deviceId);
public TrainUserSession selectLatestSession(Long userId, String deviceId);
public String createSession(Long userId, String deviceId, String ruoyiTokenKey, Date loginTime);
public int logoutSession(Long userId, String deviceId);
}
@@ -0,0 +1,57 @@
package com.ruoyi.device.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainBookDownloadRecord;
import com.ruoyi.device.mapper.TrainBookDownloadRecordMapper;
import com.ruoyi.device.service.ITrainBookDownloadRecordService;
/**
* 图书下载回执记录 Service 业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainBookDownloadRecordServiceImpl implements ITrainBookDownloadRecordService
{
@Autowired
private TrainBookDownloadRecordMapper trainBookDownloadRecordMapper;
@Override
public TrainBookDownloadRecord selectTrainBookDownloadRecordById(Long id)
{
return trainBookDownloadRecordMapper.selectTrainBookDownloadRecordById(id);
}
@Override
public List<TrainBookDownloadRecord> selectTrainBookDownloadRecordList(TrainBookDownloadRecord record)
{
return trainBookDownloadRecordMapper.selectTrainBookDownloadRecordList(record);
}
@Override
public int insertTrainBookDownloadRecord(TrainBookDownloadRecord record)
{
return trainBookDownloadRecordMapper.insertTrainBookDownloadRecord(record);
}
@Override
public int updateTrainBookDownloadRecord(TrainBookDownloadRecord record)
{
return trainBookDownloadRecordMapper.updateTrainBookDownloadRecord(record);
}
@Override
public int deleteTrainBookDownloadRecordById(Long id)
{
return trainBookDownloadRecordMapper.deleteTrainBookDownloadRecordById(id);
}
@Override
public int deleteTrainBookDownloadRecordByIds(Long[] ids)
{
return trainBookDownloadRecordMapper.deleteTrainBookDownloadRecordByIds(ids);
}
}
@@ -0,0 +1,123 @@
package com.ruoyi.device.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainBookSnapshot;
import com.ruoyi.device.mapper.TrainBookSnapshotMapper;
import com.ruoyi.device.service.ITrainBookSnapshotService;
import java.io.FileInputStream;
import java.security.MessageDigest;
import com.ruoyi.common.constant.Constants;
import com.ruoyi.common.config.RuoYiConfig;
/**
* 图书快照Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainBookSnapshotServiceImpl implements ITrainBookSnapshotService
{
@Autowired
private TrainBookSnapshotMapper trainBookSnapshotMapper;
@Override
public TrainBookSnapshot selectTrainBookSnapshotById(Long id)
{
return trainBookSnapshotMapper.selectTrainBookSnapshotById(id);
}
@Override
public List<TrainBookSnapshot> selectTrainBookSnapshotList(TrainBookSnapshot trainBookSnapshot)
{
return trainBookSnapshotMapper.selectTrainBookSnapshotList(trainBookSnapshot);
}
@Override
public int insertTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot)
{
String md5 = ComputeMd5(trainBookSnapshot.getDownloadUrl());
if (md5 != null)
{
trainBookSnapshot.setFileMd5(md5);
}
return trainBookSnapshotMapper.insertTrainBookSnapshot(trainBookSnapshot);
}
@Override
public int updateTrainBookSnapshot(TrainBookSnapshot trainBookSnapshot)
{
String md5 = ComputeMd5(trainBookSnapshot.getDownloadUrl());
//System.out.println("md5 = " + md5);
if (md5 != null)
{
trainBookSnapshot.setFileMd5(md5);
}
return trainBookSnapshotMapper.updateTrainBookSnapshot(trainBookSnapshot);
}
@Override
public int deleteTrainBookSnapshotByIds(Long[] ids)
{
return trainBookSnapshotMapper.deleteTrainBookSnapshotByIds(ids);
}
@Override
public int deleteTrainBookSnapshotById(Long id)
{
return trainBookSnapshotMapper.deleteTrainBookSnapshotById(id);
}
@Override
public List<TrainBookSnapshot> selectOnShelfList(String bookCategory)
{
return trainBookSnapshotMapper.selectOnShelfList(bookCategory);
}
@Override
public TrainBookSnapshot selectByBookIdAndVersion(String bookId, String bookVersion)
{
return trainBookSnapshotMapper.selectByBookIdAndVersion(bookId, bookVersion);
}
/**
* 计算文件完整二进制 MD5(32 位小写十六进制)。
* filePath 形如 /profile/upload/...(downloadUrl),内部解析为服务器本地绝对路径后,
* 以二进制方式分块读取(每块 65536 字节)送入同一 MD5 计算器,不解析文件内容。
*/
private String ComputeMd5(String filePath)
{
if (filePath == null || filePath.isEmpty())
{
return null;
}
String realPath = filePath;
if (filePath.startsWith(Constants.RESOURCE_PREFIX))
{
realPath = RuoYiConfig.getProfile() + filePath.substring(Constants.RESOURCE_PREFIX.length());
}
try (FileInputStream fis = new FileInputStream(realPath))
{
MessageDigest md = MessageDigest.getInstance("MD5");
byte[] buffer = new byte[65536];
int len;
while ((len = fis.read(buffer)) != -1)
{
md.update(buffer, 0, len);
}
byte[] digest = md.digest();
StringBuilder sb = new StringBuilder(digest.length * 2);
for (byte b : digest)
{
sb.append(String.format("%02x", b & 0xFF));
}
return sb.toString();
}
catch (Exception e)
{
return null;
}
}
}
@@ -0,0 +1,63 @@
package com.ruoyi.device.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainCheckinTerminal;
import com.ruoyi.device.mapper.TrainCheckinTerminalMapper;
import com.ruoyi.device.service.ITrainCheckinTerminalService;
/**
* 报到一体机(自助报到终端)Service业务层处理
*
* @author ruoyi
* @date 2026-10-24
*/
@Service
public class TrainCheckinTerminalServiceImpl implements ITrainCheckinTerminalService
{
@Autowired
private TrainCheckinTerminalMapper trainCheckinTerminalMapper;
@Override
public TrainCheckinTerminal selectTrainCheckinTerminalById(Long id)
{
return trainCheckinTerminalMapper.selectTrainCheckinTerminalById(id);
}
@Override
public List<TrainCheckinTerminal> selectTrainCheckinTerminalList(TrainCheckinTerminal trainCheckinTerminal)
{
return trainCheckinTerminalMapper.selectTrainCheckinTerminalList(trainCheckinTerminal);
}
@Override
public int insertTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal)
{
return trainCheckinTerminalMapper.insertTrainCheckinTerminal(trainCheckinTerminal);
}
@Override
public int updateTrainCheckinTerminal(TrainCheckinTerminal trainCheckinTerminal)
{
return trainCheckinTerminalMapper.updateTrainCheckinTerminal(trainCheckinTerminal);
}
@Override
public int deleteTrainCheckinTerminalByIds(Long[] ids)
{
return trainCheckinTerminalMapper.deleteTrainCheckinTerminalByIds(ids);
}
@Override
public int deleteTrainCheckinTerminalById(Long id)
{
return trainCheckinTerminalMapper.deleteTrainCheckinTerminalById(id);
}
@Override
public TrainCheckinTerminal selectTrainCheckinTerminalByTerminalId(String terminalId)
{
return trainCheckinTerminalMapper.selectTrainCheckinTerminalByTerminalId(terminalId);
}
}
@@ -0,0 +1,70 @@
package com.ruoyi.device.service.impl;
import java.util.Date;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainIotDevice;
import com.ruoyi.device.mapper.TrainIotDeviceMapper;
import com.ruoyi.device.service.ITrainIotDeviceService;
/**
* 读书机设备档案Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainIotDeviceServiceImpl implements ITrainIotDeviceService
{
@Autowired
private TrainIotDeviceMapper trainIotDeviceMapper;
@Override
public TrainIotDevice selectTrainIotDeviceById(Long id)
{
return trainIotDeviceMapper.selectTrainIotDeviceById(id);
}
@Override
public List<TrainIotDevice> selectTrainIotDeviceList(TrainIotDevice trainIotDevice)
{
return trainIotDeviceMapper.selectTrainIotDeviceList(trainIotDevice);
}
@Override
public int insertTrainIotDevice(TrainIotDevice trainIotDevice)
{
return trainIotDeviceMapper.insertTrainIotDevice(trainIotDevice);
}
@Override
public int updateTrainIotDevice(TrainIotDevice trainIotDevice)
{
return trainIotDeviceMapper.updateTrainIotDevice(trainIotDevice);
}
@Override
public int deleteTrainIotDeviceByIds(Long[] ids)
{
return trainIotDeviceMapper.deleteTrainIotDeviceByIds(ids);
}
@Override
public int deleteTrainIotDeviceById(Long id)
{
return trainIotDeviceMapper.deleteTrainIotDeviceById(id);
}
@Override
public TrainIotDevice selectTrainIotDeviceByDeviceId(String deviceId)
{
return trainIotDeviceMapper.selectTrainIotDeviceByDeviceId(deviceId);
}
@Override
public int updateHeartbeatByDeviceId(String deviceId, Date lastHeartbeatTime, Integer deviceStatus)
{
return trainIotDeviceMapper.updateHeartbeatByDeviceId(deviceId, lastHeartbeatTime, deviceStatus);
}
}
@@ -0,0 +1,63 @@
package com.ruoyi.device.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainReadingAlternateProgress;
import com.ruoyi.device.mapper.TrainReadingAlternateProgressMapper;
import com.ruoyi.device.service.ITrainReadingAlternateProgressService;
/**
* 备选冲突续读进度Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainReadingAlternateProgressServiceImpl implements ITrainReadingAlternateProgressService
{
@Autowired
private TrainReadingAlternateProgressMapper trainReadingAlternateProgressMapper;
@Override
public TrainReadingAlternateProgress selectTrainReadingAlternateProgressById(Long id)
{
return trainReadingAlternateProgressMapper.selectTrainReadingAlternateProgressById(id);
}
@Override
public List<TrainReadingAlternateProgress> selectTrainReadingAlternateProgressList(TrainReadingAlternateProgress trainReadingAlternateProgress)
{
return trainReadingAlternateProgressMapper.selectTrainReadingAlternateProgressList(trainReadingAlternateProgress);
}
@Override
public int insertTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress)
{
return trainReadingAlternateProgressMapper.insertTrainReadingAlternateProgress(trainReadingAlternateProgress);
}
@Override
public int updateTrainReadingAlternateProgress(TrainReadingAlternateProgress trainReadingAlternateProgress)
{
return trainReadingAlternateProgressMapper.updateTrainReadingAlternateProgress(trainReadingAlternateProgress);
}
@Override
public int deleteTrainReadingAlternateProgressByIds(Long[] ids)
{
return trainReadingAlternateProgressMapper.deleteTrainReadingAlternateProgressByIds(ids);
}
@Override
public int deleteTrainReadingAlternateProgressById(Long id)
{
return trainReadingAlternateProgressMapper.deleteTrainReadingAlternateProgressById(id);
}
@Override
public List<TrainReadingAlternateProgress> selectListByUserBookMode(Long userId, String bookId, String mode)
{
return trainReadingAlternateProgressMapper.selectListByUserBookMode(userId, bookId, mode);
}
}
@@ -0,0 +1,69 @@
package com.ruoyi.device.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainReadingCurrentProgress;
import com.ruoyi.device.mapper.TrainReadingCurrentProgressMapper;
import com.ruoyi.device.service.ITrainReadingCurrentProgressService;
/**
* 学员主续读进度Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainReadingCurrentProgressServiceImpl implements ITrainReadingCurrentProgressService
{
@Autowired
private TrainReadingCurrentProgressMapper trainReadingCurrentProgressMapper;
@Override
public TrainReadingCurrentProgress selectTrainReadingCurrentProgressById(Long id)
{
return trainReadingCurrentProgressMapper.selectTrainReadingCurrentProgressById(id);
}
@Override
public List<TrainReadingCurrentProgress> selectTrainReadingCurrentProgressList(TrainReadingCurrentProgress trainReadingCurrentProgress)
{
return trainReadingCurrentProgressMapper.selectTrainReadingCurrentProgressList(trainReadingCurrentProgress);
}
@Override
public int insertTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress)
{
return trainReadingCurrentProgressMapper.insertTrainReadingCurrentProgress(trainReadingCurrentProgress);
}
@Override
public int updateTrainReadingCurrentProgress(TrainReadingCurrentProgress trainReadingCurrentProgress)
{
return trainReadingCurrentProgressMapper.updateTrainReadingCurrentProgress(trainReadingCurrentProgress);
}
@Override
public int deleteTrainReadingCurrentProgressByIds(Long[] ids)
{
return trainReadingCurrentProgressMapper.deleteTrainReadingCurrentProgressByIds(ids);
}
@Override
public int deleteTrainReadingCurrentProgressById(Long id)
{
return trainReadingCurrentProgressMapper.deleteTrainReadingCurrentProgressById(id);
}
@Override
public TrainReadingCurrentProgress selectByUserBookMode(Long userId, String bookId, String mode)
{
return trainReadingCurrentProgressMapper.selectByUserBookMode(userId, bookId, mode);
}
@Override
public List<TrainReadingCurrentProgress> selectListByUserId(Long userId)
{
return trainReadingCurrentProgressMapper.selectListByUserId(userId);
}
}
@@ -0,0 +1,144 @@
package com.ruoyi.device.service.impl;
import java.util.Date;
import java.util.List;
import com.ruoyi.device.domain.TrainUserSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainReadingAlternateProgress;
import com.ruoyi.device.domain.TrainReadingCurrentProgress;
import com.ruoyi.device.domain.TrainReadingDurationLog;
import com.ruoyi.device.mapper.TrainReadingAlternateProgressMapper;
import com.ruoyi.device.mapper.TrainReadingCurrentProgressMapper;
import com.ruoyi.device.mapper.TrainReadingDurationLogMapper;
import com.ruoyi.device.mapper.TrainUserSessionMapper;
import com.ruoyi.device.service.ITrainReadingDurationLogService;
/**
* 阅读上报幂等日志Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainReadingDurationLogServiceImpl implements ITrainReadingDurationLogService
{
@Autowired
private TrainReadingDurationLogMapper trainReadingDurationLogMapper;
@Autowired
private TrainReadingCurrentProgressMapper trainReadingCurrentProgressMapper;
@Autowired
private TrainReadingAlternateProgressMapper trainReadingAlternateProgressMapper;
@Autowired
private TrainUserSessionMapper trainUserSessionMapper;
@Override
public TrainReadingDurationLog selectTrainReadingDurationLogById(Long id)
{
return trainReadingDurationLogMapper.selectTrainReadingDurationLogById(id);
}
@Override
public List<TrainReadingDurationLog> selectTrainReadingDurationLogList(TrainReadingDurationLog trainReadingDurationLog)
{
return trainReadingDurationLogMapper.selectTrainReadingDurationLogList(trainReadingDurationLog);
}
@Override
public int insertTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog)
{
return trainReadingDurationLogMapper.insertTrainReadingDurationLog(trainReadingDurationLog);
}
@Override
public int updateTrainReadingDurationLog(TrainReadingDurationLog trainReadingDurationLog)
{
return trainReadingDurationLogMapper.updateTrainReadingDurationLog(trainReadingDurationLog);
}
@Override
public int deleteTrainReadingDurationLogByIds(Long[] ids)
{
return trainReadingDurationLogMapper.deleteTrainReadingDurationLogByIds(ids);
}
@Override
public int deleteTrainReadingDurationLogById(Long id)
{
return trainReadingDurationLogMapper.deleteTrainReadingDurationLogById(id);
}
@Override
public String reportReadingRecord(TrainReadingDurationLog record)
{
Long userId = record.getUserId();
String deviceId = record.getDeviceId();
TrainUserSession session = trainUserSessionMapper.selectLatestSession(userId, deviceId);
if (session == null || session.getSessionStatus() == 3)
{
// 无会话或已退出:拒绝并记录
record.setResultCode("REJECTED");
trainReadingDurationLogMapper.insertTrainReadingDurationLog(record);
return "REJECTED";
}
TrainReadingDurationLog exist = trainReadingDurationLogMapper.selectByUserRecordId(userId, record.getRecordId());
if (exist != null)
{
// 幂等:重复 recordId 直接返回 DUPLICATE,不重复累计
return "DUPLICATE";
}
boolean active = session.getSessionStatus() == 1;
record.setResultCode(active ? "ACCEPTED" : "CONFLICT_SAVED");
record.setReceiveTime(new Date());
trainReadingDurationLogMapper.insertTrainReadingDurationLog(record);
int pageNo = record.getPageTo() != null ? record.getPageTo() : (record.getPageFrom() != null ? record.getPageFrom() : 0);
if (active)
{
// ACTIVE 会话:更新主续读进度
TrainReadingCurrentProgress cp = trainReadingCurrentProgressMapper.selectByUserBookMode(userId, record.getBookId(), record.getMode());
TrainReadingCurrentProgress prog = new TrainReadingCurrentProgress();
prog.setUserId(userId);
prog.setBookId(record.getBookId());
prog.setMode(record.getMode());
prog.setBookVersion(record.getBookVersion());
prog.setPageNo(pageNo);
prog.setProgress(record.getProgress());
prog.setSourceRecordId(record.getRecordId());
prog.setSourceSessionId(record.getSessionId());
if (cp != null)
{
prog.setId(cp.getId());
trainReadingCurrentProgressMapper.updateTrainReadingCurrentProgress(prog);
}
else
{
trainReadingCurrentProgressMapper.insertTrainReadingCurrentProgress(prog);
}
}
else
{
// REPLACED 会话:写入备选冲突进度,不覆盖主进度
TrainReadingAlternateProgress alt = new TrainReadingAlternateProgress();
alt.setUserId(userId);
alt.setBookId(record.getBookId());
alt.setMode(record.getMode());
alt.setBookVersion(record.getBookVersion());
alt.setPageNo(pageNo);
alt.setProgress(record.getProgress());
alt.setSourceRecordId(record.getRecordId());
alt.setSourceSessionId(record.getSessionId());
trainReadingAlternateProgressMapper.insertTrainReadingAlternateProgress(alt);
}
return record.getResultCode();
}
@Override
public long sumDurationSeconds(Long userId, String mode)
{
return trainReadingDurationLogMapper.sumDurationSeconds(userId, mode);
}
}
@@ -0,0 +1,100 @@
package com.ruoyi.device.service.impl;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.device.domain.TrainUserSession;
import com.ruoyi.device.mapper.TrainUserSessionMapper;
import com.ruoyi.device.service.ITrainUserSessionService;
/**
* 学员业务会话Service业务层处理
*
* @author ruoyi
* @date 2026-10-20
*/
@Service
public class TrainUserSessionServiceImpl implements ITrainUserSessionService
{
@Autowired
private TrainUserSessionMapper trainUserSessionMapper;
@Override
public TrainUserSession selectTrainUserSessionById(Long id)
{
return trainUserSessionMapper.selectTrainUserSessionById(id);
}
@Override
public List<TrainUserSession> selectTrainUserSessionList(TrainUserSession trainUserSession)
{
return trainUserSessionMapper.selectTrainUserSessionList(trainUserSession);
}
@Override
public int insertTrainUserSession(TrainUserSession trainUserSession)
{
return trainUserSessionMapper.insertTrainUserSession(trainUserSession);
}
@Override
public int updateTrainUserSession(TrainUserSession trainUserSession)
{
return trainUserSessionMapper.updateTrainUserSession(trainUserSession);
}
@Override
public int deleteTrainUserSessionByIds(Long[] ids)
{
return trainUserSessionMapper.deleteTrainUserSessionByIds(ids);
}
@Override
public int deleteTrainUserSessionById(Long id)
{
return trainUserSessionMapper.deleteTrainUserSessionById(id);
}
@Override
public TrainUserSession selectActiveSession(Long userId, String deviceId)
{
return trainUserSessionMapper.selectActiveSession(userId, deviceId);
}
@Override
public TrainUserSession selectLatestSession(Long userId, String deviceId)
{
return trainUserSessionMapper.selectLatestSession(userId, deviceId);
}
@Override
public String createSession(Long userId, String deviceId, String ruoyiTokenKey, Date loginTime)
{
trainUserSessionMapper.replaceActiveSessions(userId, new Date());
String sessionId = UUID.randomUUID().toString().replace("-", "");
TrainUserSession session = new TrainUserSession();
session.setUserId(userId);
session.setDeviceId(deviceId);
session.setSessionId(sessionId);
session.setSessionStatus(1);
session.setLoginTime(loginTime);
session.setRuoyiTokenKey(ruoyiTokenKey);
trainUserSessionMapper.insertTrainUserSession(session);
return sessionId;
}
@Override
public int logoutSession(Long userId, String deviceId)
{
TrainUserSession session = trainUserSessionMapper.selectActiveSession(userId, deviceId);
if (session == null)
{
return 0;
}
session.setSessionStatus(3);
session.setLogoutTime(new Date());
return trainUserSessionMapper.updateTrainUserSession(session);
}
}
@@ -0,0 +1,33 @@
package com.ruoyi.device.util;
/**
* 本地 ToStringBuilder,替代 org.apache.commons.lang3.builder.ToStringBuilder,
* 提供相同的流式 append(String, Object) 与 toString() API,使 device 模块不依赖 commons-lang3 即可编译。
*/
public class ToStringBuilder
{
private final StringBuilder sb = new StringBuilder();
private boolean first = true;
public ToStringBuilder(Object object, ToStringStyle style)
{
sb.append(object == null ? "Object" : object.getClass().getSimpleName()).append(" [");
}
public ToStringBuilder append(String name, Object value)
{
if (!first)
{
sb.append(", ");
}
first = false;
sb.append(name).append("=").append(value);
return this;
}
@Override
public String toString()
{
return sb.append("]").toString();
}
}
@@ -0,0 +1,13 @@
package com.ruoyi.device.util;
/**
* 本地 ToStringStyle,替代 org.apache.commons.lang3.builder.ToStringStyle,
* 用于使 device 模块不依赖 commons-lang3 即可编译。
*/
public class ToStringStyle
{
public static final ToStringStyle MULTI_LINE_STYLE = new ToStringStyle();
public static final ToStringStyle DEFAULT_STYLE = new ToStringStyle();
public static final ToStringStyle SHORT_PREFIX_STYLE = new ToStringStyle();
public static final ToStringStyle SIMPLE_STYLE = new ToStringStyle();
}
@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainBookDownloadRecordMapper">
<resultMap type="TrainBookDownloadRecord" id="TrainBookDownloadRecordResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="deviceId" column="device_id" />
<result property="bookId" column="book_id" />
<result property="bookVersion" column="book_version" />
<result property="fileMd5" column="file_md5" />
<result property="result" column="result" />
<result property="errMsg" column="err_msg" />
<result property="downloadTime" column="download_time" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTrainBookDownloadRecordVo">
select id, user_id, device_id, book_id, book_version, file_md5, result, err_msg, download_time, create_time, update_time from train_book_download_record
</sql>
<select id="selectTrainBookDownloadRecordList" parameterType="TrainBookDownloadRecord" resultMap="TrainBookDownloadRecordResult">
<include refid="selectTrainBookDownloadRecordVo"/>
<where>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="fileMd5 != null and fileMd5 != ''"> and file_md5 = #{fileMd5}</if>
<if test="result != null and result != ''"> and result = #{result}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainBookDownloadRecordById" parameterType="Long" resultMap="TrainBookDownloadRecordResult">
<include refid="selectTrainBookDownloadRecordVo"/>
where id = #{id}
</select>
<insert id="insertTrainBookDownloadRecord" parameterType="TrainBookDownloadRecord" useGeneratedKeys="true" keyProperty="id">
insert into train_book_download_record
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="fileMd5 != null and fileMd5 != ''">file_md5,</if>
<if test="result != null and result != ''">result,</if>
<if test="errMsg != null">err_msg,</if>
<if test="downloadTime != null">download_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="fileMd5 != null and fileMd5 != ''">#{fileMd5},</if>
<if test="result != null and result != ''">#{result},</if>
<if test="errMsg != null">#{errMsg},</if>
<if test="downloadTime != null">#{downloadTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTrainBookDownloadRecord" parameterType="TrainBookDownloadRecord">
update train_book_download_record
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="fileMd5 != null and fileMd5 != ''">file_md5 = #{fileMd5},</if>
<if test="result != null and result != ''">result = #{result},</if>
<if test="errMsg != null">err_msg = #{errMsg},</if>
<if test="downloadTime != null">download_time = #{downloadTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainBookDownloadRecordById" parameterType="Long">
delete from train_book_download_record where id = #{id}
</delete>
<delete id="deleteTrainBookDownloadRecordByIds" parameterType="Long">
delete from train_book_download_record where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainBookSnapshotMapper">
<resultMap type="TrainBookSnapshot" id="TrainBookSnapshotResult">
<result property="id" column="id" />
<result property="bookId" column="book_id" />
<result property="bookTitle" column="book_title" />
<result property="bookCategory" column="book_category" />
<result property="bookSummary" column="book_summary" />
<result property="bookVersion" column="book_version" />
<result property="bookCover" column="book_cover" />
<result property="fileSize" column="file_size" />
<result property="fileMd5" column="file_md5" />
<result property="downloadUrl" column="download_url" />
<result property="isOnShelf" column="is_on_shelf" />
<result property="publishTime" column="publish_time" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTrainBookSnapshotVo">
select id, book_id, book_title, book_category, book_summary, book_version, book_cover, file_size, file_md5, download_url, is_on_shelf, publish_time, create_time, update_time from train_book_snapshot
</sql>
<select id="selectTrainBookSnapshotList" parameterType="TrainBookSnapshot" resultMap="TrainBookSnapshotResult">
<include refid="selectTrainBookSnapshotVo"/>
<where>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="bookTitle != null and bookTitle != ''"> and book_title like concat('%', #{bookTitle}, '%')</if>
<if test="bookCategory != null and bookCategory != ''"> and book_category = #{bookCategory}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="bookCover != null and bookCover != ''"> and book_cover = #{bookCover}</if>
<if test="fileMd5 != null and fileMd5 != ''"> and file_md5 = #{fileMd5}</if>
<if test="isOnShelf != null"> and is_on_shelf = #{isOnShelf}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainBookSnapshotById" parameterType="Long" resultMap="TrainBookSnapshotResult">
<include refid="selectTrainBookSnapshotVo"/>
where id = #{id}
</select>
<insert id="insertTrainBookSnapshot" parameterType="TrainBookSnapshot">
insert into train_book_snapshot
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="bookTitle != null and bookTitle != ''">book_title,</if>
<if test="bookCategory != null and bookCategory != ''">book_category,</if>
<if test="bookSummary != null">book_summary,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="bookCover != null and bookCover != ''">book_cover,</if>
<if test="fileSize != null">file_size,</if>
<if test="fileMd5 != null and fileMd5 != ''">file_md5,</if>
<if test="downloadUrl != null">download_url,</if>
<if test="isOnShelf != null">is_on_shelf,</if>
<if test="publishTime != null">publish_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="bookTitle != null and bookTitle != ''">#{bookTitle},</if>
<if test="bookCategory != null and bookCategory != ''">#{bookCategory},</if>
<if test="bookSummary != null">#{bookSummary},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="bookCover != null and bookCover != ''">#{bookCover},</if>
<if test="fileSize != null">#{fileSize},</if>
<if test="fileMd5 != null and fileMd5 != ''">#{fileMd5},</if>
<if test="downloadUrl != null">#{downloadUrl},</if>
<if test="isOnShelf != null">#{isOnShelf},</if>
<if test="publishTime != null">#{publishTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTrainBookSnapshot" parameterType="TrainBookSnapshot">
update train_book_snapshot
<trim prefix="SET" suffixOverrides=",">
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="bookTitle != null and bookTitle != ''">book_title = #{bookTitle},</if>
<if test="bookCategory != null and bookCategory != ''">book_category = #{bookCategory},</if>
<if test="bookSummary != null">book_summary = #{bookSummary},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="bookCover != null and bookCover != ''">book_cover = #{bookCover},</if>
<if test="fileSize != null">file_size = #{fileSize},</if>
<if test="fileMd5 != null and fileMd5 != ''">file_md5 = #{fileMd5},</if>
<if test="downloadUrl != null">download_url = #{downloadUrl},</if>
<if test="isOnShelf != null">is_on_shelf = #{isOnShelf},</if>
<if test="publishTime != null">publish_time = #{publishTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainBookSnapshotById" parameterType="Long">
delete from train_book_snapshot where id = #{id}
</delete>
<delete id="deleteTrainBookSnapshotByIds" parameterType="Long">
delete from train_book_snapshot where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectOnShelfList" resultMap="TrainBookSnapshotResult">
<include refid="selectTrainBookSnapshotVo"/>
where is_on_shelf = 1
<if test="bookCategory != null and bookCategory != ''"> and book_category = #{bookCategory}</if>
order by publish_time desc
</select>
<select id="selectByBookIdAndVersion" resultMap="TrainBookSnapshotResult">
<include refid="selectTrainBookSnapshotVo"/>
where book_id = #{bookId} and book_version = #{bookVersion} limit 1
</select>
</mapper>
@@ -0,0 +1,177 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainCheckinTerminalMapper">
<resultMap type="TrainCheckinTerminal" id="TrainCheckinTerminalResult">
<result property="id" column="id" />
<result property="terminalId" column="terminal_id" />
<result property="terminalSn" column="terminal_sn" />
<result property="terminalName" column="terminal_name" />
<result property="bindDeptId" column="bind_dept_id" />
<result property="installLocation" column="install_location" />
<result property="supportCheckinType" column="support_checkin_type" />
<result property="supportModules" column="support_modules" />
<result property="supportPrint" column="support_print" />
<result property="supportBroadcast" column="support_broadcast" />
<result property="contactPhone" column="contact_phone" />
<result property="welcomeTitle" column="welcome_title" />
<result property="orgName" column="org_name" />
<result property="screenOrientation" column="screen_orientation" />
<result property="idleReturnSeconds" column="idle_return_seconds" />
<result property="helpText" column="help_text" />
<result property="terminalIp" column="terminal_ip" />
<result property="apiEndpoint" column="api_endpoint" />
<result property="terminalStatus" column="terminal_status" />
<result property="lastHeartbeat" column="last_heartbeat" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTrainCheckinTerminalVo">
select id, terminal_id, terminal_sn, terminal_name, bind_dept_id, install_location,
support_checkin_type, support_modules, support_print, support_broadcast,
contact_phone, welcome_title, org_name, screen_orientation, idle_return_seconds,
help_text, terminal_ip, api_endpoint, terminal_status, last_heartbeat,
del_flag, create_by, create_time, update_by, update_time, remark
from train_checkin_terminal
</sql>
<select id="selectTrainCheckinTerminalList" parameterType="TrainCheckinTerminal" resultMap="TrainCheckinTerminalResult">
<include refid="selectTrainCheckinTerminalVo"/>
<where>
and del_flag = '0'
<if test="terminalId != null and terminalId != ''"> and terminal_id = #{terminalId}</if>
<if test="terminalSn != null and terminalSn != ''"> and terminal_sn = #{terminalSn}</if>
<if test="terminalName != null and terminalName != ''"> and terminal_name like concat('%', #{terminalName}, '%')</if>
<if test="bindDeptId != null and bindDeptId != ''"> and bind_dept_id = #{bindDeptId}</if>
<if test="supportCheckinType != null and supportCheckinType != ''"> and support_checkin_type = #{supportCheckinType}</if>
<if test="supportModules != null and supportModules != ''"> and support_modules = #{supportModules}</if>
<if test="supportPrint != null and supportPrint != ''"> and support_print = #{supportPrint}</if>
<if test="supportBroadcast != null and supportBroadcast != ''"> and support_broadcast = #{supportBroadcast}</if>
<if test="terminalStatus != null"> and terminal_status = #{terminalStatus}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainCheckinTerminalById" parameterType="Long" resultMap="TrainCheckinTerminalResult">
<include refid="selectTrainCheckinTerminalVo"/>
where id = #{id} and del_flag = '0'
</select>
<select id="selectTrainCheckinTerminalByTerminalId" resultMap="TrainCheckinTerminalResult">
<include refid="selectTrainCheckinTerminalVo"/>
where terminal_id = #{terminalId} and del_flag = '0'
</select>
<insert id="insertTrainCheckinTerminal" parameterType="TrainCheckinTerminal">
insert into train_checkin_terminal
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="terminalId != null and terminalId != ''">terminal_id,</if>
<if test="terminalSn != null and terminalSn != ''">terminal_sn,</if>
<if test="terminalName != null and terminalName != ''">terminal_name,</if>
<if test="bindDeptId != null and bindDeptId != ''">bind_dept_id,</if>
<if test="installLocation != null and installLocation != ''">install_location,</if>
<if test="supportCheckinType != null and supportCheckinType != ''">support_checkin_type,</if>
<if test="supportModules != null and supportModules != ''">support_modules,</if>
<if test="supportPrint != null and supportPrint != ''">support_print,</if>
<if test="supportBroadcast != null and supportBroadcast != ''">support_broadcast,</if>
<if test="contactPhone != null and contactPhone != ''">contact_phone,</if>
<if test="welcomeTitle != null and welcomeTitle != ''">welcome_title,</if>
<if test="orgName != null and orgName != ''">org_name,</if>
<if test="screenOrientation != null and screenOrientation != ''">screen_orientation,</if>
<if test="idleReturnSeconds != null">idle_return_seconds,</if>
<if test="helpText != null and helpText != ''">help_text,</if>
<if test="terminalIp != null and terminalIp != ''">terminal_ip,</if>
<if test="apiEndpoint != null and apiEndpoint != ''">api_endpoint,</if>
<if test="terminalStatus != null">terminal_status,</if>
<if test="lastHeartbeat != null">last_heartbeat,</if>
del_flag,
<if test="createBy != null and createBy != ''">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null and updateBy != ''">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null and remark != ''">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="terminalId != null and terminalId != ''">#{terminalId},</if>
<if test="terminalSn != null and terminalSn != ''">#{terminalSn},</if>
<if test="terminalName != null and terminalName != ''">#{terminalName},</if>
<if test="bindDeptId != null and bindDeptId != ''">#{bindDeptId},</if>
<if test="installLocation != null and installLocation != ''">#{installLocation},</if>
<if test="supportCheckinType != null and supportCheckinType != ''">#{supportCheckinType},</if>
<if test="supportModules != null and supportModules != ''">#{supportModules},</if>
<if test="supportPrint != null and supportPrint != ''">#{supportPrint},</if>
<if test="supportBroadcast != null and supportBroadcast != ''">#{supportBroadcast},</if>
<if test="contactPhone != null and contactPhone != ''">#{contactPhone},</if>
<if test="welcomeTitle != null and welcomeTitle != ''">#{welcomeTitle},</if>
<if test="orgName != null and orgName != ''">#{orgName},</if>
<if test="screenOrientation != null and screenOrientation != ''">#{screenOrientation},</if>
<if test="idleReturnSeconds != null">#{idleReturnSeconds},</if>
<if test="helpText != null and helpText != ''">#{helpText},</if>
<if test="terminalIp != null and terminalIp != ''">#{terminalIp},</if>
<if test="apiEndpoint != null and apiEndpoint != ''">#{apiEndpoint},</if>
<if test="terminalStatus != null">#{terminalStatus},</if>
<if test="lastHeartbeat != null">#{lastHeartbeat},</if>
'0',
<if test="createBy != null and createBy != ''">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null and remark != ''">#{remark},</if>
</trim>
</insert>
<update id="updateTrainCheckinTerminal" parameterType="TrainCheckinTerminal">
update train_checkin_terminal
<trim prefix="SET" suffixOverrides=",">
<if test="terminalId != null and terminalId != ''">terminal_id = #{terminalId},</if>
<if test="terminalSn != null and terminalSn != ''">terminal_sn = #{terminalSn},</if>
<if test="terminalName != null and terminalName != ''">terminal_name = #{terminalName},</if>
<if test="bindDeptId != null and bindDeptId != ''">bind_dept_id = #{bindDeptId},</if>
<if test="installLocation != null and installLocation != ''">install_location = #{installLocation},</if>
<if test="supportCheckinType != null and supportCheckinType != ''">support_checkin_type = #{supportCheckinType},</if>
<if test="supportModules != null and supportModules != ''">support_modules = #{supportModules},</if>
<if test="supportPrint != null and supportPrint != ''">support_print = #{supportPrint},</if>
<if test="supportBroadcast != null and supportBroadcast != ''">support_broadcast = #{supportBroadcast},</if>
<if test="contactPhone != null and contactPhone != ''">contact_phone = #{contactPhone},</if>
<if test="welcomeTitle != null and welcomeTitle != ''">welcome_title = #{welcomeTitle},</if>
<if test="orgName != null and orgName != ''">org_name = #{orgName},</if>
<if test="screenOrientation != null and screenOrientation != ''">screen_orientation = #{screenOrientation},</if>
<if test="idleReturnSeconds != null">idle_return_seconds = #{idleReturnSeconds},</if>
<if test="helpText != null and helpText != ''">help_text = #{helpText},</if>
<if test="terminalIp != null and terminalIp != ''">terminal_ip = #{terminalIp},</if>
<if test="apiEndpoint != null and apiEndpoint != ''">api_endpoint = #{apiEndpoint},</if>
<if test="terminalStatus != null">terminal_status = #{terminalStatus},</if>
<if test="lastHeartbeat != null">last_heartbeat = #{lastHeartbeat},</if>
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null and remark != ''">remark = #{remark},</if>
</trim>
where id = #{id} and del_flag = '0'
</update>
<update id="deleteTrainCheckinTerminalById" parameterType="Long">
update train_checkin_terminal
set del_flag = '2', update_time = CURRENT_TIMESTAMP
where id = #{id} and del_flag = '0'
</update>
<update id="deleteTrainCheckinTerminalByIds" parameterType="Long">
update train_checkin_terminal
set del_flag = '2', update_time = CURRENT_TIMESTAMP
where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
and del_flag = '0'
</update>
</mapper>
@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainIotDeviceMapper">
<resultMap type="TrainIotDevice" id="TrainIotDeviceResult">
<result property="id" column="id" />
<result property="deviceId" column="device_id" />
<result property="deviceSecretDigest" column="device_secret_digest" />
<result property="deviceStatus" column="device_status" />
<result property="firmwareVersion" column="firmware_version" />
<result property="appVersion" column="app_version" />
<result property="bindOrgId" column="bind_org_id" />
<result property="bindClassId" column="bind_class_id" />
<result property="heartbeatInterval" column="heartbeat_interval" />
<result property="lastLoginTime" column="last_login_time" />
<result property="lastHeartbeatTime" column="last_heartbeat_time" />
<result property="createTime" column="create_time" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTrainIotDeviceVo">
select id, device_id, device_secret_digest, device_status, firmware_version, app_version, bind_org_id, bind_class_id, heartbeat_interval, last_login_time, last_heartbeat_time, create_time, update_time from train_iot_device
</sql>
<select id="selectTrainIotDeviceList" parameterType="TrainIotDevice" resultMap="TrainIotDeviceResult">
<include refid="selectTrainIotDeviceVo"/>
<where>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="deviceSecretDigest != null and deviceSecretDigest != ''"> and device_secret_digest = #{deviceSecretDigest}</if>
<if test="deviceStatus != null"> and device_status = #{deviceStatus}</if>
<if test="firmwareVersion != null and firmwareVersion != ''"> and firmware_version = #{firmwareVersion}</if>
<if test="appVersion != null and appVersion != ''"> and app_version = #{appVersion}</if>
<if test="bindOrgId != null and bindOrgId != ''"> and bind_org_id = #{bindOrgId}</if>
<if test="bindClassId != null and bindClassId != ''"> and bind_class_id = #{bindClassId}</if>
<if test="heartbeatInterval != null"> and heartbeat_interval = #{heartbeatInterval}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainIotDeviceById" parameterType="Long" resultMap="TrainIotDeviceResult">
<include refid="selectTrainIotDeviceVo"/>
where id = #{id}
</select>
<insert id="insertTrainIotDevice" parameterType="TrainIotDevice">
insert into train_iot_device
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="deviceSecretDigest != null and deviceSecretDigest != ''">device_secret_digest,</if>
<if test="deviceStatus != null">device_status,</if>
<if test="firmwareVersion != null and firmwareVersion != ''">firmware_version,</if>
<if test="appVersion != null and appVersion != ''">app_version,</if>
<if test="bindOrgId != null and bindOrgId != ''">bind_org_id,</if>
<if test="bindClassId != null and bindClassId != ''">bind_class_id,</if>
<if test="heartbeatInterval != null">heartbeat_interval,</if>
<if test="lastLoginTime != null">last_login_time,</if>
<if test="lastHeartbeatTime != null">last_heartbeat_time,</if>
<if test="createTime != null">create_time,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="deviceSecretDigest != null and deviceSecretDigest != ''">#{deviceSecretDigest},</if>
<if test="deviceStatus != null">#{deviceStatus},</if>
<if test="firmwareVersion != null and firmwareVersion != ''">#{firmwareVersion},</if>
<if test="appVersion != null and appVersion != ''">#{appVersion},</if>
<if test="bindOrgId != null and bindOrgId != ''">#{bindOrgId},</if>
<if test="bindClassId != null and bindClassId != ''">#{bindClassId},</if>
<if test="heartbeatInterval != null">#{heartbeatInterval},</if>
<if test="lastLoginTime != null">#{lastLoginTime},</if>
<if test="lastHeartbeatTime != null">#{lastHeartbeatTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTrainIotDevice" parameterType="TrainIotDevice">
update train_iot_device
<trim prefix="SET" suffixOverrides=",">
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="deviceSecretDigest != null and deviceSecretDigest != ''">device_secret_digest = #{deviceSecretDigest},</if>
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
<if test="firmwareVersion != null and firmwareVersion != ''">firmware_version = #{firmwareVersion},</if>
<if test="appVersion != null and appVersion != ''">app_version = #{appVersion},</if>
<if test="bindOrgId != null and bindOrgId != ''">bind_org_id = #{bindOrgId},</if>
<if test="bindClassId != null and bindClassId != ''">bind_class_id = #{bindClassId},</if>
<if test="heartbeatInterval != null">heartbeat_interval = #{heartbeatInterval},</if>
<if test="lastLoginTime != null">last_login_time = #{lastLoginTime},</if>
<if test="lastHeartbeatTime != null">last_heartbeat_time = #{lastHeartbeatTime},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainIotDeviceById" parameterType="Long">
delete from train_iot_device where id = #{id}
</delete>
<delete id="deleteTrainIotDeviceByIds" parameterType="Long">
delete from train_iot_device where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectTrainIotDeviceByDeviceId" resultMap="TrainIotDeviceResult">
<include refid="selectTrainIotDeviceVo"/>
where device_id = #{deviceId}
</select>
<update id="updateHeartbeatByDeviceId">
update train_iot_device
<set>
last_heartbeat_time = #{lastHeartbeatTime},
<if test="deviceStatus != null">device_status = #{deviceStatus},</if>
update_time = #{lastHeartbeatTime}
</set>
where device_id = #{deviceId}
</update>
</mapper>
@@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainReadingAlternateProgressMapper">
<resultMap type="TrainReadingAlternateProgress" id="TrainReadingAlternateProgressResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="bookId" column="book_id" />
<result property="mode" column="mode" />
<result property="bookVersion" column="book_version" />
<result property="pageNo" column="page_no" />
<result property="sentenceIndex" column="sentence_index" />
<result property="progress" column="progress" />
<result property="sourceRecordId" column="source_record_id" />
<result property="sourceSessionId" column="source_session_id" />
<result property="createTime" column="create_time" />
</resultMap>
<sql id="selectTrainReadingAlternateProgressVo">
select id, user_id, book_id, mode, book_version, page_no, sentence_index, progress, source_record_id, source_session_id, create_time from train_reading_alternate_progress
</sql>
<select id="selectTrainReadingAlternateProgressList" parameterType="TrainReadingAlternateProgress" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
<where>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="sourceRecordId != null and sourceRecordId != ''"> and source_record_id = #{sourceRecordId}</if>
<if test="sourceSessionId != null and sourceSessionId != ''"> and source_session_id = #{sourceSessionId}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and create_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and create_time &lt;= #{params.endTime}</if>
</where>
order by create_time desc
</select>
<select id="selectTrainReadingAlternateProgressById" parameterType="Long" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
where id = #{id}
</select>
<insert id="insertTrainReadingAlternateProgress" parameterType="TrainReadingAlternateProgress">
insert into train_reading_alternate_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="mode != null and mode != ''">mode,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="pageNo != null">page_no,</if>
<if test="sentenceIndex != null">sentence_index,</if>
<if test="progress != null">progress,</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id,</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id,</if>
<if test="createTime != null">create_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="mode != null and mode != ''">#{mode},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="pageNo != null">#{pageNo},</if>
<if test="sentenceIndex != null">#{sentenceIndex},</if>
<if test="progress != null">#{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">#{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">#{sourceSessionId},</if>
<if test="createTime != null">#{createTime},</if>
</trim>
</insert>
<update id="updateTrainReadingAlternateProgress" parameterType="TrainReadingAlternateProgress">
update train_reading_alternate_progress
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="mode != null and mode != ''">mode = #{mode},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="pageNo != null">page_no = #{pageNo},</if>
<if test="sentenceIndex != null">sentence_index = #{sentenceIndex},</if>
<if test="progress != null">progress = #{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id = #{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id = #{sourceSessionId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainReadingAlternateProgressById" parameterType="Long">
delete from train_reading_alternate_progress where id = #{id}
</delete>
<delete id="deleteTrainReadingAlternateProgressByIds" parameterType="Long">
delete from train_reading_alternate_progress where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectListByUserBookMode" resultMap="TrainReadingAlternateProgressResult">
<include refid="selectTrainReadingAlternateProgressVo"/>
where user_id = #{userId} and book_id = #{bookId} and mode = #{mode}
order by create_time desc
</select>
</mapper>
@@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainReadingCurrentProgressMapper">
<resultMap type="TrainReadingCurrentProgress" id="TrainReadingCurrentProgressResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="bookId" column="book_id" />
<result property="mode" column="mode" />
<result property="bookVersion" column="book_version" />
<result property="pageNo" column="page_no" />
<result property="sentenceIndex" column="sentence_index" />
<result property="progress" column="progress" />
<result property="sourceRecordId" column="source_record_id" />
<result property="sourceSessionId" column="source_session_id" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectTrainReadingCurrentProgressVo">
select id, user_id, book_id, mode, book_version, page_no, sentence_index, progress, source_record_id, source_session_id, update_time from train_reading_current_progress
</sql>
<select id="selectTrainReadingCurrentProgressList" parameterType="TrainReadingCurrentProgress" resultMap="TrainReadingCurrentProgressResult">
<include refid="selectTrainReadingCurrentProgressVo"/>
<where>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="sourceRecordId != null and sourceRecordId != ''"> and source_record_id = #{sourceRecordId}</if>
<if test="sourceSessionId != null and sourceSessionId != ''"> and source_session_id = #{sourceSessionId}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and update_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and update_time &lt;= #{params.endTime}</if>
</where>
order by update_time desc
</select>
<select id="selectTrainReadingCurrentProgressById" parameterType="Long" resultMap="TrainReadingCurrentProgressResult">
<include refid="selectTrainReadingCurrentProgressVo"/>
where id = #{id}
</select>
<insert id="insertTrainReadingCurrentProgress" parameterType="TrainReadingCurrentProgress">
insert into train_reading_current_progress
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="mode != null and mode != ''">mode,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="pageNo != null">page_no,</if>
<if test="sentenceIndex != null">sentence_index,</if>
<if test="progress != null">progress,</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id,</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="mode != null and mode != ''">#{mode},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="pageNo != null">#{pageNo},</if>
<if test="sentenceIndex != null">#{sentenceIndex},</if>
<if test="progress != null">#{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">#{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">#{sourceSessionId},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateTrainReadingCurrentProgress" parameterType="TrainReadingCurrentProgress">
update train_reading_current_progress
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="mode != null and mode != ''">mode = #{mode},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="pageNo != null">page_no = #{pageNo},</if>
<if test="sentenceIndex != null">sentence_index = #{sentenceIndex},</if>
<if test="progress != null">progress = #{progress},</if>
<if test="sourceRecordId != null and sourceRecordId != ''">source_record_id = #{sourceRecordId},</if>
<if test="sourceSessionId != null and sourceSessionId != ''">source_session_id = #{sourceSessionId},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainReadingCurrentProgressById" parameterType="Long">
delete from train_reading_current_progress where id = #{id}
</delete>
<delete id="deleteTrainReadingCurrentProgressByIds" parameterType="Long">
delete from train_reading_current_progress where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByUserBookMode" resultMap="TrainReadingCurrentProgressResult">
<include refid="selectTrainReadingCurrentProgressVo"/>
where user_id = #{userId} and book_id = #{bookId} and mode = #{mode} limit 1
</select>
<select id="selectListByUserId" resultMap="TrainReadingCurrentProgressResult">
<include refid="selectTrainReadingCurrentProgressVo"/>
where user_id = #{userId}
</select>
</mapper>
@@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainReadingDurationLogMapper">
<resultMap type="TrainReadingDurationLog" id="TrainReadingDurationLogResult">
<result property="id" column="id" />
<result property="deviceId" column="device_id" />
<result property="userId" column="user_id" />
<result property="sessionId" column="session_id" />
<result property="recordId" column="record_id" />
<result property="bookId" column="book_id" />
<result property="bookVersion" column="book_version" />
<result property="mode" column="mode" />
<result property="recordType" column="record_type" />
<result property="durationSec" column="duration_sec" />
<result property="readSec" column="read_sec" />
<result property="pageFrom" column="page_from" />
<result property="pageTo" column="page_to" />
<result property="progress" column="progress" />
<result property="startTime" column="start_time" />
<result property="endTime" column="end_time" />
<result property="receiveTime" column="receive_time" />
<result property="resultCode" column="result_code" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectTrainReadingDurationLogVo">
select id, device_id, user_id, session_id, record_id, book_id, book_version, mode, record_type, duration_sec, read_sec, page_from, page_to, progress, start_time, end_time, receive_time, result_code, remark from train_reading_duration_log
</sql>
<select id="selectTrainReadingDurationLogList" parameterType="TrainReadingDurationLog" resultMap="TrainReadingDurationLogResult">
<include refid="selectTrainReadingDurationLogVo"/>
<where>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="sessionId != null and sessionId != ''"> and session_id = #{sessionId}</if>
<if test="recordId != null and recordId != ''"> and record_id = #{recordId}</if>
<if test="bookId != null and bookId != ''"> and book_id = #{bookId}</if>
<if test="bookVersion != null and bookVersion != ''"> and book_version = #{bookVersion}</if>
<if test="mode != null and mode != ''"> and mode = #{mode}</if>
<if test="recordType != null and recordType != ''"> and record_type = #{recordType}</if>
<if test="resultCode != null and resultCode != ''"> and result_code = #{resultCode}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and receive_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and receive_time &lt;= #{params.endTime}</if>
</where>
order by receive_time desc
</select>
<select id="selectTrainReadingDurationLogById" parameterType="Long" resultMap="TrainReadingDurationLogResult">
<include refid="selectTrainReadingDurationLogVo"/>
where id = #{id}
</select>
<insert id="insertTrainReadingDurationLog" parameterType="TrainReadingDurationLog">
insert into train_reading_duration_log
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="userId != null">user_id,</if>
<if test="sessionId != null and sessionId != ''">session_id,</if>
<if test="recordId != null and recordId != ''">record_id,</if>
<if test="bookId != null and bookId != ''">book_id,</if>
<if test="bookVersion != null and bookVersion != ''">book_version,</if>
<if test="mode != null and mode != ''">mode,</if>
<if test="recordType != null and recordType != ''">record_type,</if>
<if test="durationSec != null">duration_sec,</if>
<if test="readSec != null">read_sec,</if>
<if test="pageFrom != null">page_from,</if>
<if test="pageTo != null">page_to,</if>
<if test="progress != null">progress,</if>
<if test="startTime != null">start_time,</if>
<if test="endTime != null">end_time,</if>
<if test="receiveTime != null">receive_time,</if>
<if test="resultCode != null and resultCode != ''">result_code,</if>
<if test="remark != null">remark,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="userId != null">#{userId},</if>
<if test="sessionId != null and sessionId != ''">#{sessionId},</if>
<if test="recordId != null and recordId != ''">#{recordId},</if>
<if test="bookId != null and bookId != ''">#{bookId},</if>
<if test="bookVersion != null and bookVersion != ''">#{bookVersion},</if>
<if test="mode != null and mode != ''">#{mode},</if>
<if test="recordType != null and recordType != ''">#{recordType},</if>
<if test="durationSec != null">#{durationSec},</if>
<if test="readSec != null">#{readSec},</if>
<if test="pageFrom != null">#{pageFrom},</if>
<if test="pageTo != null">#{pageTo},</if>
<if test="progress != null">#{progress},</if>
<if test="startTime != null">#{startTime},</if>
<if test="endTime != null">#{endTime},</if>
<if test="receiveTime != null">#{receiveTime},</if>
<if test="resultCode != null and resultCode != ''">#{resultCode},</if>
<if test="remark != null">#{remark},</if>
</trim>
</insert>
<update id="updateTrainReadingDurationLog" parameterType="TrainReadingDurationLog">
update train_reading_duration_log
<trim prefix="SET" suffixOverrides=",">
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="userId != null">user_id = #{userId},</if>
<if test="sessionId != null and sessionId != ''">session_id = #{sessionId},</if>
<if test="recordId != null and recordId != ''">record_id = #{recordId},</if>
<if test="bookId != null and bookId != ''">book_id = #{bookId},</if>
<if test="bookVersion != null and bookVersion != ''">book_version = #{bookVersion},</if>
<if test="mode != null and mode != ''">mode = #{mode},</if>
<if test="recordType != null and recordType != ''">record_type = #{recordType},</if>
<if test="durationSec != null">duration_sec = #{durationSec},</if>
<if test="readSec != null">read_sec = #{readSec},</if>
<if test="pageFrom != null">page_from = #{pageFrom},</if>
<if test="pageTo != null">page_to = #{pageTo},</if>
<if test="progress != null">progress = #{progress},</if>
<if test="startTime != null">start_time = #{startTime},</if>
<if test="endTime != null">end_time = #{endTime},</if>
<if test="receiveTime != null">receive_time = #{receiveTime},</if>
<if test="resultCode != null and resultCode != ''">result_code = #{resultCode},</if>
<if test="remark != null">remark = #{remark},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainReadingDurationLogById" parameterType="Long">
delete from train_reading_duration_log where id = #{id}
</delete>
<delete id="deleteTrainReadingDurationLogByIds" parameterType="Long">
delete from train_reading_duration_log where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectByUserRecordId" resultMap="TrainReadingDurationLogResult">
<include refid="selectTrainReadingDurationLogVo"/>
where user_id = #{userId} and record_id = #{recordId} limit 1
</select>
<select id="sumDurationSeconds" resultType="long">
select ifnull(sum(duration_sec), 0) from train_reading_duration_log
where user_id = #{userId} and mode = #{mode} and result_code in ('ACCEPTED', 'CONFLICT_SAVED')
</select>
</mapper>
@@ -0,0 +1,110 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.device.mapper.TrainUserSessionMapper">
<resultMap type="TrainUserSession" id="TrainUserSessionResult">
<result property="id" column="id" />
<result property="userId" column="user_id" />
<result property="sessionId" column="session_id" />
<result property="deviceId" column="device_id" />
<result property="sessionStatus" column="session_status" />
<result property="loginTime" column="login_time" />
<result property="replaceTime" column="replace_time" />
<result property="logoutTime" column="logout_time" />
<result property="ruoyiTokenKey" column="ruoyi_token_key" />
</resultMap>
<sql id="selectTrainUserSessionVo">
select id, user_id, session_id, device_id, session_status, login_time, replace_time, logout_time, ruoyi_token_key from train_user_session
</sql>
<select id="selectTrainUserSessionList" parameterType="TrainUserSession" resultMap="TrainUserSessionResult">
<include refid="selectTrainUserSessionVo"/>
<where>
<if test="userId != null"> and user_id = #{userId}</if>
<if test="sessionId != null and sessionId != ''"> and session_id = #{sessionId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="sessionStatus != null"> and session_status = #{sessionStatus}</if>
<if test="ruoyiTokenKey != null and ruoyiTokenKey != ''"> and ruoyi_token_key = #{ruoyiTokenKey}</if>
<if test="params.beginTime != null and params.beginTime != ''"> and login_time &gt;= #{params.beginTime}</if>
<if test="params.endTime != null and params.endTime != ''"> and login_time &lt;= #{params.endTime}</if>
</where>
order by login_time desc
</select>
<select id="selectTrainUserSessionById" parameterType="Long" resultMap="TrainUserSessionResult">
<include refid="selectTrainUserSessionVo"/>
where id = #{id}
</select>
<insert id="insertTrainUserSession" parameterType="TrainUserSession">
insert into train_user_session
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="id != null">id,</if>
<if test="userId != null">user_id,</if>
<if test="sessionId != null and sessionId != ''">session_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="sessionStatus != null">session_status,</if>
<if test="loginTime != null">login_time,</if>
<if test="replaceTime != null">replace_time,</if>
<if test="logoutTime != null">logout_time,</if>
<if test="ruoyiTokenKey != null and ruoyiTokenKey != ''">ruoyi_token_key,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="id != null">#{id},</if>
<if test="userId != null">#{userId},</if>
<if test="sessionId != null and sessionId != ''">#{sessionId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="sessionStatus != null">#{sessionStatus},</if>
<if test="loginTime != null">#{loginTime},</if>
<if test="replaceTime != null">#{replaceTime},</if>
<if test="logoutTime != null">#{logoutTime},</if>
<if test="ruoyiTokenKey != null and ruoyiTokenKey != ''">#{ruoyiTokenKey},</if>
</trim>
</insert>
<update id="updateTrainUserSession" parameterType="TrainUserSession">
update train_user_session
<trim prefix="SET" suffixOverrides=",">
<if test="userId != null">user_id = #{userId},</if>
<if test="sessionId != null and sessionId != ''">session_id = #{sessionId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="sessionStatus != null">session_status = #{sessionStatus},</if>
<if test="loginTime != null">login_time = #{loginTime},</if>
<if test="replaceTime != null">replace_time = #{replaceTime},</if>
<if test="logoutTime != null">logout_time = #{logoutTime},</if>
<if test="ruoyiTokenKey != null and ruoyiTokenKey != ''">ruoyi_token_key = #{ruoyiTokenKey},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteTrainUserSessionById" parameterType="Long">
delete from train_user_session where id = #{id}
</delete>
<delete id="deleteTrainUserSessionByIds" parameterType="Long">
delete from train_user_session where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<select id="selectActiveSession" resultMap="TrainUserSessionResult">
<include refid="selectTrainUserSessionVo"/>
where user_id = #{userId} and device_id = #{deviceId} and session_status = 1
order by login_time desc limit 1
</select>
<select id="selectLatestSession" resultMap="TrainUserSessionResult">
<include refid="selectTrainUserSessionVo"/>
where user_id = #{userId} and device_id = #{deviceId}
order by login_time desc limit 1
</select>
<update id="replaceActiveSessions">
update train_user_session set session_status = 2, replace_time = #{replaceTime}
where user_id = #{userId} and session_status = 1
</update>
</mapper>