初始代码

This commit is contained in:
wangmingwei
2026-04-21 17:19:25 +08:00
parent ac9bea0b65
commit fb2bc3165b
1320 changed files with 17009 additions and 0 deletions

View File

@@ -0,0 +1,101 @@
#set($name = "${context.className.substring(0,1).toUpperCase()}${context.className.substring(1)}")
#macro(GetLongStr $longStr)
#set($num=${longStr.length()}/65000)
#if($num>0)
#foreach($foo in [0..$num])
#if($foo==0)
#set($endstr='");')
#if(${longStr.substring(0,65000).endsWith('\')})
#set($endstr='"");')
#end
sb.append(${longStr.substring(0,65000)}$endstr
#elseif($foo==$num)
#set($startIndex=$foo*65000)
#set($startstr='"')
#if(${longStr.substring($startIndex).startsWith('"')})
#set($startstr='')
#end
sb.append($startstr${longStr.substring($startIndex)});
#else
#set($startIndex=$foo*65000)
#set($endIndex=($foo+1)*65000)
#set($endstr='");')
#if(${longStr.substring($startIndex,$endIndex).endsWith('\')})
#set($endstr='"");')
#end
#if(${longStr.substring($startIndex,$endIndex).endsWith('\\')})
#set($endstr='");')
#end
#set($startstr='"')
#if(${longStr.substring($startIndex,$endIndex).startsWith('"')})
#set($startstr='')
#end
sb.append($startstr${longStr.substring($startIndex,$endIndex)}$endstr
#end
#end
#else
#if($longStr)sb.append($longStr);#end
#end
#end
package ${context.package}.model.$!{name.toLowerCase()};
import com.yunzhupaas.util.JsonUtil;
import java.util.*;
/**
* ${context.genInfo.description}配置json
*
* @版本: ${context.genInfo.version}
* @版权: ${context.genInfo.copyright}
* @作者: ${context.genInfo.createUser}
* @日期: ${context.genInfo.createDate}
*/
public class $!{name}Constant{
#if($context.webType == 4)
/** 接口信息 */
public static final String INTERFACE_ID = "${context.interfaceId}";
public static final String INTERFACE_PARAM = #if(${context.interfaceParam}) ${context.interfaceParam} #else ""#end;
#else
/** 数据库链接 */
public static final String DBLINKID = "${context.dbLinkId}";
/** 表别名 map */
public static final Map<String,String> TABLERENAMES = JsonUtil.getJsonToBean(${context.tableRenames},Map.class);
/** 子表model map */
public static final Map<String,String> TABLEFIELDKEY = JsonUtil.getJsonToBean(${context.childKeyTableNameMap},Map.class);
/** 整个表单配置json */
public static final String getFormData(){
StringBuilder sb = new StringBuilder();
#GetLongStr(${context.formDataStr})
return sb.toString();
}
#end
#if($context.isList)
/** 列表字段配置json */
public static final String getColumnData(){
StringBuilder sb = new StringBuilder();
#GetLongStr(${context.columnDataStr})
return sb.toString();
}
/** app列表字段配置json */
public static final String getAppColumnData(){
StringBuilder sb = new StringBuilder();
#GetLongStr(${context.appColumnDataStr})
return sb.toString();
}
#if($context.webType!=4)
/** 表列表 */
public static final String getTableList(){
StringBuilder sb = new StringBuilder();
#GetLongStr(${context.tableListStr})
return sb.toString();
}
#end
#end
#if($context.billRule)
/** 单据规则 */
#foreach($key in ${context.billRule.keySet()})
public static final String $key = ${context.billRule.get($key)};
#end
#end
}

View File

@@ -0,0 +1,203 @@
#parse("PublicMacro/ControllerMarco.vm")
package ${package.Controller};
#set($peimaryKeyName = "${pKeyName.substring(0,1).toUpperCase()}${pKeyName.substring(1)}")
#set($peimaryKeyname = "${pKeyName.substring(0,1).toLowerCase()}${pKeyName.substring(1)}")
#set($serviceName = "${table.serviceName.substring(0,1).toLowerCase()}${table.serviceName.substring(1)}")
#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($packName = "${genInfo.className.toLowerCase()}")
#set($searchListSize =$!{searchList})
#set($columnListSize=$!{columnList})
#set($serverHasUpload = false)
#set($serverHasDownload = false)
#foreach($btn in ${btnsList})
#if(${btn.value}=='upload' && ${btn.show})
#set($serverHasUpload = true)
#end
#if(${btn.value}=='download' && ${btn.show})
#set($serverHasDownload = true)
#end
#end
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import com.yunzhupaas.base.ActionResult;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.permission.entity.UserEntity;
import com.yunzhupaas.constant.MsgCode;
import ${package.Service}.*;
import ${package.Entity}.*;
import com.yunzhupaas.util.*;
import ${modulePackageName}.model.${packName}.*;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.yunzhupaas.flowable.entity.TaskEntity;
#if(${springVersion.startsWith("2")})
import javax.validation.Valid;
#else
import jakarta.validation.Valid;
#end
import java.util.*;
import com.yunzhupaas.model.ExcelModel;
import com.yunzhupaas.excel.ExcelExportStyler;
import com.yunzhupaas.excel.ExcelHelper;
#if($isList)
import com.yunzhupaas.annotation.yunzhupaasField;
import com.yunzhupaas.base.vo.PageListVO;
import com.yunzhupaas.base.vo.PaginationVO;
import com.yunzhupaas.base.vo.DownloadVO;
import com.yunzhupaas.config.ConfigValueUtil;
import com.yunzhupaas.base.entity.ProvinceEntity;
import java.io.IOException;
import java.util.stream.Collectors;
import com.yunzhupaas.flowable.entity.TaskEntity;
import com.yunzhupaas.exception.WorkFlowException;
import com.yunzhupaas.model.visualJson.UploaderTemplateModel;
import com.yunzhupaas.base.util.FormExecelUtils;
#end
#if(${serverHasUpload} || ${serverHasDownload})
import org.springframework.web.multipart.MultipartFile;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.params.ExcelExportEntity;
import cn.afterturn.easypoi.excel.entity.enmus.ExcelType;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Workbook;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import com.yunzhupaas.onlinedev.model.ExcelImFieldModel;
import com.yunzhupaas.base.model.OnlineImport.ImportDataModel;
import com.yunzhupaas.base.model.OnlineImport.ImportFormCheckUniqueModel;
import com.yunzhupaas.base.model.OnlineImport.ExcelImportModel;
import com.yunzhupaas.base.model.OnlineImport.VisualImportModel;
import cn.xuyanwu.spring.file.storage.FileInfo;
import lombok.Cleanup;
import com.yunzhupaas.model.visualJson.config.HeaderModel;
import com.yunzhupaas.base.model.ColumnDataModel;
import com.yunzhupaas.base.util.VisualUtils;
#end
#if(${DS})
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
#else
import org.springframework.transaction.annotation.Transactional;
#end
#if(${isCloud}=="cloud")
import com.yunzhupaas.model.upload.UploadFileModel;
import com.yunzhupaas.file.FileApi;
import com.yunzhupaas.constant.FileTypeConstant;
import java.io.ByteArrayOutputStream;
import com.yunzhupaas.file.FileUploadApi;
import org.apache.dubbo.config.annotation.DubboReference;
#end
/**
* ${genInfo.description}
* @版本: ${genInfo.version}
* @版权: ${genInfo.copyright}
* @作者: ${genInfo.createUser}
* @日期: ${genInfo.createDate}
*/
@Slf4j
@RestController
@Tag(name = "${genInfo.description}" , description = "${module}")
#if(${isCloud}=="cloud")
#if(${module}=="form")
@RequestMapping("/${module}/${genInfo.className}")
#else
@RequestMapping("/${genInfo.className}")
#end
#else
#if(${module}=="form")
##添加流程表单模块名称
@RequestMapping("/api/workflow/${module}/${genInfo.className}")
#else
@RequestMapping("/api/${module}/${genInfo.className}")
#end
#end
public class ${table.controllerName} {
@Autowired
private GeneraterSwapUtil generaterSwapUtil;
@Autowired
private UserProvider userProvider;
@Autowired
private ${table.serviceName} ${serviceName};
#foreach($tableModel in ${childTableHandle})
@Autowired
private ${tableModel.aliasUpName}Service ${tableModel.aliasLowName}Service;
#end
#foreach($cl in ${columnTableHandle})
@Autowired
private ${cl.modelUpName}Service ${cl.modelLowName}Service;
#end
#if(${serverHasUpload} || ${serverHasDownload})
@Autowired
private ConfigValueUtil configValueUtil;
#if(${isCloud}=="cloud")
@Autowired
private FileUploadApi fileUploadApi;
@Autowired
private FileApi fileApi;
#end
#end
##表头按钮接口
#if(!${isList})## 纯表单方法
#CreateMethod()
#UpdateMethod()
#DeleteMethod()
#else## 列表方法
## 获取列表信息
#GetList()
## 表头按键接口
#foreach($btn in ${btnsList})
#if(${btn.value}=='add' && ${btn.show})
#CreateMethod(${table.comment})
#end
#if(${btn.value}=='upload' && ${btn.show})
#UploaderMethod()
#end
#if(${btn.value}=='download' && ${btn.show})
#ExportMethod()
#end
#if(${btn.value}=='batchRemove' && ${btn.show})
#end
#if(${btn.value}=='batchPrint' && ${btn.show})
#BatchPrintMethod()
#end
#end
## 删除全部走批量删除方法。(必生成)
#DeleteMethod()
#BatchRemoveMethod()
## 行内按钮接口
#foreach($column in ${columnBtnsList})
#if(${column.value}=='detail' && ${column.show} && ${isList})
#GetDetailMethod()
#end
#if(${column.value}=='remove' && ${column.show} && ${isList})
## #DeleteMethod()
#end
#if(${column.value}=='edit' && ${column.show} && ${isList})
#UpdateMethod(${table.comment})
#end
#end
#end
## 获取数据接口(不转换数据)
#GetInfoMethod()
}

View File

@@ -0,0 +1,92 @@
package ${package.Entity};
import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import java.util.Date;
import java.util.List;
import com.alibaba.fastjson.annotation.JSONField;
#foreach($field in ${table.fields})
#if(${field.propertyType} =='BigDecimal')
import java.math.BigDecimal;
#elseif(${field.propertyType} == 'BigInteger')
import java.math.BigInteger;
#elseif(${field.propertyType} == 'LocalTime')
import java.sql.Time;
#end
#end
/**
* ${table.comment}
*
* @版本: ${genInfo.version}
* @版权: ${genInfo.copyright}
* @作者: ${genInfo.createUser}
* @日期: ${genInfo.createDate}
*/
@Data
#if(${table.convert})
@TableName("${table.name}")
#end
#if(${activeRecord})
public class ${table.entity} extends Model<${table.entity}> {
#else
public class ${table.entityName} {
#end
#foreach($field in ${table.fields})
#set($tableField = "${field.name}")
#set($Property = "${field.propertyName}")
#if('f_tenant_id'==${tableField} || 'F_TENANT_ID'==${tableField})
@TableField(value = "${tableField}",fill = FieldFill.INSERT_UPDATE)
#elseif(${field.keyFlag}=='true')
@TableId(value ="${tableField}" #if(${field.keyIdentityFlag}),type = IdType.AUTO #end)
#else
#if(${tableNotSystemField.contains(${Property.toUpperCase()})})
@TableField(value = "${tableField}" , updateStrategy = FieldStrategy.IGNORED)
#else
@TableField("${tableField}")
#end
#end
#if('f_version'==${tableField.toLowerCase()})
@Version
@JSONField(name = "f_version")
#else
@JSONField(name = "${tableField}")
#end
#if(${field.propertyType} =='LocalDateTime' || ${field.propertyType} =='datePicker' || ${field.propertyType} =='LocalDate')
private Date ${Property};
#elseif(${field.propertyType} =='Clob')
private String ${Property};
#elseif(${field.propertyType} == 'LocalTime')
private Time ${Property};
#elseif(${field.type} =='datetime')
private Date ${Property};
#elseif(${field.type} =='datetime')
private Date ${Property};
#else
## 删除标记和版本字段强制int
#if(${tableField.toLowerCase()} =='f_version' || ${tableField.toLowerCase()} =='f_delete_mark')
private Integer ${Property};
#else
private ${field.propertyType} ${Property};
#end
#end
#end
#if(${main})
#foreach($item in $allTableNameList)
#set($TableEntity = "${item.table.substring(0,1).toUpperCase()}${item.table.substring(1)}")
#set($tableEntity = "${item.table.substring(0,1).toLowerCase()}${item.table.substring(1)}")
## 副表一对一
#if(${item.tableTag} =='sub-yunzhupaas')
@JSONField(name = "${tableEntity}")
@TableField(exist = false)
private ${TableEntity}Entity $tableEntity;
#end
## 子表一对多
#if(${item.tableTag} =='sub')
@JSONField(name = "${tableEntity}")
@TableField(exist = false)
private List<${TableEntity}Entity> $tableEntity;
#end
#end
#end
}

View File

@@ -0,0 +1,26 @@
#set($name = "${context.className.substring(0,1).toLowerCase()}${context.className.substring(1)}")
#set($pKeyName =${context.pKeyName})
#set($peimaryKeyName = "${pKeyName.substring(0,1).toUpperCase()}${pKeyName.substring(1)}")
#set($peimaryKeyname = "${pKeyName.substring(0,1).toLowerCase()}${pKeyName.substring(1)}")
package ${context.package}.model.$!{name.toLowerCase()};
import lombok.Data;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.alibaba.fastjson.annotation.JSONField;
/**
*
* ${context.genInfo.description}
* @版本: ${context.genInfo.version}
* @版权: ${context.genInfo.copyright}
* @作者: ${context.genInfo.createUser}
* @日期: ${context.genInfo.createDate}
*/
@Data
public class $!{context.className}ExcelErrorVO extends $!{context.className}ExcelVO{
@Excel(name = "异常原因",orderNum = "-999")
@JSONField(name = "errorsInfo")
private String errorsInfo;
}

View File

@@ -0,0 +1,79 @@
#parse("PublicMacro/ExcelMarco.vm")
##通用参数
#parse("PublicMacro/ConstantMarco.vm")
#ConstantParams()
#set($moduleName = "${context.genInfo.className.toLowerCase()}")
package ${context.package}.model.${moduleName};
import lombok.Data;
import java.sql.Time;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelEntity;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import java.math.BigDecimal;
import java.util.List;
/**
*
* ${context.genInfo.description}
* @版本: ${context.genInfo.version}
* @版权: ${context.genInfo.copyright}
* @作者: ${context.genInfo.createUser}
* @日期: ${context.genInfo.createDate}
*/
@Data
public class $!{context.className}ExcelVO{
#if(${context.isMain} && !${context.isComplexVo})
## 复杂表头对象
#foreach($item in ${context.complexHeaderList})
#if(${item.childColumns.size()}>0)
@JsonProperty("${item.id}")
@ExcelCollection(name="${item.fullName}(${item.id})",orderNum = "0")
private List<Complex${item.id}ExcelVO> ${item.id};
#end
#end
#foreach($fieLdsModel in ${context.importFields})
#set($html = $fieLdsModel)
#set($vModel = "${html.vModel}")
#set($config = $html.config)
#set($yunzhupaaskey = "${config.yunzhupaasKey}")
## 判断是否子表
#if(${vModel.toLowerCase().startsWith("tablefield")} )
@JsonProperty("${vModel}")
@ExcelCollection(name="${html.label}(${vModel})",orderNum = "${html.childList.size()}")
private List<${html.aliasUpName}ExcelVO> ${vModel};
#else
#if(!${context.complexFieldList.contains(${vModel})})
#CreateExcelFields($html,${foreach.index})
#end
#end
#end
#elseif(${context.isMain} && ${context.isComplexVo})
#foreach($fieLdsModel in ${context.importFields})
#set($html = $fieLdsModel)
#set($vModel = "${html.vModel}")
#set($config = $html.config)
#set($yunzhupaaskey = "${config.yunzhupaasKey}")
##复杂表头字段
#if(${context.complexList.contains(${vModel})} )
#CreateExcelFields($html,${foreach.index})
#end
#end
#else
#foreach($html in ${context.children.childList})
#set($fieLdsModel = ${html.fieLdsModel})
#set($config = ${fieLdsModel.config})
#set($yunzhupaaskey = ${config.yunzhupaasKey})
#set($vModel = "${fieLdsModel.vModel}")
#set($fieldName=${config.label})
#if($!vModel && ${fieLdsModel.needImport} && !$DownLoadSkipUint.contains($yunzhupaaskey))
#CreateExcelFields($fieLdsModel,${foreach.index})
#end
#end
#end
}

View File

@@ -0,0 +1,98 @@
##通用参数
#parse("PublicMacro/ConstantMarco.vm")
#ConstantParams()
#set($modelPath = "model."+${context.modelPathName})
#set($pKeyName =${context.pKeyName})
#set($pKeyNameOriginal =${context.pKeyNameOriginal})
#set($peimaryKeyname = "${pKeyName.substring(0,1).toLowerCase()}${pKeyName.substring(1)}")
package ${context.package}.${modelPath};
import lombok.Data;
import java.util.*;
import java.math.BigDecimal;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.v3.oas.annotations.media.Schema;
/**
* ${context.genInfo.description}
* @版本: ${context.genInfo.version}
* @版权: ${context.genInfo.copyright}
* @作者: ${context.genInfo.createUser}
* @日期: ${context.genInfo.createDate}
*/
@Data
@Schema(description = "表单参数")
public class $!{context.className}Form {
/** 主键 */
@Schema(description = "主键")
@JSONField(name = "${pKeyNameOriginal}")
private String $!{peimaryKeyname};
#if(${context.version})
/** 乐观锁 **/
@Schema(description = "乐观锁")
@JsonProperty("f_version")
@JSONField(name = "f_version")
private Integer version;
#end
#if(${context.isFlow})
/** 流程id **/
@Schema(description = "流程id")
@JsonProperty("flowId")
@JSONField(name = "f_flow_id")
private String flowId;
/** 流程权限列表 **/
@JsonProperty("formOperates")
private List<Map<String,Object>> formOperates = new ArrayList<>();
#end
## 主副表字段
#foreach($item in ${context.form})
#if($item.yunzhupaasKey=='mast' || $item.yunzhupaasKey=='mastTable')
#set($html = $item.formColumnModel.fieLdsModel)
#set($vModel = "${html.vModel}")
#set($fieldAlias = "${html.fieldAlias}")
#if($item.yunzhupaasKey=='mastTable')
#set($html = $item.formMastTableModel.mastTable.fieLdsModel)
#set($vModel = "${item.formMastTableModel.vModel}")
#set($fieldAlias = "yunzhupaas_"+"${html.tableAlias}"+"_yunzhupaas_"+ "${html.fieldAlias}")
#end
#set($resultType = "String")
#if($vModel!='')
#set($config = $html.config)
#set($yunzhupaaskey = "${config.yunzhupaasKey}")
#set($fieldName=${config.label})
#if(${yunzhupaaskey}!='text' && ${yunzhupaaskey}!='divider')
#if(${yunzhupaaskey}=='inputNumber' || ${yunzhupaaskey}=='calculate')
#if(${fieLdsModel.formColumnModel.fieLdsModel.precision}==0)
#set($resultType = "Integer")
#else
#set($resultType = "BigDecimal")
#end
#elseif(${yunzhupaaskey}=='slider' || ${yunzhupaaskey} == 'rate')
#set($resultType = "BigDecimal")
#elseif(${yunzhupaaskey} == 'switch')
#set($resultType = "Integer")
#elseif(${multipleUnit.contains(${yunzhupaaskey})} || ${UploadFileUnit.contains(${yunzhupaaskey})})
#set($resultType = "Object")
#else
#set($resultType = "String")
#end
/** ${fieldName} **/
@Schema(description = "${fieldName}")
@JsonProperty("${vModel}")
@JSONField(name = "${vModel}")
private ${resultType} ${fieldAlias};
#end
#end
#end
#end
#foreach($html in ${context.children})
/** 子表数据 **/
@Schema(description = "${html.aliasLowName}子表数据")
@JsonProperty("${html.aliasLowName}List")
private List<${html.aliasUpName}Model> ${html.aliasLowName}List;
#end
}

View File

@@ -0,0 +1,17 @@
package ${package.Mapper};
import ${package.Entity}.${table.entityName};
import ${superMapperClassPackage};
import com.yunzhupaas.base.mapper.SuperMapper;
/**
* ${genInfo.description}
* 版本: ${genInfo.version}
* 版权: ${genInfo.copyright}
* 作者: ${genInfo.createUser}
* 日期: ${genInfo.createDate}
*/
public interface ${table.mapperName} extends SuperMapper<${table.entityName}> {
}

View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="${package.Mapper}.${table.mapperName}">
</mapper>

View File

@@ -0,0 +1,83 @@
#parse("PublicMacro/ConstantMarco.vm")
#ConstantParams()
#set($moduleName = "${context.genInfo.className.toLowerCase()}")
#if($context.isForm)
#set($package = "package ${context.package}.${context.isForm}.model.${moduleName};")
#else
#set($package = "package ${context.package}.model.${moduleName};")
#end
${package}
import lombok.Data;
import java.util.List;
import java.util.Date;
import java.math.BigDecimal;
import com.alibaba.fastjson.annotation.JSONField;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
/**
*
* ${context.genInfo.description}
* 版本: ${context.genInfo.version}
* 版权: ${context.genInfo.copyright}
* 作者: ${context.genInfo.createUser}
* 日期: ${context.genInfo.createDate}
*/
@Data
@Schema(description = "${context.className}子表参数")
public class ${context.className}Model {
#if($!{context.thisKeyFields})
#set($keyField =${context.thisKeyFields.field})
/** 子表:${context.className} 主键:${keyField} **/
@Schema(description = "主键")
@JsonProperty("${keyField}")
#if(${context.thisKeyFields.dataType} =="int")
private Integer ${keyField};
#elseif(${context.thisKeyFields.dataType} == "bigint")
private Long ${keyField};
#else
private String ${keyField};
#end
#end
#foreach($html in ${context.children.childList})
#set($fieLdsModel = ${html.fieLdsModel})
#set($config = ${fieLdsModel.config})
#set($yunzhupaaskey = ${config.yunzhupaasKey})
#set($vModel = "${fieLdsModel.vModel}")
#set($fieldName=${config.label})
#set($fieldAlias="${fieLdsModel.fieldAlias}")
#if($vModel)
#if(${yunzhupaaskey}=='datePicker')
#set($resultType="Long")
#elseif(${yunzhupaaskey}=='inputNumber' || ${yunzhupaaskey}=='calculate')
#if(${fieLdsModel.precision}==0)
#set($resultType="Integer")
#else
#set($resultType="BigDecimal")
#end
#elseif(${yunzhupaaskey}=='slider'|| ${yunzhupaaskey}=='rate')
#set($resultType="BigDecimal")
#elseif(${yunzhupaaskey}=='relationFormAttr'|| ${yunzhupaaskey}=='popupAttr' ||${yunzhupaaskey}=='relationForm' )
#set($resultType="String")
#elseif(${multipleUnit.contains($yunzhupaaskey)} || ${UploadFileUnit.contains(${yunzhupaaskey})})
#set($resultType="Object")
#else
#set($resultType="String")
#end
/** ${fieldName} **/
@Schema(description = "${fieldName}")
#if($fieLdsModel.needImport)
@Excel(name = "${fieldName}",orderNum = "1",isImportField = "true")
#end
@JsonProperty("${vModel}")
@JSONField(name = "${vModel}")
private ${resultType} ${fieldAlias};
#if(${yunzhupaaskey}=='relationForm')
private String ${vModel}_id;
#end
#end
#end
}

View File

@@ -0,0 +1,77 @@
#set($name = "${context.className.substring(0,1).toUpperCase()}${context.className.substring(1)}")
package ${context.package}.model.$!{name.toLowerCase()};
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import com.yunzhupaas.base.Pagination;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
/**
*
* ${context.genInfo.description}
* @版本: ${context.genInfo.version}
* @版权: ${context.genInfo.copyright}
* @作者: ${context.genInfo.createUser}
* @日期: ${context.genInfo.createDate}
*/
@Data
@Schema(description = "列表查询参数")
public class $!{name}Pagination extends Pagination {
#if($!{context.isFlow})
/** 流程模板id */
@Schema(description = "流程模板id")
private String flowId;
#end
/** 关键词搜索 */
@Schema(description = "关键词搜索")
private String yunzhupaasKeyword;
/** 查询key */
@Schema(description = "查询key")
private String[] selectKey;
/** 选中数据数组id */
@Schema(description = "选中数据数组id")
private Object[] selectIds;
/** json */
@Schema(description = "json")
private String json;
/** 数据类型 0-当前页1-全部数据 */
@Schema(description = "数据类型 0-当前页1-全部数据")
private String dataType;
/** 高级查询 */
@Schema(description = "高级查询")
private String superQueryJson;
/** 功能id */
@Schema(description = "功能id")
private String moduleId;
/** 菜单id */
@Schema(description = "菜单id")
private String menuId;
#foreach($search in ${context.searchListAll})
#set($jsonKey =${search.id})
#set($label = ${search.label})
#set($fieldAliasName = "${search.afterVModel}")
#set($tableAliasName = "${search.tableAliasName}")
#if($jsonKey.contains("_yunzhupaas_"))
#set($fieldAliasName = "yunzhupaas_${tableAliasName}_yunzhupaas_${fieldAliasName}")
#elseif($jsonKey.toLowerCase().startsWith("tablefield"))
#set($fieldAliasName = "${search.tableAliasName}_${fieldAliasName}")
#end
/** ${label} */
@Schema(description = "${label}")
@JsonProperty("$jsonKey")
@JSONField(name = "${fieldAliasName}")
private Object ${fieldAliasName};
#end
#if(${context.treeTable} == true)
/**
* 树形异步父级字段传值
*/
private String treeParentValue;
/**
* 是否有参数
*/
private boolean hasParam=false;
#end
}

View File

@@ -0,0 +1,43 @@
package ${package.Service};
#set($moduleName = "${mainModelName.substring(0,1).toLowerCase()}${mainModelName.substring(1).toLowerCase()}")
import ${package.Entity}.*;
import com.yunzhupaas.base.service.SuperService;
#if(${main})
import ${modulePackageName}.model.${moduleName}.*;
import java.util.*;
#end
/**
* ${genInfo.description}
* 版本: ${genInfo.version}
* 版权: ${genInfo.copyright}
* 作者: ${genInfo.createUser}
* 日期: ${genInfo.createDate}
*/
public interface ${table.serviceName} extends SuperService<${table.entityName}> {
#if(${main})
#if(${pKeyName.toLowerCase().startsWith('f_')})
#set($peimaryKeyname = "${pKeyName.substring(2,3).toLowerCase()}${pKeyName.substring(3)}")
#else
#set($peimaryKeyname = "${pKeyName.substring(0,1).toLowerCase()}${pKeyName.substring(1).toLowerCase()}")
#end
#if($isList)
List<${table.entityName}> getList(${Name}Pagination ${name}Pagination);
List<${table.entityName}> getTypeList(${Name}Pagination ${name}Pagination,String dataType);
#end
${table.entityName} getInfo(String ${peimaryKeyname});
void delete(${table.entityName} entity);
void create(${table.entityName} entity);
boolean update(String ${peimaryKeyname}, ${table.entityName} entity);
String checkForm(${Name}Form form,int i);
void saveOrUpdate(${Name}Form ${name}Form,String id, boolean isSave) throws Exception;
#end
}

View File

@@ -0,0 +1,109 @@
#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 com.yunzhupaas.base.service.SuperServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import com.yunzhupaas.util.GeneraterSwapUtil;
import java.sql.Connection;
import java.sql.SQLException;
import lombok.Cleanup;
import com.yunzhupaas.database.plugins.DynamicSourceGeneratorInterface;
import com.yunzhupaas.database.util.DynamicDataSourceUtil;
import org.apache.commons.collections4.CollectionUtils;
import com.yunzhupaas.i18n.util.I18nUtil;
import com.yunzhupaas.exception.DataException;
import com.yunzhupaas.constant.MsgCode;
#if(${DS})
import com.baomidou.dynamic.datasource.annotation.DS;
import com.yunzhupaas.database.util.DataSourceUtil;
import com.yunzhupaas.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 com.yunzhupaas.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 com.yunzhupaas.model.QueryAllModel;
import java.text.SimpleDateFormat;
import com.yunzhupaas.util.*;
import java.util.*;
import com.yunzhupaas.base.UserInfo;
import com.yunzhupaas.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
}