mirror of https://gitee.com/makejava/EasyCode.git
优化模板
This commit is contained in:
parent
858981ca3b
commit
7b6c35b32e
|
@ -11,7 +11,7 @@
|
|||
#elseif($tool.newHashSet("java.lang.Integer", "int", "java.lang.Short", "short").contains($column.type))
|
||||
#set($jdbcType="INTEGER")
|
||||
#elseif($tool.newHashSet("java.lang.Long", "long").contains($column.type))
|
||||
#set($jdbcType="LONG INTEGER")
|
||||
#set($jdbcType="INTEGER")
|
||||
#elseif($tool.newHashSet("java.lang.Float", "float", "java.lang.Double", "double").contains($column.type))
|
||||
#set($jdbcType="NUMERIC")
|
||||
#elseif($tool.newHashSet("java.util.Date", "java.sql.Timestamp", "java.time.Instant", "java.time.LocalDateTime", "java.time.OffsetDateTime", " java.time.ZonedDateTime").contains($column.type))
|
||||
|
|
|
@ -16,7 +16,9 @@ import java.io.Serializable;
|
|||
public class $!{tableInfo.name} implements Serializable {
|
||||
private static final long serialVersionUID = $!tool.serial();
|
||||
#foreach($column in $tableInfo.fullColumn)
|
||||
#if(${column.comment})//${column.comment}#end
|
||||
#if(${column.comment})/**
|
||||
* ${column.comment}
|
||||
*/#end
|
||||
|
||||
private $!{tool.getClsNameByFullName($column.type)} $!{column.name};
|
||||
#end
|
||||
|
|
|
@ -18,7 +18,7 @@ $!define
|
|||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiController;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiResult;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import $!{tableInfo.savePackageName}.entity.$!tableInfo.name;
|
||||
import $!{tableInfo.savePackageName}.service.$!{tableInfo.name}Service;
|
||||
|
@ -47,7 +47,7 @@ public class $!{tableName} extends ApiController {
|
|||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping
|
||||
public ApiResult selectAll(Page<$!tableInfo.name> page, $!tableInfo.name $!entityName) {
|
||||
public R selectAll(Page<$!tableInfo.name> page, $!tableInfo.name $!entityName) {
|
||||
return success(this.$!{serviceName}.page(page, new QueryWrapper<>($!entityName)));
|
||||
}
|
||||
|
||||
|
@ -58,7 +58,7 @@ public class $!{tableName} extends ApiController {
|
|||
* @return 单条数据
|
||||
*/
|
||||
@GetMapping("{id}")
|
||||
public ApiResult selectOne(@PathVariable Serializable id) {
|
||||
public R selectOne(@PathVariable Serializable id) {
|
||||
return success(this.$!{serviceName}.getById(id));
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ public class $!{tableName} extends ApiController {
|
|||
* @return 新增结果
|
||||
*/
|
||||
@PostMapping
|
||||
public ApiResult insert(@RequestBody $!tableInfo.name $!entityName) {
|
||||
public R insert(@RequestBody $!tableInfo.name $!entityName) {
|
||||
return success(this.$!{serviceName}.save($!entityName));
|
||||
}
|
||||
|
||||
|
@ -80,7 +80,7 @@ public class $!{tableName} extends ApiController {
|
|||
* @return 修改结果
|
||||
*/
|
||||
@PutMapping
|
||||
public ApiResult update(@RequestBody $!tableInfo.name $!entityName) {
|
||||
public R update(@RequestBody $!tableInfo.name $!entityName) {
|
||||
return success(this.$!{serviceName}.updateById($!entityName));
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class $!{tableName} extends ApiController {
|
|||
* @return 删除结果
|
||||
*/
|
||||
@DeleteMapping
|
||||
public ApiResult delete(@RequestParam("idList") List<Long> idList) {
|
||||
public R delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.$!{serviceName}.removeByIds(idList));
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue