diff --git a/cms/cms-service/pom.xml b/cms/cms-service/pom.xml
new file mode 100644
index 00000000..c31c97af
--- /dev/null
+++ b/cms/cms-service/pom.xml
@@ -0,0 +1,50 @@
+
+
+ cms
+ com.zheng
+ 1.0.0
+
+ 4.0.0
+
+ cms-service
+ jar
+
+ cms-service
+ http://www.zhangshuzheng.cn
+
+
+ UTF-8
+
+
+
+
+ junit
+ junit
+ 4.12
+ test
+
+
+ com.zheng
+ cms-dao
+ 1.0.0
+ jar
+
+
+
+
+ cms-service
+
+
+ src/main/java
+
+ **/*.xml
+
+ true
+
+
+ src/main/resources
+
+
+
+
diff --git a/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.java b/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.java
new file mode 100644
index 00000000..32588257
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.java
@@ -0,0 +1,25 @@
+package com.zheng.mapper;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.stereotype.Repository;
+
+import com.zheng.model.User;
+import com.zheng.model.UserVO;
+
+/**
+ * 用户mapper
+ * @author shuzheng
+ * @date 2016年7月6日 下午6:05:54
+ */
+@Repository
+public interface UserVOMapper extends UserMapper {
+
+ UserVO selectUserWithBook(int id);
+
+ List selectAll(Map map);
+
+ void insertAutoKey(User user);
+
+}
\ No newline at end of file
diff --git a/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.xml b/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.xml
new file mode 100644
index 00000000..b4c6104f
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/mapper/UserVOMapper.xml
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insert into
+ user
+
+ id,
+ username,
+ password,
+ nickname,
+ sex,
+ ctime,
+
+
+ #{id,jdbcType=INTEGER},
+ #{username,jdbcType=VARCHAR},
+ #{password,jdbcType=VARCHAR},
+ #{nickname,jdbcType=VARCHAR},
+ #{sex,jdbcType=INTEGER},
+ #{ctime,jdbcType=BIGINT},
+
+
+
+
+
\ No newline at end of file
diff --git a/cms/cms-service/src/main/java/com/zheng/model/UserVO.java b/cms/cms-service/src/main/java/com/zheng/model/UserVO.java
new file mode 100644
index 00000000..91a18885
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/model/UserVO.java
@@ -0,0 +1,22 @@
+package com.zheng.model;
+
+import java.awt.print.Book;
+import java.util.List;
+
+/**
+ * 用户VO
+ * @author shuzheng
+ * @date 2016年7月6日 下午6:06:36
+ */
+public class UserVO extends User {
+
+ private List books;
+
+ public List getBooks() {
+ return books;
+ }
+
+ public void setBooks(List books) {
+ this.books = books;
+ }
+}
diff --git a/cms/cms-service/src/main/java/com/zheng/service/BaseService.java b/cms/cms-service/src/main/java/com/zheng/service/BaseService.java
new file mode 100644
index 00000000..c9cc16be
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/service/BaseService.java
@@ -0,0 +1,16 @@
+package com.zheng.service;
+
+/**
+ * baseService接口
+ * @author shuzheng
+ * @date 2016年7月7日 上午9:58:23
+ */
+public interface BaseService {
+
+ /**
+ * 获取基本操作mapper
+ * @return
+ */
+ Mapper getMapper();
+
+}
\ No newline at end of file
diff --git a/cms/cms-service/src/main/java/com/zheng/service/UserService.java b/cms/cms-service/src/main/java/com/zheng/service/UserService.java
new file mode 100644
index 00000000..ff7284e9
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/service/UserService.java
@@ -0,0 +1,37 @@
+package com.zheng.service;
+
+import java.util.List;
+import java.util.Map;
+
+import com.zheng.mapper.UserMapper;
+import com.zheng.model.User;
+import com.zheng.model.UserVO;
+
+/**
+ * 用户service接口
+ * @author shuzheng
+ * @date 2016年7月6日 下午6:03:45
+ */
+public interface UserService extends BaseService {
+
+ /**
+ * 获取带book数据的用户
+ * @param id
+ * @return
+ */
+ UserVO selectUserWithBook(int id);
+
+ /**
+ * 根据条件获取用户列表
+ * @param map
+ * @return
+ */
+ List selectAll(Map map);
+
+ /**
+ * 插入用户并返回主键
+ * @param user
+ */
+ void insertAutoKey(User user);
+
+}
\ No newline at end of file
diff --git a/cms/cms-service/src/main/java/com/zheng/service/impl/UserServiceImpl.java b/cms/cms-service/src/main/java/com/zheng/service/impl/UserServiceImpl.java
new file mode 100644
index 00000000..9d7f849e
--- /dev/null
+++ b/cms/cms-service/src/main/java/com/zheng/service/impl/UserServiceImpl.java
@@ -0,0 +1,70 @@
+package com.zheng.service.impl;
+
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.zheng.mapper.UserMapper;
+import com.zheng.mapper.UserVOMapper;
+import com.zheng.model.User;
+import com.zheng.model.UserVO;
+import com.zheng.service.UserService;
+
+/**
+ * 用户service实现
+ * @author shuzheng
+ * @date 2016年7月6日 下午6:07:58
+ */
+@Service
+@Transactional
+public class UserServiceImpl implements UserService {
+
+ @Autowired
+ private UserMapper userMapper;
+
+ @Autowired
+ private UserVOMapper userVOMapper;
+
+ /**
+ * 获取基本操作mapper
+ * @return
+ */
+ @Override
+ public UserMapper getMapper() {
+ return userMapper;
+ }
+
+ /**
+ * 获取带book数据的用户
+ * @param id
+ * @return
+ */
+ @Override
+ public UserVO selectUserWithBook(int id) {
+ return userVOMapper.selectUserWithBook(id);
+ }
+
+ /**
+ * 根据条件获取用户列表
+ * @param map
+ * @return
+ */
+ @Override
+ public List selectAll(Map map) {
+ return userVOMapper.selectAll(map);
+ }
+
+ /**
+ * 插入用户并返回主键
+ * @param user
+ */
+ @Override
+ public void insertAutoKey(User user) {
+ userVOMapper.insertAutoKey(user);
+ }
+
+
+}
\ No newline at end of file
diff --git a/cms/cms-service/src/test/java/com/zheng/service/UserServiceTest.java b/cms/cms-service/src/test/java/com/zheng/service/UserServiceTest.java
new file mode 100644
index 00000000..67426cfc
--- /dev/null
+++ b/cms/cms-service/src/test/java/com/zheng/service/UserServiceTest.java
@@ -0,0 +1,40 @@
+package com.zheng.service;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.test.context.transaction.TransactionConfiguration;
+
+import com.zheng.mapper.UserMapper;
+import com.zheng.model.User;
+import com.zheng.model.UserVO;
+
+/**
+ * 测试service
+ * @author shuzheng
+ * @date 2016年7月6日 下午6:07:43
+ */
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration({
+ "classpath:applicationContext.xml",
+ "classpath:applicationContext-jdbc.xml"
+})
+@TransactionConfiguration(transactionManager = "transactionManager", defaultRollback = true)
+public class UserServiceTest {
+
+ @Autowired
+ private UserService userService;
+
+ @Test
+ public void index() {
+ // 自定义接口调用
+ UserVO userVO = userService.selectUserWithBook(1);
+ System.out.println(userVO.getBooks().size());
+ // 自动生成接口调用
+ User user2 = userService.getMapper().selectByPrimaryKey(1);
+ System.out.println(user2.getNickname());
+ }
+
+}
diff --git a/cms/pom.xml b/cms/pom.xml
index a8c082d1..0f2e9bbc 100644
--- a/cms/pom.xml
+++ b/cms/pom.xml
@@ -16,5 +16,6 @@
cms-dao
+ cms-service
\ No newline at end of file