vue](https://gitee.com/chunanyong/springrain-vue)
https://gitee.com/chunanyong/springrain/tree/master/springrain- system/springrain-system-web/doc
https://gitee.com/chunanyong/springrain/tree/master/springrain-gencode
https://gitee.com/chunanyong/springrain/tree/master/springrain- system/springrain-system-web/sql
springrain是spring/springboot的封装,springboot开发范例.
springrain是一个Maven项目,包含spring core,spring jdbc,spring mvc.
springrain自带代码生成器,能够生成对表的增删改查的逻辑代码,以及前台页面样式和js文件
项目只依赖spring,没有hibernate,struts,ibatis.
使用jwt认证.
数据库调优可以使用druid输出慢sql,比分析xml中的语句更直观,springrain所有的sql语句都使用Finder封装管理,只要查看Finder的引用即可.
一些测试案例:
//就极简而言,一个数据库只需要一个Service,就可以管理这个数据库的任意一张表 //@Test 查询基本类型 public void testObject() throws Exception{ // Finder finder=new Finder("select id from t_user where 1=1 "); Finder finder=Finder.getSelectFinder(User.class,"id").append(" WHERE 1=1 "); finder.append("and id=:userId").setParam("userId", "admin"); String id = baseDemoService.queryForObject(finder, String.class); System.out.println(id); } //@Test 查询一个对象 public void testObjectUser() throws Exception{ //Finder finder=new Finder("select * from t_user where id=:userId order by id"); Finder finder=Finder.getSelectFinder(User.class).append(" WHERE id=:userId order by id desc "); finder.setParam("userId", "admin"); User u = baseDemoService.queryForObject(finder, User.class); System.out.println(u.getName()); } //@Test 查询分页 public void testMsSql() throws Exception{ //Finder finder=new Finder("select * from t_user order by id"); Finder finder=Finder.getSelectFinder(User.class).append(" order by id desc "); Listlist = baseDemoService.queryForList(finder, User.class, new Page(2)); System.out.println(list.size()); for(User s:list){ System.out.println(s.getName()); } } //@Test 调用数据库存储过程 public void testProc() throws Exception{ Finder finder=new Finder(); finder.setParam("unitId", 0); finder.setProcName("proc_up"); Map queryObjectByProc = (Map) baseDemoService.queryObjectByProc(finder); System.out.println(queryObjectByProc.get("#update-count-10")); } //@Test 调用数据库函数 public void testFunction() throws Exception{ Finder finder=new Finder(); finder.setFunName("fun_userId"); finder.setParam("userId", "admin"); String userName= baseDemoService.queryForObjectByByFunction(finder,String.class); System.out.println(userName); }