mirror of
https://github.com/tencentmusic/supersonic.git
synced 2026-04-30 04:54:25 +08:00
[improvement](chat) fix checkstyle error in CollectService (#439)
This commit is contained in:
@@ -5,27 +5,21 @@ import com.tencent.supersonic.auth.api.authentication.pojo.User;
|
||||
import com.tencent.supersonic.semantic.model.domain.CollectService;
|
||||
import com.tencent.supersonic.semantic.model.domain.dataobject.CollectDO;
|
||||
import com.tencent.supersonic.semantic.model.infrastructure.mapper.CollectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import javax.annotation.Resource;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class CollectServiceImpl implements CollectService {
|
||||
|
||||
|
||||
|
||||
public static final String type = "metric";
|
||||
@Resource
|
||||
private CollectMapper collectMapper;
|
||||
|
||||
|
||||
String type = "metric";
|
||||
|
||||
|
||||
@Override
|
||||
public Boolean createCollectionIndicators(User user, Long id) {
|
||||
CollectDO collectDO = new CollectDO();
|
||||
@@ -39,9 +33,9 @@ public class CollectServiceImpl implements CollectService {
|
||||
@Override
|
||||
public Boolean deleteCollectionIndicators(User user, Long id) {
|
||||
QueryWrapper<CollectDO> collectDOQueryWrapper = new QueryWrapper<>();
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getUsername,user.getName());
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getCollectId,id);
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getType,type);
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getUsername, user.getName());
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getCollectId, id);
|
||||
collectDOQueryWrapper.lambda().eq(CollectDO::getType, type);
|
||||
collectMapper.delete(collectDOQueryWrapper);
|
||||
return true;
|
||||
}
|
||||
@@ -49,8 +43,8 @@ public class CollectServiceImpl implements CollectService {
|
||||
@Override
|
||||
public List<CollectDO> getCollectList(String username) {
|
||||
QueryWrapper<CollectDO> queryWrapper = new QueryWrapper<>();
|
||||
if (!StringUtils.isEmpty(username)){
|
||||
queryWrapper.lambda().eq(CollectDO::getUsername,username);
|
||||
if (!StringUtils.isEmpty(username)) {
|
||||
queryWrapper.lambda().eq(CollectDO::getUsername, username);
|
||||
}
|
||||
return collectMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@ public class MetricServiceImpl implements MetricService {
|
||||
BeanUtils.copyProperties(metricDOPageInfo, pageInfo);
|
||||
List<CollectDO> collectList = collectService.getCollectList(user.getName());
|
||||
List<Long> collect = collectList.stream().map(CollectDO::getCollectId).collect(Collectors.toList());
|
||||
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList(),collect);
|
||||
List<MetricResp> metricResps = convertList(metricDOPageInfo.getList(), collect);
|
||||
fillAdminRes(metricResps, user);
|
||||
pageInfo.setList(metricResps);
|
||||
return pageInfo;
|
||||
|
||||
@@ -14,7 +14,7 @@ public interface CollectService {
|
||||
|
||||
Boolean createCollectionIndicators(User user, Long id);
|
||||
|
||||
Boolean deleteCollectionIndicators(User user,Long id);
|
||||
Boolean deleteCollectionIndicators(User user, Long id);
|
||||
|
||||
List<CollectDO> getCollectList(String username);
|
||||
|
||||
|
||||
@@ -66,9 +66,9 @@ public class MetricConverter {
|
||||
metricResp.setModelName(modelResp.getName());
|
||||
metricResp.setDomainId(modelResp.getDomainId());
|
||||
}
|
||||
if (collect != null && collect.contains(metricDO.getId())){
|
||||
if (collect != null && collect.contains(metricDO.getId())) {
|
||||
metricResp.setIsCollect(true);
|
||||
}else {
|
||||
} else {
|
||||
metricResp.setIsCollect(false);
|
||||
}
|
||||
metricResp.setTag(metricDO.getTags());
|
||||
|
||||
@@ -42,7 +42,7 @@ public class CollectController {
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
User user = UserHolder.findUser(request, response);
|
||||
return collectService.deleteCollectionIndicators(user,id);
|
||||
return collectService.deleteCollectionIndicators(user, id);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user