mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
commit
4a75b151d4
@ -3,7 +3,9 @@ package #(packageConfig.serviceImplPackage);
|
|||||||
import com.mybatisflex.solon.service.impl.ServiceImpl;
|
import com.mybatisflex.solon.service.impl.ServiceImpl;
|
||||||
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
||||||
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
||||||
|
#end
|
||||||
import org.noear.solon.annotation.Component;
|
import org.noear.solon.annotation.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -13,6 +15,6 @@ import org.noear.solon.annotation.Component;
|
|||||||
* @since #(javadocConfig.getSince())
|
* @since #(javadocConfig.getSince())
|
||||||
*/
|
*/
|
||||||
@Component
|
@Component
|
||||||
public class #(table.buildServiceImplClassName()) extends ServiceImpl<#(table.buildMapperClassName()), #(table.buildEntityClassName())> implements #(table.buildServiceClassName()) {
|
public class #(table.buildServiceImplClassName()) extends ServiceImpl<#(table.buildMapperClassName()), #(table.buildEntityClassName())> #if(table.getGlobalConfig().isServiceGenerateEnable()) implements #(table.buildServiceClassName()) #end{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,7 +3,9 @@ package #(packageConfig.serviceImplPackage);
|
|||||||
import #(serviceImplConfig.buildSuperClassImport());
|
import #(serviceImplConfig.buildSuperClassImport());
|
||||||
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
||||||
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
||||||
|
#end
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -6,7 +6,9 @@ package #(packageConfig.serviceImplPackage);
|
|||||||
import #(serviceImplConfig.buildSuperClassImport());
|
import #(serviceImplConfig.buildSuperClassImport());
|
||||||
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
import #(packageConfig.entityPackage).#(table.buildEntityClassName());
|
||||||
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
import #(packageConfig.mapperPackage).#(table.buildMapperClassName());
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
import #(packageConfig.servicePackage).#(table.buildServiceClassName());
|
||||||
|
#end
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
#if(isCacheExample)
|
#if(isCacheExample)
|
||||||
import com.mybatisflex.core.paginate.Page;
|
import com.mybatisflex.core.paginate.Page;
|
||||||
@ -30,94 +32,125 @@ import java.util.List;
|
|||||||
#if(isCacheExample)
|
#if(isCacheExample)
|
||||||
@CacheConfig(cacheNames = "#(firstCharToLowerCase(entityClassName))")
|
@CacheConfig(cacheNames = "#(firstCharToLowerCase(entityClassName))")
|
||||||
#end
|
#end
|
||||||
public class #(table.buildServiceImplClassName()) extends #(serviceImplConfig.buildSuperClassName())<#(table.buildMapperClassName()), #(table.buildEntityClassName())> implements #(table.buildServiceClassName()) {
|
public class #(table.buildServiceImplClassName()) extends #(serviceImplConfig.buildSuperClassName())<#(table.buildMapperClassName()), #(table.buildEntityClassName())> #if(table.getGlobalConfig().isServiceGenerateEnable()) implements #(table.buildServiceClassName())#end {
|
||||||
|
|
||||||
#if(isCacheExample)
|
#if(isCacheExample)
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(allEntries = true)
|
@CacheEvict(allEntries = true)
|
||||||
public boolean remove(QueryWrapper query) {
|
public boolean remove(QueryWrapper query) {
|
||||||
return super.remove(query);
|
return super.remove(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(key = "#id")
|
@CacheEvict(key = "#id")
|
||||||
public boolean removeById(Serializable id) {
|
public boolean removeById(Serializable id) {
|
||||||
return super.removeById(id);
|
return super.removeById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(allEntries = true)
|
@CacheEvict(allEntries = true)
|
||||||
public boolean removeByIds(Collection<? extends Serializable> ids) {
|
public boolean removeByIds(Collection<? extends Serializable> ids) {
|
||||||
return super.removeByIds(ids);
|
return super.removeByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(allEntries = true)
|
@CacheEvict(allEntries = true)
|
||||||
public boolean update(#(entityClassName) entity, QueryWrapper query) {
|
public boolean update(#(entityClassName) entity, QueryWrapper query) {
|
||||||
return super.update(entity, query);
|
return super.update(entity, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(key = "#entity.#(primaryKey)")
|
@CacheEvict(key = "#entity.#(primaryKey)")
|
||||||
public boolean updateById(#(entityClassName) entity, boolean ignoreNulls) {
|
public boolean updateById(#(entityClassName) entity, boolean ignoreNulls) {
|
||||||
return super.updateById(entity, ignoreNulls);
|
return super.updateById(entity, ignoreNulls);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@CacheEvict(allEntries = true)
|
@CacheEvict(allEntries = true)
|
||||||
public boolean updateBatch(Collection<#(entityClassName)> entities, int batchSize) {
|
public boolean updateBatch(Collection<#(entityClassName)> entities, int batchSize) {
|
||||||
return super.updateBatch(entities, batchSize);
|
return super.updateBatch(entities, batchSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#id")
|
@Cacheable(key = "#id")
|
||||||
public #(entityClassName) getById(Serializable id) {
|
public #(entityClassName) getById(Serializable id) {
|
||||||
return super.getById(id);
|
return super.getById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public #(entityClassName) getOne(QueryWrapper query) {
|
public #(entityClassName) getOne(QueryWrapper query) {
|
||||||
return super.getOne(query);
|
return super.getOne(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public <R> R getOneAs(QueryWrapper query, Class<R> asType) {
|
public <R> R getOneAs(QueryWrapper query, Class<R> asType) {
|
||||||
return super.getOneAs(query, asType);
|
return super.getOneAs(query, asType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public Object getObj(QueryWrapper query) {
|
public Object getObj(QueryWrapper query) {
|
||||||
return super.getObj(query);
|
return super.getObj(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public <R> R getObjAs(QueryWrapper query, Class<R> asType) {
|
public <R> R getObjAs(QueryWrapper query, Class<R> asType) {
|
||||||
return super.getObjAs(query, asType);
|
return super.getObjAs(query, asType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public List<Object> objList(QueryWrapper query) {
|
public List<Object> objList(QueryWrapper query) {
|
||||||
return super.objList(query);
|
return super.objList(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public <R> List<R> objListAs(QueryWrapper query, Class<R> asType) {
|
public <R> List<R> objListAs(QueryWrapper query, Class<R> asType) {
|
||||||
return super.objListAs(query, asType);
|
return super.objListAs(query, asType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public List<#(entityClassName)> list(QueryWrapper query) {
|
public List<#(entityClassName)> list(QueryWrapper query) {
|
||||||
return super.list(query);
|
return super.list(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public <R> List<R> listAs(QueryWrapper query, Class<R> asType) {
|
public <R> List<R> listAs(QueryWrapper query, Class<R> asType) {
|
||||||
return super.listAs(query, asType);
|
return super.listAs(query, asType);
|
||||||
@ -126,19 +159,25 @@ public class #(table.buildServiceImplClassName()) extends #(serviceImplConfig.bu
|
|||||||
/**
|
/**
|
||||||
* @deprecated 无法通过注解进行缓存操作。
|
* @deprecated 无法通过注解进行缓存操作。
|
||||||
*/
|
*/
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public List<#(entityClassName)> listByIds(Collection<? extends Serializable> ids) {
|
public List<#(entityClassName)> listByIds(Collection<? extends Serializable> ids) {
|
||||||
return super.listByIds(ids);
|
return super.listByIds(ids);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #query.toSQL()")
|
||||||
public long count(QueryWrapper query) {
|
public long count(QueryWrapper query) {
|
||||||
return super.count(query);
|
return super.count(query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if(table.getGlobalConfig().isServiceGenerateEnable())
|
||||||
@Override
|
@Override
|
||||||
|
#end
|
||||||
@Cacheable(key = "#root.methodName + ':' + #page.getPageSize() + ':' + #page.getPageNumber() + ':' + #query.toSQL()")
|
@Cacheable(key = "#root.methodName + ':' + #page.getPageSize() + ':' + #page.getPageNumber() + ':' + #query.toSQL()")
|
||||||
public <R> Page<R> pageAs(Page<R> page, QueryWrapper query, Class<R> asType) {
|
public <R> Page<R> pageAs(Page<R> page, QueryWrapper query, Class<R> asType) {
|
||||||
return super.pageAs(page, query, asType);
|
return super.pageAs(page, query, asType);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user