All Downloads are FREE. Search and download functionalities are using the official Maven repository.

templates.generator.Controller.vm Maven / Gradle / Ivy

There is a newer version: 2.0.5
Show newest version
package ${package}.${moduleName}.controller;

import com.github.hdy.common.result.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import ${package}.${moduleName}.entity.${className};
import ${package}.${moduleName}.service.${className}Service;

/**
 * ${comments}
 *
 * @author ${author}
 * @date ${datetime}
 */
@Controller
@RequestMapping("/${pathName}")
public class ${className}Controller {

    @Autowired
    private ${className}Service ${classname}Service;

    /**
     * 简单分页查询
     * @param pageNumber 页码
     * @param pageSize   每页显示的条数
     * @return Results
     */
    @RequestMapping("/page")
    @ResponseBody
    public Results page(${className} ${classname}, Integer pageNumber, Integer pageSize) {
        return ${classname}Service.page(${classname}, pageNumber, pageSize);
    }

    /**
     * 新增记录
     * @param ${classname}
     * @return Results
     */
    @RequestMapping("/insert")
    @ResponseBody
    public Results insert(${className} ${classname}) {
        return ${classname}Service.insert(${classname});
    }

    /**
     * 修改记录
     * @param ${classname}
     * @return Results
     */
    @RequestMapping("update")
    @ResponseBody
    public Results update(${className} ${classname}) {
        return ${classname}Service.update(${classname});
    }

    /**
     * 通过id删除一条记录
     * @param ${classname}
     * @return Results
     */
    @RequestMapping("/delete")
    @ResponseBody
    public Results delete(${className} ${classname}) {
        return ${classname}Service.delete(${classname});
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy