From 848567edba2096d32e33f32cace674eca903c99a Mon Sep 17 00:00:00 2001 From: shuzheng <469741414@qq.com> Date: Thu, 13 Oct 2016 14:06:44 +0800 Subject: [PATCH] udpate mapper --- .../java/com/zheng/cms/mapper/BookMapper.xml | 307 +++--------- .../java/com/zheng/cms/mapper/UserMapper.xml | 471 ++++-------------- .../zheng/cms/service/UserServiceTest.java | 4 +- 3 files changed, 161 insertions(+), 621 deletions(-) diff --git a/cms/cms-dao/src/main/java/com/zheng/cms/mapper/BookMapper.xml b/cms/cms-dao/src/main/java/com/zheng/cms/mapper/BookMapper.xml index 00193e3f..3b87763b 100644 --- a/cms/cms-dao/src/main/java/com/zheng/cms/mapper/BookMapper.xml +++ b/cms/cms-dao/src/main/java/com/zheng/cms/mapper/BookMapper.xml @@ -1,30 +1,30 @@ - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + and ${criterion.condition} - + and ${criterion.condition} #{criterion.value} - + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - + and ${criterion.condition} - + #{listItem} @@ -35,25 +35,25 @@ - - - - - - - - + + + + + + + + and ${criterion.condition} - + and ${criterion.condition} #{criterion.value} - + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - + and ${criterion.condition} - + #{listItem} @@ -64,292 +64,115 @@ - + id, userid, name - select - + distinct from book - + - + order by ${orderByClause} - select from book where id = #{id,jdbcType=INTEGER} - + delete from book where id = #{id,jdbcType=INTEGER} - + delete from book - + - + insert into book (id, userid, name ) values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR} ) - + insert into book - - + + id, - + userid, - + name, - - + + #{id,jdbcType=INTEGER}, - + #{userid,jdbcType=INTEGER}, - + #{name,jdbcType=VARCHAR}, - select count(*) from book - + - + update book - - + + id = #{record.id,jdbcType=INTEGER}, - + userid = #{record.userid,jdbcType=INTEGER}, - + name = #{record.name,jdbcType=VARCHAR}, - + - + update book set id = #{record.id,jdbcType=INTEGER}, userid = #{record.userid,jdbcType=INTEGER}, name = #{record.name,jdbcType=VARCHAR} - + - + update book - - + + userid = #{userid,jdbcType=INTEGER}, - + name = #{name,jdbcType=VARCHAR}, where id = #{id,jdbcType=INTEGER} - - update book - set userid = #{userid,jdbcType=INTEGER}, - name = #{name,jdbcType=VARCHAR} - where id = #{id,jdbcType=INTEGER} - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, userid, name - - - - - delete from book - where id = #{id,jdbcType=INTEGER} - - - delete from book - - - - - - insert into book (id, userid, name - ) - values (#{id,jdbcType=INTEGER}, #{userid,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR} - ) - - - insert into book - - - id, - - - userid, - - - name, - - - - - #{id,jdbcType=INTEGER}, - - - #{userid,jdbcType=INTEGER}, - - - #{name,jdbcType=VARCHAR}, - - - - - - update book - - - id = #{record.id,jdbcType=INTEGER}, - - - userid = #{record.userid,jdbcType=INTEGER}, - - - name = #{record.name,jdbcType=VARCHAR}, - - - - - - - - update book - set id = #{record.id,jdbcType=INTEGER}, - userid = #{record.userid,jdbcType=INTEGER}, - name = #{record.name,jdbcType=VARCHAR} - - - - - - update book - - - userid = #{userid,jdbcType=INTEGER}, - - - name = #{name,jdbcType=VARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - + update book set userid = #{userid,jdbcType=INTEGER}, name = #{name,jdbcType=VARCHAR} diff --git a/cms/cms-dao/src/main/java/com/zheng/cms/mapper/UserMapper.xml b/cms/cms-dao/src/main/java/com/zheng/cms/mapper/UserMapper.xml index 968b7bc4..82bfbc4b 100644 --- a/cms/cms-dao/src/main/java/com/zheng/cms/mapper/UserMapper.xml +++ b/cms/cms-dao/src/main/java/com/zheng/cms/mapper/UserMapper.xml @@ -1,36 +1,36 @@ - - - - - - - - - - + + + + + + + + + + - - + + - - - - - - - - + + + + + + + + and ${criterion.condition} - + and ${criterion.condition} #{criterion.value} - + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - + and ${criterion.condition} - + #{listItem} @@ -41,25 +41,25 @@ - - - - - - - - + + + + + + + + and ${criterion.condition} - + and ${criterion.condition} #{criterion.value} - + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - + and ${criterion.condition} - + #{listItem} @@ -70,43 +70,43 @@ - + id, username, password, nickname, sex, ctime - + content - select - + distinct , from user - + - + order by ${orderByClause} - select - + distinct from user - + - + order by ${orderByClause} - select , @@ -114,17 +114,17 @@ from user where id = #{id,jdbcType=INTEGER} - + delete from user where id = #{id,jdbcType=INTEGER} - + delete from user - + - + insert into user (id, username, password, nickname, sex, ctime, content) @@ -132,91 +132,91 @@ #{nickname,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT}, #{content,jdbcType=LONGVARCHAR}) - + insert into user - - + + id, - + username, - + password, - + nickname, - + sex, - + ctime, - + content, - - + + #{id,jdbcType=INTEGER}, - + #{username,jdbcType=VARCHAR}, - + #{password,jdbcType=VARCHAR}, - + #{nickname,jdbcType=VARCHAR}, - + #{sex,jdbcType=INTEGER}, - + #{ctime,jdbcType=BIGINT}, - + #{content,jdbcType=LONGVARCHAR}, - select count(*) from user - + - + update user - - + + id = #{record.id,jdbcType=INTEGER}, - + username = #{record.username,jdbcType=VARCHAR}, - + password = #{record.password,jdbcType=VARCHAR}, - + nickname = #{record.nickname,jdbcType=VARCHAR}, - + sex = #{record.sex,jdbcType=INTEGER}, - + ctime = #{record.ctime,jdbcType=BIGINT}, - + content = #{record.content,jdbcType=LONGVARCHAR}, - + - + update user set id = #{record.id,jdbcType=INTEGER}, username = #{record.username,jdbcType=VARCHAR}, @@ -225,11 +225,11 @@ sex = #{record.sex,jdbcType=INTEGER}, ctime = #{record.ctime,jdbcType=BIGINT}, content = #{record.content,jdbcType=LONGVARCHAR} - + - + update user set id = #{record.id,jdbcType=INTEGER}, username = #{record.username,jdbcType=VARCHAR}, @@ -237,35 +237,35 @@ nickname = #{record.nickname,jdbcType=VARCHAR}, sex = #{record.sex,jdbcType=INTEGER}, ctime = #{record.ctime,jdbcType=BIGINT} - + - + update user - - + + username = #{username,jdbcType=VARCHAR}, - + password = #{password,jdbcType=VARCHAR}, - + nickname = #{nickname,jdbcType=VARCHAR}, - + sex = #{sex,jdbcType=INTEGER}, - + ctime = #{ctime,jdbcType=BIGINT}, - + content = #{content,jdbcType=LONGVARCHAR}, where id = #{id,jdbcType=INTEGER} - + update user set username = #{username,jdbcType=VARCHAR}, password = #{password,jdbcType=VARCHAR}, @@ -275,290 +275,7 @@ content = #{content,jdbcType=LONGVARCHAR} where id = #{id,jdbcType=INTEGER} - - update user - set username = #{username,jdbcType=VARCHAR}, - password = #{password,jdbcType=VARCHAR}, - nickname = #{nickname,jdbcType=VARCHAR}, - sex = #{sex,jdbcType=INTEGER}, - ctime = #{ctime,jdbcType=BIGINT} - where id = #{id,jdbcType=INTEGER} - - - - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - - - - - - - - and ${criterion.condition} - - - and ${criterion.condition} #{criterion.value} - - - and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} - - - and ${criterion.condition} - - #{listItem} - - - - - - - - - - - id, username, password, nickname, sex, ctime - - - content - - - - - - delete from user - where id = #{id,jdbcType=INTEGER} - - - delete from user - - - - - - insert into user (id, username, password, - nickname, sex, ctime, - content) - values (#{id,jdbcType=INTEGER}, #{username,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, - #{nickname,jdbcType=VARCHAR}, #{sex,jdbcType=INTEGER}, #{ctime,jdbcType=BIGINT}, - #{content,jdbcType=LONGVARCHAR}) - - - insert into user - - - id, - - - username, - - - password, - - - nickname, - - - sex, - - - ctime, - - - content, - - - - - #{id,jdbcType=INTEGER}, - - - #{username,jdbcType=VARCHAR}, - - - #{password,jdbcType=VARCHAR}, - - - #{nickname,jdbcType=VARCHAR}, - - - #{sex,jdbcType=INTEGER}, - - - #{ctime,jdbcType=BIGINT}, - - - #{content,jdbcType=LONGVARCHAR}, - - - - - - update user - - - id = #{record.id,jdbcType=INTEGER}, - - - username = #{record.username,jdbcType=VARCHAR}, - - - password = #{record.password,jdbcType=VARCHAR}, - - - nickname = #{record.nickname,jdbcType=VARCHAR}, - - - sex = #{record.sex,jdbcType=INTEGER}, - - - ctime = #{record.ctime,jdbcType=BIGINT}, - - - content = #{record.content,jdbcType=LONGVARCHAR}, - - - - - - - - update user - set id = #{record.id,jdbcType=INTEGER}, - username = #{record.username,jdbcType=VARCHAR}, - password = #{record.password,jdbcType=VARCHAR}, - nickname = #{record.nickname,jdbcType=VARCHAR}, - sex = #{record.sex,jdbcType=INTEGER}, - ctime = #{record.ctime,jdbcType=BIGINT}, - content = #{record.content,jdbcType=LONGVARCHAR} - - - - - - update user - set id = #{record.id,jdbcType=INTEGER}, - username = #{record.username,jdbcType=VARCHAR}, - password = #{record.password,jdbcType=VARCHAR}, - nickname = #{record.nickname,jdbcType=VARCHAR}, - sex = #{record.sex,jdbcType=INTEGER}, - ctime = #{record.ctime,jdbcType=BIGINT} - - - - - - update user - - - username = #{username,jdbcType=VARCHAR}, - - - password = #{password,jdbcType=VARCHAR}, - - - nickname = #{nickname,jdbcType=VARCHAR}, - - - sex = #{sex,jdbcType=INTEGER}, - - - ctime = #{ctime,jdbcType=BIGINT}, - - - content = #{content,jdbcType=LONGVARCHAR}, - - - where id = #{id,jdbcType=INTEGER} - - - update user - set username = #{username,jdbcType=VARCHAR}, - password = #{password,jdbcType=VARCHAR}, - nickname = #{nickname,jdbcType=VARCHAR}, - sex = #{sex,jdbcType=INTEGER}, - ctime = #{ctime,jdbcType=BIGINT}, - content = #{content,jdbcType=LONGVARCHAR} - where id = #{id,jdbcType=INTEGER} - - + update user set username = #{username,jdbcType=VARCHAR}, password = #{password,jdbcType=VARCHAR}, diff --git a/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java b/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java index 78ca9fec..0fefb556 100644 --- a/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java +++ b/cms/cms-service/src/test/java/com/zheng/cms/service/UserServiceTest.java @@ -31,10 +31,10 @@ public class UserServiceTest { public void index() { // 自定义接口调用 UserVO userVO = userService.selectUserWithBook(1); - System.out.println(userVO.getBooks().size()); + System.out.println(null == userVO ? "null" : userVO.getBooks().size()); // 自动生成接口调用 User user = userService.getMapper().selectByPrimaryKey(1); - System.out.println(user.getNickname()); + System.out.println(null == user ? "null" :user.getNickname()); } }