mirror of
https://gitee.com/myxzgzs/boyue_jnpf.git
synced 2025-08-09 07:42:43 +08:00
110 lines
3.9 KiB
Plaintext
110 lines
3.9 KiB
Plaintext
![]() |
#parse("PublicMacro/ServiceImpMarco.vm")
|
||
|
#set($moduleName = "${mainModelName.substring(0,1).toLowerCase()}${mainModelName.substring(1).toLowerCase()}")
|
||
|
#set($peimaryKeyName="${pKeyName.substring(0,1).toUpperCase()}${pKeyName.substring(1)}")
|
||
|
package ${package.ServiceImpl};
|
||
|
|
||
|
import ${package.Entity}.*;
|
||
|
import ${package.Mapper}.${table.mapperName};
|
||
|
import ${package.Service}.*;
|
||
|
import ${superServiceImplClassPackage};
|
||
|
import ${modulePackageName}.model.${moduleName}.*;
|
||
|
import org.springframework.stereotype.Service;
|
||
|
import jnpf.base.service.SuperServiceImpl;
|
||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||
|
import jnpf.util.GeneraterSwapUtil;
|
||
|
import java.sql.Connection;
|
||
|
import java.sql.SQLException;
|
||
|
import lombok.Cleanup;
|
||
|
import jnpf.database.plugins.DynamicSourceGeneratorInterface;
|
||
|
import jnpf.database.util.DynamicDataSourceUtil;
|
||
|
import org.apache.commons.collections4.CollectionUtils;
|
||
|
import jnpf.i18n.util.I18nUtil;
|
||
|
import jnpf.exception.DataException;
|
||
|
import jnpf.constant.MsgCode;
|
||
|
#if(${DS})
|
||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||
|
import jnpf.database.util.DataSourceUtil;
|
||
|
import jnpf.database.model.entity.DbLinkEntity;
|
||
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||
|
#end
|
||
|
#if(${main})
|
||
|
import java.math.BigDecimal;
|
||
|
import cn.hutool.core.util.ObjectUtil;
|
||
|
import java.lang.reflect.Field;
|
||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||
|
import java.util.regex.Pattern;
|
||
|
import java.util.stream.Collectors;
|
||
|
import jnpf.base.model.ColumnDataModel;
|
||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||
|
import org.springframework.transaction.annotation.Transactional;
|
||
|
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||
|
import com.github.yulichang.toolkit.JoinWrappers;
|
||
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||
|
import jnpf.model.QueryAllModel;
|
||
|
import java.text.SimpleDateFormat;
|
||
|
import jnpf.util.*;
|
||
|
import java.util.*;
|
||
|
import jnpf.base.UserInfo;
|
||
|
import jnpf.permission.entity.UserEntity;
|
||
|
import com.github.pagehelper.PageHelper;
|
||
|
#end
|
||
|
/**
|
||
|
*
|
||
|
* ${genInfo.description}
|
||
|
* 版本: ${genInfo.version}
|
||
|
* 版权: ${genInfo.copyright}
|
||
|
* 作者: ${genInfo.createUser}
|
||
|
* 日期: ${genInfo.createDate}
|
||
|
*/
|
||
|
@Service
|
||
|
#if(${DS})
|
||
|
@DS("${DS}")
|
||
|
#end
|
||
|
public class ${table.serviceImplName} extends SuperServiceImpl<${table.mapperName}, ${table.entityName}> implements ${table.serviceName}#if(${DS}),DynamicSourceGeneratorInterface #end{
|
||
|
@Autowired
|
||
|
private GeneraterSwapUtil generaterSwapUtil;
|
||
|
#if(${main})
|
||
|
@Autowired
|
||
|
private UserProvider userProvider;
|
||
|
#foreach($child in ${columnTableHandle})
|
||
|
@Autowired
|
||
|
private ${child.modelUpName}Service ${child.modelLowName}Service;
|
||
|
#end
|
||
|
#foreach($subfield in ${childTableHandle})
|
||
|
@Autowired
|
||
|
private ${subfield.aliasUpName}Service ${subfield.aliasLowName}Service;
|
||
|
#end
|
||
|
## 通用变量
|
||
|
#set($Name = "${genInfo.className.substring(0,1).toUpperCase()}${genInfo.className.substring(1)}")
|
||
|
#set($name = "${genInfo.className.substring(0,1).toLowerCase()}${genInfo.className.substring(1)}")
|
||
|
#set($QueryWrapper = "${name}QueryWrapper")
|
||
|
#set($serviceName = "${table.serviceName.substring(0,1).toLowerCase()}${table.serviceName.substring(1)}")
|
||
|
#set($Entity = "${table.entityName}")
|
||
|
#set($searchListSize =$!{searchList})
|
||
|
#if($isList)
|
||
|
## 列表接口
|
||
|
#GetTypeList()
|
||
|
#end
|
||
|
## 增删改查接口
|
||
|
#CrudMethod()
|
||
|
## 表单验证
|
||
|
#CheckForm()
|
||
|
## 业务主键验证
|
||
|
#if(${useBusinessKey})
|
||
|
#CheckBusinessKey()
|
||
|
#end
|
||
|
## 保存修改事务方法
|
||
|
#SaveOrUpdate()
|
||
|
#end
|
||
|
## 数据源切换
|
||
|
#if(${DS})
|
||
|
@Override
|
||
|
public DataSourceUtil getDataSource() {
|
||
|
return generaterSwapUtil.getDataSource(this.getClass().getAnnotation(DS.class).value());
|
||
|
}
|
||
|
#end
|
||
|
}
|