📝 升级文档.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:07
|
||||
*/
|
||||
public interface CommandSnippetApi {
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.orion.visor.module.infra.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 对外服务类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:07
|
||||
*/
|
||||
public interface PathBookmarkApi {
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.api.impl;
|
||||
|
||||
import com.orion.visor.module.asset.service.CommandSnippetService;
|
||||
import com.orion.visor.module.infra.api.CommandSnippetApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CommandSnippetApiImpl implements CommandSnippetApi {
|
||||
|
||||
@Resource
|
||||
private CommandSnippetService commandSnippetService;
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return commandSnippetService.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.orion.visor.module.asset.api.impl;
|
||||
|
||||
import com.orion.visor.module.asset.service.PathBookmarkService;
|
||||
import com.orion.visor.module.infra.api.PathBookmarkApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 对外服务实现类
|
||||
*
|
||||
* @author Jiahang Li
|
||||
* @version 1.0.0
|
||||
* @since 2024/6/3 11:11
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PathBookmarkApiImpl implements PathBookmarkApi {
|
||||
|
||||
@Resource
|
||||
private PathBookmarkService pathBookmarkService;
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return pathBookmarkService.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.asset.entity.domain.CommandSnippetDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 命令片段 Mapper 接口
|
||||
*
|
||||
@@ -42,4 +44,16 @@ public interface CommandSnippetDAO extends IMapper<CommandSnippetDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<CommandSnippetDO> wrapper = this.lambda()
|
||||
.in(CommandSnippetDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import com.orion.visor.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.visor.module.asset.entity.domain.PathBookmarkDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 路径标签 Mapper 接口
|
||||
*
|
||||
@@ -42,4 +44,16 @@ public interface PathBookmarkDAO extends IMapper<PathBookmarkDO> {
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
default int deleteByUserIdList(List<Long> userIdList) {
|
||||
LambdaQueryWrapper<PathBookmarkDO> wrapper = this.lambda()
|
||||
.in(PathBookmarkDO::getUserId, userIdList);
|
||||
return this.delete(wrapper);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -46,14 +46,6 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
List<CommandSnippetVO> getCommandSnippetList();
|
||||
|
||||
/**
|
||||
* 删除命令片段
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteCommandSnippetById(Long id);
|
||||
|
||||
/**
|
||||
* 设置分组为 null
|
||||
*
|
||||
@@ -63,6 +55,14 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
Integer setGroupNull(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 删除命令片段
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteCommandSnippetById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 groupId 删除
|
||||
*
|
||||
@@ -72,4 +72,12 @@ public interface CommandSnippetService {
|
||||
*/
|
||||
Integer deleteByGroupId(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -46,14 +46,6 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
List<PathBookmarkVO> getPathBookmarkList();
|
||||
|
||||
/**
|
||||
* 删除路径标签
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deletePathBookmarkById(Long id);
|
||||
|
||||
/**
|
||||
* 设置分组为 null
|
||||
*
|
||||
@@ -63,6 +55,14 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
Integer setGroupNull(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 删除路径标签
|
||||
*
|
||||
* @param id id
|
||||
* @return effect
|
||||
*/
|
||||
Integer deletePathBookmarkById(Long id);
|
||||
|
||||
/**
|
||||
* 通过 groupId 删除
|
||||
*
|
||||
@@ -72,4 +72,12 @@ public interface PathBookmarkService {
|
||||
*/
|
||||
Integer deleteByGroupId(Long userId, Long groupId);
|
||||
|
||||
/**
|
||||
* 通过 userId 删除
|
||||
*
|
||||
* @param userIdList userIdList
|
||||
* @return effect
|
||||
*/
|
||||
Integer deleteByUserIdList(List<Long> userIdList);
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.orion.visor.module.asset.service.CommandSnippetGroupService;
|
||||
import com.orion.visor.module.asset.service.CommandSnippetService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Comparator;
|
||||
@@ -52,7 +51,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
@Override
|
||||
public Long createCommandSnippet(CommandSnippetCreateRequest request) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}", JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-createCommandSnippet request: {}" , JSON.toJSONString(request));
|
||||
// 转换
|
||||
CommandSnippetDO record = CommandSnippetConvert.MAPPER.to(request);
|
||||
record.setUserId(userId);
|
||||
@@ -61,7 +60,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
// 插入
|
||||
int effect = commandSnippetDAO.insert(record);
|
||||
Long id = record.getId();
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}", id, effect);
|
||||
log.info("CommandSnippetService-createCommandSnippet id: {}, effect: {}" , id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return id;
|
||||
@@ -71,7 +70,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
public Integer updateCommandSnippetById(CommandSnippetUpdateRequest request) {
|
||||
Long id = Valid.notNull(request.getId(), ErrorMessage.ID_MISSING);
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}", id, JSON.toJSONString(request));
|
||||
log.info("CommandSnippetService-updateCommandSnippetById id: {}, request: {}" , id, JSON.toJSONString(request));
|
||||
// 查询
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
@@ -86,7 +85,7 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
.eq(CommandSnippetDO::getId, id)
|
||||
.eq(CommandSnippetDO::getUserId, userId);
|
||||
int effect = commandSnippetDAO.update(null, update);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}", effect);
|
||||
log.info("CommandSnippetService-updateCommandSnippetById effect: {}" , effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
@@ -145,29 +144,28 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteCommandSnippetById(Long id) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}", id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}" , id);
|
||||
// 检查数据是否存在
|
||||
CommandSnippetDO record = commandSnippetDAO.selectById(id);
|
||||
Valid.notNull(record, ErrorMessage.DATA_ABSENT);
|
||||
// 删除
|
||||
int effect = commandSnippetDAO.deleteById(id);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}", id, effect);
|
||||
log.info("CommandSnippetService-deleteCommandSnippetById id: {}, effect: {}" , id, effect);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId), id);
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(CommandSnippetCacheKeyDefine.SNIPPET.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = commandSnippetDAO.deleteByGroupId(groupId);
|
||||
@@ -176,6 +174,11 @@ public class CommandSnippetServiceImpl implements CommandSnippetService {
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return commandSnippetDAO.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查对象是否存在
|
||||
*
|
||||
|
||||
@@ -143,6 +143,14 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deletePathBookmarkById(Long id) {
|
||||
Long userId = SecurityUtils.getLoginUserId();
|
||||
@@ -159,19 +167,16 @@ public class PathBookmarkServiceImpl implements PathBookmarkService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer setGroupNull(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.setGroupIdWithNull(groupId);
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteByGroupId(Long userId, Long groupId) {
|
||||
int effect = pathBookmarkDAO.deleteByGroupId(groupId);
|
||||
// 删除缓存
|
||||
RedisMaps.delete(PathBookmarkCacheKeyDefine.PATH_BOOKMARK.format(userId));
|
||||
return effect;
|
||||
public Integer deleteByUserIdList(List<Long> userIdList) {
|
||||
return pathBookmarkDAO.deleteByUserIdList(userIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user