美文网首页
后台增删改查功能模块

后台增删改查功能模块

作者: 黑小胡子 | 来源:发表于2017-07-05 09:12 被阅读0次

使用工具:PowerDesign16.5、Navicat11.2.7、eclipse mars1、jetty。
详细步骤:

1、使用PD做表结构
2、使用Navicat建数据库表
3、配置数据库连接
4、逆向工程代码
5、代码整合到项目中
6、后台用户中心添加功能模块
7、项目本地运行
8、测试增删改查功能

1、使用PD做表结构
2、双击表结构>prieview,将创建表语句复制粘贴到Navicat上的查询>新建查询>查询编辑器>运行。
3、在com.sendinfo.tms.code项目下的com.sendinfo.code中创建一个config.properties,设置url。
jdbc.type=mysql
jdbc.driverClassName=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://192.168.200.104:3306/tms_scenic?useUnicode=true&characterEncoding=utf-8
jdbc.username=tms
jdbc.password=Tms.2017
4、在com.sendinfo.tms.code项目下的com.sendinfo.code中创建一个EasyuiMain,
1)配置项
Map<String, Object> config = new HashMap<String, Object>();
2)配置基本包路径
config.put("basepkg", "com.sendinfo.biz.resource");
3)配置WEB资源路径
config.put("catalog", "resource");
4)日期替换
config.put("date", DateFormatUtils.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
5)代码写入磁盘路径
String rootPath = "E:\workspace\com.sendinfo.tms.code\codegen";
6)数据库catalog
String catalog = "";
7)配置数据库schema,Oracle数据库的用户名
String schema = "tms_scenic";
8)配置数据表名称,多个以逗号隔开,支持Like查询
String tableName = "traffic_info,exhibi_info";
9)任务名称,取值:all(所有)、entity(只生成实体)、java(只生成Java代码)、page(只生成页面)、settle(结算系统)
String taskName = "easyui";
10)代码生成
// 代码生成
String location = "classpath:com/sendinfo/code/applicationContext.xml";
ApplicationContext context = new ClassPathXmlApplicationContext(location);
DatabaseFactory databaseFactory = (DatabaseFactory) context.getBean("databaseFactory");
DatabaseWapper database = databaseFactory.readDatabaseWapper(catalog.toUpperCase(), schema.toUpperCase(),
tableName.toUpperCase());
System.out.println("Tables: " + Arrays.asList(database.getTableNames()));
CodeService service = (CodeService) context.getBean("codeService");
List<CodeFile> filelist = service.gencode(database, taskName, config);
writeCodeFile(rootPath, filelist);//写文件到硬盘

5、对EasyuiMain run as>java application,完成。
6、再去硬盘取出各个文件放到项目中对应的位置
6.1com\sendinfo\biz\resource下有:
--action>xxxxAction.java
--dao
custom>xxxxCustom.xml
impl>xxxxDaoImpl.java
mapper>xxxxMapper.xml
xxxxDao.java
--entity>xxxx.java
--service
impl>xxxxServiceImpl.java
>xxxxService.java

6.2resourece>每个表对应3个ftl文件,分别是add、edit、list,文件粘贴到sendinfo-tms-resource下的webapp.WEB-INF.ftl.resource中。
6.3struts>xxxAction.xml,把里边的代码粘贴到sendinfo-tms-resource下的resource.struts中的struts-resource.xml。

7、jetty:run 运行项目,然后在用户中心>系统管理中,
1)权限管理>旅游资源管理,添加,如
名称:公路交通资源
唯一编码:traffic
URL:/resource/trafficinfo/list.htm
排序:8
2)角色管理>权限配置>在地理资源中勾选新添加的资源。

相关文章

  • 后台增删改查功能模块

    使用工具:PowerDesign16.5、Navicat11.2.7、eclipse mars1、jetty。详细...

  • mysql的插入语句

    MySQL增删改查之增insert、replace

  • kibana

    下载 解压 远程访问 后台执行 增删改查

  • MYSQL数据库的增删改查

    MYSQL数据库的增删改查 一.对于库的增删改查 增create database 库名称;create data...

  • 关于python的list的增查删改

    说到增查删改,想起了数据库,我们在关系型数据库当中就会对表进行增查删改。 在python当中我们也可以对list进...

  • 0812 A

    mongodb 增删改查 增: db.createCollection("name", {options:numb...

  • 增删改

    对于表中的操作,就是增删改查,查内容较多,这里先说增删改。 1.增(insert或者load) 即插入数据,多行插...

  • 项目小结

    已完成部分: 后台录入系统 实现后台录入系统的前端页面 实现对手工艺品记录的增删改查 实现对店铺记录的增删改查 实...

  • python+flask+uwsgi 后台管理系统

    python+flask+uwsgi 后台管理系统,使用python + flask 开发后台登陆,基础的增删改查...

  • SQL查询结构总结

    SQL 增删改查 对数据库有修改的操作是:增删改 增 insert into 表名 values(); 删 del...

网友评论

      本文标题:后台增删改查功能模块

      本文链接:https://www.haomeiwen.com/subject/phmfhxtx.html