Java高级架构师(一)第18节:X-gen所需service、web层模板
以X-gen的Controller为例:
package $#modulePackge#.web; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam; import $#modulePackge#.service.I$#moduleNameSuperCase#Service;
import $#modulePackge#.vo.$#moduleNameSuperCase#Model;
import $#modulePackge#.vo.$#moduleNameSuperCase#QueryModel;
import com.sishuok.pageutil.Page;
import com.sishuok.util.format.DateFormatHelper;
import com.sishuok.util.json.JsonHelper; @Controller
@RequestMapping(value="/$#moduleName#")
public class $#moduleNameSuperCase#Controller {
@Autowired
private I$#moduleNameSuperCase#Service iservice = null; @RequestMapping(value="toAdd",method=RequestMethod.GET)
public String toAdd(){ return "$#moduleName#/add";
}
@RequestMapping(value="add",method=RequestMethod.POST)
public String add(@ModelAttribute("m") $#moduleNameSuperCase#Model m){
iservice.create(m);
return "$#moduleName#/success";
}
@RequestMapping(value="toUpdate/{uuid}",method=RequestMethod.GET)
public String toUpdate(Model model,@PathVariable("uuid") int uuid){
$#moduleNameSuperCase#Model m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "$#moduleName#/update";
}
@RequestMapping(value="update",method=RequestMethod.POST)
public String post(@ModelAttribute("m") $#moduleNameSuperCase#Model m){
iservice.update(m);
return "$#moduleName#/success";
}
@RequestMapping(value="toDelete/{uuid}",method=RequestMethod.GET)
public String toDelete(Model model,@PathVariable("uuid") int uuid){
$#moduleNameSuperCase#Model m = iservice.getByUuid(uuid);
model.addAttribute("m", m);
return "$#moduleName#/delete";
}
@RequestMapping(value="delete",method=RequestMethod.POST)
public String post(@RequestParam("uuid") int uuid){
iservice.delete(uuid);
return "$#moduleName#/success";
}
@RequestMapping(value="toList",method=RequestMethod.GET)
public String toList(@ModelAttribute("wm")$#moduleNameSuperCase#WebModel wm,Model model){
$#moduleNameSuperCase#QueryModel qm = null;
if(wm.getQueryJsonStr()==null || wm.getQueryJsonStr().trim().length()==0){
qm = new $#moduleNameSuperCase#QueryModel();
}else{
String s = wm.getQueryJsonStr();
s = s.replace("-", "%");
qm = ($#moduleNameSuperCase#QueryModel)JsonHelper.str2Object(s, $#moduleNameSuperCase#QueryModel.class);
} qm.getPage().setNowPage(wm.getNowPage());
if(wm.getPageShow() > 0){
qm.getPage().setPageShow(wm.getPageShow());
} Page dbPage = iservice.getByConditionPage(qm); //
model.addAttribute("wm", wm);
model.addAttribute("page", dbPage); return "$#moduleName#/list";
}
@RequestMapping(value="toQuery",method=RequestMethod.GET)
public String toQuery(){
return "$#moduleName#/query";
}
}
Java高级架构师(一)第18节:X-gen所需service、web层模板的更多相关文章
- Java高级架构师(一)第01节:整体课程概览
本课程专注于构建:高可扩展性.高性能.大数据量.高并发.分布式的系统架构. 从零开始.全面系统.成体系的软件架构课程,循序渐进的讲述构建上述系统架构所需要的各种技术知识和技能. 适应人群: 1:有一定 ...
- 好好讲一讲,到底什么是Java高级架构师!
一. 什么是架构师 曾经有这么个段子: 甲:我已经应聘到一家中型软件公司了,今天上班的时候,全公司的人都来欢迎我. 乙:羡慕ing,都什么人来了? 甲:CEO.COO.CTO.All of 程序员,还 ...
- JAVA高级架构师基础功:Spring中AOP的两种代理方式:动态代理和CGLIB详解
在spring框架中使用了两种代理方式: 1.JDK自带的动态代理. 2.Spring框架自己提供的CGLIB的方式. 这两种也是Spring框架核心AOP的基础. 在详细讲解上述提到的动态代理和CG ...
- Java高级架构师(一)第42节:应用上Nginx过后的体系结构
以后的架构思考方向: 体系结构的演变
- Java高级架构师(一)第31节:Nginx简介、安装和基本运行
第一节:主要介绍Nginx和安装
- Java高级架构师(一)第28节:Index、商品详细页和购物车
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding= ...
- Java高级架构师(一)第26节:测试并调整登录的业务功能
主Index的处理Java: package com.sishuok.architecture1; import org.springframework.beans.factory.annotatio ...
- Java高级架构师(一)第25节:实现前端的业务登录等功能
package com.sishuok.architecture1; import javax.servlet.http.Cookie; import javax.servlet.http.HttpS ...
- Java高级架构师(一)第19节:X-gen生成相应的Visitor
package cn.javass.themes.smvcsm.visitors; import cn.javass.xgen.genconf.vo.ExtendConfModel; import c ...
随机推荐
- CMU Bomblab 答案
室友拉我做的... http://csapp.cs.cmu.edu/3e/labs.html Border relations with Canada have never been better. ...
- Git命令文本手册
git init # 初始化本地git仓库(创建新仓库) git config --global user.name "xxx" # 配置用户名 git config --glob ...
- powercmd注册码
推荐一个很方便的软件:powercmd 用户名:nzone 注册码:PCMDA-86128-PCMDA-70594 . 下载地址网上很多: http://soft.hao123.com/soft/a ...
- java web标签
一:国庆结束了,回来上班,结果老大说过两天才出差,所以这两天就用来补自己不太懂的知识或者以前没有熟悉的知识,jsp的标签就是,因为在项目中自己封装了一些标签,但是我自己只是会用,真正的原理性的东西我还 ...
- Tomcat部署时war和war exploded区别及验证
war和war exploded的区别 在使用IDEA开发项目的时候,部署Tomcat的时候通常会出现下边的情况: 是选择war还是war exploded 这里首先看一下他们两个的区别: war模式 ...
- 解决Idea Jsp <%%>中 request resopnse等无自动提示的问题
解决办法:缺少Apache的lib依赖, 只需 File->Project Srructure->Libraries 加号 找到Apache安装的lib目录添加依赖即可.亲测可用
- python3 闭包函数,装饰器
闭包函数: 1.定义在函数内部的函数 2.包含对外部作用域而非全局作用域的引用特点: 1.自带作用域 2.延迟计算(取到内存地址,加括号执行) def 外部函数(func): def 内部函数(*ar ...
- Selenium2+python自动化56-unittest之断言(assert)【转载】
前言 在测试用例中,执行完测试用例后,最后一步是判断测试结果是pass还是fail,自动化测试脚本里面一般把这种生成测试结果的方法称为断言(assert). 用unittest组件测试用例的时候,断言 ...
- 安装XHProf分析PHP性能瓶颈(原创)
废话不多说,直接上代码 ,手动滑稽.o(╯□╰)o 如果已解决您的问题,请在文章底部点击下关注,非常感谢. 下面是LINUX命令行 $ wget http://pecl.php.net/get/x ...
- centos 修改ftp目录
# usermod -d /home/www username // # service vsftpd restart // 重启vsftpd 两步搞定