【jeecg-mybatis版本】 mybatis+spring mvc 完美整合方案 查询,保存,更新,删除自动生成
程序员文章站
2022-03-12 13:09:10
...
Jeecg-mybatis-framework 版本
简要说明
- JEECG[J2EE Code Generation]是一款基于代码生成器的J2EE智能开发框架,借助该框架可以节省50%的工作量,实现代码生成+手工merge的半智能开发
- 代码生成:根据表生成对应的Bean,Service,Dao,Action,XML,JSP等,增删改查功能直接使用,实现了快速开发
- jeecg-mybatis-framework,采用SpringMVC+Mybatis等主流框架
- 支持数据库: Mysql,Oracle10g
- 前端:使用Jquery和Easyui技术.JS封装简洁,操作简单.
- 权限:对菜单,按钮控制.根据登陆用户权限展示拥有的菜单和按钮.
- 拦截:对所有无权限URL进行拦截,防止手动发送HTTP请求,确保系统全性.
链接:http://pan.baidu.com/s/1pJMkprt密码: k3u8
入门视频:
链接:http://pan.baidu.com/s/1ntD0O1z密码: 66gi
环境搭建:
1.创建一个utf-8的数据库,数据库名jeecgmybatis
2.执行脚本jeecgmybatis.sql,初始化数据库
3.项目导入myeclipse工程
4.启动项目
访问:http://localhost:8080/jeecg-mybatis-framework
5.代码生成器路径
/jeecg-mybatis-framework/src/com/code/CodeUtil.java
技术交流
本系统由JEECG社区提供,如需个性化定制,可与官方(www.jeecg.org)联系.
- 交流:106259349, 106838471, 289782002
- 开发者:JEECG社区
- 官网:http://www.jeecg.org
- <?xmlversion="1.0"encoding="UTF-8"?>
- <!DOCTYPEmapper
- PUBLIC"-//mybatis.org//DTDMapper3.0//EN"
- "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mappernamespace="scott.dao.demo.JeecgNoteDao">
- <!--ResultMap-->
- <resultMapid="BaseResultMap"type="scott.entity.demo.JeecgNote">
- <resultcolumn="id"property="id"/>
- <resultcolumn="title"property="title"/>
- <resultcolumn="content"property="content"/>
- <resultcolumn="crtuser"property="crtuser"/>
- <resultcolumn="crtuser_name"property="crtuser_name"/>
- <resultcolumn="create_dt"property="create_dt"/>
- <resultcolumn="deleted"property="deleted"/>
- </resultMap>
- <!--jeecg_notetableallfields-->
- <sqlid="Base_Column_List">
- id,title,content,crtuser,crtuser_name,create_dt,deleted
- </sql>
- <!--查询条件-->
- <sqlid="Example_Where_Clause">
- where1=1
- <trimsuffixOverrides=",">
- <iftest="id!=nullandid!=''">
- andid=#{id}
- </if>
- <iftest="title!=nullandtitle!=''">
- andtitle=#{title}
- </if>
- <iftest="content!=nullandcontent!=''">
- andcontent=#{content}
- </if>
- <iftest="crtuser!=nullandcrtuser!=''">
- andcrtuser=#{crtuser}
- </if>
- <iftest="crtuser_name!=nullandcrtuser_name!=''">
- andcrtuser_name=#{crtuser_name}
- </if>
- <iftest="create_dt!=nullandcreate_dt!=''">
- andcreate_dt=#{create_dt}
- </if>
- <iftest="deleted!=nullanddeleted!=''">
- anddeleted=#{deleted}
- </if>
- </trim>
- </sql>
- <!--插入记录-->
- <insertid="add"parameterType="Object">
- <selectKeyresultType="java.lang.Integer"order="AFTER"keyProperty="id">
- SELECTLAST_INSERT_ID()
- </selectKey>
- insertintojeecg_note(id,title,content,crtuser,crtuser_name,create_dt,deleted)
- values(#{id},#{title},#{content},#{crtuser},#{crtuser_name},#{create_dt},#{deleted})
- </insert>
- <!--根据id,修改记录-->
- <updateid="update"parameterType="Object">
- updatejeecg_notesettitle=#{title},content=#{content},crtuser=#{crtuser},crtuser_name=#{crtuser_name},create_dt=#{create_dt},deleted=#{deleted}whereid=#{id}
- </update>
- <!--修改记录,只修改只不为空的字段-->
- <updateid="updateBySelective"parameterType="Object">
- updatejeecg_noteset
- <trimsuffixOverrides=",">
- <iftest="title!=null">
- title=#{title},
- </if>
- <iftest="content!=null">
- content=#{content},
- </if>
- <iftest="crtuser!=null">
- crtuser=#{crtuser},
- </if>
- <iftest="crtuser_name!=null">
- crtuser_name=#{crtuser_name},
- </if>
- <iftest="create_dt!=null">
- create_dt=#{create_dt},
- </if>
- <iftest="deleted!=null">
- deleted=#{deleted},
- </if>
- </trim>whereid=#{id}
- </update>
- <!--删除记录-->
- <deleteid="delete"parameterType="Object">
- deletefromjeecg_notewhereid=#{id}
- </delete>
- <!--根据id查询公告-->
- <selectid="queryById"resultMap="BaseResultMap"parameterType="Object">
- select<includerefid="Base_Column_List"/>
- fromjeecg_notewhereid=#{id}
- </select>
- <!--公告列表总数-->
- <selectid="queryByCount"resultType="java.lang.Integer"parameterType="Object">
- selectcount(1)fromjeecg_note
- <includerefid="Example_Where_Clause"/>
- </select>
- <!--查询公告列表-->
- <selectid="queryByList"resultMap="BaseResultMap"parameterType="Object">
- select
- <includerefid="Base_Column_List"/>
- fromjeecg_note
- <includerefid="Example_Where_Clause"/>
- <iftest="pager.orderCondition!=nullandpager.orderCondition!=''">
- ${pager.orderCondition}
- </if>
- <iftest="pager.mysqlQueryCondition!=nullandpager.mysqlQueryCondition!=''">
- ${pager.mysqlQueryCondition}
- </if>
- </select>
- </mapper>