parent
18b6dfa068
commit
13f37ce0cc
@ -0,0 +1,63 @@
|
|||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import javax.validation.*;
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ${class.description} Controller
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/${class.classNameLowerUnderscore}")
|
||||||
|
@Api(tags = "${class.description}")
|
||||||
|
@Validated
|
||||||
|
public class ${class.className}Controller {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ${class.className}Service ${class.classNameVar}Service;
|
||||||
|
|
||||||
|
@PostMapping("/create")
|
||||||
|
@ApiOperation("创建${class.description}")
|
||||||
|
public CommonResult<Integer> create${class.className}(@Valid ${class.className}CreateReqVO createVO) {
|
||||||
|
return success(${class.classNameVar}Service.create${class.className}(createVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/update")
|
||||||
|
@ApiOperation("更新${class.description}")
|
||||||
|
public CommonResult<Boolean> update${class.className}(@Valid ${class.className}UpdateReqVO updateVO) {
|
||||||
|
${class.classNameVar}Service.update${class.className}(updateVO);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/delete")
|
||||||
|
@ApiOperation("删除${class.description}")
|
||||||
|
@ApiImplicitParam(name = "${class.classNameVar}Id", value = "${class.description}编号", required = true)
|
||||||
|
public CommonResult<Boolean> delete${class.className}(@RequestParam("${class.classNameVar}Id") Integer ${class.classNameVar}Id) {
|
||||||
|
${class.classNameVar}Service.delete${class.className}(${class.classNameVar}Id);
|
||||||
|
return success(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/get")
|
||||||
|
@ApiOperation("获得${class.description}")
|
||||||
|
@ApiImplicitParam(name = "${class.classNameVar}Id", value = "${class.description}编号", required = true)
|
||||||
|
public CommonResult<${class.className}RespVO> get${class.className}(@RequestParam("${class.classNameVar}Id") Integer ${class.classNameVar}Id) {
|
||||||
|
return success(${class.classNameVar}Service.get${class.className}(${class.classNameVar}Id));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation("获得${class.description}列表")
|
||||||
|
@ApiImplicitParam(name = "${class.classNameVar}Ids", value = "${class.description}编号列表", required = true)
|
||||||
|
public CommonResult<List<${class.className}RespVO>> list${class.className}s(@RequestParam("${class.classNameVar}Ids") List<Integer> ${class.classNameVar}Ids) {
|
||||||
|
return success(${class.classNameVar}Service.list${class.className}s(${class.classNameVar}Ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation("获得${class.description}分页")
|
||||||
|
public CommonResult<PageResult<${class.className}RespVO>> page${class.className}(${class.className}PageReqVO pageVO) {
|
||||||
|
return success(${class.classNameVar}Service.page${class.className}(pageVO));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,43 @@
|
|||||||
|
package ${basePackage}.${table.moduleName}.controller.${table.businessName}.vo;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
import java.util.*;
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
import io.swagger.annotations.*;
|
||||||
|
import ${pageParamClassName};
|
||||||
|
|
||||||
|
@ApiModel("${table.classComment}分页 Request VO")
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@ToString(callSuper = true)
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ${table.className}PageReqVO extends PageParam {
|
||||||
|
|
||||||
|
#foreach ($column in $columns)
|
||||||
|
#set ($JavaField = $column.javaField.substring(0,1).toUpperCase() + ${column.javaField.substring(1)})##首字母大写
|
||||||
|
#if (${column.listOperation})##查询操作
|
||||||
|
#if (${column.listOperationCondition} == "BETWEEN")## Between 的时候
|
||||||
|
@ApiModelProperty(value = "开始${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||||
|
#if (${column.javaType} == "Date")## 时间类型
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
#end
|
||||||
|
private ${column.javaType} begin${JavaField};
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "结束${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||||
|
#if (${column.javaType} == "Date")## 时间类型
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
#end
|
||||||
|
private ${column.javaType} end${JavaField};
|
||||||
|
#else
|
||||||
|
#if (${column.javaType} == "Date")## 时间类型
|
||||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||||
|
#end
|
||||||
|
@ApiModelProperty(value = "${column.columnComment}"#if ("$!column.example" != ""), example = "${column.example}"#end)
|
||||||
|
private ${column.javaType} ${column.javaField};
|
||||||
|
#end
|
||||||
|
|
||||||
|
#end
|
||||||
|
#end
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue