|
@@ -1,11 +1,6 @@
|
|
|
package ${package.ServiceImpl};
|
|
|
|
|
|
|
|
|
-import ${package.Mapper}.${table.mapperName};
|
|
|
-import ${package.Entity}.${entity};
|
|
|
-import ${package.Service}.${table.serviceName};
|
|
|
-import ${superServiceImplClassPackage};
|
|
|
-
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
<#if superServiceImplClass?? && superServiceImplClass == "SuperCacheServiceImpl">
|
|
|
import org.springframework.aop.framework.AopContext;
|
|
@@ -31,25 +26,32 @@ import org.springframework.stereotype.Service;
|
|
|
open class ${table.serviceImplName} : ${superServiceImplClass}<${table.mapperName}, ${entity}>(), ${table.serviceName} {
|
|
|
}
|
|
|
<#else>
|
|
|
-<#if superServiceImplClass??>
|
|
|
-public class ${table.serviceImplName} extends ${superServiceImplClass}<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
|
|
-<#else>
|
|
|
-public class ${table.serviceImplName} {
|
|
|
-</#if>
|
|
|
-<#if superServiceImplClass?? && superServiceImplClass == "SuperCacheServiceImpl">
|
|
|
- /**
|
|
|
- * 建议将改变量移动到CacheKey工具类中统一管理,并在 caffeine.properties 文件中合理配置有效期
|
|
|
- */
|
|
|
- protected static final String ${entity?upper_case} = "${entity?lower_case}";
|
|
|
+public class ${table.serviceImplName} extends SuperCacheServiceImpl<${table.mapperName}, ${entity}> implements ${table.serviceName} {
|
|
|
+ @Override
|
|
|
+ public IPage<${entity}> pageList(IPage page, LbqWrapper<${entity}> wrapper) {
|
|
|
+ return baseMapper.pageList(page, wrapper, new DataScope());
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
- protected String getRegion() {
|
|
|
- return ${entity?upper_case};
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public ${entity} save(${entity}SaveDTO data) {
|
|
|
+ ${entity} model = BeanPlusUtil.toBean(data, ${entity}.class);
|
|
|
+ save(model);
|
|
|
+ return model;
|
|
|
}
|
|
|
|
|
|
- protected ${table.serviceName} currentProxy() {
|
|
|
- return ((${table.serviceName}) AopContext.currentProxy());
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public ${entity} update(${entity}UpdateDTO data) {
|
|
|
+ ${entity} model = BeanPlusUtil.toBean(data, ${entity}.class);
|
|
|
+ updateById(model);
|
|
|
+ return model;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean delete(${entity} model) {
|
|
|
+ return removeById(model);
|
|
|
}
|
|
|
-</#if>
|
|
|
}
|
|
|
</#if>
|