serv\web- 日志
This commit is contained in:
@@ -53,13 +53,14 @@ public interface BannerMapper extends BaseMapper<TbBanner> {
|
||||
TbBanner selectByBannerId(@Param("bannerId") String bannerId);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询Banner列表
|
||||
* @description 根据状态查询Banner列表(包含权限过滤)
|
||||
* @param status 状态
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectByStatus(@Param("status") Integer status);
|
||||
List<TbBanner> selectByStatus(@Param("status") Integer status, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据位置查询Banner列表
|
||||
@@ -71,22 +72,24 @@ public interface BannerMapper extends BaseMapper<TbBanner> {
|
||||
List<TbBanner> selectByPosition(@Param("position") String position);
|
||||
|
||||
/**
|
||||
* @description 查询有效的Banner列表(按排序)
|
||||
* @description 查询有效的Banner列表(按排序,包含权限过滤)
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbBanner> Banner列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbBanner> selectActiveBanners();
|
||||
List<TbBanner> selectActiveBanners(@Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 检查Banner标题是否存在
|
||||
* @description 检查Banner标题是否存在(包含权限过滤)
|
||||
* @param title Banner标题
|
||||
* @param excludeId 排除的Banner ID(用于更新时排除自身)
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId);
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 插入Banner
|
||||
|
||||
@@ -39,68 +39,75 @@ public interface ResourceMapper extends BaseMapper<TbResource> {
|
||||
TbResource selectByResourceId(@Param("resourceId") String resourceId);
|
||||
|
||||
/**
|
||||
* @description 根据标签ID查询资源列表
|
||||
* @description 根据标签ID查询资源列表(包含权限过滤)
|
||||
* @param tagId 标签ID(文章分类标签,tagType=1)
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByTagId(@Param("tagId") String tagId);
|
||||
List<TbResource> selectByTagId(@Param("tagId") String tagId, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询资源列表
|
||||
* @description 根据状态查询资源列表(包含权限过滤)
|
||||
* @param status 状态
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByStatus(@Param("status") Integer status);
|
||||
List<TbResource> selectByStatus(@Param("status") Integer status, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据类型查询资源列表
|
||||
* @description 根据类型查询资源列表(包含权限过滤)
|
||||
* @param type 类型
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectByType(@Param("type") Integer type);
|
||||
List<TbResource> selectByType(@Param("type") Integer type, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 查询热门资源列表
|
||||
* @description 查询热门资源列表(包含权限过滤)
|
||||
* @param limit 限制数量
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectHotResources(@Param("limit") Integer limit);
|
||||
List<TbResource> selectHotResources(@Param("limit") Integer limit, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 查询最新资源列表
|
||||
* @description 查询最新资源列表(包含权限过滤)
|
||||
* @param limit 限制数量
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> selectLatestResources(@Param("limit") Integer limit);
|
||||
List<TbResource> selectLatestResources(@Param("limit") Integer limit, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据关键词搜索资源
|
||||
* @description 根据关键词搜索资源(包含权限过滤)
|
||||
* @param keyword 关键词
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbResource> 资源列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbResource> searchByKeyword(@Param("keyword") String keyword);
|
||||
List<TbResource> searchByKeyword(@Param("keyword") String keyword, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 检查资源标题是否存在
|
||||
* @description 检查资源标题是否存在(包含权限过滤)
|
||||
* @param title 资源标题
|
||||
* @param excludeId 排除的资源ID(用于更新时排除自身)
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId);
|
||||
int countByTitle(@Param("title") String title, @Param("excludeId") String excludeId, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 插入资源
|
||||
|
||||
@@ -39,22 +39,24 @@ public interface TagMapper extends BaseMapper<TbTag> {
|
||||
TbTag selectByTagId(@Param("tagId") String tagId);
|
||||
|
||||
/**
|
||||
* @description 根据标签名称查询标签
|
||||
* @description 根据标签名称查询标签(包含权限过滤)
|
||||
* @param name 标签名称
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return TbTag 标签信息
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
TbTag selectByName(@Param("name") String name);
|
||||
TbTag selectByName(@Param("name") String name, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据状态查询标签列表
|
||||
* @description 根据状态查询标签列表(包含权限过滤)
|
||||
* @param status 状态
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return List<TbTag> 标签列表
|
||||
* @author yslg
|
||||
* @since 2025-10-15
|
||||
*/
|
||||
List<TbTag> selectByStatus(@Param("status") Integer status);
|
||||
List<TbTag> selectByStatus(@Param("status") Integer status, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 根据标签类型查询标签列表
|
||||
@@ -75,15 +77,16 @@ public interface TagMapper extends BaseMapper<TbTag> {
|
||||
List<TbTag> selectHotTags(@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* @description 检查标签名称是否存在(同类型下)
|
||||
* @description 检查标签名称是否存在(同类型下,包含权限过滤)
|
||||
* @param name 标签名称
|
||||
* @param tagType 标签类型
|
||||
* @param excludeId 排除的标签ID(用于更新时排除自身)
|
||||
* @param userDeptRoles 用户部门角色列表
|
||||
* @return int 存在的数量
|
||||
* @author yslg
|
||||
* @since 2025-10-27
|
||||
*/
|
||||
int countByNameAndType(@Param("name") String name, @Param("tagType") Integer tagType, @Param("excludeId") String excludeId);
|
||||
int countByNameAndType(@Param("name") String name, @Param("tagType") Integer tagType, @Param("excludeId") String excludeId, @Param("userDeptRoles") List<UserDeptRoleVO> userDeptRoles);
|
||||
|
||||
/**
|
||||
* @description 插入标签
|
||||
|
||||
@@ -85,7 +85,8 @@ public class NCBannerServiceImpl implements BannerService {
|
||||
}
|
||||
|
||||
// 检查标题是否已存在
|
||||
int count = bannerMapper.countByTitle(banner.getTitle(), null);
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
int count = bannerMapper.countByTitle(banner.getTitle(), null, userDeptRoles);
|
||||
if (count > 0) {
|
||||
resultDomain.fail("横幅标题已存在");
|
||||
return resultDomain;
|
||||
@@ -115,7 +116,6 @@ public class NCBannerServiceImpl implements BannerService {
|
||||
|
||||
// 创建横幅资源权限
|
||||
try {
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
if (userDeptRoles != null && !userDeptRoles.isEmpty()) {
|
||||
// 使用用户的第一个部门角色创建权限
|
||||
resourcePermissionService.createResourcePermission(
|
||||
@@ -162,7 +162,8 @@ public class NCBannerServiceImpl implements BannerService {
|
||||
|
||||
// 如果修改了标题,检查标题是否已被使用
|
||||
if (StringUtils.hasText(banner.getTitle()) && !banner.getTitle().equals(existing.getTitle())) {
|
||||
int count = bannerMapper.countByTitle(banner.getTitle(), banner.getBannerID());
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
int count = bannerMapper.countByTitle(banner.getTitle(), banner.getBannerID(), userDeptRoles);
|
||||
if (count > 0) {
|
||||
resultDomain.fail("横幅标题已存在");
|
||||
return resultDomain;
|
||||
@@ -318,7 +319,8 @@ public class NCBannerServiceImpl implements BannerService {
|
||||
public ResultDomain<TbBanner> getActiveBanners(Integer limit) {
|
||||
ResultDomain<TbBanner> resultDomain = new ResultDomain<>();
|
||||
try {
|
||||
List<TbBanner> list = bannerMapper.selectActiveBanners();
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
List<TbBanner> list = bannerMapper.selectActiveBanners(userDeptRoles);
|
||||
|
||||
// 如果指定了limit,截取列表
|
||||
if (limit != null && limit > 0 && list != null && list.size() > limit) {
|
||||
|
||||
@@ -146,7 +146,8 @@ public class NCResourceServiceImpl implements ResourceService {
|
||||
}
|
||||
|
||||
// 检查标题是否已存在
|
||||
int count = resourceMapper.countByTitle(resourceVO.getResource().getTitle(), null);
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
int count = resourceMapper.countByTitle(resourceVO.getResource().getTitle(), null, userDeptRoles);
|
||||
if (count > 0) {
|
||||
resultDomain.fail("资源标题已存在");
|
||||
return resultDomain;
|
||||
@@ -205,7 +206,6 @@ public class NCResourceServiceImpl implements ResourceService {
|
||||
|
||||
// 创建资源权限
|
||||
try {
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
if (userDeptRoles != null && !userDeptRoles.isEmpty()) {
|
||||
// 使用用户的第一个部门角色创建权限
|
||||
resourcePermissionService.createResourcePermission(
|
||||
@@ -259,7 +259,8 @@ public class NCResourceServiceImpl implements ResourceService {
|
||||
|
||||
// 如果修改了标题,检查标题是否已被使用
|
||||
if (StringUtils.hasText(resource.getTitle()) && !resource.getTitle().equals(existing.getTitle())) {
|
||||
int count = resourceMapper.countByTitle(resource.getTitle(), resource.getResourceID());
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
int count = resourceMapper.countByTitle(resource.getTitle(), resource.getResourceID(), userDeptRoles);
|
||||
if (count > 0) {
|
||||
resultDomain.fail("资源标题已存在");
|
||||
return resultDomain;
|
||||
@@ -762,7 +763,8 @@ public class NCResourceServiceImpl implements ResourceService {
|
||||
}
|
||||
|
||||
// 先按关键词搜索
|
||||
List<TbResource> list = resourceMapper.searchByKeyword(keyword);
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
List<TbResource> list = resourceMapper.searchByKeyword(keyword, userDeptRoles);
|
||||
|
||||
// 如果指定了分类ID,进行过滤
|
||||
if (StringUtils.hasText(tagID) && list != null) {
|
||||
|
||||
@@ -58,7 +58,8 @@ public class NCTagServiceImpl implements TagService {
|
||||
}
|
||||
|
||||
// 检查标签名称是否已存在(同类型下)
|
||||
int count = tagMapper.countByNameAndType(tag.getName(), tag.getTagType(), null);
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
int count = tagMapper.countByNameAndType(tag.getName(), tag.getTagType(), null, userDeptRoles);
|
||||
if (count > 0) {
|
||||
resultDomain.fail("该类型下标签名称已存在");
|
||||
return resultDomain;
|
||||
@@ -83,7 +84,6 @@ public class NCTagServiceImpl implements TagService {
|
||||
|
||||
// 创建标签资源权限
|
||||
try {
|
||||
List<UserDeptRoleVO> userDeptRoles = LoginUtil.getCurrentDeptRole();
|
||||
if (userDeptRoles != null && !userDeptRoles.isEmpty()) {
|
||||
// 使用用户的第一个部门角色创建权限
|
||||
resourcePermissionService.createResourcePermission(
|
||||
|
||||
@@ -76,7 +76,6 @@
|
||||
AND rp.deleted = 0
|
||||
AND rp.can_read = 1
|
||||
AND (
|
||||
-- 全局权限:所有用户可访问
|
||||
(rp.dept_id IS NULL AND rp.role_id IS NULL)
|
||||
<if test="userDeptRoles != null and userDeptRoles.size() > 0">
|
||||
OR EXISTS (
|
||||
@@ -88,12 +87,9 @@
|
||||
) user_roles
|
||||
LEFT JOIN tb_sys_dept perm_dept ON perm_dept.dept_id = rp.dept_id AND perm_dept.deleted = 0
|
||||
WHERE
|
||||
-- 部门级权限:当前部门或父部门(通过dept_path判断继承关系)
|
||||
(rp.role_id IS NULL AND rp.dept_id IS NOT NULL
|
||||
AND user_roles.dept_path LIKE CONCAT(perm_dept.dept_path, '%'))
|
||||
-- 角色级权限:跨部门的角色权限
|
||||
OR (rp.dept_id IS NULL AND rp.role_id = user_roles.role_id)
|
||||
-- 精确权限:特定部门的特定角色
|
||||
OR (rp.dept_id = user_roles.dept_id AND rp.role_id = user_roles.role_id)
|
||||
)
|
||||
</if>
|
||||
@@ -157,13 +153,13 @@
|
||||
WHERE banner_id = #{bannerID} AND deleted = 0
|
||||
</select>
|
||||
|
||||
<!-- 根据状态查询Banner列表 -->
|
||||
<!-- 根据状态查询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 DISTINCT b.*
|
||||
FROM tb_banner b
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE b.status = #{status} AND b.deleted = 0
|
||||
ORDER BY b.order_num ASC, b.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据位置查询Banner列表 -->
|
||||
@@ -175,22 +171,23 @@
|
||||
ORDER BY order_num ASC, create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 查询有效的Banner列表(按排序) -->
|
||||
<!-- 查询有效的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 DISTINCT b.*
|
||||
FROM tb_banner b
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE b.status = 1 AND b.deleted = 0
|
||||
ORDER BY b.order_num ASC, b.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查Banner标题是否存在 -->
|
||||
<!-- 检查Banner标题是否存在 - 添加权限过滤 -->
|
||||
<select id="countByTitle" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_banner
|
||||
WHERE title = #{title} AND deleted = 0
|
||||
SELECT COUNT(DISTINCT b.id)
|
||||
FROM tb_banner b
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE b.title = #{title} AND b.deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND banner_id != #{excludeId}
|
||||
AND b.banner_id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
@@ -130,38 +130,38 @@
|
||||
|
||||
<!-- 根据标签ID查询资源列表 -->
|
||||
<select id="selectByTagId" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE tag_id = #{tagId} AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
SELECT DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.tag_id = #{tagId} AND r.deleted = 0
|
||||
ORDER BY r.publish_time DESC, r.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 DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.status = #{status} AND r.deleted = 0
|
||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据标签类型查询资源列表 -->
|
||||
<select id="selectByType" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE tag_id = #{type} AND deleted = 0
|
||||
ORDER BY publish_time DESC, create_time DESC
|
||||
SELECT DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.tag_id = #{type} AND r.deleted = 0
|
||||
ORDER BY r.publish_time DESC, r.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
|
||||
SELECT DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.status = 1 AND r.deleted = 0
|
||||
ORDER BY r.view_count DESC, r.like_count DESC, r.publish_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
@@ -169,11 +169,11 @@
|
||||
|
||||
<!-- 查询最新资源列表 -->
|
||||
<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
|
||||
SELECT DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.status = 1 AND r.deleted = 0
|
||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
||||
<if test="limit != null and limit > 0">
|
||||
LIMIT #{limit}
|
||||
</if>
|
||||
@@ -181,23 +181,24 @@
|
||||
|
||||
<!-- 根据关键词搜索资源 -->
|
||||
<select id="searchByKeyword" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="Base_Column_List" />
|
||||
FROM tb_resource
|
||||
WHERE (title LIKE CONCAT('%', #{keyword}, '%')
|
||||
SELECT DISTINCT r.*
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE (r.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
|
||||
AND r.status = 1 AND r.deleted = 0
|
||||
ORDER BY r.publish_time DESC, r.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 检查资源标题是否存在 -->
|
||||
<select id="countByTitle" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_resource
|
||||
WHERE title = #{title} AND deleted = 0
|
||||
SELECT COUNT(DISTINCT r.id)
|
||||
FROM tb_resource r
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE r.title = #{title} AND r.deleted = 0
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND resource_id != #{excludeId}
|
||||
AND r.resource_id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
@@ -205,14 +206,10 @@
|
||||
<insert id="insertResource" parameterType="org.xyzh.common.dto.resource.TbResource">
|
||||
INSERT INTO tb_resource (
|
||||
id, resource_id, title, content, summary, cover_image, tag_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
|
||||
source_url, creator,create_time
|
||||
) VALUES (
|
||||
#{id}, #{resourceID}, #{title}, #{content}, #{summary}, #{coverImage}, #{tagID}, #{author}, #{source},
|
||||
#{sourceUrl}, #{viewCount}, #{likeCount}, #{collectCount}, #{status}, #{isRecommend},
|
||||
#{isBanner}, #{publishTime}, #{creator}, #{updater}, #{createTime}, #{updateTime},
|
||||
#{deleteTime}, #{deleted}
|
||||
#{sourceUrl}, #{creator}, #{createTime}
|
||||
)
|
||||
</insert>
|
||||
|
||||
@@ -291,17 +288,13 @@
|
||||
<insert id="batchInsertResources" parameterType="java.util.List">
|
||||
INSERT INTO tb_resource (
|
||||
id, resource_id, title, content, summary, cover_image, tag_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
|
||||
source_url, creator,create_time
|
||||
) VALUES
|
||||
<foreach collection="resourceList" item="item" separator=",">
|
||||
(
|
||||
#{item.id}, #{item.resourceID}, #{item.title}, #{item.content}, #{item.summary}, #{item.coverImage},
|
||||
#{item.tagID}, #{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}
|
||||
#{item.creator}, #{item.createTime}
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
@@ -103,21 +103,21 @@
|
||||
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 DISTINCT t.*
|
||||
FROM tb_tag t
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE t.name = #{name} AND t.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 DISTINCT t.*
|
||||
FROM tb_tag t
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE t.deleted = 0
|
||||
ORDER BY t.create_time DESC
|
||||
</select>
|
||||
|
||||
<!-- 根据标签类型查询标签列表 -->
|
||||
@@ -144,16 +144,17 @@
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 检查标签名称是否存在(同类型下) -->
|
||||
<!-- 检查标签名称是否存在(同类型下) - 添加权限过滤 -->
|
||||
<select id="countByNameAndType" resultType="int">
|
||||
SELECT COUNT(1)
|
||||
FROM tb_tag
|
||||
WHERE name = #{name} AND deleted = 0
|
||||
SELECT COUNT(DISTINCT t.id)
|
||||
FROM tb_tag t
|
||||
<include refid="Permission_Filter"/>
|
||||
WHERE t.name = #{name} AND t.deleted = 0
|
||||
<if test="tagType != null">
|
||||
AND tag_type = #{tagType}
|
||||
AND t.tag_type = #{tagType}
|
||||
</if>
|
||||
<if test="excludeId != null and excludeId != ''">
|
||||
AND id != #{excludeId}
|
||||
AND t.id != #{excludeId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user