refactor(infra): 代码生成器模板中引入 MyBatis-Plus
- 在 service 接口中添加了对 MyBatis-Plus IService 接口的继承- 在 service 实现类中引入了 MyBatis-Plus 的 ServiceImpl 基类 -优化了 service 实现类的结构,使其与 MyBatis-Plus 集成
This commit is contained in:
parent
d96b447a94
commit
2cff1970d7
@ -2,6 +2,7 @@ package ${basePackage}.module.${table.moduleName}.service.${table.businessName};
|
||||
|
||||
import java.util.*;
|
||||
import ${jakartaPackage}.validation.*;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import ${basePackage}.module.${table.moduleName}.controller.${sceneEnum.basePackage}.${table.businessName}.vo.*;
|
||||
import ${basePackage}.module.${table.moduleName}.dal.dataobject.${table.businessName}.${table.className}DO;
|
||||
## 特殊:主子表专属逻辑
|
||||
@ -16,7 +17,7 @@ import ${PageParamClassName};
|
||||
*
|
||||
* @author ${table.author}
|
||||
*/
|
||||
public interface ${table.className}Service {
|
||||
public interface ${table.className}Service extends IService<${table.className}DO> {
|
||||
|
||||
/**
|
||||
* 创建${table.classComment}
|
||||
@ -144,4 +145,4 @@ public interface ${table.className}Service {
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ import ${basePackage}.module.${subTable.moduleName}.dal.dataobject.${subTable.bu
|
||||
import ${PageResultClassName};
|
||||
import ${PageParamClassName};
|
||||
import ${BeanUtils};
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
|
||||
import ${basePackage}.module.${table.moduleName}.dal.mysql.${table.businessName}.${table.className}Mapper;
|
||||
## 特殊:主子表专属逻辑
|
||||
@ -33,7 +34,8 @@ import static ${basePackage}.module.${table.moduleName}.enums.ErrorCodeConstants
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class ${table.className}ServiceImpl implements ${table.className}Service {
|
||||
#set($mainMapper = "${table.className}Mapper")
|
||||
public class ${table.className}ServiceImpl extends ServiceImpl<${mainMapper}, ${table.className}DO> implements ${table.className}Service {
|
||||
|
||||
@Resource
|
||||
private ${table.className}Mapper ${classNameVar}Mapper;
|
||||
@ -348,4 +350,4 @@ public class ${table.className}ServiceImpl implements ${table.className}Service
|
||||
}
|
||||
|
||||
#end
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user