更正测试表dao

This commit is contained in:
shuzheng 2016-11-20 14:53:06 +08:00
parent 6abc6d6ed0
commit 49c3b3adc2
6 changed files with 52 additions and 236 deletions

View File

@ -73,7 +73,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from book
from test_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
@ -92,31 +92,32 @@
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
select
<include refid="Base_Column_List" />
from book
from test_book
where book_id = #{bookId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from book
delete from test_book
where book_id = #{bookId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.zheng.cms.dao.model.BookExample" >
delete from book
delete from test_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.zheng.cms.dao.model.Book" >
insert into book (book_id, user_id, name
)
values (#{bookId,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}
)
<selectKey resultType="java.lang.Integer" keyProperty="bookId" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_book (user_id, name)
values (#{userId,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.zheng.cms.dao.model.Book" >
insert into book
<selectKey resultType="java.lang.Integer" keyProperty="bookId" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_book
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="bookId != null" >
book_id,
</if>
<if test="userId != null" >
user_id,
</if>
@ -125,9 +126,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="bookId != null" >
#{bookId,jdbcType=INTEGER},
</if>
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
@ -137,13 +135,13 @@
</trim>
</insert>
<select id="countByExample" parameterType="com.zheng.cms.dao.model.BookExample" resultType="java.lang.Integer" >
select count(*) from book
select count(*) from test_book
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update book
update test_book
<set >
<if test="record.bookId != null" >
book_id = #{record.bookId,jdbcType=INTEGER},
@ -160,7 +158,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map" >
update book
update test_book
set book_id = #{record.bookId,jdbcType=INTEGER},
user_id = #{record.userId,jdbcType=INTEGER},
name = #{record.name,jdbcType=VARCHAR}
@ -169,7 +167,7 @@
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.zheng.cms.dao.model.Book" >
update book
update test_book
<set >
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
@ -181,7 +179,7 @@
where book_id = #{bookId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.zheng.cms.dao.model.Book" >
update book
update test_book
set user_id = #{userId,jdbcType=INTEGER},
name = #{name,jdbcType=VARCHAR}
where book_id = #{bookId,jdbcType=INTEGER}

View File

@ -13,8 +13,6 @@
<result column="allowcomments" property="allowcomments" jdbcType="TINYINT" />
<result column="status" property="status" jdbcType="TINYINT" />
<result column="user_id" property="userId" jdbcType="INTEGER" />
<result column="up" property="up" jdbcType="INTEGER" />
<result column="down" property="down" jdbcType="INTEGER" />
<result column="readnumber" property="readnumber" jdbcType="INTEGER" />
<result column="ctime" property="ctime" jdbcType="BIGINT" />
<result column="orders" property="orders" jdbcType="BIGINT" />
@ -82,7 +80,7 @@
</sql>
<sql id="Base_Column_List" >
article_id, title, author, fromurl, image, keywords, description, type, allowcomments,
status, user_id, up, down, readnumber, ctime, orders
status, user_id, readnumber, ctime, orders
</sql>
<sql id="Blob_Column_List" >
content
@ -150,15 +148,13 @@
insert into cms_article (title, author, fromurl,
image, keywords, description,
type, allowcomments, status,
user_id, up, down, readnumber,
ctime, orders, content
)
user_id, readnumber, ctime,
orders, content)
values (#{title,jdbcType=VARCHAR}, #{author,jdbcType=VARCHAR}, #{fromurl,jdbcType=VARCHAR},
#{image,jdbcType=VARCHAR}, #{keywords,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR},
#{type,jdbcType=TINYINT}, #{allowcomments,jdbcType=TINYINT}, #{status,jdbcType=TINYINT},
#{userId,jdbcType=INTEGER}, #{up,jdbcType=INTEGER}, #{down,jdbcType=INTEGER}, #{readnumber,jdbcType=INTEGER},
#{ctime,jdbcType=BIGINT}, #{orders,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
)
#{userId,jdbcType=INTEGER}, #{readnumber,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT},
#{orders,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR})
</insert>
<insert id="insertSelective" parameterType="com.zheng.cms.dao.model.CmsArticle" >
<selectKey resultType="java.lang.Integer" keyProperty="articleId" order="AFTER" >
@ -196,12 +192,6 @@
<if test="userId != null" >
user_id,
</if>
<if test="up != null" >
up,
</if>
<if test="down != null" >
down,
</if>
<if test="readnumber != null" >
readnumber,
</if>
@ -246,12 +236,6 @@
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="up != null" >
#{up,jdbcType=INTEGER},
</if>
<if test="down != null" >
#{down,jdbcType=INTEGER},
</if>
<if test="readnumber != null" >
#{readnumber,jdbcType=INTEGER},
</if>
@ -308,12 +292,6 @@
<if test="record.userId != null" >
user_id = #{record.userId,jdbcType=INTEGER},
</if>
<if test="record.up != null" >
up = #{record.up,jdbcType=INTEGER},
</if>
<if test="record.down != null" >
down = #{record.down,jdbcType=INTEGER},
</if>
<if test="record.readnumber != null" >
readnumber = #{record.readnumber,jdbcType=INTEGER},
</if>
@ -344,8 +322,6 @@
allowcomments = #{record.allowcomments,jdbcType=TINYINT},
status = #{record.status,jdbcType=TINYINT},
user_id = #{record.userId,jdbcType=INTEGER},
up = #{record.up,jdbcType=INTEGER},
down = #{record.down,jdbcType=INTEGER},
readnumber = #{record.readnumber,jdbcType=INTEGER},
ctime = #{record.ctime,jdbcType=BIGINT},
orders = #{record.orders,jdbcType=BIGINT},
@ -367,8 +343,6 @@
allowcomments = #{record.allowcomments,jdbcType=TINYINT},
status = #{record.status,jdbcType=TINYINT},
user_id = #{record.userId,jdbcType=INTEGER},
up = #{record.up,jdbcType=INTEGER},
down = #{record.down,jdbcType=INTEGER},
readnumber = #{record.readnumber,jdbcType=INTEGER},
ctime = #{record.ctime,jdbcType=BIGINT},
orders = #{record.orders,jdbcType=BIGINT}
@ -409,12 +383,6 @@
<if test="userId != null" >
user_id = #{userId,jdbcType=INTEGER},
</if>
<if test="up != null" >
up = #{up,jdbcType=INTEGER},
</if>
<if test="down != null" >
down = #{down,jdbcType=INTEGER},
</if>
<if test="readnumber != null" >
readnumber = #{readnumber,jdbcType=INTEGER},
</if>
@ -442,8 +410,6 @@
allowcomments = #{allowcomments,jdbcType=TINYINT},
status = #{status,jdbcType=TINYINT},
user_id = #{userId,jdbcType=INTEGER},
up = #{up,jdbcType=INTEGER},
down = #{down,jdbcType=INTEGER},
readnumber = #{readnumber,jdbcType=INTEGER},
ctime = #{ctime,jdbcType=BIGINT},
orders = #{orders,jdbcType=BIGINT},
@ -462,8 +428,6 @@
allowcomments = #{allowcomments,jdbcType=TINYINT},
status = #{status,jdbcType=TINYINT},
user_id = #{userId,jdbcType=INTEGER},
up = #{up,jdbcType=INTEGER},
down = #{down,jdbcType=INTEGER},
readnumber = #{readnumber,jdbcType=INTEGER},
ctime = #{ctime,jdbcType=BIGINT},
orders = #{orders,jdbcType=BIGINT}

