review code.
This commit is contained in:
@@ -28,6 +28,15 @@ public interface IMapper<T> extends BaseMapper<T> {
|
||||
return Conditions.wrapper();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 LambdaQueryWrapper 对象
|
||||
*
|
||||
* @return 获取 wrapper
|
||||
*/
|
||||
default LambdaQueryWrapper<T> lambda() {
|
||||
return new LambdaQueryWrapper<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 DataQuery 对象
|
||||
*
|
||||
|
||||
@@ -51,6 +51,22 @@ public interface TagRelApi {
|
||||
*/
|
||||
Future<List<List<TagDTO>>> getRelTags(TagTypeEnum type, List<Long> relIdList);
|
||||
|
||||
/**
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param tagId tagId
|
||||
* @return rel
|
||||
*/
|
||||
List<Long> getRelIdByTagId(Long tagId);
|
||||
|
||||
/**
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param tagIdList tagIdList
|
||||
* @return rel
|
||||
*/
|
||||
List<Long> getRelIdByTagId(List<Long> tagIdList);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.orion.ops.module.infra.entity.request.favorite.FavoriteCreateRequest;
|
||||
import com.orion.ops.module.infra.entity.request.favorite.FavoriteQueryRequest;
|
||||
import com.orion.ops.module.infra.enums.FavoriteTypeEnum;
|
||||
import com.orion.ops.module.infra.service.FavoriteService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -21,7 +20,6 @@ import java.util.concurrent.Future;
|
||||
* @version 1.0.0
|
||||
* @since 2023-9-1 10:30
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class FavoriteApiImpl implements FavoriteApi {
|
||||
|
||||
|
||||
@@ -57,6 +57,16 @@ public class TagRelApiImpl implements TagRelApi {
|
||||
return CompletableFuture.completedFuture(values);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getRelIdByTagId(Long tagId) {
|
||||
return tagRelService.getRelIdByTagId(tagId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getRelIdByTagId(List<Long> tagIdList) {
|
||||
return tagRelService.getRelIdByTagId(tagIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async("asyncExecutor")
|
||||
public void deleteRelId(TagTypeEnum type, Long relId) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.FavoriteDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -15,18 +14,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface FavoriteDAO extends IMapper<FavoriteDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<FavoriteDO> queryCondition(FavoriteDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(FavoriteDO::getId, entity.getId())
|
||||
.eq(FavoriteDO::getUserId, entity.getUserId())
|
||||
.eq(FavoriteDO::getRelId, entity.getRelId())
|
||||
.eq(FavoriteDO::getType, entity.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemMenuDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -15,25 +14,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemMenuDAO extends IMapper<SystemMenuDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<SystemMenuDO> queryCondition(SystemMenuDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(SystemMenuDO::getId, entity.getId())
|
||||
.eq(SystemMenuDO::getParentId, entity.getParentId())
|
||||
.eq(SystemMenuDO::getName, entity.getName())
|
||||
.eq(SystemMenuDO::getPermission, entity.getPermission())
|
||||
.eq(SystemMenuDO::getType, entity.getType())
|
||||
.eq(SystemMenuDO::getSort, entity.getSort())
|
||||
.eq(SystemMenuDO::getStatus, entity.getStatus())
|
||||
.eq(SystemMenuDO::getCache, entity.getCache())
|
||||
.eq(SystemMenuDO::getIcon, entity.getIcon())
|
||||
.eq(SystemMenuDO::getPath, entity.getPath())
|
||||
.eq(SystemMenuDO::getComponent, entity.getComponent());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,20 +18,6 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface SystemRoleDAO extends IMapper<SystemRoleDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<SystemRoleDO> queryCondition(SystemRoleDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(SystemRoleDO::getId, entity.getId())
|
||||
.eq(SystemRoleDO::getName, entity.getName())
|
||||
.eq(SystemRoleDO::getCode, entity.getCode())
|
||||
.eq(SystemRoleDO::getStatus, entity.getStatus());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过编码查询角色
|
||||
*
|
||||
|
||||
@@ -17,19 +17,6 @@ import java.util.List;
|
||||
@Mapper
|
||||
public interface SystemRoleMenuDAO extends IMapper<SystemRoleMenuDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<SystemRoleMenuDO> queryCondition(SystemRoleMenuDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(SystemRoleMenuDO::getId, entity.getId())
|
||||
.eq(SystemRoleMenuDO::getRoleId, entity.getRoleId())
|
||||
.eq(SystemRoleMenuDO::getMenuId, entity.getMenuId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过 roleId 删除
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.SystemUserDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -15,23 +14,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface SystemUserDAO extends IMapper<SystemUserDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<SystemUserDO> queryCondition(SystemUserDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(SystemUserDO::getId, entity.getId())
|
||||
.eq(SystemUserDO::getUsername, entity.getUsername())
|
||||
.eq(SystemUserDO::getPassword, entity.getPassword())
|
||||
.eq(SystemUserDO::getNickname, entity.getNickname())
|
||||
.eq(SystemUserDO::getAvatar, entity.getAvatar())
|
||||
.eq(SystemUserDO::getMobile, entity.getMobile())
|
||||
.eq(SystemUserDO::getEmail, entity.getEmail())
|
||||
.eq(SystemUserDO::getStatus, entity.getStatus())
|
||||
.eq(SystemUserDO::getLastLoginTime, entity.getLastLoginTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,19 +18,6 @@ import java.util.stream.Collectors;
|
||||
@Mapper
|
||||
public interface SystemUserRoleDAO extends IMapper<SystemUserRoleDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<SystemUserRoleDO> queryCondition(SystemUserRoleDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(SystemUserRoleDO::getId, entity.getId())
|
||||
.eq(SystemUserRoleDO::getUserId, entity.getUserId())
|
||||
.eq(SystemUserRoleDO::getRoleId, entity.getRoleId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询用户的全部 roleId
|
||||
*
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.orion.ops.module.infra.dao;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.TagDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -15,17 +14,4 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
@Mapper
|
||||
public interface TagDAO extends IMapper<TagDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
*/
|
||||
default LambdaQueryWrapper<TagDO> queryCondition(TagDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(TagDO::getId, entity.getId())
|
||||
.eq(TagDO::getName, entity.getName())
|
||||
.eq(TagDO::getType, entity.getType());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,9 @@ import com.orion.ops.framework.mybatis.core.mapper.IMapper;
|
||||
import com.orion.ops.module.infra.entity.domain.TagRelDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 标签引用 Mapper 接口
|
||||
*
|
||||
@@ -16,18 +19,35 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
public interface TagRelDAO extends IMapper<TagRelDO> {
|
||||
|
||||
/**
|
||||
* 获取查询条件
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param entity entity
|
||||
* @return 查询条件
|
||||
* @param tagId tagId
|
||||
* @return rel
|
||||
*/
|
||||
default LambdaQueryWrapper<TagRelDO> queryCondition(TagRelDO entity) {
|
||||
return this.wrapper()
|
||||
.eq(TagRelDO::getId, entity.getId())
|
||||
.eq(TagRelDO::getTagId, entity.getTagId())
|
||||
.eq(TagRelDO::getTagName, entity.getTagName())
|
||||
.eq(TagRelDO::getTagType, entity.getTagType())
|
||||
.eq(TagRelDO::getRelId, entity.getRelId());
|
||||
default List<Long> selectRelIdByTagId(Long tagId) {
|
||||
LambdaQueryWrapper<TagRelDO> wrapper = this.lambda()
|
||||
.select(TagRelDO::getRelId)
|
||||
.eq(TagRelDO::getTagId, tagId);
|
||||
return this.selectList(wrapper)
|
||||
.stream()
|
||||
.map(TagRelDO::getRelId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param tagIdList tagIdList
|
||||
* @return rel
|
||||
*/
|
||||
default List<Long> selectRelIdByTagId(List<Long> tagIdList) {
|
||||
LambdaQueryWrapper<TagRelDO> wrapper = this.lambda()
|
||||
.select(TagRelDO::getRelId)
|
||||
.in(TagRelDO::getTagId, tagIdList);
|
||||
return this.selectList(wrapper)
|
||||
.stream()
|
||||
.map(TagRelDO::getRelId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -49,6 +49,22 @@ public interface TagRelService {
|
||||
*/
|
||||
List<List<TagCacheDTO>> getRelTags(String type, List<Long> relIdList);
|
||||
|
||||
/**
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param tagId tagId
|
||||
* @return rel
|
||||
*/
|
||||
List<Long> getRelIdByTagId(Long tagId);
|
||||
|
||||
/**
|
||||
* 查询 tag 关联的所有 id
|
||||
*
|
||||
* @param tagIdList tagIdList
|
||||
* @return rel
|
||||
*/
|
||||
List<Long> getRelIdByTagId(List<Long> tagIdList);
|
||||
|
||||
/**
|
||||
* 通过 relId 删除
|
||||
*
|
||||
|
||||
@@ -148,6 +148,16 @@ public class TagRelServiceImpl implements TagRelService {
|
||||
return cacheValueList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getRelIdByTagId(Long tagId) {
|
||||
return tagRelDAO.selectRelIdByTagId(tagId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getRelIdByTagId(List<Long> tagIdList) {
|
||||
return tagRelDAO.selectRelIdByTagId(tagIdList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer deleteRelId(String type, Long relId) {
|
||||
// 删除数据库
|
||||
|
||||
Reference in New Issue
Block a user