refactor(core):优化服务实现类代码结构

- 调整了多个服务实现类中的 import 语句顺序- 移除了未使用的注解和依赖注入相关导入
- 统一了 MyBatis 注解的导入方式-优化了数据源配置类中的 DataSource 导入位置
- 移除了过滤器中不必要的 Component 注解- 简化了部分重复的代码结构以提升可读性
This commit is contained in:
2025-10-15 19:31:02 +08:00
parent 3904e8510e
commit ee99654e7c
12 changed files with 16 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
package com.hanserwei.hannote.count.biz.service; package com.hanserwei.hannote.count.biz.service;
import com.hanserwei.hannote.count.biz.domain.dataobject.NoteCountDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hanserwei.hannote.count.biz.domain.dataobject.NoteCountDO;
public interface NoteCountDOService extends IService<NoteCountDO>{ public interface NoteCountDOService extends IService<NoteCountDO>{

View File

@@ -1,7 +1,7 @@
package com.hanserwei.hannote.count.biz.service; package com.hanserwei.hannote.count.biz.service;
import com.hanserwei.hannote.count.biz.domain.dataobject.UserCountDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hanserwei.hannote.count.biz.domain.dataobject.UserCountDO;
public interface UserCountDOService extends IService<UserCountDO>{ public interface UserCountDOService extends IService<UserCountDO>{

View File

@@ -1,12 +1,10 @@
package com.hanserwei.hannote.count.biz.service.impl; package com.hanserwei.hannote.count.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.count.biz.domain.dataobject.NoteCountDO; import com.hanserwei.hannote.count.biz.domain.dataobject.NoteCountDO;
import com.hanserwei.hannote.count.biz.domain.mapper.NoteCountDOMapper; import com.hanserwei.hannote.count.biz.domain.mapper.NoteCountDOMapper;
import com.hanserwei.hannote.count.biz.service.NoteCountDOService; import com.hanserwei.hannote.count.biz.service.NoteCountDOService;
import org.springframework.stereotype.Service;
@Service @Service
public class NoteCountDOServiceImpl extends ServiceImpl<NoteCountDOMapper, NoteCountDO> implements NoteCountDOService{ public class NoteCountDOServiceImpl extends ServiceImpl<NoteCountDOMapper, NoteCountDO> implements NoteCountDOService{

View File

@@ -1,12 +1,10 @@
package com.hanserwei.hannote.count.biz.service.impl; package com.hanserwei.hannote.count.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.count.biz.domain.mapper.UserCountDOMapper;
import com.hanserwei.hannote.count.biz.domain.dataobject.UserCountDO; import com.hanserwei.hannote.count.biz.domain.dataobject.UserCountDO;
import com.hanserwei.hannote.count.biz.domain.mapper.UserCountDOMapper;
import com.hanserwei.hannote.count.biz.service.UserCountDOService; import com.hanserwei.hannote.count.biz.service.UserCountDOService;
import org.springframework.stereotype.Service;
@Service @Service
public class UserCountDOServiceImpl extends ServiceImpl<UserCountDOMapper, UserCountDO> implements UserCountDOService{ public class UserCountDOServiceImpl extends ServiceImpl<UserCountDOMapper, UserCountDO> implements UserCountDOService{

View File

@@ -2,7 +2,6 @@ package com.hanserwei.hannote.distributed.id.generator.biz.config;
import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder; import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceBuilder;
import jakarta.annotation.PostConstruct; import jakarta.annotation.PostConstruct;
import javax.sql.DataSource;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
@@ -11,6 +10,8 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import javax.sql.DataSource;
@Slf4j @Slf4j
@Configuration @Configuration
@RequiredArgsConstructor @RequiredArgsConstructor

View File

@@ -1,12 +1,7 @@
package com.hanserwei.hannote.distributed.id.generator.biz.core.segment.dao; package com.hanserwei.hannote.distributed.id.generator.biz.core.segment.dao;
import com.hanserwei.hannote.distributed.id.generator.biz.core.segment.model.LeafAlloc; import com.hanserwei.hannote.distributed.id.generator.biz.core.segment.model.LeafAlloc;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.*;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import java.util.List; import java.util.List;

View File

@@ -1,13 +1,12 @@
package com.hanserwei.hannote.note.biz.service.impl; package com.hanserwei.hannote.note.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO; import com.hanserwei.hannote.note.biz.domain.dataobject.NoteCollectionDO;
import com.hanserwei.hannote.note.biz.domain.mapper.NoteCollectionDOMapper; import com.hanserwei.hannote.note.biz.domain.mapper.NoteCollectionDOMapper;
import com.hanserwei.hannote.note.biz.service.NoteCollectionDOService; import com.hanserwei.hannote.note.biz.service.NoteCollectionDOService;
import org.springframework.stereotype.Service;
@Service @Service
public class NoteCollectionDOServiceImpl extends ServiceImpl<NoteCollectionDOMapper, NoteCollectionDO> implements NoteCollectionDOService{ public class NoteCollectionDOServiceImpl extends ServiceImpl<NoteCollectionDOMapper, NoteCollectionDO> implements NoteCollectionDOService {
} }

View File

@@ -1,7 +1,7 @@
package com.hanserwei.hannote.user.relation.biz.service; package com.hanserwei.hannote.user.relation.biz.service;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FansDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FansDO;
public interface FansDOService extends IService<FansDO>{ public interface FansDOService extends IService<FansDO>{

View File

@@ -1,7 +1,7 @@
package com.hanserwei.hannote.user.relation.biz.service; package com.hanserwei.hannote.user.relation.biz.service;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FollowingDO;
import com.baomidou.mybatisplus.extension.service.IService; import com.baomidou.mybatisplus.extension.service.IService;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FollowingDO;
public interface FollowingDOService extends IService<FollowingDO>{ public interface FollowingDOService extends IService<FollowingDO>{

View File

@@ -1,12 +1,10 @@
package com.hanserwei.hannote.user.relation.biz.service.impl; package com.hanserwei.hannote.user.relation.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FansDO; import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FansDO;
import com.hanserwei.hannote.user.relation.biz.domain.mapper.FansDOMapper; import com.hanserwei.hannote.user.relation.biz.domain.mapper.FansDOMapper;
import com.hanserwei.hannote.user.relation.biz.service.FansDOService; import com.hanserwei.hannote.user.relation.biz.service.FansDOService;
import org.springframework.stereotype.Service;
@Service @Service
public class FansDOServiceImpl extends ServiceImpl<FansDOMapper, FansDO> implements FansDOService{ public class FansDOServiceImpl extends ServiceImpl<FansDOMapper, FansDO> implements FansDOService{

View File

@@ -1,12 +1,10 @@
package com.hanserwei.hannote.user.relation.biz.service.impl; package com.hanserwei.hannote.user.relation.biz.service.impl;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hanserwei.hannote.user.relation.biz.domain.mapper.FollowingDOMapper;
import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FollowingDO; import com.hanserwei.hannote.user.relation.biz.domain.dataobject.FollowingDO;
import com.hanserwei.hannote.user.relation.biz.domain.mapper.FollowingDOMapper;
import com.hanserwei.hannote.user.relation.biz.service.FollowingDOService; import com.hanserwei.hannote.user.relation.biz.service.FollowingDOService;
import org.springframework.stereotype.Service;
@Service @Service
public class FollowingDOServiceImpl extends ServiceImpl<FollowingDOMapper, FollowingDO> implements FollowingDOService{ public class FollowingDOServiceImpl extends ServiceImpl<FollowingDOMapper, FollowingDO> implements FollowingDOService{

View File

@@ -8,7 +8,6 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse; import jakarta.servlet.http.HttpServletResponse;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.OncePerRequestFilter; import org.springframework.web.filter.OncePerRequestFilter;
import java.io.IOException; import java.io.IOException;