View File

@ -84,7 +84,7 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from user
from test_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
@ -98,7 +98,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from user
from test_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
@ -119,33 +119,36 @@
<include refid="Base_Column_List" />
,
<include refid="Blob_Column_List" />
from user
from test_user
where user_id = #{userId,jdbcType=INTEGER}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
delete from user
delete from test_user
where user_id = #{userId,jdbcType=INTEGER}
</delete>
<delete id="deleteByExample" parameterType="com.zheng.cms.dao.model.UserExample" >
delete from user
delete from test_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</delete>
<insert id="insert" parameterType="com.zheng.cms.dao.model.User" >
insert into user (user_id, username, password,
nickname, sex, ctime,
content)
values (#{userId,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
#{nickname,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT},
#{content,jdbcType=LONGVARCHAR})
<selectKey resultType="java.lang.Integer" keyProperty="userId" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_user (username, password, nickname,
sex, ctime, content
)
values (#{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{nickname,jdbcType=VARCHAR},
#{sex,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}
)
</insert>
<insert id="insertSelective" parameterType="com.zheng.cms.dao.model.User" >
insert into user
<selectKey resultType="java.lang.Integer" keyProperty="userId" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>
insert into test_user
<trim prefix="(" suffix=")" suffixOverrides="," >
<if test="userId != null" >
user_id,
</if>
<if test="username != null" >
username,
</if>
@ -166,9 +169,6 @@
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides="," >
<if test="userId != null" >
#{userId,jdbcType=INTEGER},
</if>
<if test="username != null" >
#{username,jdbcType=VARCHAR},
</if>
@ -190,13 +190,13 @@
</trim>
</insert>
<select id="countByExample" parameterType="com.zheng.cms.dao.model.UserExample" resultType="java.lang.Integer" >
select count(*) from user
select count(*) from test_user
<if test="_parameter != null" >
<include refid="Example_Where_Clause" />
</if>
</select>
<update id="updateByExampleSelective" parameterType="map" >
update user
update test_user
<set >
<if test="record.userId != null" >
user_id = #{record.userId,jdbcType=INTEGER},
@ -225,7 +225,7 @@
</if>
</update>
<update id="updateByExampleWithBLOBs" parameterType="map" >
update user
update test_user
set user_id = #{record.userId,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
@ -238,7 +238,7 @@
</if>
</update>
<update id="updateByExample" parameterType="map" >
update user
update test_user
set user_id = #{record.userId,jdbcType=INTEGER},
username = #{record.username,jdbcType=VARCHAR},
password = #{record.password,jdbcType=VARCHAR},
@ -250,7 +250,7 @@
</if>
</update>
<update id="updateByPrimaryKeySelective" parameterType="com.zheng.cms.dao.model.User" >
update user
update test_user
<set >
<if test="username != null" >
username = #{username,jdbcType=VARCHAR},
@ -274,7 +274,7 @@
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKeyWithBLOBs" parameterType="com.zheng.cms.dao.model.User" >
update user
update test_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},
@ -284,7 +284,7 @@
where user_id = #{userId,jdbcType=INTEGER}
</update>
<update id="updateByPrimaryKey" parameterType="com.zheng.cms.dao.model.User" >
update user
update test_user
set username = #{username,jdbcType=VARCHAR},
password = #{password,jdbcType=VARCHAR},
nickname = #{nickname,jdbcType=VARCHAR},

