Appfuse:第一张表维护
1. 建立表userinfo
| 列名 | 描述 |
| UserID | 主键、自增 |
| UserName | 用户名 |
| Pwd | 密码 |
| CreateDate | 创建日期 |
2. 在src/main/resources目录下增加文件hibernate.reveng.xml,并在pom.xml中配置build子标签
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-reverse-engineering
SYSTEM "http://hibernate.sourceforge.net/hibernate-reverse-engineering-3.0.dtd" > <hibernate-reverse-engineering> <type-mapping>
<!-- jdbc-type is name fom java.sql.Types -->
<sql-type jdbc-type="VARCHAR" length='1' hibernate-type="yes_no"/>
<!-- length, scale and precision can be used to specify the mapping precisly -->
<sql-type jdbc-type="NUMERIC" precision='1' hibernate-type="boolean"/>
<!-- the type-mappings are ordered. This mapping will be consulted last,
thus overriden by the previous one if precision=1 for the column -->
<sql-type jdbc-type="BIGINT" hibernate-type="java.lang.Long"/>
<sql-type jdbc-type="INTEGER" hibernate-type="java.lang.Long"/>
<sql-type jdbc-type="NUMERIC" hibernate-type="java.lang.Long"/>
</type-mapping> <table-filter match-name="*" exclude="true"/>
<table-filter match-name="userinfo" exclude="false"/>
</hibernate-reverse-engineering>
hibernate.reveng.xml
<plugin>
<groupId>org.appfuse.plugins</groupId>
<artifactId>appfuse-maven-plugin</artifactId>
<version>${project.parent.version}</version>
<configuration>
<componentProperties>
<revengfile>src/main/resources/hibernate.reveng.xml</revengfile>
</componentProperties>
<genericCore>${amp.genericCore}</genericCore>
<fullSource>${amp.fullSource}</fullSource>
</configuration>
<dependencies>
<dependency>
<groupId>${jdbc.groupId}</groupId>
<artifactId>${jdbc.artifactId}</artifactId>
<version>${jdbc.version}</version>
</dependency>
</dependencies>
</plugin>
pom的配置
3. 打开命令行,输入mvn appfuse:gen-model 生成实体类userinfo.java
package com.zcmp.disappearwind.model; import com.zcmp.disappearwind.model.BaseObject; import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.Field;
import org.hibernate.search.annotations.Indexed;
import org.hibernate.search.annotations.IndexedEmbedded; import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.xml.bind.annotation.XmlRootElement; import java.io.Serializable; @Entity
@Table(name="userinfot",catalog="disappearwind")
@Indexed
@XmlRootElement
public class Userinfo extends BaseObject implements Serializable {
private Long userId;
private Date createDate;
private String pwd;
private String userName; @Id @GeneratedValue(strategy=IDENTITY) @DocumentId
public Long getUserId() {
return this.userId;
} public void setUserId(Long userId) {
this.userId = userId;
}
@Temporal(TemporalType.TIMESTAMP)
@Column(name="CreateDate", length=19)
@Field
public Date getCreateDate() {
return this.createDate;
} public void setCreateDate(Date createDate) {
this.createDate = createDate;
} @Column(name="Pwd", length=128)
@Field
public String getPwd() {
return this.pwd;
} public void setPwd(String pwd) {
this.pwd = pwd;
} @Column(name="UserName", length=128)
@Field
public String getUserName() {
return this.userName;
} public void setUserName(String userName) {
this.userName = userName;
} public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false; Userinfo pojo = (Userinfo) o; if (createDate != null ? !createDate.equals(pojo.createDate) : pojo.createDate != null) return false;
if (pwd != null ? !pwd.equals(pojo.pwd) : pojo.pwd != null) return false;
if (userName != null ? !userName.equals(pojo.userName) : pojo.userName != null) return false; return true;
} public int hashCode() {
int result = 0;
result = (createDate != null ? createDate.hashCode() : 0);
result = 31 * result + (pwd != null ? pwd.hashCode() : 0);
result = 31 * result + (userName != null ? userName.hashCode() : 0); return result;
} public String toString() {
StringBuffer sb = new StringBuffer(getClass().getSimpleName()); sb.append(" [");
sb.append("userId").append("='").append(getUserId()).append("', ");
sb.append("createDate").append("='").append(getCreateDate()).append("', ");
sb.append("pwd").append("='").append(getPwd()).append("', ");
sb.append("userName").append("='").append(getUserName()).append("'");
sb.append("]"); return sb.toString();
} }
Userinfo
4. 在命令号运行mvn appfuse:gen生成页面、Controller、menu配置等文件,注意提示输入实体名的时候大小写一定要和第三步生成的类名保持一致
5. 打开ApplicationResources_zh.properties文件,汉化各字段的名称以及各种标题和提示信息
6. 重新部署即可
Appfuse:第一张表维护的更多相关文章
- mysql连表查空,查询第二张表中没有第一张表中的数据
select consumer_id,user_name,mobile,invite_code from csr_consumer where invite_count<(select coun ...
- 级联两个bootstrap-table。一张表显示相关的数据,通过点击这张表的某一行,传过去对应的ID,刷新另外一张表。
二张表的代码(我用的插件,大家可以去网上直接下载http://issues.wenzhixin.net.cn/bootstrap-table/): <div class="contai ...
- sql语句左链接left join--3张表关联
表A---------------------------------关联第一张表B-----------------------关联第二张表c select * fomr 表名A left join ...
- 【第十五篇】easyui datagrid的列编辑,同时插入两张表的数据进去
看图说话. 需求:插入两张表,上面的表单是第一张表的内容,下面的两个表格是第二张详情表的内容,跟第一张表的id关联 第二张表有一个列是需要用户手动填写添加的. 国际惯例,上代码 <div id= ...
- 利用pymysql同时修改两张表的数据
使用pymysql操作数据库中相关联的两张表需求:两张表中分别有一个字段是json格式,需要往json中再插入一个属性值’container_cloud’=’fasle’. import pymysq ...
- Ajax案例:三级联动查询员工的信息(三张表进行内连接)
需求分析: 通过数据库连接池,可以查询到数据库中员工的各种信息,通过点击下拉框的方式实现三级联动,即:没有点击city下拉框,后面两个下拉框中没有值,这样,点击city下拉框,department下拉 ...
- 多对多第三张表的创建方式 和 forms组件的使用
目录 一.多对多第三张表的创建 1. 全自动方式 (1)实现代码 (2)优点和不足 2. 纯手撸方式(了解) (1)实现代码 (2)优点和不足 3. 半自动方式(推荐使用) (1)实现代码 (2)优点 ...
- sql 查出一张表中重复的所有记录数据
1.在面试的时候碰到一个 问题,就是让写一张表中有id和name 两个字段,查询出name重复的所有数据,现在列下: select * from xi a where (a.username) in ...
- SQLSERVER中如何快速比较两张表的不一样
SQLSERVER中如何快速比较两张表的不一样 不知不觉要写2014年的最后一篇博文了~ 一般来说,如何检测两张表的内容是否一致,体现在复制的时候发布端和订阅端的两端的数据上面 我这里罗列了一些如何从 ...
随机推荐
- 【腾讯Bugly干货分享】移动客户端中高效使用SQLite
本文来自于腾讯bugly开发者社区,非经作者同意,请勿转载,原文地址:http://dev.qq.com/topic/57b57f2a0703f7d31b9a3932 作者:赵丰 导语 iOS 程序能 ...
- [免费了] SailingEase .NET Resources Tool (.NET 多语言资源编辑器)
这是我2010年左右,写 Winform IDE (http://www.cnblogs.com/sheng_chao/p/4387249.html)项目时延伸出的一个小项目. 最初是以共享软件的形式 ...
- ASP.NET MVC Model绑定(四)
ASP.NET MVC Model绑定(四) 前言 前面的篇幅对于Model绑定器IModelBinder以及实现类型.Model绑定器提供程序都作了粗略的讲解,可以把Model绑定器想象成一个大的容 ...
- Android开发学习之路-Android中使用RxJava
RxJava的核心内容很简单,就是进行异步操作.类似于Handler和AsyncTask的功能,但是在代码结构上不同. RxJava使用了观察者模式和建造者模式中的链式调用(类似于C#的LINQ). ...
- [Java 缓存] Java Cache之 Guava Cache的简单应用.
前言 今天第一次使用MarkDown的形式发博客. 准备记录一下自己对Guava Cache的认识及项目中的实际使用经验. 一: 什么是Guava Guava工程包含了若干被Google的 Java项 ...
- ASP.NET MVC5+EF6+EasyUI 后台管理系统(37)-文章发布系统④-百万级数据和千万级数据简单测试
系列目录 我想测试EF在一百万条数据下的显示时间!这分数据应该有很多同学想要,看看EF的性能! 服务器 现在来向SQL2008R2插入1000000条数据吧 declare @i int; ; beg ...
- 当master down掉后,pt-heartbeat不断重试会导致内存缓慢增长
最近同事反映,在使用pt-heartbeat监控主从复制延迟的过程中,如果master down掉了,则pt-heartbeat则会连接失败,但会不断重试. 重试本无可厚非,毕竟从使用者的角度来说,希 ...
- 制作自己的MVC框架(二)——启动
自己写了个框架,取名为“PrimusPHP”,就3个文件夹,log中是日志文件,会自动生成. app中就是控制器和视图,public中是入口文件和静态资源,library中既有框架的核心类,还有工具类 ...
- 图的生成树(森林)(克鲁斯卡尔Kruskal算法和普里姆Prim算法)、以及并查集的使用
图的连通性问题:无向图的连通分量和生成树,所有顶点均由边连接在一起,但不存在回路的图. 设图 G=(V, E) 是个连通图,当从图任一顶点出发遍历图G 时,将边集 E(G) 分成两个集合 T(G) 和 ...
- 【基于WPF+OneNote+Oracle的中文图片识别系统阶段总结】之篇三:批量处理后的txt文件入库处理
篇一:WPF常用知识以及本项目设计总结:http://www.cnblogs.com/baiboy/p/wpf.html 篇二:基于OneNote难点突破和批量识别:http://www.cnblog ...