代码生成器调整
This commit is contained in:
parent
e89f22cd8c
commit
c622781003
|
|
@ -29,7 +29,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(Exception.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleException(Exception e) {
|
||||
public AjaxResult<Object> handleException(Exception e) {
|
||||
if (GlobalConfig.debug) {
|
||||
e.printStackTrace();
|
||||
System.out.println(e.getMessage());
|
||||
|
|
@ -44,7 +44,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(BaseException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleException(BaseException e) {
|
||||
public AjaxResult<Object> handleException(BaseException e) {
|
||||
int code = e.getCode();
|
||||
String msg = e.getMsg();
|
||||
return AjaxResult.failed(code, msg);
|
||||
|
|
@ -56,7 +56,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(BindException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleBindException(BindException e) {
|
||||
public AjaxResult<Object> handleBindException(BindException e) {
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
Integer code = HttpEnum.PARAMS_VALID_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage();
|
||||
|
|
@ -69,7 +69,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MissingServletRequestParameterException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handlePathException(MissingServletRequestParameterException e) {
|
||||
public AjaxResult<Object> handlePathException(MissingServletRequestParameterException e) {
|
||||
Integer code = HttpEnum.PARAMS_VALID_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(e.getMessage());
|
||||
return AjaxResult.failed(code, msg);
|
||||
|
|
@ -81,7 +81,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MethodArgumentNotValidException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
public AjaxResult<Object> handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
|
||||
BindingResult bindingResult = e.getBindingResult();
|
||||
Integer code = HttpEnum.PARAMS_VALID_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(bindingResult.getFieldError()).getDefaultMessage();
|
||||
|
|
@ -94,7 +94,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(HttpMessageNotReadableException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {
|
||||
public AjaxResult<Object> handleHttpMessageNotReadableException(HttpMessageNotReadableException e) {
|
||||
Integer code = HttpEnum.PARAMS_TYPE_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(e.getMessage());
|
||||
return AjaxResult.failed(code, msg.split(";")[0]);
|
||||
|
|
@ -106,7 +106,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(HttpRequestMethodNotSupportedException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleRequestMethodException(HttpRequestMethodNotSupportedException e) {
|
||||
public AjaxResult<Object> handleRequestMethodException(HttpRequestMethodNotSupportedException e) {
|
||||
Integer code = HttpEnum.REQUEST_METHOD_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(e.getMessage());
|
||||
return AjaxResult.failed(code, msg);
|
||||
|
|
@ -118,7 +118,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(IllegalArgumentException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleIllegalArgumentException(IllegalArgumentException e) {
|
||||
public AjaxResult<Object> handleIllegalArgumentException(IllegalArgumentException e) {
|
||||
Integer code = HttpEnum.ASSERT_ARGUMENT_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(e.getMessage());
|
||||
return AjaxResult.failed(code, msg);
|
||||
|
|
@ -130,7 +130,7 @@ public class GlobalException {
|
|||
@ResponseStatus(HttpStatus.OK)
|
||||
@ExceptionHandler(MybatisPlusException.class)
|
||||
@ResponseBody
|
||||
public AjaxResult handleMybatisPlusException(MybatisPlusException e) {
|
||||
public AjaxResult<Object> handleMybatisPlusException(MybatisPlusException e) {
|
||||
Integer code = HttpEnum.ASSERT_MYBATIS_ERROR.getCode();
|
||||
String msg = Objects.requireNonNull(e.getMessage());
|
||||
return AjaxResult.failed(code, msg);
|
||||
|
|
|
|||
|
|
@ -375,7 +375,6 @@ public class GenerateServiceImpl implements IGenerateService {
|
|||
Template tpl = Velocity.getTemplate(template, GenConstants.UTF8);
|
||||
tpl.merge(context, sw);
|
||||
map.put(template.replace(".vm", ""), sw.toString());
|
||||
System.out.println(sw);
|
||||
}
|
||||
|
||||
return map;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ public class GenUtil {
|
|||
* @param table 表
|
||||
*/
|
||||
public static void initColumn(GenTableColumn column, GenTable table) {
|
||||
column.setTableId(table.getId());
|
||||
String columnName = column.getColumnName();
|
||||
String columnType = GenUtil.getDbType(column.getColumnType());
|
||||
column.setTableId(table.getId());
|
||||
column.setColumnLength(GenUtil.getColumnLength(column.getColumnType()));
|
||||
column.setJavaField(StringUtil.toCamelCase(columnName));
|
||||
column.setJavaType(JavaConstants.TYPE_STRING);
|
||||
|
|
@ -66,6 +66,7 @@ public class GenUtil {
|
|||
|
||||
// 日期字段
|
||||
else if (GenUtil.isArraysContains(SqlConstants.COLUMN_TYPE_TIME, columnType)) {
|
||||
|
||||
column.setJavaType(JavaConstants.TYPE_DATE);
|
||||
column.setHtmlType(HtmlConstants.HTML_DATETIME);
|
||||
}
|
||||
|
|
@ -241,6 +242,9 @@ public class GenUtil {
|
|||
* @return 截取后的列类型
|
||||
*/
|
||||
public static String getColumnLength(String columnType) {
|
||||
if (columnType.equals("")) {
|
||||
return "0";
|
||||
}
|
||||
if (StringUtil.indexOf(columnType, "(") > 0) {
|
||||
return StringUtil.substringBetween(columnType, "(", ")");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,12 +115,14 @@ public class VelocityUtil {
|
|||
public static List<String> getTemplateList(String genTpl, List<GenTableColumn> columns) {
|
||||
List<String> templates = new LinkedList<>();
|
||||
templates.add("java/controller.java.vm");
|
||||
templates.add("java/entity.java.vm");
|
||||
templates.add("java/mapper.java.vm");
|
||||
templates.add("java/service.java.vm");
|
||||
templates.add("java/serviceImpl.java.vm");
|
||||
templates.add("java/validate.java.vm");
|
||||
templates.add("java/voList.java.vm");
|
||||
templates.add("java/entity.java.vm");
|
||||
templates.add("java/mapper.java.vm");
|
||||
templates.add("java/validateCreate.java.vm");
|
||||
templates.add("java/validateUpdate.java.vm");
|
||||
templates.add("java/validateSearch.java.vm");
|
||||
templates.add("java/voListed.java.vm");
|
||||
templates.add("java/voDetail.java.vm");
|
||||
templates.add("vue/api.ts.vm");
|
||||
templates.add("vue/edit.vue.vm");
|
||||
|
|
@ -144,35 +146,35 @@ public class VelocityUtil {
|
|||
String moduleName = genTable.getModuleName();
|
||||
|
||||
if (template.contains("mapper.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/mapper/{}/{}Mapper.java", GenConfig.commonPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/mapper/{}Mapper.java", GenConfig.commonPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("entity.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/entity/{}/{}.java", GenConfig.commonPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/entity/{}.java", GenConfig.commonPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("service.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/service/{}/I{}Service.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/service/I{}Service.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("serviceImpl.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/service/{}/impl/{}ServiceImpl.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/service/impl/{}ServiceImpl.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("controller.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/controller/{}/{}Controller.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/controller/{}Controller.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("validate.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/validate/{}/{}Param.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/validate/{}Param.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("voList.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/vo/{}/{}ListVo.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
else if (template.contains("voListed.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/vo/{}ListedVo.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("voDetail.java.vm")) {
|
||||
fileName = StringUtil.format("java/{}/vo/{}/{}DetailVo.java", GenConfig.adminPackage, moduleName, entityName);
|
||||
fileName = StringUtil.format("java/{}/vo/{}DetailVo.java", GenConfig.adminPackage, entityName);
|
||||
}
|
||||
|
||||
else if (template.contains("vue/api.ts.vm")) {
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
package ${packageName}.admin.controller.${moduleName};
|
||||
package ${packageName}.admin.controller;
|
||||
|
||||
#if(!$table.genTpl.equals("crud"))
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
#end
|
||||
import ${packageName}.admin.config.aop.Log;
|
||||
import ${packageName}.admin.service.${moduleName}.I${EntityName}Service;
|
||||
|
|
@ -16,6 +16,8 @@ import ${packageName}.common.core.AjaxResult;
|
|||
import ${packageName}.common.core.PageResult;
|
||||
#end
|
||||
import ${packageName}.common.validator.annotation.IDMust;
|
||||
import com.mdd.common.core.AjaxResult;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
|
@ -50,18 +52,19 @@ public class ${EntityName}Controller {
|
|||
*/
|
||||
#if($table.genTpl.equals("crud"))
|
||||
@GetMapping("/list")
|
||||
public Object list(@Validated PageParam pageParam,
|
||||
@RequestParam Map<String, String> params) {
|
||||
PageResult<${EntityName}ListVo> list = i${EntityName}Service.list(pageParam, params);
|
||||
public AjaxResult<PageResult<${EntityName}ListedVo>> list(@Validated PageParam pageParam,
|
||||
@RequestParam Map<String, String> params) {
|
||||
PageResult<${EntityName}ListedVo> list = i${EntityName}Service.list(pageParam, params);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
#else
|
||||
@GetMapping("/list")
|
||||
public Object list(@RequestParam Map<String, String> params) {
|
||||
public AjaxResult<JSONArray> list(@RequestParam Map<String, String> params) {
|
||||
JSONArray list = i${EntityName}Service.list(params);
|
||||
return AjaxResult.success(list);
|
||||
}
|
||||
#end
|
||||
|
||||
/**
|
||||
* ${functionName}详情
|
||||
*
|
||||
|
|
@ -69,10 +72,10 @@ public class ${EntityName}Controller {
|
|||
* @author ${authorName}
|
||||
#end
|
||||
* @param id 主键ID
|
||||
* @return Object
|
||||
* @return AjaxResult<${EntityName}DetailVo>
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
public Object detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
public AjaxResult<${EntityName}DetailVo> detail(@Validated @IDMust() @RequestParam("id") Integer id) {
|
||||
${EntityName}DetailVo detail = i${EntityName}Service.detail(id);
|
||||
return AjaxResult.success(detail);
|
||||
}
|
||||
|
|
@ -83,13 +86,13 @@ public class ${EntityName}Controller {
|
|||
#if(!$authorName.equals(""))
|
||||
* @author ${authorName}
|
||||
#end
|
||||
* @param ${entityName}Param 参数
|
||||
* @return Object
|
||||
* @param createValidate 参数
|
||||
* @return AjaxResult<Object>
|
||||
*/
|
||||
@Log(title = "${functionName}新增")
|
||||
@PostMapping("/add")
|
||||
public Object add(@Validated(value = ${EntityName}Param.create.class) @RequestBody ${EntityName}Param ${entityName}Param) {
|
||||
i${EntityName}Service.add(${entityName}Param);
|
||||
public AjaxResult<Object> add(@Validated @RequestBody ${EntityName}CreateValidate createValidate) {
|
||||
i${EntityName}Service.add(createValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
@ -99,13 +102,13 @@ public class ${EntityName}Controller {
|
|||
#if(!$authorName.equals(""))
|
||||
* @author ${authorName}
|
||||
#end
|
||||
* @param ${entityName}Param 参数
|
||||
* @return Object
|
||||
* @param updateValidate 参数
|
||||
* @return AjaxResult<Object>
|
||||
*/
|
||||
@Log(title = "${functionName}编辑")
|
||||
@PostMapping("/edit")
|
||||
public Object edit(@Validated(value = ${EntityName}Param.update.class) @RequestBody ${EntityName}Param ${entityName}Param) {
|
||||
i${EntityName}Service.edit(${entityName}Param);
|
||||
public AjaxResult<Object> edit(@Validated @RequestBody ${EntityName}UpdateValidate updateValidate) {
|
||||
i${EntityName}Service.edit(updateValidate);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
@ -115,14 +118,14 @@ public class ${EntityName}Controller {
|
|||
#if(!$authorName.equals(""))
|
||||
* @author ${authorName}
|
||||
#end
|
||||
* @param ${entityName}Param 参数
|
||||
* @return Object
|
||||
* @param idValidate 参数
|
||||
* @return AjaxResult<Object>
|
||||
*/
|
||||
@Log(title = "${functionName}删除")
|
||||
@PostMapping("/del")
|
||||
public Object del(@Validated(value = ${EntityName}Param.delete.class) @RequestBody ${EntityName}Param ${entityName}Param) {
|
||||
public AjaxResult<Object> del(@Validated @RequestBody IdValidate idValidate) {
|
||||
#set($AttrName=$primaryKey.substring(0,1).toUpperCase() + ${primaryKey.substring(1)})
|
||||
i${EntityName}Service.del(${entityName}Param.get${AttrName}());
|
||||
i${EntityName}Service.del(idValidate.getId());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.common.entity.${moduleName};
|
||||
package ${packageName}.common.entity;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.common.mapper.${moduleName};
|
||||
package ${packageName}.common.mapper;
|
||||
|
||||
import ${packageName}.common.core.basics.IBaseMapper;
|
||||
import ${packageName}.common.entity.${moduleName}.${EntityName};
|
||||
|
|
|
|||
|
|
@ -1,12 +1,13 @@
|
|||
package ${packageName}.admin.service.${moduleName};
|
||||
package ${packageName}.admin.service
|
||||
|
||||
#if(!$table.genTpl.equals("crud"))
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
#end
|
||||
import ${packageName}.admin.validate.common.PageParam;
|
||||
import ${packageName}.admin.validate.${moduleName}.${EntityName}Param;
|
||||
import ${packageName}.admin.vo.${moduleName}.${EntityName}ListVo;
|
||||
import ${packageName}.admin.vo.${moduleName}.${EntityName}DetailVo;
|
||||
import ${packageName}.admin.validate.${EntityName}CreateValidate;
|
||||
import ${packageName}.admin.validate.${EntityName}UpdateValidate;
|
||||
import ${packageName}.admin.vo.${EntityName}ListedVo;
|
||||
import ${packageName}.admin.vo.${EntityName}DetailVo;
|
||||
import ${packageName}.common.core.PageResult;
|
||||
|
||||
import java.util.Map;
|
||||
|
|
@ -29,9 +30,9 @@ public interface I${EntityName}Service {
|
|||
#end
|
||||
* @param pageParam 分页参数
|
||||
* @param params 搜索参数
|
||||
* @return PageResult<${EntityName}Vo>
|
||||
* @return PageResult<${EntityName}ListedVo>
|
||||
*/
|
||||
PageResult<${EntityName}ListVo> list(PageParam pageParam, Map<String, String> params);
|
||||
PageResult<${EntityName}ListedVo> list(PageParam pageParam, Map<String, String> params);
|
||||
#elseif($table.genTpl=="tree")
|
||||
/**
|
||||
* ${functionName}列表
|
||||
|
|
@ -62,9 +63,9 @@ public interface I${EntityName}Service {
|
|||
#if(!$authorName.equals(""))
|
||||
* @author ${authorName}
|
||||
#end
|
||||
* @param ${entityName}Param 参数
|
||||
* @param createValidate 参数
|
||||
*/
|
||||
void add(${EntityName}Param ${entityName}Param);
|
||||
void add(${EntityName}CreateValidate createValidate);
|
||||
|
||||
/**
|
||||
* ${functionName}编辑
|
||||
|
|
@ -72,9 +73,9 @@ public interface I${EntityName}Service {
|
|||
#if(!$authorName.equals(""))
|
||||
* @author ${authorName}
|
||||
#end
|
||||
* @param ${entityName}Param 参数
|
||||
* @param updateValidate 参数
|
||||
*/
|
||||
void edit(${EntityName}Param ${entityName}Param);
|
||||
void edit(${EntityName}UpdateValidate updateValidate);
|
||||
|
||||
/**
|
||||
* ${functionName}删除
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.admin.service.${moduleName}.impl;
|
||||
package ${packageName}.admin.service.impl;
|
||||
|
||||
#if(!$table.genTpl.equals("crud"))
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
|
|
@ -7,14 +7,15 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.yulichang.query.MPJQueryWrapper;
|
||||
import ${packageName}.admin.service.${moduleName}.I${EntityName}Service;
|
||||
import ${packageName}.admin.service.I${EntityName}Service;
|
||||
import ${packageName}.admin.validate.common.PageParam;
|
||||
import ${packageName}.admin.validate.${moduleName}.${EntityName}Param;
|
||||
import ${packageName}.admin.vo.${moduleName}.${EntityName}ListVo;
|
||||
import ${packageName}.admin.vo.${moduleName}.${EntityName}DetailVo;
|
||||
import ${packageName}.admin.validate.${EntityName}CreateValidate;
|
||||
import ${packageName}.admin.validate.${EntityName}UpdateValidate;
|
||||
import ${packageName}.admin.vo.${EntityName}ListedVo;
|
||||
import ${packageName}.admin.vo.${EntityName}DetailVo;
|
||||
import ${packageName}.common.core.PageResult;
|
||||
import ${packageName}.common.entity.${moduleName}.${EntityName};
|
||||
import ${packageName}.common.mapper.${moduleName}.${EntityName}Mapper;
|
||||
import ${packageName}.common.entity.${EntityName};
|
||||
import ${packageName}.common.mapper.${EntityName}Mapper;
|
||||
import ${packageName}.common.utils.ArrayUtil;
|
||||
import ${packageName}.common.utils.TimeUtil;
|
||||
import ${packageName}.common.utils.UrlUtil;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.admin.validate.${moduleName};
|
||||
package ${packageName}.admin.validate;
|
||||
|
||||
import ${packageName}.admin.validate.BaseParam;
|
||||
import ${packageName}.common.validator.annotation.IDMust;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,28 @@
|
|||
package ${packageName}.admin.validate;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}参数
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName}CreateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isInsert==1)
|
||||
#if($column.isRequired==1)
|
||||
@NotNull(message = "${column.javaField}参数缺失")
|
||||
#end
|
||||
private ${column.javaType} ${column.javaField};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package ${packageName}.admin.validate;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}参数
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName}SearchValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isQuery==1)
|
||||
private ${column.javaType} ${column.javaField};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package ${packageName}.admin.validate;
|
||||
|
||||
import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import javax.validation.constraints.*;
|
||||
import ${packageName}.common.validator.annotation.IDMust;
|
||||
|
||||
#set($isAuthor = !$authorName.equals(""))
|
||||
/**
|
||||
* ${functionName}参数
|
||||
#if($isAuthor)
|
||||
* @author ${authorName}
|
||||
#end
|
||||
*/
|
||||
@Data
|
||||
public class ${EntityName}UpdateValidate implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
#foreach ($column in $columns)
|
||||
#if($column.isEdit==1)
|
||||
#if($column.isRequired==1 && $column.isPk==0)
|
||||
@NotNull(message = "${column.javaField}参数缺失")
|
||||
#end
|
||||
#if($column.isPk==1)
|
||||
@IDMust(message = "${column.javaField}参数必传且需大于0")
|
||||
#end
|
||||
private ${column.javaType} ${column.javaField};
|
||||
|
||||
#end
|
||||
#end
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.admin.vo.${moduleName};
|
||||
package ${packageName}.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package ${packageName}.admin.vo.${moduleName};
|
||||
package ${packageName}.admin.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
Loading…
Reference in New Issue