serv-mapper和.xml 基本增删改
This commit is contained in:
@@ -35,6 +35,9 @@ SOURCE createTableAI.sql;
|
||||
-- 10. 创建系统配置和日志相关表
|
||||
SOURCE createTableSystem.sql;
|
||||
|
||||
-- 11. 创建文件系统相关表
|
||||
SOURCE createTableFile.sql;
|
||||
|
||||
-- =====================================================
|
||||
-- 初始化完成
|
||||
-- =====================================================
|
||||
|
||||
@@ -44,6 +44,26 @@
|
||||
<artifactId>news</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>study</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>usercenter</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>file</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>ai</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -14,7 +14,8 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
*/
|
||||
@EnableTransactionManagement
|
||||
@SpringBootApplication(scanBasePackages = "org.xyzh")
|
||||
@MapperScan({"org.xyzh.system.mapper", "org.xyzh.news.mapper"})
|
||||
@MapperScan({"org.xyzh.system.mapper", "org.xyzh.file.mapper", "org.xyzh.news.mapper", "org.xyzh.study.mapper",
|
||||
"org.xyzh.usercenter.mapper", "org.xyzh.ai.mapper", "org.xyzh.file.mapper"})
|
||||
public class App {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -63,4 +63,76 @@ public class BaseEntity implements Serializable {
|
||||
*/
|
||||
private String remark;
|
||||
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
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 Date getDeleteTime() {
|
||||
return deleteTime;
|
||||
}
|
||||
|
||||
|
||||
public void setDeleteTime(Date deleteTime) {
|
||||
this.deleteTime = deleteTime;
|
||||
}
|
||||
|
||||
|
||||
public Integer getIsDeleted() {
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
|
||||
public void setIsDeleted(Integer isDeleted) {
|
||||
this.isDeleted = isDeleted;
|
||||
}
|
||||
|
||||
|
||||
public Integer getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
|
||||
public void setVersion(Integer version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
|
||||
public String getRemark() {
|
||||
return remark;
|
||||
}
|
||||
|
||||
|
||||
public void setRemark(String remark) {
|
||||
this.remark = remark;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -97,4 +97,101 @@ public class DataEntity<T> extends BaseEntity {
|
||||
*/
|
||||
private List<T> dataList;
|
||||
|
||||
public String getCreatorID() {
|
||||
return creatorID;
|
||||
}
|
||||
|
||||
public void setCreatorID(String creatorID) {
|
||||
this.creatorID = creatorID;
|
||||
}
|
||||
|
||||
public String getCreatorName() {
|
||||
return creatorName;
|
||||
}
|
||||
|
||||
public void setCreatorName(String creatorName) {
|
||||
this.creatorName = creatorName;
|
||||
}
|
||||
|
||||
public String getUpdatorID() {
|
||||
return updatorID;
|
||||
}
|
||||
|
||||
public void setUpdatorID(String updatorID) {
|
||||
this.updatorID = updatorID;
|
||||
}
|
||||
|
||||
public String getUpdatorName() {
|
||||
return updatorName;
|
||||
}
|
||||
|
||||
public void setUpdatorName(String updatorName) {
|
||||
this.updatorName = updatorName;
|
||||
}
|
||||
|
||||
public String getDeleterID() {
|
||||
return deleterID;
|
||||
}
|
||||
|
||||
public void setDeleterID(String deleterID) {
|
||||
this.deleterID = deleterID;
|
||||
}
|
||||
|
||||
public String getDeleterName() {
|
||||
return deleterName;
|
||||
}
|
||||
|
||||
public void setDeleterName(String deleterName) {
|
||||
this.deleterName = deleterName;
|
||||
}
|
||||
|
||||
public String getOwnerID() {
|
||||
return ownerID;
|
||||
}
|
||||
|
||||
public void setOwnerID(String ownerID) {
|
||||
this.ownerID = ownerID;
|
||||
}
|
||||
|
||||
public String getOwnerName() {
|
||||
return ownerName;
|
||||
}
|
||||
|
||||
public void setOwnerName(String ownerName) {
|
||||
this.ownerName = ownerName;
|
||||
}
|
||||
|
||||
public DataStatus getDataStatus() {
|
||||
return dataStatus;
|
||||
}
|
||||
|
||||
public void setDataStatus(DataStatus dataStatus) {
|
||||
this.dataStatus = dataStatus;
|
||||
}
|
||||
|
||||
public Boolean getVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(Boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public T getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(T data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public List<T> getDataList() {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
public void setDataList(List<T> dataList) {
|
||||
this.dataList = dataList;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,114 @@ public class UserVO {
|
||||
private String deleteTime;
|
||||
private String deleted;
|
||||
private String status;
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getUserID() {
|
||||
return userID;
|
||||
}
|
||||
public void setUserID(String userID) {
|
||||
this.userID = userID;
|
||||
}
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
public String getWechatID() {
|
||||
return wechatID;
|
||||
}
|
||||
public void setWechatID(String wechatID) {
|
||||
this.wechatID = wechatID;
|
||||
}
|
||||
public String getAvatar() {
|
||||
return avatar;
|
||||
}
|
||||
public void setAvatar(String avatar) {
|
||||
this.avatar = avatar;
|
||||
}
|
||||
public String getGender() {
|
||||
return gender;
|
||||
}
|
||||
public void setGender(String gender) {
|
||||
this.gender = gender;
|
||||
}
|
||||
public String getFamilyName() {
|
||||
return familyName;
|
||||
}
|
||||
public void setFamilyName(String familyName) {
|
||||
this.familyName = familyName;
|
||||
}
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
public void setGivenName(String givenName) {
|
||||
this.givenName = givenName;
|
||||
}
|
||||
public String getFullName() {
|
||||
return fullName;
|
||||
}
|
||||
public void setFullName(String fullName) {
|
||||
this.fullName = fullName;
|
||||
}
|
||||
public String getIdCard() {
|
||||
return idCard;
|
||||
}
|
||||
public void setIdCard(String idCard) {
|
||||
this.idCard = idCard;
|
||||
}
|
||||
public String getAddress() {
|
||||
return address;
|
||||
}
|
||||
public void setAddress(String address) {
|
||||
this.address = address;
|
||||
}
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public String getUpdateTime() {
|
||||
return updateTime;
|
||||
}
|
||||
public void setUpdateTime(String updateTime) {
|
||||
this.updateTime = updateTime;
|
||||
}
|
||||
public String getDeleteTime() {
|
||||
return deleteTime;
|
||||
}
|
||||
public void setDeleteTime(String deleteTime) {
|
||||
this.deleteTime = deleteTime;
|
||||
}
|
||||
public String getDeleted() {
|
||||
return deleted;
|
||||
}
|
||||
public void setDeleted(String deleted) {
|
||||
this.deleted = deleted;
|
||||
}
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -19,4 +19,25 @@
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- MyBatis Plus -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis -->
|
||||
<!-- <dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
</dependency>
|
||||
-->
|
||||
<!-- 通用DTO -->
|
||||
<dependency>
|
||||
<groupId>org.xyzh</groupId>
|
||||
<artifactId>common-dto</artifactId>
|
||||
<version>${school-news.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,7 +0,0 @@
|
||||
package org.xyzh;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbBanner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description Banner数据访问层
|
||||
* @description BannerMapper.java文件描述 Banner数据访问层
|
||||
* @filename BannerMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,113 @@ public interface BannerMapper extends BaseMapper<TbBanner> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectBanners(TbBanner filter);
|
||||
|
||||
/**
|
||||
* @description 根据Banner ID查询Banner信息
|
||||
* @param bannerId Banner ID
|
||||
* @return TbBanner Banner信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbBanner selectByBannerId(@Param("bannerId") String bannerId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询Banner列表
|
||||
* @param status 状态
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据位置查询Banner列表
|
||||
* @param position 位置
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectByPosition(@Param("position") String position);
|
||||
|
||||
/**
|
||||
* @description 查询有效的Banner列表(按排序)
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectActiveBanners();
|
||||
|
||||
/**
|
||||
* @description 检查Banner标题是否存在
|
||||
* @param title Banner标题
|
||||
* @param excludeId 排除的Banner ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入Banner
|
||||
* @param banner Banner
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertBanner(TbBanner banner);
|
||||
|
||||
/**
|
||||
* @description 更新Banner
|
||||
* @param banner Banner
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateBanner(TbBanner banner);
|
||||
|
||||
/**
|
||||
* @description 删除Banner
|
||||
* @param banner Banner
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteBanner(TbBanner banner);
|
||||
|
||||
/**
|
||||
* @description 批量插入Banner
|
||||
* @param bannerList Banner列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertBanners(@Param("bannerList") List<TbBanner> bannerList);
|
||||
|
||||
/**
|
||||
* @description 批量删除Banner
|
||||
* @param ids Banner ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteBanners(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询Banner
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectBannersPage(@Param("filter") TbBanner filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计Banner总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countBanners(@Param("filter") TbBanner filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbDataCollectionConfig;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 数据采集配置数据访问层
|
||||
* @description DataCollectionConfigMapper.java文件描述 数据采集配置数据访问层
|
||||
* @filename DataCollectionConfigMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,122 @@ public interface DataCollectionConfigMapper extends BaseMapper<TbDataCollectionC
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionConfig> selectDataCollectionConfigs(TbDataCollectionConfig filter);
|
||||
|
||||
/**
|
||||
* @description 根据配置ID查询配置信息
|
||||
* @param configId 配置ID
|
||||
* @return TbDataCollectionConfig 配置信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbDataCollectionConfig selectByConfigId(@Param("configId") String configId);
|
||||
|
||||
/**
|
||||
* @description 根据名称查询配置
|
||||
* @param name 配置名称
|
||||
* @return TbDataCollectionConfig 配置信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbDataCollectionConfig selectByName(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询配置列表
|
||||
* @param status 状态
|
||||
* @return List<TbDataCollectionConfig> 配置列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionConfig> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询配置列表
|
||||
* @param type 类型
|
||||
* @return List<TbDataCollectionConfig> 配置列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionConfig> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询启用的配置列表
|
||||
* @return List<TbDataCollectionConfig> 配置列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionConfig> selectActiveConfigs();
|
||||
|
||||
/**
|
||||
* @description 检查配置名称是否存在
|
||||
* @param name 配置名称
|
||||
* @param excludeId 排除的配置ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入数据采集配置
|
||||
* @param dataCollectionConfig 数据采集配置
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertDataCollectionConfig(TbDataCollectionConfig dataCollectionConfig);
|
||||
|
||||
/**
|
||||
* @description 更新数据采集配置
|
||||
* @param dataCollectionConfig 数据采集配置
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateDataCollectionConfig(TbDataCollectionConfig dataCollectionConfig);
|
||||
|
||||
/**
|
||||
* @description 删除数据采集配置
|
||||
* @param dataCollectionConfig 数据采集配置
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteDataCollectionConfig(TbDataCollectionConfig dataCollectionConfig);
|
||||
|
||||
/**
|
||||
* @description 批量插入数据采集配置
|
||||
* @param dataCollectionConfigList 数据采集配置列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertDataCollectionConfigs(@Param("dataCollectionConfigList") List<TbDataCollectionConfig> dataCollectionConfigList);
|
||||
|
||||
/**
|
||||
* @description 批量删除数据采集配置
|
||||
* @param ids 配置ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteDataCollectionConfigs(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询数据采集配置
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbDataCollectionConfig> 数据采集配置列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionConfig> selectDataCollectionConfigsPage(@Param("filter") TbDataCollectionConfig filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计数据采集配置总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countDataCollectionConfigs(@Param("filter") TbDataCollectionConfig filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbDataCollectionLog;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 数据采集记录数据访问层
|
||||
* @description DataCollectionLogMapper.java文件描述 数据采集记录数据访问层
|
||||
* @filename DataCollectionLogMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,122 @@ public interface DataCollectionLogMapper extends BaseMapper<TbDataCollectionLog>
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectDataCollectionLogs(TbDataCollectionLog filter);
|
||||
|
||||
/**
|
||||
* @description 根据记录ID查询记录信息
|
||||
* @param logId 记录ID
|
||||
* @return TbDataCollectionLog 记录信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbDataCollectionLog selectByLogId(@Param("logId") String logId);
|
||||
|
||||
/**
|
||||
* @description 根据配置ID查询记录列表
|
||||
* @param configId 配置ID
|
||||
* @return List<TbDataCollectionLog> 记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectByConfigId(@Param("configId") String configId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询记录列表
|
||||
* @param status 状态
|
||||
* @return List<TbDataCollectionLog> 记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询记录列表
|
||||
* @param type 类型
|
||||
* @return List<TbDataCollectionLog> 记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询最新的记录列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbDataCollectionLog> 记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectLatestLogs(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 查询采集统计信息
|
||||
* @param configId 配置ID
|
||||
* @return TbDataCollectionLog 统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbDataCollectionLog selectCollectionStatistics(@Param("configId") String configId);
|
||||
|
||||
/**
|
||||
* @description 插入数据采集记录
|
||||
* @param dataCollectionLog 数据采集记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertDataCollectionLog(TbDataCollectionLog dataCollectionLog);
|
||||
|
||||
/**
|
||||
* @description 更新数据采集记录
|
||||
* @param dataCollectionLog 数据采集记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateDataCollectionLog(TbDataCollectionLog dataCollectionLog);
|
||||
|
||||
/**
|
||||
* @description 删除数据采集记录
|
||||
* @param dataCollectionLog 数据采集记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteDataCollectionLog(TbDataCollectionLog dataCollectionLog);
|
||||
|
||||
/**
|
||||
* @description 批量插入数据采集记录
|
||||
* @param dataCollectionLogList 数据采集记录列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertDataCollectionLogs(@Param("dataCollectionLogList") List<TbDataCollectionLog> dataCollectionLogList);
|
||||
|
||||
/**
|
||||
* @description 批量删除数据采集记录
|
||||
* @param ids 记录ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteDataCollectionLogs(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询数据采集记录
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbDataCollectionLog> 数据采集记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbDataCollectionLog> selectDataCollectionLogsPage(@Param("filter") TbDataCollectionLog filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计数据采集记录总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countDataCollectionLogs(@Param("filter") TbDataCollectionLog filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbResourceCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 资源分类数据访问层
|
||||
* @description ResourceCategoryMapper.java文件描述 资源分类数据访问层
|
||||
* @filename ResourceCategoryMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,113 @@ public interface ResourceCategoryMapper extends BaseMapper<TbResourceCategory> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceCategory> selectResourceCategories(TbResourceCategory filter);
|
||||
|
||||
/**
|
||||
* @description 根据分类ID查询分类信息
|
||||
* @param categoryId 分类ID
|
||||
* @return TbResourceCategory 分类信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbResourceCategory selectByCategoryId(@Param("categoryId") String categoryId);
|
||||
|
||||
/**
|
||||
* @description 根据父分类ID查询子分类列表
|
||||
* @param parentId 父分类ID
|
||||
* @return List<TbResourceCategory> 子分类列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceCategory> selectByParentId(@Param("parentId") String parentId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询分类列表
|
||||
* @param status 状态
|
||||
* @return List<TbResourceCategory> 分类列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceCategory> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 查询分类树结构
|
||||
* @return List<TbResourceCategory> 分类树
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceCategory> selectCategoryTree();
|
||||
|
||||
/**
|
||||
* @description 检查分类名称是否存在
|
||||
* @param name 分类名称
|
||||
* @param excludeId 排除的分类ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入资源分类
|
||||
* @param resourceCategory 资源分类
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertResourceCategory(TbResourceCategory resourceCategory);
|
||||
|
||||
/**
|
||||
* @description 更新资源分类
|
||||
* @param resourceCategory 资源分类
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateResourceCategory(TbResourceCategory resourceCategory);
|
||||
|
||||
/**
|
||||
* @description 删除资源分类
|
||||
* @param resourceCategory 资源分类
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteResourceCategory(TbResourceCategory resourceCategory);
|
||||
|
||||
/**
|
||||
* @description 批量插入资源分类
|
||||
* @param resourceCategoryList 资源分类列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertResourceCategories(@Param("resourceCategoryList") List<TbResourceCategory> resourceCategoryList);
|
||||
|
||||
/**
|
||||
* @description 批量删除资源分类
|
||||
* @param ids 分类ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteResourceCategories(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询资源分类
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbResourceCategory> 资源分类列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceCategory> selectResourceCategoriesPage(@Param("filter") TbResourceCategory filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计资源分类总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countResourceCategories(@Param("filter") TbResourceCategory filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 资源数据访问层
|
||||
* @description ResourceMapper.java文件描述 资源数据访问层
|
||||
* @filename ResourceMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,141 @@ public interface ResourceMapper extends BaseMapper<TbResource> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectResources(TbResource filter);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID查询资源信息
|
||||
* @param resourceId 资源ID
|
||||
* @return TbResource 资源信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbResource selectByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据分类ID查询资源列表
|
||||
* @param categoryId 分类ID
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByCategoryId(@Param("categoryId") String categoryId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询资源列表
|
||||
* @param status 状态
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询资源列表
|
||||
* @param type 类型
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询热门资源列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectHotResources(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 查询最新资源列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectLatestResources(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 根据关键词搜索资源
|
||||
* @param keyword 关键词
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> searchByKeyword(@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* @description 检查资源标题是否存在
|
||||
* @param title 资源标题
|
||||
* @param excludeId 排除的资源ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入资源
|
||||
* @param resource 资源
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertResource(TbResource resource);
|
||||
|
||||
/**
|
||||
* @description 更新资源
|
||||
* @param resource 资源
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateResource(TbResource resource);
|
||||
|
||||
/**
|
||||
* @description 删除资源
|
||||
* @param resource 资源
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteResource(TbResource resource);
|
||||
|
||||
/**
|
||||
* @description 批量插入资源
|
||||
* @param resourceList 资源列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertResources(@Param("resourceList") List<TbResource> resourceList);
|
||||
|
||||
/**
|
||||
* @description 批量删除资源
|
||||
* @param ids 资源ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteResources(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询资源
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectResourcesPage(@Param("filter") TbResource filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计资源总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countResources(@Param("filter") TbResource filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbResourceRecommend;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 资源推荐数据访问层
|
||||
* @description ResourceRecommendMapper.java文件描述 资源推荐数据访问层
|
||||
* @filename ResourceRecommendMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,122 @@ public interface ResourceRecommendMapper extends BaseMapper<TbResourceRecommend>
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectResourceRecommends(TbResourceRecommend filter);
|
||||
|
||||
/**
|
||||
* @description 根据推荐ID查询推荐信息
|
||||
* @param recommendId 推荐ID
|
||||
* @return TbResourceRecommend 推荐信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbResourceRecommend selectByRecommendId(@Param("recommendId") String recommendId);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID查询推荐列表
|
||||
* @param resourceId 资源ID
|
||||
* @return List<TbResourceRecommend> 推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询推荐列表
|
||||
* @param status 状态
|
||||
* @return List<TbResourceRecommend> 推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询推荐列表
|
||||
* @param type 类型
|
||||
* @return List<TbResourceRecommend> 推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询热门推荐列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbResourceRecommend> 推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectHotRecommends(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 查询最新推荐列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbResourceRecommend> 推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectLatestRecommends(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 插入资源推荐
|
||||
* @param resourceRecommend 资源推荐
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertResourceRecommend(TbResourceRecommend resourceRecommend);
|
||||
|
||||
/**
|
||||
* @description 更新资源推荐
|
||||
* @param resourceRecommend 资源推荐
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateResourceRecommend(TbResourceRecommend resourceRecommend);
|
||||
|
||||
/**
|
||||
* @description 删除资源推荐
|
||||
* @param resourceRecommend 资源推荐
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteResourceRecommend(TbResourceRecommend resourceRecommend);
|
||||
|
||||
/**
|
||||
* @description 批量插入资源推荐
|
||||
* @param resourceRecommendList 资源推荐列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertResourceRecommends(@Param("resourceRecommendList") List<TbResourceRecommend> resourceRecommendList);
|
||||
|
||||
/**
|
||||
* @description 批量删除资源推荐
|
||||
* @param ids 推荐ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteResourceRecommends(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询资源推荐
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbResourceRecommend> 资源推荐列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceRecommend> selectResourceRecommendsPage(@Param("filter") TbResourceRecommend filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计资源推荐总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countResourceRecommends(@Param("filter") TbResourceRecommend filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbResourceTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 资源标签关联数据访问层
|
||||
* @description ResourceTagMapper.java文件描述 资源标签关联数据访问层
|
||||
* @filename ResourceTagMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,134 @@ public interface ResourceTagMapper extends BaseMapper<TbResourceTag> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceTag> selectResourceTags(TbResourceTag filter);
|
||||
|
||||
/**
|
||||
* @description 根据关联ID查询关联信息
|
||||
* @param relationId 关联ID
|
||||
* @return TbResourceTag 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbResourceTag selectByRelationId(@Param("relationId") String relationId);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID查询标签关联列表
|
||||
* @param resourceId 资源ID
|
||||
* @return List<TbResourceTag> 标签关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceTag> selectByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID查询资源关联列表
|
||||
* @param tagId 标签ID
|
||||
* @return List<TbResourceTag> 资源关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceTag> selectByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID和标签ID查询关联信息
|
||||
* @param resourceId 资源ID
|
||||
* @param tagId 标签ID
|
||||
* @return TbResourceTag 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbResourceTag selectByResourceIdAndTagId(@Param("resourceId") String resourceId, @Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 检查资源标签关联是否存在
|
||||
* @param resourceId 资源ID
|
||||
* @param tagId 标签ID
|
||||
* @param excludeId 排除的关联ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByResourceIdAndTagId(@Param("resourceId") String resourceId, @Param("tagId") String tagId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入资源标签关联
|
||||
* @param resourceTag 资源标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertResourceTag(TbResourceTag resourceTag);
|
||||
|
||||
/**
|
||||
* @description 更新资源标签关联
|
||||
* @param resourceTag 资源标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateResourceTag(TbResourceTag resourceTag);
|
||||
|
||||
/**
|
||||
* @description 删除资源标签关联
|
||||
* @param resourceTag 资源标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteResourceTag(TbResourceTag resourceTag);
|
||||
|
||||
/**
|
||||
* @description 批量插入资源标签关联
|
||||
* @param resourceTagList 资源标签关联列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertResourceTags(@Param("resourceTagList") List<TbResourceTag> resourceTagList);
|
||||
|
||||
/**
|
||||
* @description 批量删除资源标签关联
|
||||
* @param ids 关联ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteResourceTags(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID批量删除标签关联
|
||||
* @param resourceId 资源ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID批量删除资源关联
|
||||
* @param tagId 标签ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 分页查询资源标签关联
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbResourceTag> 资源标签关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResourceTag> selectResourceTagsPage(@Param("filter") TbResourceTag filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计资源标签关联总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countResourceTags(@Param("filter") TbResourceTag filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.news.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.resource.TbTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 标签数据访问层
|
||||
* @description TagMapper.java文件描述 标签数据访问层
|
||||
* @filename TagMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,123 @@ public interface TagMapper extends BaseMapper<TbTag> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectTags(TbTag filter);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID查询标签信息
|
||||
* @param tagId 标签ID
|
||||
* @return TbTag 标签信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTag selectByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 根据标签名称查询标签
|
||||
* @param name 标签名称
|
||||
* @return TbTag 标签信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTag selectByName(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询标签列表
|
||||
* @param status 状态
|
||||
* @return List<TbTag> 标签列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询标签列表
|
||||
* @param type 类型
|
||||
* @return List<TbTag> 标签列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询热门标签列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbTag> 标签列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectHotTags(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 检查标签名称是否存在
|
||||
* @param name 标签名称
|
||||
* @param excludeId 排除的标签ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入标签
|
||||
* @param tag 标签
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertTag(TbTag tag);
|
||||
|
||||
/**
|
||||
* @description 更新标签
|
||||
* @param tag 标签
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateTag(TbTag tag);
|
||||
|
||||
/**
|
||||
* @description 删除标签
|
||||
* @param tag 标签
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteTag(TbTag tag);
|
||||
|
||||
/**
|
||||
* @description 批量插入标签
|
||||
* @param tagList 标签列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertTags(@Param("tagList") List<TbTag> tagList);
|
||||
|
||||
/**
|
||||
* @description 批量删除标签
|
||||
* @param ids 标签ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteTags(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询标签
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbTag> 标签列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectTagsPage(@Param("filter") TbTag filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计标签总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countTags(@Param("filter") TbTag filter);
|
||||
}
|
||||
|
||||
@@ -54,4 +54,148 @@
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据Banner ID查询Banner信息 -->
|
||||
<select id="selectByBannerId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_banner
|
||||
WHERE id = #{bannerId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询Banner列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_banner
|
||||
WHERE status = #{status} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据位置查询Banner列表 -->
|
||||
<select id="selectByPosition" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_banner
|
||||
WHERE link_type = #{position} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询有效的Banner列表(按排序) -->
|
||||
<select id="selectActiveBanners" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_banner
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查Banner标题是否存在 -->
|
||||
<select id="countByTitle" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_banner
|
||||
WHERE title = #{title} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入Banner -->
|
||||
<insert id="insertBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
|
||||
INSERT INTO tb_banner (
|
||||
id, title, image_url, link_type, link_id, link_url, order_num, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{title}, #{imageUrl}, #{linkType}, #{linkID}, #{linkUrl}, #{orderNum}, #{status},
|
||||
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新Banner -->
|
||||
<update id="updateBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
|
||||
UPDATE tb_banner
|
||||
<set>
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="imageUrl != null and imageUrl != ''">
|
||||
image_url = #{imageUrl},
|
||||
</if>
|
||||
<if test="linkType != null">
|
||||
link_type = #{linkType},
|
||||
</if>
|
||||
<if test="linkID != null and linkID != ''">
|
||||
link_id = #{linkID},
|
||||
</if>
|
||||
<if test="linkUrl != null and linkUrl != ''">
|
||||
link_url = #{linkUrl},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除Banner -->
|
||||
<delete id="deleteBanner" parameterType="org.xyzh.common.dto.resource.TbBanner">
|
||||
DELETE FROM tb_banner
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入Banner -->
|
||||
<insert id="batchInsertBanners" parameterType="java.util.List">
|
||||
INSERT INTO tb_banner (
|
||||
id, title, image_url, link_type, link_id, link_url, order_num, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="bannerList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.title}, #{item.imageUrl}, #{item.linkType}, #{item.linkID},
|
||||
#{item.linkUrl}, #{item.orderNum}, #{item.status}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除Banner -->
|
||||
<delete id="batchDeleteBanners">
|
||||
DELETE FROM tb_banner
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询Banner -->
|
||||
<select id="selectBannersPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_banner
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计Banner总数 -->
|
||||
<select id="countBanners" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_banner
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -58,4 +58,159 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据配置ID查询配置信息 -->
|
||||
<select id="selectByConfigId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
WHERE id = #{configId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据名称查询配置 -->
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询配置列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
WHERE status = #{status} AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询配置列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
WHERE source_type = #{type} AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询启用的配置列表 -->
|
||||
<select id="selectActiveConfigs" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查配置名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_data_collection_config
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入数据采集配置 -->
|
||||
<insert id="insertDataCollectionConfig" parameterType="org.xyzh.common.dto.resource.TbDataCollectionConfig">
|
||||
INSERT INTO tb_data_collection_config (
|
||||
id, name, source_url, source_type, frequency, category_id, status,
|
||||
last_collect_time, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{name}, #{sourceUrl}, #{sourceType}, #{frequency}, #{categoryID}, #{status},
|
||||
#{lastCollectTime}, #{creator}, #{updater}, #{createTime}, #{updateTime},
|
||||
#{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新数据采集配置 -->
|
||||
<update id="updateDataCollectionConfig" parameterType="org.xyzh.common.dto.resource.TbDataCollectionConfig">
|
||||
UPDATE tb_data_collection_config
|
||||
<set>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''">
|
||||
source_url = #{sourceUrl},
|
||||
</if>
|
||||
<if test="sourceType != null and sourceType != ''">
|
||||
source_type = #{sourceType},
|
||||
</if>
|
||||
<if test="frequency != null and frequency != ''">
|
||||
frequency = #{frequency},
|
||||
</if>
|
||||
<if test="categoryID != null and categoryID != ''">
|
||||
category_id = #{categoryID},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="lastCollectTime != null">
|
||||
last_collect_time = #{lastCollectTime},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除数据采集配置 -->
|
||||
<delete id="deleteDataCollectionConfig" parameterType="org.xyzh.common.dto.resource.TbDataCollectionConfig">
|
||||
DELETE FROM tb_data_collection_config
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入数据采集配置 -->
|
||||
<insert id="batchInsertDataCollectionConfigs" parameterType="java.util.List">
|
||||
INSERT INTO tb_data_collection_config (
|
||||
id, name, source_url, source_type, frequency, category_id, status,
|
||||
last_collect_time, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="dataCollectionConfigList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.name}, #{item.sourceUrl}, #{item.sourceType}, #{item.frequency},
|
||||
#{item.categoryID}, #{item.status}, #{item.lastCollectTime}, #{item.creator},
|
||||
#{item.updater}, #{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除数据采集配置 -->
|
||||
<delete id="batchDeleteDataCollectionConfigs">
|
||||
DELETE FROM tb_data_collection_config
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询数据采集配置 -->
|
||||
<select id="selectDataCollectionConfigsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_config
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计数据采集配置总数 -->
|
||||
<select id="countDataCollectionConfigs" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_data_collection_config
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -41,4 +41,148 @@
|
||||
ORDER BY collect_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据记录ID查询记录信息 -->
|
||||
<select id="selectByLogId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
WHERE id = #{logId}
|
||||
</select>
|
||||
|
||||
<!-- 根据配置ID查询记录列表 -->
|
||||
<select id="selectByConfigId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
WHERE config_id = #{configId}
|
||||
ORDER BY collect_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询记录列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
WHERE status = #{status}
|
||||
ORDER BY collect_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询记录列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
ORDER BY collect_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询最新的记录列表 -->
|
||||
<select id="selectLatestLogs" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
ORDER BY collect_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询采集统计信息 -->
|
||||
<select id="selectCollectionStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
config_id,
|
||||
SUM(collect_count) as collect_count,
|
||||
SUM(success_count) as success_count,
|
||||
SUM(fail_count) as fail_count,
|
||||
MAX(collect_time) as collect_time
|
||||
FROM tb_data_collection_log
|
||||
WHERE config_id = #{configId}
|
||||
GROUP BY config_id
|
||||
</select>
|
||||
|
||||
<!-- 插入数据采集记录 -->
|
||||
<insert id="insertDataCollectionLog" parameterType="org.xyzh.common.dto.resource.TbDataCollectionLog">
|
||||
INSERT INTO tb_data_collection_log (
|
||||
id, config_id, collect_count, success_count, fail_count, status,
|
||||
message, collect_time
|
||||
) VALUES (
|
||||
#{id}, #{configID}, #{collectCount}, #{successCount}, #{failCount}, #{status},
|
||||
#{message}, #{collectTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新数据采集记录 -->
|
||||
<update id="updateDataCollectionLog" parameterType="org.xyzh.common.dto.resource.TbDataCollectionLog">
|
||||
UPDATE tb_data_collection_log
|
||||
<set>
|
||||
<if test="configID != null and configID != ''">
|
||||
config_id = #{configID},
|
||||
</if>
|
||||
<if test="collectCount != null">
|
||||
collect_count = #{collectCount},
|
||||
</if>
|
||||
<if test="successCount != null">
|
||||
success_count = #{successCount},
|
||||
</if>
|
||||
<if test="failCount != null">
|
||||
fail_count = #{failCount},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="message != null and message != ''">
|
||||
message = #{message},
|
||||
</if>
|
||||
<if test="collectTime != null">
|
||||
collect_time = #{collectTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除数据采集记录 -->
|
||||
<delete id="deleteDataCollectionLog" parameterType="org.xyzh.common.dto.resource.TbDataCollectionLog">
|
||||
DELETE FROM tb_data_collection_log
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入数据采集记录 -->
|
||||
<insert id="batchInsertDataCollectionLogs" parameterType="java.util.List">
|
||||
INSERT INTO tb_data_collection_log (
|
||||
id, config_id, collect_count, success_count, fail_count, status,
|
||||
message, collect_time
|
||||
) VALUES
|
||||
<foreach collection="dataCollectionLogList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.configID}, #{item.collectCount}, #{item.successCount},
|
||||
#{item.failCount}, #{item.status}, #{item.message}, #{item.collectTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除数据采集记录 -->
|
||||
<delete id="batchDeleteDataCollectionLogs">
|
||||
DELETE FROM tb_data_collection_log
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询数据采集记录 -->
|
||||
<select id="selectDataCollectionLogsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_data_collection_log
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY collect_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计数据采集记录总数 -->
|
||||
<select id="countDataCollectionLogs" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_data_collection_log
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -50,4 +50,145 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据分类ID查询分类信息 -->
|
||||
<select id="selectByCategoryId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_category
|
||||
WHERE category_id = #{categoryId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据父分类ID查询子分类列表 -->
|
||||
<select id="selectByParentId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_category
|
||||
WHERE parent_id = #{parentId} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询分类列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_category
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 查询分类树结构 -->
|
||||
<select id="selectCategoryTree" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_category
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 检查分类名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource_category
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入资源分类 -->
|
||||
<insert id="insertResourceCategory" parameterType="org.xyzh.common.dto.resource.TbResourceCategory">
|
||||
INSERT INTO tb_resource_category (
|
||||
id, category_id, name, parent_id, description, icon, order_num,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{categoryID}, #{name}, #{parentID}, #{description}, #{icon}, #{orderNum},
|
||||
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新资源分类 -->
|
||||
<update id="updateResourceCategory" parameterType="org.xyzh.common.dto.resource.TbResourceCategory">
|
||||
UPDATE tb_resource_category
|
||||
<set>
|
||||
<if test="categoryID != null and categoryID != ''">
|
||||
category_id = #{categoryID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="parentID != null and parentID != ''">
|
||||
parent_id = #{parentID},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="icon != null and icon != ''">
|
||||
icon = #{icon},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除资源分类 -->
|
||||
<delete id="deleteResourceCategory" parameterType="org.xyzh.common.dto.resource.TbResourceCategory">
|
||||
DELETE FROM tb_resource_category
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入资源分类 -->
|
||||
<insert id="batchInsertResourceCategories" parameterType="java.util.List">
|
||||
INSERT INTO tb_resource_category (
|
||||
id, category_id, name, parent_id, description, icon, order_num,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="resourceCategoryList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.categoryID}, #{item.name}, #{item.parentID}, #{item.description},
|
||||
#{item.icon}, #{item.orderNum}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除资源分类 -->
|
||||
<delete id="batchDeleteResourceCategories">
|
||||
DELETE FROM tb_resource_category
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询资源分类 -->
|
||||
<select id="selectResourceCategoriesPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_category
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计资源分类总数 -->
|
||||
<select id="countResourceCategories" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource_category
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -70,4 +70,216 @@
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据资源ID查询资源信息 -->
|
||||
<select id="selectByResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE id = #{resourceId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据分类ID查询资源列表 -->
|
||||
<select id="selectByCategoryId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE category_id = #{categoryId} AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询资源列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE status = #{status} AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询资源列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE category_id = #{type} AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询热门资源列表 -->
|
||||
<select id="selectHotResources" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY view_count DESC, like_count DESC, publish_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询最新资源列表 -->
|
||||
<select id="selectLatestResources" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据关键词搜索资源 -->
|
||||
<select id="searchByKeyword" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE (title LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR content LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR summary LIKE CONCAT('%', #{keyword}, '%'))
|
||||
AND status = 1 AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查资源标题是否存在 -->
|
||||
<select id="countByTitle" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource
|
||||
WHERE title = #{title} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入资源 -->
|
||||
<insert id="insertResource" parameterType="org.xyzh.common.dto.resource.TbResource">
|
||||
INSERT INTO tb_resource (
|
||||
id, title, content, summary, cover_image, category_id, author, source,
|
||||
source_url, view_count, like_count, collect_count, status, is_recommend,
|
||||
is_banner, publish_time, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{title}, #{content}, #{summary}, #{coverImage}, #{categoryID}, #{author}, #{source},
|
||||
#{sourceUrl}, #{viewCount}, #{likeCount}, #{collectCount}, #{status}, #{isRecommend},
|
||||
#{isBanner}, #{publishTime}, #{creator}, #{updater}, #{createTime}, #{updateTime},
|
||||
#{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新资源 -->
|
||||
<update id="updateResource" parameterType="org.xyzh.common.dto.resource.TbResource">
|
||||
UPDATE tb_resource
|
||||
<set>
|
||||
<if test="title != null and title != ''">
|
||||
title = #{title},
|
||||
</if>
|
||||
<if test="content != null and content != ''">
|
||||
content = #{content},
|
||||
</if>
|
||||
<if test="summary != null and summary != ''">
|
||||
summary = #{summary},
|
||||
</if>
|
||||
<if test="coverImage != null and coverImage != ''">
|
||||
cover_image = #{coverImage},
|
||||
</if>
|
||||
<if test="categoryID != null and categoryID != ''">
|
||||
category_id = #{categoryID},
|
||||
</if>
|
||||
<if test="author != null and author != ''">
|
||||
author = #{author},
|
||||
</if>
|
||||
<if test="source != null and source != ''">
|
||||
source = #{source},
|
||||
</if>
|
||||
<if test="sourceUrl != null and sourceUrl != ''">
|
||||
source_url = #{sourceUrl},
|
||||
</if>
|
||||
<if test="viewCount != null">
|
||||
view_count = #{viewCount},
|
||||
</if>
|
||||
<if test="likeCount != null">
|
||||
like_count = #{likeCount},
|
||||
</if>
|
||||
<if test="collectCount != null">
|
||||
collect_count = #{collectCount},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="isRecommend != null">
|
||||
is_recommend = #{isRecommend},
|
||||
</if>
|
||||
<if test="isBanner != null">
|
||||
is_banner = #{isBanner},
|
||||
</if>
|
||||
<if test="publishTime != null">
|
||||
publish_time = #{publishTime},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除资源 -->
|
||||
<delete id="deleteResource" parameterType="org.xyzh.common.dto.resource.TbResource">
|
||||
DELETE FROM tb_resource
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入资源 -->
|
||||
<insert id="batchInsertResources" parameterType="java.util.List">
|
||||
INSERT INTO tb_resource (
|
||||
id, title, content, summary, cover_image, category_id, author, source,
|
||||
source_url, view_count, like_count, collect_count, status, is_recommend,
|
||||
is_banner, publish_time, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="resourceList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.title}, #{item.content}, #{item.summary}, #{item.coverImage},
|
||||
#{item.categoryID}, #{item.author}, #{item.source}, #{item.sourceUrl},
|
||||
#{item.viewCount}, #{item.likeCount}, #{item.collectCount}, #{item.status},
|
||||
#{item.isRecommend}, #{item.isBanner}, #{item.publishTime}, #{item.creator},
|
||||
#{item.updater}, #{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除资源 -->
|
||||
<delete id="batchDeleteResources">
|
||||
DELETE FROM tb_resource
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询资源 -->
|
||||
<select id="selectResourcesPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计资源总数 -->
|
||||
<select id="countResources" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -44,4 +44,149 @@
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据推荐ID查询推荐信息 -->
|
||||
<select id="selectByRecommendId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE id = #{recommendId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据资源ID查询推荐列表 -->
|
||||
<select id="selectByResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE resource_id = #{resourceId} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询推荐列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询推荐列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询热门推荐列表 -->
|
||||
<select id="selectHotRecommends" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询最新推荐列表 -->
|
||||
<select id="selectLatestRecommends" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入资源推荐 -->
|
||||
<insert id="insertResourceRecommend" parameterType="org.xyzh.common.dto.resource.TbResourceRecommend">
|
||||
INSERT INTO tb_resource_recommend (
|
||||
id, resource_id, order_num, reason, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{resourceID}, #{orderNum}, #{reason}, #{creator}, #{updater}, #{createTime},
|
||||
#{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新资源推荐 -->
|
||||
<update id="updateResourceRecommend" parameterType="org.xyzh.common.dto.resource.TbResourceRecommend">
|
||||
UPDATE tb_resource_recommend
|
||||
<set>
|
||||
<if test="resourceID != null and resourceID != ''">
|
||||
resource_id = #{resourceID},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="reason != null and reason != ''">
|
||||
reason = #{reason},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除资源推荐 -->
|
||||
<delete id="deleteResourceRecommend" parameterType="org.xyzh.common.dto.resource.TbResourceRecommend">
|
||||
DELETE FROM tb_resource_recommend
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入资源推荐 -->
|
||||
<insert id="batchInsertResourceRecommends" parameterType="java.util.List">
|
||||
INSERT INTO tb_resource_recommend (
|
||||
id, resource_id, order_num, reason, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="resourceRecommendList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.resourceID}, #{item.orderNum}, #{item.reason}, #{item.creator},
|
||||
#{item.updater}, #{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除资源推荐 -->
|
||||
<delete id="batchDeleteResourceRecommends">
|
||||
DELETE FROM tb_resource_recommend
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询资源推荐 -->
|
||||
<select id="selectResourceRecommendsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_recommend
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计资源推荐总数 -->
|
||||
<select id="countResourceRecommends" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource_recommend
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -37,4 +37,133 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据关联ID查询关联信息 -->
|
||||
<select id="selectByRelationId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_tag
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据资源ID查询标签关联列表 -->
|
||||
<select id="selectByResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_tag
|
||||
WHERE resource_id = #{resourceId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据标签ID查询资源关联列表 -->
|
||||
<select id="selectByTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_tag
|
||||
WHERE tag_id = #{tagId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据资源ID和标签ID查询关联信息 -->
|
||||
<select id="selectByResourceIdAndTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_tag
|
||||
WHERE resource_id = #{resourceId} AND tag_id = #{tagId}
|
||||
</select>
|
||||
|
||||
<!-- 检查资源标签关联是否存在 -->
|
||||
<select id="countByResourceIdAndTagId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource_tag
|
||||
WHERE resource_id = #{resourceId} AND tag_id = #{tagId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入资源标签关联 -->
|
||||
<insert id="insertResourceTag" parameterType="org.xyzh.common.dto.resource.TbResourceTag">
|
||||
INSERT INTO tb_resource_tag (
|
||||
id, resource_id, tag_id, creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{resourceID}, #{tagID}, #{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新资源标签关联 -->
|
||||
<update id="updateResourceTag" parameterType="org.xyzh.common.dto.resource.TbResourceTag">
|
||||
UPDATE tb_resource_tag
|
||||
<set>
|
||||
<if test="resourceID != null and resourceID != ''">
|
||||
resource_id = #{resourceID},
|
||||
</if>
|
||||
<if test="tagID != null and tagID != ''">
|
||||
tag_id = #{tagID},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除资源标签关联 -->
|
||||
<delete id="deleteResourceTag" parameterType="org.xyzh.common.dto.resource.TbResourceTag">
|
||||
DELETE FROM tb_resource_tag
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入资源标签关联 -->
|
||||
<insert id="batchInsertResourceTags" parameterType="java.util.List">
|
||||
INSERT INTO tb_resource_tag (
|
||||
id, resource_id, tag_id, creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="resourceTagList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.resourceID}, #{item.tagID}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除资源标签关联 -->
|
||||
<delete id="batchDeleteResourceTags">
|
||||
DELETE FROM tb_resource_tag
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据资源ID批量删除标签关联 -->
|
||||
<delete id="deleteByResourceId">
|
||||
DELETE FROM tb_resource_tag
|
||||
WHERE resource_id = #{resourceId}
|
||||
</delete>
|
||||
|
||||
<!-- 根据标签ID批量删除资源关联 -->
|
||||
<delete id="deleteByTagId">
|
||||
DELETE FROM tb_resource_tag
|
||||
WHERE tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询资源标签关联 -->
|
||||
<select id="selectResourceTagsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource_tag
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计资源标签关联总数 -->
|
||||
<select id="countResourceTags" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource_tag
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -48,4 +48,150 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据标签ID查询标签信息 -->
|
||||
<select id="selectByTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
WHERE tag_id = #{tagId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据标签名称查询标签 -->
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询标签列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询标签列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询热门标签列表 -->
|
||||
<select id="selectHotTags" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 检查标签名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_tag
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入标签 -->
|
||||
<insert id="insertTag" parameterType="org.xyzh.common.dto.resource.TbTag">
|
||||
INSERT INTO tb_tag (
|
||||
id, tag_id, name, color, description, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{tagID}, #{name}, #{color}, #{description}, #{creator}, #{updater}, #{createTime},
|
||||
#{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新标签 -->
|
||||
<update id="updateTag" parameterType="org.xyzh.common.dto.resource.TbTag">
|
||||
UPDATE tb_tag
|
||||
<set>
|
||||
<if test="tagID != null and tagID != ''">
|
||||
tag_id = #{tagID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="color != null and color != ''">
|
||||
color = #{color},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除标签 -->
|
||||
<delete id="deleteTag" parameterType="org.xyzh.common.dto.resource.TbTag">
|
||||
DELETE FROM tb_tag
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入标签 -->
|
||||
<insert id="batchInsertTags" parameterType="java.util.List">
|
||||
INSERT INTO tb_tag (
|
||||
id, tag_id, name, color, description, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="tagList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.tagID}, #{item.name}, #{item.color}, #{item.description},
|
||||
#{item.creator}, #{item.updater}, #{item.createTime}, #{item.updateTime},
|
||||
#{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除标签 -->
|
||||
<delete id="batchDeleteTags">
|
||||
DELETE FROM tb_tag
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询标签 -->
|
||||
<select id="selectTagsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_tag
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计标签总数 -->
|
||||
<select id="countTags" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_tag
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbCourseChapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 课程章节数据访问层
|
||||
* @description CourseChapterMapper.java文件描述 课程章节数据访问层
|
||||
* @filename CourseChapterMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,132 @@ public interface CourseChapterMapper extends BaseMapper<TbCourseChapter> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseChapter> selectCourseChapters(TbCourseChapter filter);
|
||||
|
||||
/**
|
||||
* @description 根据章节ID查询章节信息
|
||||
* @param chapterId 章节ID
|
||||
* @return TbCourseChapter 章节信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourseChapter selectByChapterId(@Param("chapterId") String chapterId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询章节列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbCourseChapter> 章节列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseChapter> selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据章节名称查询章节
|
||||
* @param name 章节名称
|
||||
* @return TbCourseChapter 章节信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourseChapter selectByName(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询章节列表
|
||||
* @param status 状态
|
||||
* @return List<TbCourseChapter> 章节列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseChapter> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID和排序查询章节列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbCourseChapter> 章节列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseChapter> selectByCourseIdOrderBySort(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 检查章节名称是否存在
|
||||
* @param name 章节名称
|
||||
* @param excludeId 排除的章节ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入课程章节
|
||||
* @param courseChapter 课程章节
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertCourseChapter(TbCourseChapter courseChapter);
|
||||
|
||||
/**
|
||||
* @description 更新课程章节
|
||||
* @param courseChapter 课程章节
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateCourseChapter(TbCourseChapter courseChapter);
|
||||
|
||||
/**
|
||||
* @description 删除课程章节
|
||||
* @param courseChapter 课程章节
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteCourseChapter(TbCourseChapter courseChapter);
|
||||
|
||||
/**
|
||||
* @description 批量插入课程章节
|
||||
* @param courseChapterList 课程章节列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertCourseChapters(@Param("courseChapterList") List<TbCourseChapter> courseChapterList);
|
||||
|
||||
/**
|
||||
* @description 批量删除课程章节
|
||||
* @param ids 章节ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteCourseChapters(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID批量删除章节
|
||||
* @param courseId 课程ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 分页查询课程章节
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbCourseChapter> 课程章节列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseChapter> selectCourseChaptersPage(@Param("filter") TbCourseChapter filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计课程章节总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countCourseChapters(@Param("filter") TbCourseChapter filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbCourse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 课程数据访问层
|
||||
* @description CourseMapper.java文件描述 课程数据访问层
|
||||
* @filename CourseMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,150 @@ public interface CourseMapper extends BaseMapper<TbCourse> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectCourses(TbCourse filter);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询课程信息
|
||||
* @param courseId 课程ID
|
||||
* @return TbCourse 课程信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourse selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据课程名称查询课程
|
||||
* @param name 课程名称
|
||||
* @return TbCourse 课程信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourse selectByName(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询课程列表
|
||||
* @param status 状态
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询课程列表
|
||||
* @param type 类型
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 根据难度查询课程列表
|
||||
* @param difficulty 难度
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectByDifficulty(@Param("difficulty") Integer difficulty);
|
||||
|
||||
/**
|
||||
* @description 查询热门课程列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectHotCourses(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 查询最新课程列表
|
||||
* @param limit 限制数量
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectLatestCourses(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 根据关键词搜索课程
|
||||
* @param keyword 关键词
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> searchByKeyword(@Param("keyword") String keyword);
|
||||
|
||||
/**
|
||||
* @description 检查课程名称是否存在
|
||||
* @param name 课程名称
|
||||
* @param excludeId 排除的课程ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入课程
|
||||
* @param course 课程
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertCourse(TbCourse course);
|
||||
|
||||
/**
|
||||
* @description 更新课程
|
||||
* @param course 课程
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateCourse(TbCourse course);
|
||||
|
||||
/**
|
||||
* @description 删除课程
|
||||
* @param course 课程
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteCourse(TbCourse course);
|
||||
|
||||
/**
|
||||
* @description 批量插入课程
|
||||
* @param courseList 课程列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertCourses(@Param("courseList") List<TbCourse> courseList);
|
||||
|
||||
/**
|
||||
* @description 批量删除课程
|
||||
* @param ids 课程ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteCourses(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询课程
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbCourse> 课程列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourse> selectCoursesPage(@Param("filter") TbCourse filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计课程总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countCourses(@Param("filter") TbCourse filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbCourseTag;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 课程标签关联数据访问层
|
||||
* @description CourseTagMapper.java文件描述 课程标签关联数据访问层
|
||||
* @filename CourseTagMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,134 @@ public interface CourseTagMapper extends BaseMapper<TbCourseTag> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseTag> selectCourseTags(TbCourseTag filter);
|
||||
|
||||
/**
|
||||
* @description 根据关联ID查询关联信息
|
||||
* @param relationId 关联ID
|
||||
* @return TbCourseTag 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourseTag selectByRelationId(@Param("relationId") String relationId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询标签关联列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbCourseTag> 标签关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseTag> selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID查询课程关联列表
|
||||
* @param tagId 标签ID
|
||||
* @return List<TbCourseTag> 课程关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseTag> selectByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID和标签ID查询关联信息
|
||||
* @param courseId 课程ID
|
||||
* @param tagId 标签ID
|
||||
* @return TbCourseTag 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbCourseTag selectByCourseIdAndTagId(@Param("courseId") String courseId, @Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 检查课程标签关联是否存在
|
||||
* @param courseId 课程ID
|
||||
* @param tagId 标签ID
|
||||
* @param excludeId 排除的关联ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByCourseIdAndTagId(@Param("courseId") String courseId, @Param("tagId") String tagId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入课程标签关联
|
||||
* @param courseTag 课程标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertCourseTag(TbCourseTag courseTag);
|
||||
|
||||
/**
|
||||
* @description 更新课程标签关联
|
||||
* @param courseTag 课程标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateCourseTag(TbCourseTag courseTag);
|
||||
|
||||
/**
|
||||
* @description 删除课程标签关联
|
||||
* @param courseTag 课程标签关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteCourseTag(TbCourseTag courseTag);
|
||||
|
||||
/**
|
||||
* @description 批量插入课程标签关联
|
||||
* @param courseTagList 课程标签关联列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertCourseTags(@Param("courseTagList") List<TbCourseTag> courseTagList);
|
||||
|
||||
/**
|
||||
* @description 批量删除课程标签关联
|
||||
* @param ids 关联ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteCourseTags(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID批量删除标签关联
|
||||
* @param courseId 课程ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID批量删除课程关联
|
||||
* @param tagId 标签ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 分页查询课程标签关联
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbCourseTag> 课程标签关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbCourseTag> selectCourseTagsPage(@Param("filter") TbCourseTag filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计课程标签关联总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countCourseTags(@Param("filter") TbCourseTag filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbLearningRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 学习记录数据访问层
|
||||
* @description LearningRecordMapper.java文件描述 学习记录数据访问层
|
||||
* @filename LearningRecordMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,123 @@ public interface LearningRecordMapper extends BaseMapper<TbLearningRecord> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningRecord> selectLearningRecords(TbLearningRecord filter);
|
||||
|
||||
/**
|
||||
* @description 根据记录ID查询记录信息
|
||||
* @param recordId 记录ID
|
||||
* @return TbLearningRecord 记录信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningRecord selectByRecordId(@Param("recordId") String recordId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询学习记录列表
|
||||
* @param userId 用户ID
|
||||
* @return List<TbLearningRecord> 学习记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningRecord> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询学习记录列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbLearningRecord> 学习记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningRecord> selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和课程ID查询学习记录
|
||||
* @param userId 用户ID
|
||||
* @param courseId 课程ID
|
||||
* @return TbLearningRecord 学习记录
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningRecord selectByUserIdAndCourseId(@Param("userId") String userId, @Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询学习记录列表
|
||||
* @param status 状态
|
||||
* @return List<TbLearningRecord> 学习记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningRecord> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 查询用户学习统计信息
|
||||
* @param userId 用户ID
|
||||
* @return TbLearningRecord 统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningRecord selectLearningStatistics(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 插入学习记录
|
||||
* @param learningRecord 学习记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertLearningRecord(TbLearningRecord learningRecord);
|
||||
|
||||
/**
|
||||
* @description 更新学习记录
|
||||
* @param learningRecord 学习记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateLearningRecord(TbLearningRecord learningRecord);
|
||||
|
||||
/**
|
||||
* @description 删除学习记录
|
||||
* @param learningRecord 学习记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteLearningRecord(TbLearningRecord learningRecord);
|
||||
|
||||
/**
|
||||
* @description 批量插入学习记录
|
||||
* @param learningRecordList 学习记录列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertLearningRecords(@Param("learningRecordList") List<TbLearningRecord> learningRecordList);
|
||||
|
||||
/**
|
||||
* @description 批量删除学习记录
|
||||
* @param ids 记录ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteLearningRecords(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询学习记录
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbLearningRecord> 学习记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningRecord> selectLearningRecordsPage(@Param("filter") TbLearningRecord filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计学习记录总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countLearningRecords(@Param("filter") TbLearningRecord filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbLearningStatistics;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 学习统计数据访问层
|
||||
* @description LearningStatisticsMapper.java文件描述 学习统计数据访问层
|
||||
* @filename LearningStatisticsMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,123 @@ public interface LearningStatisticsMapper extends BaseMapper<TbLearningStatistic
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningStatistics> selectLearningStatistics(TbLearningStatistics filter);
|
||||
|
||||
/**
|
||||
* @description 根据统计ID查询统计信息
|
||||
* @param statisticsId 统计ID
|
||||
* @return TbLearningStatistics 统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningStatistics selectByStatisticsId(@Param("statisticsId") String statisticsId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询学习统计
|
||||
* @param userId 用户ID
|
||||
* @return TbLearningStatistics 学习统计
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningStatistics selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询学习统计列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbLearningStatistics> 学习统计列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningStatistics> selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和课程ID查询学习统计
|
||||
* @param userId 用户ID
|
||||
* @param courseId 课程ID
|
||||
* @return TbLearningStatistics 学习统计
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningStatistics selectByUserIdAndCourseId(@Param("userId") String userId, @Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据统计类型查询学习统计列表
|
||||
* @param type 统计类型
|
||||
* @return List<TbLearningStatistics> 学习统计列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningStatistics> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 查询用户学习排行榜
|
||||
* @param limit 限制数量
|
||||
* @return List<TbLearningStatistics> 学习统计列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningStatistics> selectLearningRanking(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 插入学习统计
|
||||
* @param learningStatistics 学习统计
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertLearningStatistics(TbLearningStatistics learningStatistics);
|
||||
|
||||
/**
|
||||
* @description 更新学习统计
|
||||
* @param learningStatistics 学习统计
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateLearningStatistics(TbLearningStatistics learningStatistics);
|
||||
|
||||
/**
|
||||
* @description 删除学习统计
|
||||
* @param learningStatistics 学习统计
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteLearningStatistics(TbLearningStatistics learningStatistics);
|
||||
|
||||
/**
|
||||
* @description 批量插入学习统计
|
||||
* @param learningStatisticsList 学习统计列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertLearningStatistics(@Param("learningStatisticsList") List<TbLearningStatistics> learningStatisticsList);
|
||||
|
||||
/**
|
||||
* @description 批量删除学习统计
|
||||
* @param ids 统计ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteLearningStatistics(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询学习统计
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbLearningStatistics> 学习统计列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningStatistics> selectLearningStatisticsPage(@Param("filter") TbLearningStatistics filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计学习统计总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countLearningStatistics(@Param("filter") TbLearningStatistics filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbLearningTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 学习任务数据访问层
|
||||
* @description LearningTaskMapper.java文件描述 学习任务数据访问层
|
||||
* @filename LearningTaskMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,141 @@ public interface LearningTaskMapper extends BaseMapper<TbLearningTask> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectLearningTasks(TbLearningTask filter);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID查询任务信息
|
||||
* @param taskId 任务ID
|
||||
* @return TbLearningTask 任务信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningTask selectByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询学习任务列表
|
||||
* @param userId 用户ID
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据任务名称查询任务
|
||||
* @param name 任务名称
|
||||
* @return TbLearningTask 任务信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbLearningTask selectByName(@Param("name") String name);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询学习任务列表
|
||||
* @param status 状态
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据优先级查询学习任务列表
|
||||
* @param priority 优先级
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectByPriority(@Param("priority") Integer priority);
|
||||
|
||||
/**
|
||||
* @description 查询用户待完成任务列表
|
||||
* @param userId 用户ID
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectPendingTasksByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询用户已完成任务列表
|
||||
* @param userId 用户ID
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectCompletedTasksByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 检查任务名称是否存在
|
||||
* @param name 任务名称
|
||||
* @param excludeId 排除的任务ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入学习任务
|
||||
* @param learningTask 学习任务
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertLearningTask(TbLearningTask learningTask);
|
||||
|
||||
/**
|
||||
* @description 更新学习任务
|
||||
* @param learningTask 学习任务
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateLearningTask(TbLearningTask learningTask);
|
||||
|
||||
/**
|
||||
* @description 删除学习任务
|
||||
* @param learningTask 学习任务
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteLearningTask(TbLearningTask learningTask);
|
||||
|
||||
/**
|
||||
* @description 批量插入学习任务
|
||||
* @param learningTaskList 学习任务列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertLearningTasks(@Param("learningTaskList") List<TbLearningTask> learningTaskList);
|
||||
|
||||
/**
|
||||
* @description 批量删除学习任务
|
||||
* @param ids 任务ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteLearningTasks(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询学习任务
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbLearningTask> 学习任务列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbLearningTask> selectLearningTasksPage(@Param("filter") TbLearningTask filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计学习任务总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countLearningTasks(@Param("filter") TbLearningTask filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbTaskCourse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 任务课程关联数据访问层
|
||||
* @description TaskCourseMapper.java文件描述 任务课程关联数据访问层
|
||||
* @filename TaskCourseMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,134 @@ public interface TaskCourseMapper extends BaseMapper<TbTaskCourse> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskCourse> selectTaskCourses(TbTaskCourse filter);
|
||||
|
||||
/**
|
||||
* @description 根据关联ID查询关联信息
|
||||
* @param relationId 关联ID
|
||||
* @return TbTaskCourse 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskCourse selectByRelationId(@Param("relationId") String relationId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID查询课程关联列表
|
||||
* @param taskId 任务ID
|
||||
* @return List<TbTaskCourse> 课程关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskCourse> selectByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID查询任务关联列表
|
||||
* @param courseId 课程ID
|
||||
* @return List<TbTaskCourse> 任务关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskCourse> selectByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID和课程ID查询关联信息
|
||||
* @param taskId 任务ID
|
||||
* @param courseId 课程ID
|
||||
* @return TbTaskCourse 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskCourse selectByTaskIdAndCourseId(@Param("taskId") String taskId, @Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 检查任务课程关联是否存在
|
||||
* @param taskId 任务ID
|
||||
* @param courseId 课程ID
|
||||
* @param excludeId 排除的关联ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTaskIdAndCourseId(@Param("taskId") String taskId, @Param("courseId") String courseId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入任务课程关联
|
||||
* @param taskCourse 任务课程关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertTaskCourse(TbTaskCourse taskCourse);
|
||||
|
||||
/**
|
||||
* @description 更新任务课程关联
|
||||
* @param taskCourse 任务课程关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateTaskCourse(TbTaskCourse taskCourse);
|
||||
|
||||
/**
|
||||
* @description 删除任务课程关联
|
||||
* @param taskCourse 任务课程关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteTaskCourse(TbTaskCourse taskCourse);
|
||||
|
||||
/**
|
||||
* @description 批量插入任务课程关联
|
||||
* @param taskCourseList 任务课程关联列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertTaskCourses(@Param("taskCourseList") List<TbTaskCourse> taskCourseList);
|
||||
|
||||
/**
|
||||
* @description 批量删除任务课程关联
|
||||
* @param ids 关联ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteTaskCourses(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID批量删除课程关联
|
||||
* @param taskId 任务ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据课程ID批量删除任务关联
|
||||
* @param courseId 课程ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByCourseId(@Param("courseId") String courseId);
|
||||
|
||||
/**
|
||||
* @description 分页查询任务课程关联
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbTaskCourse> 任务课程关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskCourse> selectTaskCoursesPage(@Param("filter") TbTaskCourse filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计任务课程关联总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countTaskCourses(@Param("filter") TbTaskCourse filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbTaskResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 任务资源关联数据访问层
|
||||
* @description TaskResourceMapper.java文件描述 任务资源关联数据访问层
|
||||
* @filename TaskResourceMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,134 @@ public interface TaskResourceMapper extends BaseMapper<TbTaskResource> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskResource> selectTaskResources(TbTaskResource filter);
|
||||
|
||||
/**
|
||||
* @description 根据关联ID查询关联信息
|
||||
* @param relationId 关联ID
|
||||
* @return TbTaskResource 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskResource selectByRelationId(@Param("relationId") String relationId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID查询资源关联列表
|
||||
* @param taskId 任务ID
|
||||
* @return List<TbTaskResource> 资源关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskResource> selectByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID查询任务关联列表
|
||||
* @param resourceId 资源ID
|
||||
* @return List<TbTaskResource> 任务关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskResource> selectByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID和资源ID查询关联信息
|
||||
* @param taskId 任务ID
|
||||
* @param resourceId 资源ID
|
||||
* @return TbTaskResource 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskResource selectByTaskIdAndResourceId(@Param("taskId") String taskId, @Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 检查任务资源关联是否存在
|
||||
* @param taskId 任务ID
|
||||
* @param resourceId 资源ID
|
||||
* @param excludeId 排除的关联ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTaskIdAndResourceId(@Param("taskId") String taskId, @Param("resourceId") String resourceId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入任务资源关联
|
||||
* @param taskResource 任务资源关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertTaskResource(TbTaskResource taskResource);
|
||||
|
||||
/**
|
||||
* @description 更新任务资源关联
|
||||
* @param taskResource 任务资源关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateTaskResource(TbTaskResource taskResource);
|
||||
|
||||
/**
|
||||
* @description 删除任务资源关联
|
||||
* @param taskResource 任务资源关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteTaskResource(TbTaskResource taskResource);
|
||||
|
||||
/**
|
||||
* @description 批量插入任务资源关联
|
||||
* @param taskResourceList 任务资源关联列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertTaskResources(@Param("taskResourceList") List<TbTaskResource> taskResourceList);
|
||||
|
||||
/**
|
||||
* @description 批量删除任务资源关联
|
||||
* @param ids 关联ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteTaskResources(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID批量删除资源关联
|
||||
* @param taskId 任务ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据资源ID批量删除任务关联
|
||||
* @param resourceId 资源ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 分页查询任务资源关联
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbTaskResource> 任务资源关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskResource> selectTaskResourcesPage(@Param("filter") TbTaskResource filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计任务资源关联总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countTaskResources(@Param("filter") TbTaskResource filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.study.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.study.TbTaskUser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 任务用户数据访问层
|
||||
* @description TaskUserMapper.java文件描述 任务用户数据访问层
|
||||
* @filename TaskUserMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,153 @@ public interface TaskUserMapper extends BaseMapper<TbTaskUser> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectTaskUsers(TbTaskUser filter);
|
||||
|
||||
/**
|
||||
* @description 根据关联ID查询关联信息
|
||||
* @param relationId 关联ID
|
||||
* @return TbTaskUser 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskUser selectByRelationId(@Param("relationId") String relationId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID查询用户关联列表
|
||||
* @param taskId 任务ID
|
||||
* @return List<TbTaskUser> 用户关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询任务关联列表
|
||||
* @param userId 用户ID
|
||||
* @return List<TbTaskUser> 任务关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID和用户ID查询关联信息
|
||||
* @param taskId 任务ID
|
||||
* @param userId 用户ID
|
||||
* @return TbTaskUser 关联信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTaskUser selectByTaskIdAndUserId(@Param("taskId") String taskId, @Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询任务用户关联列表
|
||||
* @param status 状态
|
||||
* @return List<TbTaskUser> 任务用户关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectByStatus(@Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和状态查询任务关联列表
|
||||
* @param userId 用户ID
|
||||
* @param status 状态
|
||||
* @return List<TbTaskUser> 任务关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectByUserIdAndStatus(@Param("userId") String userId, @Param("status") Integer status);
|
||||
|
||||
/**
|
||||
* @description 检查任务用户关联是否存在
|
||||
* @param taskId 任务ID
|
||||
* @param userId 用户ID
|
||||
* @param excludeId 排除的关联ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTaskIdAndUserId(@Param("taskId") String taskId, @Param("userId") String userId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入任务用户关联
|
||||
* @param taskUser 任务用户关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertTaskUser(TbTaskUser taskUser);
|
||||
|
||||
/**
|
||||
* @description 更新任务用户关联
|
||||
* @param taskUser 任务用户关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateTaskUser(TbTaskUser taskUser);
|
||||
|
||||
/**
|
||||
* @description 删除任务用户关联
|
||||
* @param taskUser 任务用户关联
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteTaskUser(TbTaskUser taskUser);
|
||||
|
||||
/**
|
||||
* @description 批量插入任务用户关联
|
||||
* @param taskUserList 任务用户关联列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertTaskUsers(@Param("taskUserList") List<TbTaskUser> taskUserList);
|
||||
|
||||
/**
|
||||
* @description 批量删除任务用户关联
|
||||
* @param ids 关联ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteTaskUsers(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 根据任务ID批量删除用户关联
|
||||
* @param taskId 任务ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByTaskId(@Param("taskId") String taskId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID批量删除任务关联
|
||||
* @param userId 用户ID
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 分页查询任务用户关联
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbTaskUser> 任务用户关联列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTaskUser> selectTaskUsersPage(@Param("filter") TbTaskUser filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计任务用户关联总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countTaskUsers(@Param("filter") TbTaskUser filter);
|
||||
}
|
||||
|
||||
@@ -47,4 +47,159 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据章节ID查询章节信息 -->
|
||||
<select id="selectByChapterId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
WHERE id = #{chapterId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询章节列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
WHERE course_id = #{courseId} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据章节名称查询章节 -->
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询章节列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID和排序查询章节列表 -->
|
||||
<select id="selectByCourseIdOrderBySort" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
WHERE course_id = #{courseId} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 检查章节名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course_chapter
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入课程章节 -->
|
||||
<insert id="insertCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
|
||||
INSERT INTO tb_course_chapter (
|
||||
id, course_id, name, content, video_url, duration, order_num,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{courseID}, #{name}, #{content}, #{videoUrl}, #{duration}, #{orderNum},
|
||||
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新课程章节 -->
|
||||
<update id="updateCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
|
||||
UPDATE tb_course_chapter
|
||||
<set>
|
||||
<if test="courseID != null and courseID != ''">
|
||||
course_id = #{courseID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="content != null and content != ''">
|
||||
content = #{content},
|
||||
</if>
|
||||
<if test="videoUrl != null and videoUrl != ''">
|
||||
video_url = #{videoUrl},
|
||||
</if>
|
||||
<if test="duration != null">
|
||||
duration = #{duration},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除课程章节 -->
|
||||
<delete id="deleteCourseChapter" parameterType="org.xyzh.common.dto.study.TbCourseChapter">
|
||||
DELETE FROM tb_course_chapter
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入课程章节 -->
|
||||
<insert id="batchInsertCourseChapters" parameterType="java.util.List">
|
||||
INSERT INTO tb_course_chapter (
|
||||
id, course_id, name, content, video_url, duration, order_num,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="courseChapterList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.courseID}, #{item.name}, #{item.content}, #{item.videoUrl},
|
||||
#{item.duration}, #{item.orderNum}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除课程章节 -->
|
||||
<delete id="batchDeleteCourseChapters">
|
||||
DELETE FROM tb_course_chapter
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据课程ID批量删除章节 -->
|
||||
<delete id="deleteByCourseId">
|
||||
DELETE FROM tb_course_chapter
|
||||
WHERE course_id = #{courseId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询课程章节 -->
|
||||
<select id="selectCourseChaptersPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_chapter
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计课程章节总数 -->
|
||||
<select id="countCourseChapters" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course_chapter
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -59,4 +59,209 @@
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询课程信息 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE course_id = #{courseId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据课程名称查询课程 -->
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询课程列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE status = #{status} AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询课程列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据难度查询课程列表 -->
|
||||
<select id="selectByDifficulty" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询热门课程列表 -->
|
||||
<select id="selectHotCourses" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY view_count DESC, learn_count DESC, create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 查询最新课程列表 -->
|
||||
<select id="selectLatestCourses" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据关键词搜索课程 -->
|
||||
<select id="searchByKeyword" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
WHERE (name LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR description LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR content LIKE CONCAT('%', #{keyword}, '%')
|
||||
OR teacher LIKE CONCAT('%', #{keyword}, '%'))
|
||||
AND status = 1 AND deleted = 0
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查课程名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入课程 -->
|
||||
<insert id="insertCourse" parameterType="org.xyzh.common.dto.study.TbCourse">
|
||||
INSERT INTO tb_course (
|
||||
id, course_id, name, cover_image, description, content, duration,
|
||||
teacher, status, view_count, learn_count, order_num, creator, updater,
|
||||
create_time, update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{courseID}, #{name}, #{coverImage}, #{description}, #{content}, #{duration},
|
||||
#{teacher}, #{status}, #{viewCount}, #{learnCount}, #{orderNum}, #{creator}, #{updater},
|
||||
#{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新课程 -->
|
||||
<update id="updateCourse" parameterType="org.xyzh.common.dto.study.TbCourse">
|
||||
UPDATE tb_course
|
||||
<set>
|
||||
<if test="courseID != null and courseID != ''">
|
||||
course_id = #{courseID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="coverImage != null and coverImage != ''">
|
||||
cover_image = #{coverImage},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="content != null and content != ''">
|
||||
content = #{content},
|
||||
</if>
|
||||
<if test="duration != null">
|
||||
duration = #{duration},
|
||||
</if>
|
||||
<if test="teacher != null and teacher != ''">
|
||||
teacher = #{teacher},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="viewCount != null">
|
||||
view_count = #{viewCount},
|
||||
</if>
|
||||
<if test="learnCount != null">
|
||||
learn_count = #{learnCount},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除课程 -->
|
||||
<delete id="deleteCourse" parameterType="org.xyzh.common.dto.study.TbCourse">
|
||||
DELETE FROM tb_course
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入课程 -->
|
||||
<insert id="batchInsertCourses" parameterType="java.util.List">
|
||||
INSERT INTO tb_course (
|
||||
id, course_id, name, cover_image, description, content, duration,
|
||||
teacher, status, view_count, learn_count, order_num, creator, updater,
|
||||
create_time, update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="courseList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.courseID}, #{item.name}, #{item.coverImage}, #{item.description},
|
||||
#{item.content}, #{item.duration}, #{item.teacher}, #{item.status}, #{item.viewCount},
|
||||
#{item.learnCount}, #{item.orderNum}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除课程 -->
|
||||
<delete id="batchDeleteCourses">
|
||||
DELETE FROM tb_course
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询课程 -->
|
||||
<select id="selectCoursesPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计课程总数 -->
|
||||
<select id="countCourses" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -37,4 +37,133 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据关联ID查询关联信息 -->
|
||||
<select id="selectByRelationId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_tag
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询标签关联列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_tag
|
||||
WHERE course_id = #{courseId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据标签ID查询课程关联列表 -->
|
||||
<select id="selectByTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_tag
|
||||
WHERE tag_id = #{tagId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID和标签ID查询关联信息 -->
|
||||
<select id="selectByCourseIdAndTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_tag
|
||||
WHERE course_id = #{courseId} AND tag_id = #{tagId}
|
||||
</select>
|
||||
|
||||
<!-- 检查课程标签关联是否存在 -->
|
||||
<select id="countByCourseIdAndTagId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course_tag
|
||||
WHERE course_id = #{courseId} AND tag_id = #{tagId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入课程标签关联 -->
|
||||
<insert id="insertCourseTag" parameterType="org.xyzh.common.dto.study.TbCourseTag">
|
||||
INSERT INTO tb_course_tag (
|
||||
id, course_id, tag_id, creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{courseID}, #{tagID}, #{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新课程标签关联 -->
|
||||
<update id="updateCourseTag" parameterType="org.xyzh.common.dto.study.TbCourseTag">
|
||||
UPDATE tb_course_tag
|
||||
<set>
|
||||
<if test="courseID != null and courseID != ''">
|
||||
course_id = #{courseID},
|
||||
</if>
|
||||
<if test="tagID != null and tagID != ''">
|
||||
tag_id = #{tagID},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除课程标签关联 -->
|
||||
<delete id="deleteCourseTag" parameterType="org.xyzh.common.dto.study.TbCourseTag">
|
||||
DELETE FROM tb_course_tag
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入课程标签关联 -->
|
||||
<insert id="batchInsertCourseTags" parameterType="java.util.List">
|
||||
INSERT INTO tb_course_tag (
|
||||
id, course_id, tag_id, creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="courseTagList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.courseID}, #{item.tagID}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除课程标签关联 -->
|
||||
<delete id="batchDeleteCourseTags">
|
||||
DELETE FROM tb_course_tag
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据课程ID批量删除标签关联 -->
|
||||
<delete id="deleteByCourseId">
|
||||
DELETE FROM tb_course_tag
|
||||
WHERE course_id = #{courseId}
|
||||
</delete>
|
||||
|
||||
<!-- 根据标签ID批量删除课程关联 -->
|
||||
<delete id="deleteByTagId">
|
||||
DELETE FROM tb_course_tag
|
||||
WHERE tag_id = #{tagId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询课程标签关联 -->
|
||||
<select id="selectCourseTagsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_course_tag
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计课程标签关联总数 -->
|
||||
<select id="countCourseTags" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_course_tag
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -54,4 +54,156 @@
|
||||
ORDER BY last_learn_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据记录ID查询记录信息 -->
|
||||
<select id="selectByRecordId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
WHERE id = #{recordId}
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询学习记录列表 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY last_learn_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询学习记录列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
WHERE resource_id = #{courseId}
|
||||
ORDER BY last_learn_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和课程ID查询学习记录 -->
|
||||
<select id="selectByUserIdAndCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
WHERE user_id = #{userId} AND resource_id = #{courseId}
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询学习记录列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
WHERE is_complete = #{status}
|
||||
ORDER BY last_learn_time DESC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户学习统计信息 -->
|
||||
<select id="selectLearningStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
user_id,
|
||||
COUNT(*) as total_records,
|
||||
SUM(duration) as total_duration,
|
||||
AVG(progress) as avg_progress,
|
||||
COUNT(CASE WHEN is_complete = 1 THEN 1 END) as completed_count
|
||||
FROM tb_learning_record
|
||||
WHERE user_id = #{userId}
|
||||
GROUP BY user_id
|
||||
</select>
|
||||
|
||||
<!-- 插入学习记录 -->
|
||||
<insert id="insertLearningRecord" parameterType="org.xyzh.common.dto.study.TbLearningRecord">
|
||||
INSERT INTO tb_learning_record (
|
||||
id, user_id, resource_type, resource_id, task_id, duration, progress,
|
||||
is_complete, complete_time, last_learn_time, create_time, update_time
|
||||
) VALUES (
|
||||
#{id}, #{userID}, #{resourceType}, #{resourceID}, #{taskID}, #{duration}, #{progress},
|
||||
#{isComplete}, #{completeTime}, #{lastLearnTime}, #{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新学习记录 -->
|
||||
<update id="updateLearningRecord" parameterType="org.xyzh.common.dto.study.TbLearningRecord">
|
||||
UPDATE tb_learning_record
|
||||
<set>
|
||||
<if test="userID != null and userID != ''">
|
||||
user_id = #{userID},
|
||||
</if>
|
||||
<if test="resourceType != null">
|
||||
resource_type = #{resourceType},
|
||||
</if>
|
||||
<if test="resourceID != null and resourceID != ''">
|
||||
resource_id = #{resourceID},
|
||||
</if>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="duration != null">
|
||||
duration = #{duration},
|
||||
</if>
|
||||
<if test="progress != null">
|
||||
progress = #{progress},
|
||||
</if>
|
||||
<if test="isComplete != null">
|
||||
is_complete = #{isComplete},
|
||||
</if>
|
||||
<if test="completeTime != null">
|
||||
complete_time = #{completeTime},
|
||||
</if>
|
||||
<if test="lastLearnTime != null">
|
||||
last_learn_time = #{lastLearnTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除学习记录 -->
|
||||
<delete id="deleteLearningRecord" parameterType="org.xyzh.common.dto.study.TbLearningRecord">
|
||||
DELETE FROM tb_learning_record
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入学习记录 -->
|
||||
<insert id="batchInsertLearningRecords" parameterType="java.util.List">
|
||||
INSERT INTO tb_learning_record (
|
||||
id, user_id, resource_type, resource_id, task_id, duration, progress,
|
||||
is_complete, complete_time, last_learn_time, create_time, update_time
|
||||
) VALUES
|
||||
<foreach collection="learningRecordList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userID}, #{item.resourceType}, #{item.resourceID}, #{item.taskID},
|
||||
#{item.duration}, #{item.progress}, #{item.isComplete}, #{item.completeTime},
|
||||
#{item.lastLearnTime}, #{item.createTime}, #{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除学习记录 -->
|
||||
<delete id="batchDeleteLearningRecords">
|
||||
DELETE FROM tb_learning_record
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询学习记录 -->
|
||||
<select id="selectLearningRecordsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_record
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY last_learn_time DESC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计学习记录总数 -->
|
||||
<select id="countLearningRecords" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_learning_record
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -42,4 +42,144 @@
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据统计ID查询统计信息 -->
|
||||
<select id="selectByStatisticsId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
WHERE id = #{statisticsId}
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询学习统计 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询学习统计列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和课程ID查询学习统计 -->
|
||||
<select id="selectByUserIdAndCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据统计类型查询学习统计列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
ORDER BY stat_date DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户学习排行榜 -->
|
||||
<select id="selectLearningRanking" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
ORDER BY total_duration DESC, complete_count DESC, stat_date DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入学习统计 -->
|
||||
<insert id="insertLearningStatistics" parameterType="org.xyzh.common.dto.study.TbLearningStatistics">
|
||||
INSERT INTO tb_learning_statistics (
|
||||
id, user_id, stat_date, total_duration, resource_count, course_count,
|
||||
complete_count, create_time, update_time
|
||||
) VALUES (
|
||||
#{id}, #{userID}, #{statDate}, #{totalDuration}, #{resourceCount}, #{courseCount},
|
||||
#{completeCount}, #{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新学习统计 -->
|
||||
<update id="updateLearningStatistics" parameterType="org.xyzh.common.dto.study.TbLearningStatistics">
|
||||
UPDATE tb_learning_statistics
|
||||
<set>
|
||||
<if test="userID != null and userID != ''">
|
||||
user_id = #{userID},
|
||||
</if>
|
||||
<if test="statDate != null">
|
||||
stat_date = #{statDate},
|
||||
</if>
|
||||
<if test="totalDuration != null">
|
||||
total_duration = #{totalDuration},
|
||||
</if>
|
||||
<if test="resourceCount != null">
|
||||
resource_count = #{resourceCount},
|
||||
</if>
|
||||
<if test="courseCount != null">
|
||||
course_count = #{courseCount},
|
||||
</if>
|
||||
<if test="completeCount != null">
|
||||
complete_count = #{completeCount},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除学习统计 -->
|
||||
<delete id="deleteLearningStatistics" parameterType="org.xyzh.common.dto.study.TbLearningStatistics">
|
||||
DELETE FROM tb_learning_statistics
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入学习统计 -->
|
||||
<insert id="batchInsertLearningStatistics" parameterType="java.util.List">
|
||||
INSERT INTO tb_learning_statistics (
|
||||
id, user_id, stat_date, total_duration, resource_count, course_count,
|
||||
complete_count, create_time, update_time
|
||||
) VALUES
|
||||
<foreach collection="learningStatisticsList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userID}, #{item.statDate}, #{item.totalDuration},
|
||||
#{item.resourceCount}, #{item.courseCount}, #{item.completeCount},
|
||||
#{item.createTime}, #{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除学习统计 -->
|
||||
<delete id="batchDeleteLearningStatistics">
|
||||
DELETE FROM tb_learning_statistics
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询学习统计 -->
|
||||
<select id="selectLearningStatisticsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_statistics
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY stat_date DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计学习统计总数 -->
|
||||
<select id="countLearningStatistics" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_learning_statistics
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -50,4 +50,171 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询任务信息 -->
|
||||
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE task_id = #{taskId} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询学习任务列表 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务名称查询任务 -->
|
||||
<select id="selectByName" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询学习任务列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE status = #{status} AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据优先级查询学习任务列表 -->
|
||||
<select id="selectByPriority" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户待完成任务列表 -->
|
||||
<select id="selectPendingTasksByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE status = 0 AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户已完成任务列表 -->
|
||||
<select id="selectCompletedTasksByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
WHERE status = 1 AND deleted = 0
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查任务名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_learning_task
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入学习任务 -->
|
||||
<insert id="insertLearningTask" parameterType="org.xyzh.common.dto.study.TbLearningTask">
|
||||
INSERT INTO tb_learning_task (
|
||||
id, task_id, name, description, start_time, end_time, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{name}, #{description}, #{startTime}, #{endTime}, #{status},
|
||||
#{creator}, #{updater}, #{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新学习任务 -->
|
||||
<update id="updateLearningTask" parameterType="org.xyzh.common.dto.study.TbLearningTask">
|
||||
UPDATE tb_learning_task
|
||||
<set>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="startTime != null">
|
||||
start_time = #{startTime},
|
||||
</if>
|
||||
<if test="endTime != null">
|
||||
end_time = #{endTime},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除学习任务 -->
|
||||
<delete id="deleteLearningTask" parameterType="org.xyzh.common.dto.study.TbLearningTask">
|
||||
DELETE FROM tb_learning_task
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入学习任务 -->
|
||||
<insert id="batchInsertLearningTasks" parameterType="java.util.List">
|
||||
INSERT INTO tb_learning_task (
|
||||
id, task_id, name, description, start_time, end_time, status,
|
||||
creator, updater, create_time, update_time, delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="learningTaskList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.name}, #{item.description}, #{item.startTime},
|
||||
#{item.endTime}, #{item.status}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除学习任务 -->
|
||||
<delete id="batchDeleteLearningTasks">
|
||||
DELETE FROM tb_learning_task
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询学习任务 -->
|
||||
<select id="selectLearningTasksPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_learning_task
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计学习任务总数 -->
|
||||
<select id="countLearningTasks" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_learning_task
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -42,4 +42,140 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据关联ID查询关联信息 -->
|
||||
<select id="selectByRelationId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_course
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询课程关联列表 -->
|
||||
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_course
|
||||
WHERE task_id = #{taskId}
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据课程ID查询任务关联列表 -->
|
||||
<select id="selectByCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_course
|
||||
WHERE course_id = #{courseId}
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID和课程ID查询关联信息 -->
|
||||
<select id="selectByTaskIdAndCourseId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_course
|
||||
WHERE task_id = #{taskId} AND course_id = #{courseId}
|
||||
</select>
|
||||
|
||||
<!-- 检查任务课程关联是否存在 -->
|
||||
<select id="countByTaskIdAndCourseId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_course
|
||||
WHERE task_id = #{taskId} AND course_id = #{courseId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入任务课程关联 -->
|
||||
<insert id="insertTaskCourse" parameterType="org.xyzh.common.dto.study.TbTaskCourse">
|
||||
INSERT INTO tb_task_course (
|
||||
id, task_id, course_id, required, order_num, creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{courseID}, #{required}, #{orderNum}, #{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新任务课程关联 -->
|
||||
<update id="updateTaskCourse" parameterType="org.xyzh.common.dto.study.TbTaskCourse">
|
||||
UPDATE tb_task_course
|
||||
<set>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="courseID != null and courseID != ''">
|
||||
course_id = #{courseID},
|
||||
</if>
|
||||
<if test="required != null">
|
||||
required = #{required},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除任务课程关联 -->
|
||||
<delete id="deleteTaskCourse" parameterType="org.xyzh.common.dto.study.TbTaskCourse">
|
||||
DELETE FROM tb_task_course
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入任务课程关联 -->
|
||||
<insert id="batchInsertTaskCourses" parameterType="java.util.List">
|
||||
INSERT INTO tb_task_course (
|
||||
id, task_id, course_id, required, order_num, creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="taskCourseList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.courseID}, #{item.required},
|
||||
#{item.orderNum}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除任务课程关联 -->
|
||||
<delete id="batchDeleteTaskCourses">
|
||||
DELETE FROM tb_task_course
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据任务ID批量删除课程关联 -->
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE FROM tb_task_course
|
||||
WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<!-- 根据课程ID批量删除任务关联 -->
|
||||
<delete id="deleteByCourseId">
|
||||
DELETE FROM tb_task_course
|
||||
WHERE course_id = #{courseId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询任务课程关联 -->
|
||||
<select id="selectTaskCoursesPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_course
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计任务课程关联总数 -->
|
||||
<select id="countTaskCourses" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_course
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -42,4 +42,140 @@
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据关联ID查询关联信息 -->
|
||||
<select id="selectByRelationId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_resource
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询资源关联列表 -->
|
||||
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_resource
|
||||
WHERE task_id = #{taskId}
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据资源ID查询任务关联列表 -->
|
||||
<select id="selectByResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_resource
|
||||
WHERE resource_id = #{resourceId}
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID和资源ID查询关联信息 -->
|
||||
<select id="selectByTaskIdAndResourceId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_resource
|
||||
WHERE task_id = #{taskId} AND resource_id = #{resourceId}
|
||||
</select>
|
||||
|
||||
<!-- 检查任务资源关联是否存在 -->
|
||||
<select id="countByTaskIdAndResourceId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_resource
|
||||
WHERE task_id = #{taskId} AND resource_id = #{resourceId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入任务资源关联 -->
|
||||
<insert id="insertTaskResource" parameterType="org.xyzh.common.dto.study.TbTaskResource">
|
||||
INSERT INTO tb_task_resource (
|
||||
id, task_id, resource_id, required, order_num, creator, create_time
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{resourceID}, #{required}, #{orderNum}, #{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新任务资源关联 -->
|
||||
<update id="updateTaskResource" parameterType="org.xyzh.common.dto.study.TbTaskResource">
|
||||
UPDATE tb_task_resource
|
||||
<set>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="resourceID != null and resourceID != ''">
|
||||
resource_id = #{resourceID},
|
||||
</if>
|
||||
<if test="required != null">
|
||||
required = #{required},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除任务资源关联 -->
|
||||
<delete id="deleteTaskResource" parameterType="org.xyzh.common.dto.study.TbTaskResource">
|
||||
DELETE FROM tb_task_resource
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入任务资源关联 -->
|
||||
<insert id="batchInsertTaskResources" parameterType="java.util.List">
|
||||
INSERT INTO tb_task_resource (
|
||||
id, task_id, resource_id, required, order_num, creator, create_time
|
||||
) VALUES
|
||||
<foreach collection="taskResourceList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.resourceID}, #{item.required},
|
||||
#{item.orderNum}, #{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除任务资源关联 -->
|
||||
<delete id="batchDeleteTaskResources">
|
||||
DELETE FROM tb_task_resource
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据任务ID批量删除资源关联 -->
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE FROM tb_task_resource
|
||||
WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<!-- 根据资源ID批量删除任务关联 -->
|
||||
<delete id="deleteByResourceId">
|
||||
DELETE FROM tb_task_resource
|
||||
WHERE resource_id = #{resourceId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询任务资源关联 -->
|
||||
<select id="selectTaskResourcesPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_resource
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计任务资源关联总数 -->
|
||||
<select id="countTaskResources" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_resource
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -49,4 +49,170 @@
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据关联ID查询关联信息 -->
|
||||
<select id="selectByRelationId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE id = #{relationId}
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID查询用户关联列表 -->
|
||||
<select id="selectByTaskId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE task_id = #{taskId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询任务关联列表 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据任务ID和用户ID查询关联信息 -->
|
||||
<select id="selectByTaskIdAndUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE task_id = #{taskId} AND user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询任务用户关联列表 -->
|
||||
<select id="selectByStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE status = #{status}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和状态查询任务关联列表 -->
|
||||
<select id="selectByUserIdAndStatus" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
WHERE user_id = #{userId} AND status = #{status}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查任务用户关联是否存在 -->
|
||||
<select id="countByTaskIdAndUserId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_user
|
||||
WHERE task_id = #{taskId} AND user_id = #{userId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入任务用户关联 -->
|
||||
<insert id="insertTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
INSERT INTO tb_task_user (
|
||||
id, task_id, user_id, dept_id, status, progress, complete_time,
|
||||
creator, create_time, update_time
|
||||
) VALUES (
|
||||
#{id}, #{taskID}, #{userID}, #{deptID}, #{status}, #{progress}, #{completeTime},
|
||||
#{creator}, #{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新任务用户关联 -->
|
||||
<update id="updateTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
UPDATE tb_task_user
|
||||
<set>
|
||||
<if test="taskID != null and taskID != ''">
|
||||
task_id = #{taskID},
|
||||
</if>
|
||||
<if test="userID != null and userID != ''">
|
||||
user_id = #{userID},
|
||||
</if>
|
||||
<if test="deptID != null and deptID != ''">
|
||||
dept_id = #{deptID},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="progress != null">
|
||||
progress = #{progress},
|
||||
</if>
|
||||
<if test="completeTime != null">
|
||||
complete_time = #{completeTime},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除任务用户关联 -->
|
||||
<delete id="deleteTaskUser" parameterType="org.xyzh.common.dto.study.TbTaskUser">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入任务用户关联 -->
|
||||
<insert id="batchInsertTaskUsers" parameterType="java.util.List">
|
||||
INSERT INTO tb_task_user (
|
||||
id, task_id, user_id, dept_id, status, progress, complete_time,
|
||||
creator, create_time, update_time
|
||||
) VALUES
|
||||
<foreach collection="taskUserList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.taskID}, #{item.userID}, #{item.deptID}, #{item.status},
|
||||
#{item.progress}, #{item.completeTime}, #{item.creator}, #{item.createTime}, #{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除任务用户关联 -->
|
||||
<delete id="batchDeleteTaskUsers">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 根据任务ID批量删除用户关联 -->
|
||||
<delete id="deleteByTaskId">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE task_id = #{taskId}
|
||||
</delete>
|
||||
|
||||
<!-- 根据用户ID批量删除任务关联 -->
|
||||
<delete id="deleteByUserId">
|
||||
DELETE FROM tb_task_user
|
||||
WHERE user_id = #{userId}
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询任务用户关联 -->
|
||||
<select id="selectTaskUsersPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_task_user
|
||||
<include refid="Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计任务用户关联总数 -->
|
||||
<select id="countTaskUsers" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_task_user
|
||||
<include refid="Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbAchievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 成就数据访问层
|
||||
* @description AchievementMapper.java文件描述 成就数据访问层
|
||||
* @filename AchievementMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,115 @@ public interface AchievementMapper extends BaseMapper<TbAchievement> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAchievement> selectAchievements(TbAchievement filter);
|
||||
|
||||
/**
|
||||
* @description 根据成就ID查询成就信息
|
||||
* @param achievementId 成就ID
|
||||
* @return TbAchievement 成就信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbAchievement selectByAchievementId(@Param("achievementId") String achievementId);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询成就列表
|
||||
* @param type 成就类型
|
||||
* @return List<TbAchievement> 成就列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAchievement> selectByType(@Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 根据类型和等级查询成就列表
|
||||
* @param type 成就类型
|
||||
* @param level 成就等级
|
||||
* @return List<TbAchievement> 成就列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAchievement> selectByTypeAndLevel(@Param("type") Integer type, @Param("level") Integer level);
|
||||
|
||||
/**
|
||||
* @description 查询成就排行榜
|
||||
* @param limit 限制数量
|
||||
* @return List<TbAchievement> 成就排行榜
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAchievement> selectAchievementRanking(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 检查成就名称是否存在
|
||||
* @param name 成就名称
|
||||
* @param excludeId 排除的成就ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByName(@Param("name") String name, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 插入成就
|
||||
* @param achievement 成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertAchievement(TbAchievement achievement);
|
||||
|
||||
/**
|
||||
* @description 更新成就
|
||||
* @param achievement 成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateAchievement(TbAchievement achievement);
|
||||
|
||||
/**
|
||||
* @description 删除成就
|
||||
* @param achievement 成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteAchievement(TbAchievement achievement);
|
||||
|
||||
/**
|
||||
* @description 批量插入成就
|
||||
* @param achievementList 成就列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertAchievements(@Param("achievementList") List<TbAchievement> achievementList);
|
||||
|
||||
/**
|
||||
* @description 批量删除成就
|
||||
* @param ids 成就ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteAchievements(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询成就
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbAchievement> 成就列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbAchievement> selectAchievementsPage(@Param("filter") TbAchievement filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计成就总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countAchievements(@Param("filter") TbAchievement filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbPointsRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 积分记录数据访问层
|
||||
* @description PointsRecordMapper.java文件描述 积分记录数据访问层
|
||||
* @filename PointsRecordMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,105 @@ public interface PointsRecordMapper extends BaseMapper<TbPointsRecord> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbPointsRecord> selectPointsRecords(TbPointsRecord filter);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询积分记录
|
||||
* @param userId 用户ID
|
||||
* @return List<TbPointsRecord> 积分记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbPointsRecord> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和类型查询积分记录
|
||||
* @param userId 用户ID
|
||||
* @param type 积分类型
|
||||
* @return List<TbPointsRecord> 积分记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbPointsRecord> selectByUserIdAndType(@Param("userId") String userId, @Param("type") Integer type);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询积分记录(包含用户基本信息)
|
||||
* @param userId 用户ID
|
||||
* @return List<TbPointsRecord> 积分记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbPointsRecord> selectPointsRecordsWithUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询用户积分统计
|
||||
* @param userId 用户ID
|
||||
* @return TbPointsRecord 积分统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbPointsRecord selectPointsStatistics(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 插入积分记录
|
||||
* @param pointsRecord 积分记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertPointsRecord(TbPointsRecord pointsRecord);
|
||||
|
||||
/**
|
||||
* @description 更新积分记录
|
||||
* @param pointsRecord 积分记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updatePointsRecord(TbPointsRecord pointsRecord);
|
||||
|
||||
/**
|
||||
* @description 删除积分记录
|
||||
* @param pointsRecord 积分记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deletePointsRecord(TbPointsRecord pointsRecord);
|
||||
|
||||
/**
|
||||
* @description 批量插入积分记录
|
||||
* @param pointsRecordList 积分记录列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertPointsRecords(@Param("pointsRecordList") List<TbPointsRecord> pointsRecordList);
|
||||
|
||||
/**
|
||||
* @description 批量删除积分记录
|
||||
* @param ids 记录ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeletePointsRecords(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询积分记录
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbPointsRecord> 积分记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbPointsRecord> selectPointsRecordsPage(@Param("filter") TbPointsRecord filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计积分记录总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countPointsRecords(@Param("filter") TbPointsRecord filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbUserAchievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 用户成就数据访问层
|
||||
* @description UserAchievementMapper.java文件描述 用户成就数据访问层
|
||||
* @filename UserAchievementMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,105 @@ public interface UserAchievementMapper extends BaseMapper<TbUserAchievement> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserAchievement> selectUserAchievements(TbUserAchievement filter);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询成就记录
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserAchievement> 成就记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserAchievement> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和成就ID查询成就记录
|
||||
* @param userId 用户ID
|
||||
* @param achievementId 成就ID
|
||||
* @return List<TbUserAchievement> 成就记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserAchievement> selectByUserIdAndAchievementId(@Param("userId") String userId, @Param("achievementId") String achievementId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询成就记录(包含用户基本信息)
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserAchievement> 成就记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserAchievement> selectUserAchievementsWithUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询用户成就统计
|
||||
* @param userId 用户ID
|
||||
* @return TbUserAchievement 成就统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbUserAchievement selectAchievementStatistics(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 插入用户成就
|
||||
* @param userAchievement 用户成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertUserAchievement(TbUserAchievement userAchievement);
|
||||
|
||||
/**
|
||||
* @description 更新用户成就
|
||||
* @param userAchievement 用户成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateUserAchievement(TbUserAchievement userAchievement);
|
||||
|
||||
/**
|
||||
* @description 删除用户成就
|
||||
* @param userAchievement 用户成就
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteUserAchievement(TbUserAchievement userAchievement);
|
||||
|
||||
/**
|
||||
* @description 批量插入用户成就
|
||||
* @param userAchievementList 用户成就列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertUserAchievements(@Param("userAchievementList") List<TbUserAchievement> userAchievementList);
|
||||
|
||||
/**
|
||||
* @description 批量删除用户成就
|
||||
* @param ids 成就ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteUserAchievements(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询用户成就
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbUserAchievement> 用户成就列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserAchievement> selectUserAchievementsPage(@Param("filter") TbUserAchievement filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计用户成就总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countUserAchievements(@Param("filter") TbUserAchievement filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbUserBrowseRecord;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 用户浏览记录数据访问层
|
||||
* @description UserBrowseRecordMapper.java文件描述 用户浏览记录数据访问层
|
||||
* @filename UserBrowseRecordMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,105 @@ public interface UserBrowseRecordMapper extends BaseMapper<TbUserBrowseRecord> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserBrowseRecord> selectUserBrowseRecords(TbUserBrowseRecord filter);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询浏览记录
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserBrowseRecord> 浏览记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserBrowseRecord> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和类型查询浏览记录
|
||||
* @param userId 用户ID
|
||||
* @param browseType 浏览类型
|
||||
* @return List<TbUserBrowseRecord> 浏览记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserBrowseRecord> selectByUserIdAndType(@Param("userId") String userId, @Param("browseType") Integer browseType);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询浏览记录(包含用户基本信息)
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserBrowseRecord> 浏览记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserBrowseRecord> selectUserBrowseRecordsWithUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询用户浏览统计
|
||||
* @param userId 用户ID
|
||||
* @return TbUserBrowseRecord 浏览统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbUserBrowseRecord selectBrowseStatistics(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 插入用户浏览记录
|
||||
* @param userBrowseRecord 用户浏览记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertUserBrowseRecord(TbUserBrowseRecord userBrowseRecord);
|
||||
|
||||
/**
|
||||
* @description 更新用户浏览记录
|
||||
* @param userBrowseRecord 用户浏览记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateUserBrowseRecord(TbUserBrowseRecord userBrowseRecord);
|
||||
|
||||
/**
|
||||
* @description 删除用户浏览记录
|
||||
* @param userBrowseRecord 用户浏览记录
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteUserBrowseRecord(TbUserBrowseRecord userBrowseRecord);
|
||||
|
||||
/**
|
||||
* @description 批量插入用户浏览记录
|
||||
* @param userBrowseRecordList 用户浏览记录列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertUserBrowseRecords(@Param("userBrowseRecordList") List<TbUserBrowseRecord> userBrowseRecordList);
|
||||
|
||||
/**
|
||||
* @description 批量删除用户浏览记录
|
||||
* @param ids 记录ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteUserBrowseRecords(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询用户浏览记录
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbUserBrowseRecord> 用户浏览记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserBrowseRecord> selectUserBrowseRecordsPage(@Param("filter") TbUserBrowseRecord filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计用户浏览记录总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countUserBrowseRecords(@Param("filter") TbUserBrowseRecord filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbUserCollection;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 用户收藏数据访问层
|
||||
* @description UserCollectionMapper.java文件描述 用户收藏数据访问层
|
||||
* @filename UserCollectionMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,105 @@ public interface UserCollectionMapper extends BaseMapper<TbUserCollection> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserCollection> selectUserCollections(TbUserCollection filter);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询收藏记录
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserCollection> 收藏记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserCollection> selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID和类型查询收藏记录
|
||||
* @param userId 用户ID
|
||||
* @param collectionType 收藏类型
|
||||
* @return List<TbUserCollection> 收藏记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserCollection> selectByUserIdAndType(@Param("userId") String userId, @Param("collectionType") Integer collectionType);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询收藏记录(包含用户基本信息)
|
||||
* @param userId 用户ID
|
||||
* @return List<TbUserCollection> 收藏记录列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserCollection> selectUserCollectionsWithUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询用户收藏统计
|
||||
* @param userId 用户ID
|
||||
* @return TbUserCollection 收藏统计信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbUserCollection selectCollectionStatistics(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 插入用户收藏
|
||||
* @param userCollection 用户收藏
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertUserCollection(TbUserCollection userCollection);
|
||||
|
||||
/**
|
||||
* @description 更新用户收藏
|
||||
* @param userCollection 用户收藏
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateUserCollection(TbUserCollection userCollection);
|
||||
|
||||
/**
|
||||
* @description 删除用户收藏
|
||||
* @param userCollection 用户收藏
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteUserCollection(TbUserCollection userCollection);
|
||||
|
||||
/**
|
||||
* @description 批量插入用户收藏
|
||||
* @param userCollectionList 用户收藏列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertUserCollections(@Param("userCollectionList") List<TbUserCollection> userCollectionList);
|
||||
|
||||
/**
|
||||
* @description 批量删除用户收藏
|
||||
* @param ids 收藏ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteUserCollections(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询用户收藏
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbUserCollection> 用户收藏列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserCollection> selectUserCollectionsPage(@Param("filter") TbUserCollection filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计用户收藏总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countUserCollections(@Param("filter") TbUserCollection filter);
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@ package org.xyzh.usercenter.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.xyzh.common.core.page.PageParam;
|
||||
import org.xyzh.common.dto.usercenter.TbUserPoints;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @description 用户积分数据访问层
|
||||
* @description UserPointsMapper.java文件描述 用户积分数据访问层
|
||||
* @filename UserPointsMapper.java
|
||||
* @author yslg
|
||||
* @copyright xyzh
|
||||
@@ -24,4 +26,105 @@ public interface UserPointsMapper extends BaseMapper<TbUserPoints> {
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserPoints> selectUserPoints(TbUserPoints filter);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询积分信息
|
||||
* @param userId 用户ID
|
||||
* @return TbUserPoints 用户积分信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbUserPoints selectByUserId(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 检查用户积分是否存在
|
||||
* @param userId 用户ID
|
||||
* @param excludeId 排除的积分ID(用于更新时排除自身)
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByUserId(@Param("userId") String userId, @Param("excludeId") String excludeId);
|
||||
|
||||
/**
|
||||
* @description 根据用户ID查询积分信息(包含用户基本信息)
|
||||
* @param userId 用户ID
|
||||
* @return TbUserPoints 用户积分信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbUserPoints selectUserPointsWithUser(@Param("userId") String userId);
|
||||
|
||||
/**
|
||||
* @description 查询积分排行榜
|
||||
* @param limit 限制数量
|
||||
* @return List<TbUserPoints> 积分排行榜
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserPoints> selectPointsRanking(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 插入用户积分
|
||||
* @param userPoints 用户积分
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int insertUserPoints(TbUserPoints userPoints);
|
||||
|
||||
/**
|
||||
* @description 更新用户积分
|
||||
* @param userPoints 用户积分
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int updateUserPoints(TbUserPoints userPoints);
|
||||
|
||||
/**
|
||||
* @description 删除用户积分
|
||||
* @param userPoints 用户积分
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int deleteUserPoints(TbUserPoints userPoints);
|
||||
|
||||
/**
|
||||
* @description 批量插入用户积分
|
||||
* @param userPointsList 用户积分列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchInsertUserPoints(@Param("userPointsList") List<TbUserPoints> userPointsList);
|
||||
|
||||
/**
|
||||
* @description 批量删除用户积分
|
||||
* @param ids 积分ID列表
|
||||
* @return int 影响行数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int batchDeleteUserPoints(@Param("ids") List<String> ids);
|
||||
|
||||
/**
|
||||
* @description 分页查询用户积分
|
||||
* @param filter 过滤条件
|
||||
* @param pageParam 分页参数
|
||||
* @return List<TbUserPoints> 用户积分列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbUserPoints> selectUserPointsPage(@Param("filter") TbUserPoints filter, @Param("pageParam") PageParam pageParam);
|
||||
|
||||
/**
|
||||
* @description 统计用户积分总数
|
||||
* @param filter 过滤条件
|
||||
* @return long 总数
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
long countUserPoints(@Param("filter") TbUserPoints filter);
|
||||
}
|
||||
@@ -2,63 +2,462 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.AchievementMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="achievement_id" property="achievementID" jdbcType="VARCHAR"/>
|
||||
<result column="name" property="name" jdbcType="VARCHAR"/>
|
||||
<result column="description" property="description" jdbcType="VARCHAR"/>
|
||||
<result column="icon" property="icon" jdbcType="VARCHAR"/>
|
||||
<result column="type" property="type" jdbcType="INTEGER"/>
|
||||
<result column="level" property="level" jdbcType="INTEGER"/>
|
||||
<result column="condition_type" property="conditionType" jdbcType="INTEGER"/>
|
||||
<result column="condition_value" property="conditionValue" jdbcType="INTEGER"/>
|
||||
<result column="points" property="points" jdbcType="INTEGER"/>
|
||||
<result column="order_num" property="orderNum" jdbcType="INTEGER"/>
|
||||
<result column="creator" property="creator" jdbcType="VARCHAR"/>
|
||||
<result column="updater" property="updater" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="delete_time" property="deleteTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="deleted" property="deleted" jdbcType="BOOLEAN"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="achievement_id" property="achievementId" />
|
||||
<result column="name" property="name" />
|
||||
<result column="description" property="description" />
|
||||
<result column="icon" property="icon" />
|
||||
<result column="type" property="type" />
|
||||
<result column="level" property="level" />
|
||||
<result column="condition_type" property="conditionType" />
|
||||
<result column="condition_value" property="conditionValue" />
|
||||
<result column="points" property="points" />
|
||||
<result column="order_num" property="orderNum" />
|
||||
<result column="creator" property="creator" />
|
||||
<result column="updater" property="updater" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
<result column="delete_time" property="deleteTime" />
|
||||
<result column="deleted" property="deleted" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, achievement_id, name, description, icon, type, level, condition_type,
|
||||
condition_value, points, order_num, creator, updater, create_time,
|
||||
update_time, delete_time, deleted
|
||||
condition_value, points, order_num, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
deleted = 0
|
||||
<if test="achievementID != null and achievementID != ''">
|
||||
AND achievement_id = #{achievementID}
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
AND name LIKE CONCAT('%', #{name}, '%')
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND level = #{level}
|
||||
</if>
|
||||
<if test="conditionType != null">
|
||||
AND condition_type = #{conditionType}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.achievementId != null and filter.achievementId != ''">
|
||||
AND achievement_id = #{filter.achievementId}
|
||||
</if>
|
||||
<if test="filter.name != null and filter.name != ''">
|
||||
AND name LIKE CONCAT('%', #{filter.name}, '%')
|
||||
</if>
|
||||
<if test="filter.type != null">
|
||||
AND type = #{filter.type}
|
||||
</if>
|
||||
<if test="filter.level != null">
|
||||
AND level = #{filter.level}
|
||||
</if>
|
||||
<if test="filter.conditionType != null">
|
||||
AND condition_type = #{filter.conditionType}
|
||||
</if>
|
||||
<if test="filter.points != null">
|
||||
AND points = #{filter.points}
|
||||
</if>
|
||||
<if test="filter.creator != null and filter.creator != ''">
|
||||
AND creator = #{filter.creator}
|
||||
</if>
|
||||
<if test="filter.deleted != null">
|
||||
AND deleted = #{filter.deleted}
|
||||
</if>
|
||||
<if test="filter.createTime != null">
|
||||
AND create_time = #{filter.createTime}
|
||||
</if>
|
||||
<if test="filter.updateTime != null">
|
||||
AND update_time = #{filter.updateTime}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectAchievements -->
|
||||
<!-- 根据ID查询单条记录 -->
|
||||
<select id="selectByIdCustom" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询单条记录 -->
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询列表 -->
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询 -->
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询记录(支持排序) -->
|
||||
<select id="selectListWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询(支持排序) -->
|
||||
<select id="selectPageWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入单条记录 -->
|
||||
<insert id="insertOneCustom" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
INSERT INTO tb_achievement (
|
||||
id, achievement_id, name, description, icon, type, level, condition_type,
|
||||
condition_value, points, order_num, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES (
|
||||
#{entity.id}, #{entity.achievementId}, #{entity.name}, #{entity.description}, #{entity.icon},
|
||||
#{entity.type}, #{entity.level}, #{entity.conditionType}, #{entity.conditionValue},
|
||||
#{entity.points}, #{entity.orderNum}, #{entity.creator}, #{entity.updater},
|
||||
#{entity.createTime}, #{entity.updateTime}, #{entity.deleteTime}, #{entity.deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入记录 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO tb_achievement (
|
||||
id, achievement_id, name, description, icon, type, level, condition_type,
|
||||
condition_value, points, order_num, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id}, #{entity.achievementId}, #{entity.name}, #{entity.description}, #{entity.icon},
|
||||
#{entity.type}, #{entity.level}, #{entity.conditionType}, #{entity.conditionValue},
|
||||
#{entity.points}, #{entity.orderNum}, #{entity.creator}, #{entity.updater},
|
||||
#{entity.createTime}, #{entity.updateTime}, #{entity.deleteTime}, #{entity.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据ID更新记录 -->
|
||||
<update id="updateByIdCustom" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
UPDATE tb_achievement
|
||||
<set>
|
||||
<if test="entity.achievementId != null and entity.achievementId != ''">
|
||||
achievement_id = #{entity.achievementId},
|
||||
</if>
|
||||
<if test="entity.name != null and entity.name != ''">
|
||||
name = #{entity.name},
|
||||
</if>
|
||||
<if test="entity.description != null and entity.description != ''">
|
||||
description = #{entity.description},
|
||||
</if>
|
||||
<if test="entity.icon != null and entity.icon != ''">
|
||||
icon = #{entity.icon},
|
||||
</if>
|
||||
<if test="entity.type != null">
|
||||
type = #{entity.type},
|
||||
</if>
|
||||
<if test="entity.level != null">
|
||||
level = #{entity.level},
|
||||
</if>
|
||||
<if test="entity.conditionType != null">
|
||||
condition_type = #{entity.conditionType},
|
||||
</if>
|
||||
<if test="entity.conditionValue != null">
|
||||
condition_value = #{entity.conditionValue},
|
||||
</if>
|
||||
<if test="entity.points != null">
|
||||
points = #{entity.points},
|
||||
</if>
|
||||
<if test="entity.orderNum != null">
|
||||
order_num = #{entity.orderNum},
|
||||
</if>
|
||||
<if test="entity.creator != null and entity.creator != ''">
|
||||
creator = #{entity.creator},
|
||||
</if>
|
||||
<if test="entity.updater != null and entity.updater != ''">
|
||||
updater = #{entity.updater},
|
||||
</if>
|
||||
<if test="entity.updateTime != null">
|
||||
update_time = #{entity.updateTime},
|
||||
</if>
|
||||
<if test="entity.deleteTime != null">
|
||||
delete_time = #{entity.deleteTime},
|
||||
</if>
|
||||
<if test="entity.deleted != null">
|
||||
deleted = #{entity.deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{entity.id}
|
||||
</update>
|
||||
|
||||
<!-- 根据条件更新记录 -->
|
||||
<update id="updateByFilter" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
UPDATE tb_achievement
|
||||
<set>
|
||||
<if test="entity.achievementId != null and entity.achievementId != ''">
|
||||
achievement_id = #{entity.achievementId},
|
||||
</if>
|
||||
<if test="entity.name != null and entity.name != ''">
|
||||
name = #{entity.name},
|
||||
</if>
|
||||
<if test="entity.description != null and entity.description != ''">
|
||||
description = #{entity.description},
|
||||
</if>
|
||||
<if test="entity.icon != null and entity.icon != ''">
|
||||
icon = #{entity.icon},
|
||||
</if>
|
||||
<if test="entity.type != null">
|
||||
type = #{entity.type},
|
||||
</if>
|
||||
<if test="entity.level != null">
|
||||
level = #{entity.level},
|
||||
</if>
|
||||
<if test="entity.conditionType != null">
|
||||
condition_type = #{entity.conditionType},
|
||||
</if>
|
||||
<if test="entity.conditionValue != null">
|
||||
condition_value = #{entity.conditionValue},
|
||||
</if>
|
||||
<if test="entity.points != null">
|
||||
points = #{entity.points},
|
||||
</if>
|
||||
<if test="entity.orderNum != null">
|
||||
order_num = #{entity.orderNum},
|
||||
</if>
|
||||
<if test="entity.creator != null and entity.creator != ''">
|
||||
creator = #{entity.creator},
|
||||
</if>
|
||||
<if test="entity.updater != null and entity.updater != ''">
|
||||
updater = #{entity.updater},
|
||||
</if>
|
||||
<if test="entity.updateTime != null">
|
||||
update_time = #{entity.updateTime},
|
||||
</if>
|
||||
<if test="entity.deleteTime != null">
|
||||
delete_time = #{entity.deleteTime},
|
||||
</if>
|
||||
<if test="entity.deleted != null">
|
||||
deleted = #{entity.deleted},
|
||||
</if>
|
||||
</set>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</update>
|
||||
|
||||
<!-- 删除方法使用MyBatis-Plus的BaseMapper提供的方法 -->
|
||||
<!-- deleteById(Serializable id) - 根据ID删除 -->
|
||||
<!-- deleteBatchIds(Collection<? extends Serializable> idList) - 批量删除 -->
|
||||
<!-- deleteByMap(Map<String, Object> columnMap) - 根据Map删除 -->
|
||||
<!-- delete(Wrapper<T> queryWrapper) - 根据条件删除 -->
|
||||
|
||||
<!-- 根据条件统计记录数 -->
|
||||
<select id="countByFilter" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 检查记录是否存在 -->
|
||||
<select id="existsByFilter" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 查询成就列表 -->
|
||||
<select id="selectAchievements" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY order_num ASC, create_time ASC
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据成就ID查询成就信息 -->
|
||||
<select id="selectByAchievementId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
WHERE achievement_id = #{achievementId}
|
||||
</select>
|
||||
|
||||
<!-- 根据类型查询成就列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
WHERE type = #{type}
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据类型和等级查询成就列表 -->
|
||||
<select id="selectByTypeAndLevel" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
WHERE type = #{type} AND level = #{level}
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询成就排行榜 -->
|
||||
<select id="selectAchievementRanking" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
WHERE deleted = 0
|
||||
ORDER BY points DESC, level DESC, order_num ASC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 检查成就名称是否存在 -->
|
||||
<select id="countByName" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_achievement
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入成就 -->
|
||||
<insert id="insertAchievement" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
INSERT INTO tb_achievement (
|
||||
id, achievement_id, name, description, icon, type, level, condition_type,
|
||||
condition_value, points, order_num, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES (
|
||||
#{id}, #{achievementId}, #{name}, #{description}, #{icon}, #{type}, #{level},
|
||||
#{conditionType}, #{conditionValue}, #{points}, #{orderNum}, #{creator}, #{updater},
|
||||
#{createTime}, #{updateTime}, #{deleteTime}, #{deleted}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新成就 -->
|
||||
<update id="updateAchievement" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
UPDATE tb_achievement
|
||||
<set>
|
||||
<if test="achievementId != null and achievementId != ''">
|
||||
achievement_id = #{achievementId},
|
||||
</if>
|
||||
<if test="name != null and name != ''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
<if test="icon != null and icon != ''">
|
||||
icon = #{icon},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="level != null">
|
||||
level = #{level},
|
||||
</if>
|
||||
<if test="conditionType != null">
|
||||
condition_type = #{conditionType},
|
||||
</if>
|
||||
<if test="conditionValue != null">
|
||||
condition_value = #{conditionValue},
|
||||
</if>
|
||||
<if test="points != null">
|
||||
points = #{points},
|
||||
</if>
|
||||
<if test="orderNum != null">
|
||||
order_num = #{orderNum},
|
||||
</if>
|
||||
<if test="creator != null and creator != ''">
|
||||
creator = #{creator},
|
||||
</if>
|
||||
<if test="updater != null and updater != ''">
|
||||
updater = #{updater},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="deleteTime != null">
|
||||
delete_time = #{deleteTime},
|
||||
</if>
|
||||
<if test="deleted != null">
|
||||
deleted = #{deleted},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除成就 -->
|
||||
<delete id="deleteAchievement" parameterType="org.xyzh.common.dto.usercenter.TbAchievement">
|
||||
DELETE FROM tb_achievement
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入成就 -->
|
||||
<insert id="batchInsertAchievements" parameterType="java.util.List">
|
||||
INSERT INTO tb_achievement (
|
||||
id, achievement_id, name, description, icon, type, level, condition_type,
|
||||
condition_value, points, order_num, creator, updater, create_time, update_time,
|
||||
delete_time, deleted
|
||||
) VALUES
|
||||
<foreach collection="achievementList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.achievementId}, #{item.name}, #{item.description}, #{item.icon},
|
||||
#{item.type}, #{item.level}, #{item.conditionType}, #{item.conditionValue},
|
||||
#{item.points}, #{item.orderNum}, #{item.creator}, #{item.updater},
|
||||
#{item.createTime}, #{item.updateTime}, #{item.deleteTime}, #{item.deleted}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除成就 -->
|
||||
<delete id="batchDeleteAchievements">
|
||||
DELETE FROM tb_achievement
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询成就 -->
|
||||
<select id="selectAchievementsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计成就总数 -->
|
||||
<select id="countAchievements" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,48 +2,339 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.PointsRecordMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="points" property="points" jdbcType="INTEGER"/>
|
||||
<result column="type" property="type" jdbcType="INTEGER"/>
|
||||
<result column="source_type" property="sourceType" jdbcType="INTEGER"/>
|
||||
<result column="source_id" property="sourceID" jdbcType="VARCHAR"/>
|
||||
<result column="description" property="description" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="points" property="points" />
|
||||
<result column="type" property="type" />
|
||||
<result column="source_type" property="sourceType" />
|
||||
<result column="source_id" property="sourceId" />
|
||||
<result column="description" property="description" />
|
||||
<result column="create_time" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, points, type, source_type, source_id, description, create_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="type != null">
|
||||
AND type = #{type}
|
||||
</if>
|
||||
<if test="sourceType != null">
|
||||
AND source_type = #{sourceType}
|
||||
</if>
|
||||
<if test="sourceID != null and sourceID != ''">
|
||||
AND source_id = #{sourceID}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.points != null">
|
||||
AND points = #{filter.points}
|
||||
</if>
|
||||
<if test="filter.type != null">
|
||||
AND type = #{filter.type}
|
||||
</if>
|
||||
<if test="filter.sourceType != null">
|
||||
AND source_type = #{filter.sourceType}
|
||||
</if>
|
||||
<if test="filter.sourceId != null and filter.sourceId != ''">
|
||||
AND source_id = #{filter.sourceId}
|
||||
</if>
|
||||
<if test="filter.description != null and filter.description != ''">
|
||||
AND description LIKE CONCAT('%', #{filter.description}, '%')
|
||||
</if>
|
||||
<if test="filter.createTime != null">
|
||||
AND create_time = #{filter.createTime}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectPointsRecords -->
|
||||
<!-- 根据ID查询单条记录 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询单条记录 -->
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询列表 -->
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询 -->
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询记录(支持排序) -->
|
||||
<select id="selectListWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询(支持排序) -->
|
||||
<select id="selectPageWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入单条记录 -->
|
||||
<insert id="insertOne" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
INSERT INTO tb_points_record (
|
||||
id, user_id, points, type, source_type, source_id, description, create_time
|
||||
) VALUES (
|
||||
#{entity.id}, #{entity.userId}, #{entity.points}, #{entity.type},
|
||||
#{entity.sourceType}, #{entity.sourceId}, #{entity.description}, #{entity.createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入记录 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO tb_points_record (
|
||||
id, user_id, points, type, source_type, source_id, description, create_time
|
||||
) VALUES
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id}, #{entity.userId}, #{entity.points}, #{entity.type},
|
||||
#{entity.sourceType}, #{entity.sourceId}, #{entity.description}, #{entity.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据ID更新记录 -->
|
||||
<update id="updateById" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
UPDATE tb_points_record
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.points != null">
|
||||
points = #{entity.points},
|
||||
</if>
|
||||
<if test="entity.type != null">
|
||||
type = #{entity.type},
|
||||
</if>
|
||||
<if test="entity.sourceType != null">
|
||||
source_type = #{entity.sourceType},
|
||||
</if>
|
||||
<if test="entity.sourceId != null and entity.sourceId != ''">
|
||||
source_id = #{entity.sourceId},
|
||||
</if>
|
||||
<if test="entity.description != null and entity.description != ''">
|
||||
description = #{entity.description},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{entity.id}
|
||||
</update>
|
||||
|
||||
<!-- 根据条件更新记录 -->
|
||||
<update id="updateByFilter" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
UPDATE tb_points_record
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.points != null">
|
||||
points = #{entity.points},
|
||||
</if>
|
||||
<if test="entity.type != null">
|
||||
type = #{entity.type},
|
||||
</if>
|
||||
<if test="entity.sourceType != null">
|
||||
source_type = #{entity.sourceType},
|
||||
</if>
|
||||
<if test="entity.sourceId != null and entity.sourceId != ''">
|
||||
source_id = #{entity.sourceId},
|
||||
</if>
|
||||
<if test="entity.description != null and entity.description != ''">
|
||||
description = #{entity.description},
|
||||
</if>
|
||||
</set>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</update>
|
||||
|
||||
<!-- 删除方法使用MyBatis-Plus的BaseMapper提供的方法 -->
|
||||
<!-- deleteById(Serializable id) - 根据ID删除 -->
|
||||
<!-- deleteBatchIds(Collection<? extends Serializable> idList) - 批量删除 -->
|
||||
<!-- deleteByMap(Map<String, Object> columnMap) - 根据Map删除 -->
|
||||
<!-- delete(Wrapper<T> queryWrapper) - 根据条件删除 -->
|
||||
|
||||
<!-- 根据条件统计记录数 -->
|
||||
<select id="countByFilter" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 检查记录是否存在 -->
|
||||
<select id="existsByFilter" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 查询积分记录列表 -->
|
||||
<select id="selectPointsRecords" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Where_Clause"/>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询积分记录 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和类型查询积分记录 -->
|
||||
<select id="selectByUserIdAndType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
WHERE user_id = #{userId} AND type = #{type}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询积分记录(包含用户基本信息) -->
|
||||
<select id="selectPointsRecordsWithUser" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
pr.id, pr.user_id, pr.points, pr.type, pr.source_type, pr.source_id,
|
||||
pr.description, pr.create_time
|
||||
FROM tb_points_record pr
|
||||
LEFT JOIN tb_sys_user u ON pr.user_id = u.id
|
||||
WHERE pr.user_id = #{userId}
|
||||
ORDER BY pr.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户积分统计 -->
|
||||
<select id="selectPointsStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
user_id,
|
||||
SUM(points) as points,
|
||||
COUNT(*) as type,
|
||||
MAX(create_time) as create_time
|
||||
FROM tb_points_record
|
||||
WHERE user_id = #{userId}
|
||||
GROUP BY user_id
|
||||
</select>
|
||||
|
||||
<!-- 插入积分记录 -->
|
||||
<insert id="insertPointsRecord" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
INSERT INTO tb_points_record (
|
||||
id, user_id, points, type, source_type, source_id, description, create_time
|
||||
) VALUES (
|
||||
#{id}, #{userId}, #{points}, #{type}, #{sourceType}, #{sourceId},
|
||||
#{description}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新积分记录 -->
|
||||
<update id="updatePointsRecord" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
UPDATE tb_points_record
|
||||
<set>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="points != null">
|
||||
points = #{points},
|
||||
</if>
|
||||
<if test="type != null">
|
||||
type = #{type},
|
||||
</if>
|
||||
<if test="sourceType != null">
|
||||
source_type = #{sourceType},
|
||||
</if>
|
||||
<if test="sourceId != null and sourceId != ''">
|
||||
source_id = #{sourceId},
|
||||
</if>
|
||||
<if test="description != null and description != ''">
|
||||
description = #{description},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除积分记录 -->
|
||||
<delete id="deletePointsRecord" parameterType="org.xyzh.common.dto.usercenter.TbPointsRecord">
|
||||
DELETE FROM tb_points_record
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入积分记录 -->
|
||||
<insert id="batchInsertPointsRecords" parameterType="java.util.List">
|
||||
INSERT INTO tb_points_record (
|
||||
id, user_id, points, type, source_type, source_id, description, create_time
|
||||
) VALUES
|
||||
<foreach collection="pointsRecordList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.points}, #{item.type},
|
||||
#{item.sourceType}, #{item.sourceId}, #{item.description}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除积分记录 -->
|
||||
<delete id="batchDeletePointsRecords">
|
||||
DELETE FROM tb_points_record
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询积分记录 -->
|
||||
<select id="selectPointsRecordsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计积分记录总数 -->
|
||||
<select id="countPointsRecords" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_points_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,38 +2,290 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.UserAchievementMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="achievement_id" property="achievementID" jdbcType="VARCHAR"/>
|
||||
<result column="obtain_time" property="obtainTime" jdbcType="TIMESTAMP"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="achievement_id" property="achievementId" />
|
||||
<result column="obtain_time" property="obtainTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, achievement_id, obtain_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="achievementID != null and achievementID != ''">
|
||||
AND achievement_id = #{achievementID}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.achievementId != null and filter.achievementId != ''">
|
||||
AND achievement_id = #{filter.achievementId}
|
||||
</if>
|
||||
<if test="filter.obtainTime != null">
|
||||
AND obtain_time = #{filter.obtainTime}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectUserAchievements -->
|
||||
<!-- 根据ID查询单条记录 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询单条记录 -->
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询列表 -->
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询 -->
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询记录(支持排序) -->
|
||||
<select id="selectListWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询(支持排序) -->
|
||||
<select id="selectPageWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入单条记录 -->
|
||||
<insert id="insertOne" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
INSERT INTO tb_user_achievement (
|
||||
id, user_id, achievement_id, obtain_time
|
||||
) VALUES (
|
||||
#{entity.id}, #{entity.userId}, #{entity.achievementId}, #{entity.obtainTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入记录 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_achievement (
|
||||
id, user_id, achievement_id, obtain_time
|
||||
) VALUES
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id}, #{entity.userId}, #{entity.achievementId}, #{entity.obtainTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据ID更新记录 -->
|
||||
<update id="updateById" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
UPDATE tb_user_achievement
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.achievementId != null and entity.achievementId != ''">
|
||||
achievement_id = #{entity.achievementId},
|
||||
</if>
|
||||
<if test="entity.obtainTime != null">
|
||||
obtain_time = #{entity.obtainTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{entity.id}
|
||||
</update>
|
||||
|
||||
<!-- 根据条件更新记录 -->
|
||||
<update id="updateByFilter" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
UPDATE tb_user_achievement
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.achievementId != null and entity.achievementId != ''">
|
||||
achievement_id = #{entity.achievementId},
|
||||
</if>
|
||||
<if test="entity.obtainTime != null">
|
||||
obtain_time = #{entity.obtainTime},
|
||||
</if>
|
||||
</set>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</update>
|
||||
|
||||
<!-- 删除方法使用MyBatis-Plus的BaseMapper提供的方法 -->
|
||||
<!-- deleteById(Serializable id) - 根据ID删除 -->
|
||||
<!-- deleteBatchIds(Collection<? extends Serializable> idList) - 批量删除 -->
|
||||
<!-- deleteByMap(Map<String, Object> columnMap) - 根据Map删除 -->
|
||||
<!-- delete(Wrapper<T> queryWrapper) - 根据条件删除 -->
|
||||
|
||||
<!-- 根据条件统计记录数 -->
|
||||
<select id="countByFilter" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 检查记录是否存在 -->
|
||||
<select id="existsByFilter" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 查询用户成就列表 -->
|
||||
<select id="selectUserAchievements" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Where_Clause"/>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询成就记录 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY obtain_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和成就ID查询成就记录 -->
|
||||
<select id="selectByUserIdAndAchievementId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
WHERE user_id = #{userId} AND achievement_id = #{achievementId}
|
||||
ORDER BY obtain_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询成就记录(包含用户基本信息) -->
|
||||
<select id="selectUserAchievementsWithUser" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
ua.id, ua.user_id, ua.achievement_id, ua.obtain_time
|
||||
FROM tb_user_achievement ua
|
||||
LEFT JOIN tb_sys_user u ON ua.user_id = u.id
|
||||
WHERE ua.user_id = #{userId}
|
||||
ORDER BY ua.obtain_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户成就统计 -->
|
||||
<select id="selectAchievementStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
user_id,
|
||||
COUNT(*) as achievement_id,
|
||||
MAX(obtain_time) as obtain_time
|
||||
FROM tb_user_achievement
|
||||
WHERE user_id = #{userId}
|
||||
GROUP BY user_id
|
||||
</select>
|
||||
|
||||
<!-- 插入用户成就 -->
|
||||
<insert id="insertUserAchievement" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
INSERT INTO tb_user_achievement (
|
||||
id, user_id, achievement_id, obtain_time
|
||||
) VALUES (
|
||||
#{id}, #{userId}, #{achievementId}, #{obtainTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新用户成就 -->
|
||||
<update id="updateUserAchievement" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
UPDATE tb_user_achievement
|
||||
<set>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="achievementId != null and achievementId != ''">
|
||||
achievement_id = #{achievementId},
|
||||
</if>
|
||||
<if test="obtainTime != null">
|
||||
obtain_time = #{obtainTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除用户成就 -->
|
||||
<delete id="deleteUserAchievement" parameterType="org.xyzh.common.dto.usercenter.TbUserAchievement">
|
||||
DELETE FROM tb_user_achievement
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入用户成就 -->
|
||||
<insert id="batchInsertUserAchievements" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_achievement (
|
||||
id, user_id, achievement_id, obtain_time
|
||||
) VALUES
|
||||
<foreach collection="userAchievementList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.achievementId}, #{item.obtainTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除用户成就 -->
|
||||
<delete id="batchDeleteUserAchievements">
|
||||
DELETE FROM tb_user_achievement
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询用户成就 -->
|
||||
<select id="selectUserAchievementsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY obtain_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计用户成就总数 -->
|
||||
<select id="countUserAchievements" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_achievement
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,46 +2,319 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.UserBrowseRecordMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="browse_type" property="browseType" jdbcType="INTEGER"/>
|
||||
<result column="browse_id" property="browseID" jdbcType="VARCHAR"/>
|
||||
<result column="browse_time" property="browseTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="ip_address" property="ipAddress" jdbcType="VARCHAR"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="browse_type" property="browseType" />
|
||||
<result column="browse_id" property="browseId" />
|
||||
<result column="browse_time" property="browseTime" />
|
||||
<result column="ip_address" property="ipAddress" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, browse_type, browse_id, browse_time, ip_address
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="browseType != null">
|
||||
AND browse_type = #{browseType}
|
||||
</if>
|
||||
<if test="browseID != null and browseID != ''">
|
||||
AND browse_id = #{browseID}
|
||||
</if>
|
||||
<if test="ipAddress != null and ipAddress != ''">
|
||||
AND ip_address = #{ipAddress}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.browseType != null">
|
||||
AND browse_type = #{filter.browseType}
|
||||
</if>
|
||||
<if test="filter.browseId != null and filter.browseId != ''">
|
||||
AND browse_id = #{filter.browseId}
|
||||
</if>
|
||||
<if test="filter.ipAddress != null and filter.ipAddress != ''">
|
||||
AND ip_address = #{filter.ipAddress}
|
||||
</if>
|
||||
<if test="filter.browseTime != null">
|
||||
AND browse_time = #{filter.browseTime}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectUserBrowseRecords -->
|
||||
<!-- 根据ID查询单条记录 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询单条记录 -->
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询列表 -->
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询 -->
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询记录(支持排序) -->
|
||||
<select id="selectListWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询(支持排序) -->
|
||||
<select id="selectPageWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入单条记录 -->
|
||||
<insert id="insertOne" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
INSERT INTO tb_user_browse_record (
|
||||
id, user_id, browse_type, browse_id, browse_time, ip_address
|
||||
) VALUES (
|
||||
#{entity.id}, #{entity.userId}, #{entity.browseType}, #{entity.browseId},
|
||||
#{entity.browseTime}, #{entity.ipAddress}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入记录 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_browse_record (
|
||||
id, user_id, browse_type, browse_id, browse_time, ip_address
|
||||
) VALUES
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id}, #{entity.userId}, #{entity.browseType}, #{entity.browseId},
|
||||
#{entity.browseTime}, #{entity.ipAddress}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据ID更新记录 -->
|
||||
<update id="updateById" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
UPDATE tb_user_browse_record
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.browseType != null">
|
||||
browse_type = #{entity.browseType},
|
||||
</if>
|
||||
<if test="entity.browseId != null and entity.browseId != ''">
|
||||
browse_id = #{entity.browseId},
|
||||
</if>
|
||||
<if test="entity.browseTime != null">
|
||||
browse_time = #{entity.browseTime},
|
||||
</if>
|
||||
<if test="entity.ipAddress != null and entity.ipAddress != ''">
|
||||
ip_address = #{entity.ipAddress},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{entity.id}
|
||||
</update>
|
||||
|
||||
<!-- 根据条件更新记录 -->
|
||||
<update id="updateByFilter" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
UPDATE tb_user_browse_record
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.browseType != null">
|
||||
browse_type = #{entity.browseType},
|
||||
</if>
|
||||
<if test="entity.browseId != null and entity.browseId != ''">
|
||||
browse_id = #{entity.browseId},
|
||||
</if>
|
||||
<if test="entity.browseTime != null">
|
||||
browse_time = #{entity.browseTime},
|
||||
</if>
|
||||
<if test="entity.ipAddress != null and entity.ipAddress != ''">
|
||||
ip_address = #{entity.ipAddress},
|
||||
</if>
|
||||
</set>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</update>
|
||||
|
||||
<!-- 删除方法使用MyBatis-Plus的BaseMapper提供的方法 -->
|
||||
<!-- deleteById(Serializable id) - 根据ID删除 -->
|
||||
<!-- deleteBatchIds(Collection<? extends Serializable> idList) - 批量删除 -->
|
||||
<!-- deleteByMap(Map<String, Object> columnMap) - 根据Map删除 -->
|
||||
<!-- delete(Wrapper<T> queryWrapper) - 根据条件删除 -->
|
||||
|
||||
<!-- 根据条件统计记录数 -->
|
||||
<select id="countByFilter" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 检查记录是否存在 -->
|
||||
<select id="existsByFilter" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 查询用户浏览记录列表 -->
|
||||
<select id="selectUserBrowseRecords" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Where_Clause"/>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询浏览记录 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY browse_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和类型查询浏览记录 -->
|
||||
<select id="selectByUserIdAndType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
WHERE user_id = #{userId} AND browse_type = #{browseType}
|
||||
ORDER BY browse_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询浏览记录(包含用户基本信息) -->
|
||||
<select id="selectUserBrowseRecordsWithUser" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
ubr.id, ubr.user_id, ubr.browse_type, ubr.browse_id, ubr.browse_time, ubr.ip_address
|
||||
FROM tb_user_browse_record ubr
|
||||
LEFT JOIN tb_sys_user u ON ubr.user_id = u.id
|
||||
WHERE ubr.user_id = #{userId}
|
||||
ORDER BY ubr.browse_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户浏览统计 -->
|
||||
<select id="selectBrowseStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
user_id,
|
||||
COUNT(*) as browse_type,
|
||||
MAX(browse_time) as browse_time
|
||||
FROM tb_user_browse_record
|
||||
WHERE user_id = #{userId}
|
||||
GROUP BY user_id
|
||||
</select>
|
||||
|
||||
<!-- 插入用户浏览记录 -->
|
||||
<insert id="insertUserBrowseRecord" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
INSERT INTO tb_user_browse_record (
|
||||
id, user_id, browse_type, browse_id, browse_time, ip_address
|
||||
) VALUES (
|
||||
#{id}, #{userId}, #{browseType}, #{browseId}, #{browseTime}, #{ipAddress}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新用户浏览记录 -->
|
||||
<update id="updateUserBrowseRecord" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
UPDATE tb_user_browse_record
|
||||
<set>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="browseType != null">
|
||||
browse_type = #{browseType},
|
||||
</if>
|
||||
<if test="browseId != null and browseId != ''">
|
||||
browse_id = #{browseId},
|
||||
</if>
|
||||
<if test="browseTime != null">
|
||||
browse_time = #{browseTime},
|
||||
</if>
|
||||
<if test="ipAddress != null and ipAddress != ''">
|
||||
ip_address = #{ipAddress},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除用户浏览记录 -->
|
||||
<delete id="deleteUserBrowseRecord" parameterType="org.xyzh.common.dto.usercenter.TbUserBrowseRecord">
|
||||
DELETE FROM tb_user_browse_record
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入用户浏览记录 -->
|
||||
<insert id="batchInsertUserBrowseRecords" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_browse_record (
|
||||
id, user_id, browse_type, browse_id, browse_time, ip_address
|
||||
) VALUES
|
||||
<foreach collection="userBrowseRecordList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.browseType}, #{item.browseId},
|
||||
#{item.browseTime}, #{item.ipAddress}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除用户浏览记录 -->
|
||||
<delete id="batchDeleteUserBrowseRecords">
|
||||
DELETE FROM tb_user_browse_record
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询用户浏览记录 -->
|
||||
<select id="selectUserBrowseRecordsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY browse_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计用户浏览记录总数 -->
|
||||
<select id="countUserBrowseRecords" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_browse_record
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,42 +2,294 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.UserCollectionMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="collection_type" property="collectionType" jdbcType="INTEGER"/>
|
||||
<result column="collection_id" property="collectionID" jdbcType="VARCHAR"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="collection_type" property="collectionType" />
|
||||
<result column="collection_id" property="collectionId" />
|
||||
<result column="create_time" property="createTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, collection_type, collection_id, create_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="collectionType != null">
|
||||
AND collection_type = #{collectionType}
|
||||
</if>
|
||||
<if test="collectionID != null and collectionID != ''">
|
||||
AND collection_id = #{collectionID}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.collectionType != null">
|
||||
AND collection_type = #{filter.collectionType}
|
||||
</if>
|
||||
<if test="filter.collectionId != null and filter.collectionId != ''">
|
||||
AND collection_id = #{filter.collectionId}
|
||||
</if>
|
||||
<if test="filter.createTime != null">
|
||||
AND create_time = #{filter.createTime}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectUserCollections -->
|
||||
<!-- 根据ID查询单条记录 -->
|
||||
<select id="selectById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询单条记录 -->
|
||||
<select id="selectOne" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
LIMIT 1
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询列表 -->
|
||||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询 -->
|
||||
<select id="selectPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据条件查询记录(支持排序) -->
|
||||
<select id="selectListWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据条件分页查询(支持排序) -->
|
||||
<select id="selectPageWithOrder" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY ${orderBy}
|
||||
<if test="orderDirection != null and orderDirection != ''">
|
||||
${orderDirection}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入单条记录 -->
|
||||
<insert id="insertOne" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
INSERT INTO tb_user_collection (
|
||||
id, user_id, collection_type, collection_id, create_time
|
||||
) VALUES (
|
||||
#{entity.id}, #{entity.userId}, #{entity.collectionType}, #{entity.collectionId}, #{entity.createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 批量插入记录 -->
|
||||
<insert id="batchInsert" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_collection (
|
||||
id, user_id, collection_type, collection_id, create_time
|
||||
) VALUES
|
||||
<foreach collection="entities" item="entity" separator=",">
|
||||
(
|
||||
#{entity.id}, #{entity.userId}, #{entity.collectionType}, #{entity.collectionId}, #{entity.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 根据ID更新记录 -->
|
||||
<update id="updateById" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
UPDATE tb_user_collection
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.collectionType != null">
|
||||
collection_type = #{entity.collectionType},
|
||||
</if>
|
||||
<if test="entity.collectionId != null and entity.collectionId != ''">
|
||||
collection_id = #{entity.collectionId},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{entity.id}
|
||||
</update>
|
||||
|
||||
<!-- 根据条件更新记录 -->
|
||||
<update id="updateByFilter" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
UPDATE tb_user_collection
|
||||
<set>
|
||||
<if test="entity.userId != null and entity.userId != ''">
|
||||
user_id = #{entity.userId},
|
||||
</if>
|
||||
<if test="entity.collectionType != null">
|
||||
collection_type = #{entity.collectionType},
|
||||
</if>
|
||||
<if test="entity.collectionId != null and entity.collectionId != ''">
|
||||
collection_id = #{entity.collectionId},
|
||||
</if>
|
||||
</set>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</update>
|
||||
|
||||
<!-- 删除方法使用MyBatis-Plus的BaseMapper提供的方法 -->
|
||||
<!-- deleteById(Serializable id) - 根据ID删除 -->
|
||||
<!-- deleteBatchIds(Collection<? extends Serializable> idList) - 批量删除 -->
|
||||
<!-- deleteByMap(Map<String, Object> columnMap) - 根据Map删除 -->
|
||||
<!-- delete(Wrapper<T> queryWrapper) - 根据条件删除 -->
|
||||
|
||||
<!-- 根据条件统计记录数 -->
|
||||
<select id="countByFilter" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 检查记录是否存在 -->
|
||||
<select id="existsByFilter" resultType="boolean">
|
||||
SELECT COUNT(1) > 0
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 查询用户收藏列表 -->
|
||||
<select id="selectUserCollections" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Where_Clause"/>
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询收藏记录 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
WHERE user_id = #{userId}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID和类型查询收藏记录 -->
|
||||
<select id="selectByUserIdAndType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
WHERE user_id = #{userId} AND collection_type = #{collectionType}
|
||||
ORDER BY create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询收藏记录(包含用户基本信息) -->
|
||||
<select id="selectUserCollectionsWithUser" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
uc.id, uc.user_id, uc.collection_type, uc.collection_id, uc.create_time
|
||||
FROM tb_user_collection uc
|
||||
LEFT JOIN tb_sys_user u ON uc.user_id = u.id
|
||||
WHERE uc.user_id = #{userId}
|
||||
ORDER BY uc.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询用户收藏统计 -->
|
||||
<select id="selectCollectionStatistics" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
user_id,
|
||||
COUNT(*) as collection_type,
|
||||
MAX(create_time) as create_time
|
||||
FROM tb_user_collection
|
||||
WHERE user_id = #{userId}
|
||||
GROUP BY user_id
|
||||
</select>
|
||||
|
||||
<!-- 插入用户收藏 -->
|
||||
<insert id="insertUserCollection" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
INSERT INTO tb_user_collection (
|
||||
id, user_id, collection_type, collection_id, create_time
|
||||
) VALUES (
|
||||
#{id}, #{userId}, #{collectionType}, #{collectionId}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新用户收藏 -->
|
||||
<update id="updateUserCollection" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
UPDATE tb_user_collection
|
||||
<set>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="collectionType != null">
|
||||
collection_type = #{collectionType},
|
||||
</if>
|
||||
<if test="collectionId != null and collectionId != ''">
|
||||
collection_id = #{collectionId},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除用户收藏 -->
|
||||
<delete id="deleteUserCollection" parameterType="org.xyzh.common.dto.usercenter.TbUserCollection">
|
||||
DELETE FROM tb_user_collection
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入用户收藏 -->
|
||||
<insert id="batchInsertUserCollections" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_collection (
|
||||
id, user_id, collection_type, collection_id, create_time
|
||||
) VALUES
|
||||
<foreach collection="userCollectionList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.collectionType}, #{item.collectionId}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除用户收藏 -->
|
||||
<delete id="batchDeleteUserCollections">
|
||||
DELETE FROM tb_user_collection
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询用户收藏 -->
|
||||
<select id="selectUserCollectionsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计用户收藏总数 -->
|
||||
<select id="countUserCollections" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_collection
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -2,41 +2,168 @@
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.xyzh.usercenter.mapper.UserPointsMapper">
|
||||
|
||||
<!-- 基础结果映射 -->
|
||||
<!-- 结果映射 -->
|
||||
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.usercenter.TbUserPoints">
|
||||
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||||
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||||
<result column="total_points" property="totalPoints" jdbcType="INTEGER"/>
|
||||
<result column="current_points" property="currentPoints" jdbcType="INTEGER"/>
|
||||
<result column="level" property="level" jdbcType="INTEGER"/>
|
||||
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||||
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||||
<id column="id" property="id" />
|
||||
<result column="user_id" property="userId" />
|
||||
<result column="total_points" property="totalPoints" />
|
||||
<result column="current_points" property="currentPoints" />
|
||||
<result column="level" property="level" />
|
||||
<result column="create_time" property="createTime" />
|
||||
<result column="update_time" property="updateTime" />
|
||||
</resultMap>
|
||||
|
||||
<!-- 基础字段 -->
|
||||
<!-- 字段列表 -->
|
||||
<sql id="Base_Column_List">
|
||||
id, user_id, total_points, current_points, level, create_time, update_time
|
||||
</sql>
|
||||
|
||||
<!-- 通用条件 -->
|
||||
<sql id="Where_Clause">
|
||||
<!-- 查询条件 -->
|
||||
<sql id="Base_Where_Clause">
|
||||
<where>
|
||||
<if test="userID != null and userID != ''">
|
||||
AND user_id = #{userID}
|
||||
</if>
|
||||
<if test="level != null">
|
||||
AND level = #{level}
|
||||
<if test="filter != null">
|
||||
<if test="filter.id != null and filter.id != ''">
|
||||
AND id = #{filter.id}
|
||||
</if>
|
||||
<if test="filter.userId != null and filter.userId != ''">
|
||||
AND user_id = #{filter.userId}
|
||||
</if>
|
||||
<if test="filter.totalPoints != null">
|
||||
AND total_points = #{filter.totalPoints}
|
||||
</if>
|
||||
<if test="filter.currentPoints != null">
|
||||
AND current_points = #{filter.currentPoints}
|
||||
</if>
|
||||
<if test="filter.level != null">
|
||||
AND level = #{filter.level}
|
||||
</if>
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<!-- selectUserPoints -->
|
||||
<!-- 查询用户积分列表 -->
|
||||
<select id="selectUserPoints" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List"/>
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_points
|
||||
<include refid="Where_Clause"/>
|
||||
ORDER BY level DESC, current_points DESC
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询积分信息 -->
|
||||
<select id="selectByUserId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_points
|
||||
WHERE user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 检查用户积分是否存在 -->
|
||||
<select id="countByUserId" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_points
|
||||
WHERE user_id = #{userId}
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据用户ID查询积分信息(包含用户基本信息) -->
|
||||
<select id="selectUserPointsWithUser" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
up.id, up.user_id, up.total_points, up.current_points, up.level,
|
||||
up.create_time, up.update_time
|
||||
FROM tb_user_points up
|
||||
LEFT JOIN tb_sys_user u ON up.user_id = u.id
|
||||
WHERE up.user_id = #{userId}
|
||||
</select>
|
||||
|
||||
<!-- 查询积分排行榜 -->
|
||||
<select id="selectPointsRanking" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_points
|
||||
ORDER BY current_points DESC, total_points DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 插入用户积分 -->
|
||||
<insert id="insertUserPoints" parameterType="org.xyzh.common.dto.usercenter.TbUserPoints">
|
||||
INSERT INTO tb_user_points (
|
||||
id, user_id, total_points, current_points, level, create_time, update_time
|
||||
) VALUES (
|
||||
#{id}, #{userId}, #{totalPoints}, #{currentPoints},
|
||||
#{level}, #{createTime}, #{updateTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<!-- 更新用户积分 -->
|
||||
<update id="updateUserPoints" parameterType="org.xyzh.common.dto.usercenter.TbUserPoints">
|
||||
UPDATE tb_user_points
|
||||
<set>
|
||||
<if test="userId != null and userId != ''">
|
||||
user_id = #{userId},
|
||||
</if>
|
||||
<if test="totalPoints != null">
|
||||
total_points = #{totalPoints},
|
||||
</if>
|
||||
<if test="currentPoints != null">
|
||||
current_points = #{currentPoints},
|
||||
</if>
|
||||
<if test="level != null">
|
||||
level = #{level},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
</set>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<!-- 删除用户积分 -->
|
||||
<delete id="deleteUserPoints" parameterType="org.xyzh.common.dto.usercenter.TbUserPoints">
|
||||
DELETE FROM tb_user_points
|
||||
WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<!-- 批量插入用户积分 -->
|
||||
<insert id="batchInsertUserPoints" parameterType="java.util.List">
|
||||
INSERT INTO tb_user_points (
|
||||
id, user_id, total_points, current_points, level, create_time, update_time
|
||||
) VALUES
|
||||
<foreach collection="userPointsList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.userId}, #{item.totalPoints}, #{item.currentPoints},
|
||||
#{item.level}, #{item.createTime}, #{item.updateTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<!-- 批量删除用户积分 -->
|
||||
<delete id="batchDeleteUserPoints">
|
||||
DELETE FROM tb_user_points
|
||||
WHERE id IN
|
||||
<foreach collection="ids" item="id" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<!-- 分页查询用户积分 -->
|
||||
<select id="selectUserPointsPage" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_user_points
|
||||
<include refid="Base_Where_Clause" />
|
||||
ORDER BY create_time DESC
|
||||
LIMIT #{pageParam.pageSize} OFFSET #{pageParam.pageNumber}
|
||||
</select>
|
||||
|
||||
<!-- 统计用户积分总数 -->
|
||||
<select id="countUserPoints" resultType="long">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_user_points
|
||||
<include refid="Base_Where_Clause" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user