View File

@ -25,10 +25,6 @@ public class CmsArticle implements Serializable {
private Integer userId;
private Integer up;
private Integer down;
private Integer readnumber;
private Long ctime;
@ -127,22 +123,6 @@ public class CmsArticle implements Serializable {
this.userId = userId;
}
public Integer getUp() {
return up;
}
public void setUp(Integer up) {
this.up = up;
}
public Integer getDown() {
return down;
}
public void setDown(Integer down) {
this.down = down;
}
public Integer getReadnumber() {
return readnumber;
}
@ -192,8 +172,6 @@ public class CmsArticle implements Serializable {
sb.append(", allowcomments=").append(allowcomments);
sb.append(", status=").append(status);
sb.append(", userId=").append(userId);
sb.append(", up=").append(up);
sb.append(", down=").append(down);
sb.append(", readnumber=").append(readnumber);
sb.append(", ctime=").append(ctime);
sb.append(", orders=").append(orders);
@ -225,8 +203,6 @@ public class CmsArticle implements Serializable {
&& (this.getAllowcomments() == null ? other.getAllowcomments() == null : this.getAllowcomments().equals(other.getAllowcomments()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getUserId() == null ? other.getUserId() == null : this.getUserId().equals(other.getUserId()))
&& (this.getUp() == null ? other.getUp() == null : this.getUp().equals(other.getUp()))
&& (this.getDown() == null ? other.getDown() == null : this.getDown().equals(other.getDown()))
&& (this.getReadnumber() == null ? other.getReadnumber() == null : this.getReadnumber().equals(other.getReadnumber()))
&& (this.getCtime() == null ? other.getCtime() == null : this.getCtime().equals(other.getCtime()))
&& (this.getOrders() == null ? other.getOrders() == null : this.getOrders().equals(other.getOrders()))
@ -248,8 +224,6 @@ public class CmsArticle implements Serializable {
result = prime * result + ((getAllowcomments() == null) ? 0 : getAllowcomments().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getUserId() == null) ? 0 : getUserId().hashCode());
result = prime * result + ((getUp() == null) ? 0 : getUp().hashCode());
result = prime * result + ((getDown() == null) ? 0 : getDown().hashCode());
result = prime * result + ((getReadnumber() == null) ? 0 : getReadnumber().hashCode());
result = prime * result + ((getCtime() == null) ? 0 : getCtime().hashCode());
result = prime * result + ((getOrders() == null) ? 0 : getOrders().hashCode());

View File

@ -844,126 +844,6 @@ public class CmsArticleExample {
return (Criteria) this;
}
public Criteria andUpIsNull() {
addCriterion("up is null");
return (Criteria) this;
}
public Criteria andUpIsNotNull() {
addCriterion("up is not null");
return (Criteria) this;
}
public Criteria andUpEqualTo(Integer value) {
addCriterion("up =", value, "up");
return (Criteria) this;
}
public Criteria andUpNotEqualTo(Integer value) {
addCriterion("up <>", value, "up");
return (Criteria) this;
}
public Criteria andUpGreaterThan(Integer value) {
addCriterion("up >", value, "up");
return (Criteria) this;
}
public Criteria andUpGreaterThanOrEqualTo(Integer value) {
addCriterion("up >=", value, "up");
return (Criteria) this;
}
public Criteria andUpLessThan(Integer value) {
addCriterion("up <", value, "up");
return (Criteria) this;
}
public Criteria andUpLessThanOrEqualTo(Integer value) {
addCriterion("up <=", value, "up");
return (Criteria) this;
}
public Criteria andUpIn(List<Integer> values) {
addCriterion("up in", values, "up");
return (Criteria) this;
}
public Criteria andUpNotIn(List<Integer> values) {
addCriterion("up not in", values, "up");
return (Criteria) this;
}
public Criteria andUpBetween(Integer value1, Integer value2) {
addCriterion("up between", value1, value2, "up");
return (Criteria) this;
}
public Criteria andUpNotBetween(Integer value1, Integer value2) {
addCriterion("up not between", value1, value2, "up");
return (Criteria) this;
}
public Criteria andDownIsNull() {
addCriterion("down is null");
return (Criteria) this;
}
public Criteria andDownIsNotNull() {
addCriterion("down is not null");
return (Criteria) this;
}
public Criteria andDownEqualTo(Integer value) {
addCriterion("down =", value, "down");
return (Criteria) this;
}
public Criteria andDownNotEqualTo(Integer value) {
addCriterion("down <>", value, "down");
return (Criteria) this;
}
public Criteria andDownGreaterThan(Integer value) {
addCriterion("down >", value, "down");
return (Criteria) this;
}
public Criteria andDownGreaterThanOrEqualTo(Integer value) {
addCriterion("down >=", value, "down");
return (Criteria) this;
}
public Criteria andDownLessThan(Integer value) {
addCriterion("down <", value, "down");
return (Criteria) this;
}
public Criteria andDownLessThanOrEqualTo(Integer value) {
addCriterion("down <=", value, "down");
return (Criteria) this;
}
public Criteria andDownIn(List<Integer> values) {
addCriterion("down in", values, "down");
return (Criteria) this;
}
public Criteria andDownNotIn(List<Integer> values) {
addCriterion("down not in", values, "down");
return (Criteria) this;
}
public Criteria andDownBetween(Integer value1, Integer value2) {
addCriterion("down between", value1, value2, "down");
return (Criteria) this;
}
public Criteria andDownNotBetween(Integer value1, Integer value2) {
addCriterion("down not between", value1, value2, "down");
return (Criteria) this;
}
public Criteria andReadnumberIsNull() {
addCriterion("readnumber is null");
return (Criteria) this;

View File

@ -64,11 +64,11 @@
<javaClientGenerator targetPackage="${generator.javaClientGenerator.targetPackage}" targetProject="src/main/java" type="XMLMAPPER" />
<!-- 需要映射的表 -->
<table tableName="user" domainObjectName="User">
<generatedKey column="id" sqlStatement="MySql" identity="true" />
<table tableName="test_user" domainObjectName="User">
<generatedKey column="user_id" sqlStatement="MySql" identity="true" />
</table>
<table tableName="book" domainObjectName="Book">
<generatedKey column="id" sqlStatement="MySql" identity="true" />
<table tableName="test_book" domainObjectName="Book">
<generatedKey column="book_id" sqlStatement="MySql" identity="true" />
</table>
<table tableName="cms_article" domainObjectName="CmsArticle">
<generatedKey column="article_id" sqlStatement="MySql" identity="true" />