Wizzercn / NutzWk

WK系列开发框架-V1至V5 Java开源企业级开发框架(单应用/微服务/分布式)
https://budwk.com
Apache License 2.0
1.62k stars 637 forks source link

代码生成器生成controller时遇到数字型主键的问题 #100

Closed cranehe closed 6 years ago

cranehe commented 6 years ago

代码生成器生成controller时遇到数字型主键,使用的代码模板没有考虑这种情况

文件位置:wk-code/wk-code-generator/src/main/resources/templet/controller.vm

@At("/detail/?")
    @Ok("beetl:/${table.ViewBasePath}/detail.html")
    @RequiresPermissions("${table.Permissions}")
    public void detail(${table.pkType} id, HttpServletRequest req) {
        if (!Strings.isBlank(id)) {
            req.setAttribute("obj", ${table.ServiceInstanceName}.fetch(id));
        }else{
            req.setAttribute("obj", null);
        }
    }
Wizzercn commented 6 years ago

好吧好吧,改了……