初始代码
This commit is contained in:
203
TemplateCodeVue3/java/Controller.java.vm
Normal file
203
TemplateCodeVue3/java/Controller.java.vm
Normal 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()
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user