Skip to content

Commit 6aa56cb

Browse files
committed
refactor: 修改高级版代码生成器模板
1 parent 4b0d9b5 commit 6aa56cb

File tree

1 file changed

+4
-9
lines changed

1 file changed

+4
-9
lines changed

src/test/resources/mpg/templates/premium/controller.java.ftl

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,24 @@ import io.github.talelin.core.annotation.LoginRequired;
77
</#if>
88
import io.github.talelin.latticy.common.mybatis.Page;
99
import io.github.talelin.latticy.common.util.PageUtil;
10+
import io.github.talelin.latticy.dto.query.BasePageDTO;
1011
import ${package.Service}.${table.serviceName};
1112
import org.springframework.beans.BeanUtils;
1213
import org.springframework.beans.factory.annotation.Autowired;
14+
import org.springframework.validation.annotation.Validated;
1315
import org.springframework.web.bind.annotation.PostMapping;
1416
import org.springframework.web.bind.annotation.PutMapping;
1517
import org.springframework.web.bind.annotation.DeleteMapping;
1618
import org.springframework.web.bind.annotation.GetMapping;
1719
import org.springframework.web.bind.annotation.RequestMapping;
1820
import org.springframework.web.bind.annotation.PathVariable;
19-
import org.springframework.web.bind.annotation.RequestParam;
2021
import org.springframework.web.bind.annotation.RequestBody;
2122
import ${package.Entity}.${entity};
2223
import io.github.talelin.latticy.vo.CreatedVO;
2324
import io.github.talelin.latticy.vo.DeletedVO;
2425
import io.github.talelin.latticy.vo.PageResponseVO;
2526
import io.github.talelin.latticy.vo.UpdatedVO;
2627

27-
import javax.validation.constraints.Min;
28-
import javax.validation.constraints.Max;
2928
import javax.validation.constraints.Positive;
3029

3130
<#if restControllerStyle>
@@ -116,13 +115,9 @@ public class ${table.controllerName} {
116115
@LoginRequired
117116
</#if>
118117
public PageResponseVO<${entity}> page(
119-
@RequestParam(name = "page", required = false, defaultValue = "0")
120-
@Min(value = 0, message = "{page.number.min}") Integer page,
121-
@RequestParam(name = "count", required = false, defaultValue = "10")
122-
@Min(value = 1, message = "{page.count.min}")
123-
@Max(value = 30, message = "{page.count.max}") Integer count
118+
@Validated BasePageDTO dto
124119
) {
125-
return PageUtil.build(${table.serviceName?uncap_first}.page(new Page<>(page, count), null));
120+
return PageUtil.build(${table.serviceName?uncap_first}.page(new Page<>(dto.getPage(), dto.getCount()), null));
126121
}
127122

128123
}

0 commit comments

Comments
 (0)