serv-mapper和.xml 基本增删改

This commit is contained in:
2025-10-16 14:31:56 +08:00
parent 7f65404f28
commit 1199cbc176
54 changed files with 7516 additions and 197 deletions

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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);
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>