Browse Source

community

傅行帆 6 years ago
parent
commit
abf87f5ad1

+ 40
- 1
CODE/smart-community/operate-api/src/main/java/com/community/huiju/controller/CommunityController.java View File

9
 import io.swagger.annotations.ApiOperation;
9
 import io.swagger.annotations.ApiOperation;
10
 import org.springframework.beans.factory.annotation.Autowired;
10
 import org.springframework.beans.factory.annotation.Autowired;
11
 import org.springframework.cloud.context.config.annotation.RefreshScope;
11
 import org.springframework.cloud.context.config.annotation.RefreshScope;
12
+import org.springframework.web.bind.annotation.PathVariable;
12
 import org.springframework.web.bind.annotation.RequestBody;
13
 import org.springframework.web.bind.annotation.RequestBody;
13
 import org.springframework.web.bind.annotation.RequestMapping;
14
 import org.springframework.web.bind.annotation.RequestMapping;
14
 import org.springframework.web.bind.annotation.RequestMethod;
15
 import org.springframework.web.bind.annotation.RequestMethod;
32
 	
33
 	
33
 	@ApiOperation(value = "根据搜索条件获取小区列表", notes = "根据搜索条件获取小区列表")
34
 	@ApiOperation(value = "根据搜索条件获取小区列表", notes = "根据搜索条件获取小区列表")
34
 	@ApiImplicitParams({
35
 	@ApiImplicitParams({
35
-			@ApiImplicitParam(paramType = "body", name = "ToCommunities", dataType = "String",value =
36
+			@ApiImplicitParam(paramType = "body", name = "toCommunities", dataType = "String",value =
36
 					"id:社区编号,communityName:社区名称(模糊查询), provinceId:省份id,cityId:城市id,districtId:区县id"),
37
 					"id:社区编号,communityName:社区名称(模糊查询), provinceId:省份id,cityId:城市id,districtId:区县id"),
37
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
38
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageNum", value = "分页第几页"),
38
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
39
 			@ApiImplicitParam(paramType = "query", dataType = "integer", name = "pageSize", value = "分页每页长度")
46
 		responseBean.addSuccess(communitiesList);
47
 		responseBean.addSuccess(communitiesList);
47
 		return responseBean;
48
 		return responseBean;
48
 	}
49
 	}
50
+	
51
+	@ApiOperation(value = "添加小区", notes = "添加小区")
52
+	@ApiImplicitParams({
53
+			@ApiImplicitParam(paramType = "body", name = "toCommunities", dataType = "String",value =
54
+					"communityName:社区名称,communityAlias:小区别名, provinceId:省份id,cityId:城市id,districtId:区县id,longitude: 经度,latitude: 纬度,userName:物业端用户名,loginName:物业端登录名")
55
+	})
56
+	@RequestMapping(value = "/community/add",method = RequestMethod.POST)
57
+	public ResponseBean addCommunity(@RequestBody ToCommunities toCommunities){
58
+		ResponseBean responseBean = new ResponseBean();
59
+		Integer size = communityService.addCommunity(toCommunities);
60
+		responseBean.addSuccess(size);
61
+		return responseBean;
62
+	}
63
+	
64
+	@ApiOperation(value = "根据id获取小区", notes = "根据id获取小区")
65
+	@ApiImplicitParams({
66
+			@ApiImplicitParam(paramType = "path", dataType = "integer", name = "id", value = "小区id")
67
+	})
68
+	@RequestMapping(value = "/community/{id}",method = RequestMethod.GET)
69
+	public ResponseBean getCommunityById(@PathVariable("id") Integer id){
70
+		ResponseBean responseBean = new ResponseBean();
71
+		ToCommunities communities = communityService.getCommunityById(id);
72
+		responseBean.addSuccess(communities);
73
+		return responseBean;
74
+	}
75
+	
76
+	@ApiOperation(value = "根据id更新小区数据", notes = "根据id更新小区数据")
77
+	@ApiImplicitParams({
78
+			@ApiImplicitParam(paramType = "body", name = "toCommunities", dataType = "String",value =
79
+					"communityName:社区名称,communityAlias:小区别名, provinceId:省份id,cityId:城市id,districtId:区县id,longitude: 经度,latitude: 纬度,userName:物业端用户名,loginName:物业端登录名")
80
+	})
81
+	@RequestMapping(value = "/community/update",method = RequestMethod.POST)
82
+	public ResponseBean updateCommunityById(@RequestBody ToCommunities toCommunities){
83
+		ResponseBean responseBean = new ResponseBean();
84
+		Integer size = communityService.updateCommunityById(toCommunities);
85
+		responseBean.addSuccess(size);
86
+		return responseBean;
87
+	}
49
 }
88
 }

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TpUserCommunityMapper.java View File

1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpUserCommunity;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TpUserCommunityMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TpUserCommunity record);
11
+
12
+    int insertSelective(TpUserCommunity record);
13
+
14
+    TpUserCommunity selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TpUserCommunity record);
17
+
18
+    int updateByPrimaryKey(TpUserCommunity record);
19
+}

+ 19
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/dao/TpUserMapper.java View File

1
+package com.community.huiju.dao;
2
+
3
+import com.community.huiju.model.TpUser;
4
+import org.apache.ibatis.annotations.Mapper;
5
+
6
+@Mapper
7
+public interface TpUserMapper {
8
+    int deleteByPrimaryKey(Integer id);
9
+
10
+    int insert(TpUser record);
11
+
12
+    int insertSelective(TpUser record);
13
+
14
+    TpUser selectByPrimaryKey(Integer id);
15
+
16
+    int updateByPrimaryKeySelective(TpUser record);
17
+
18
+    int updateByPrimaryKey(TpUser record);
19
+}

+ 20
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/ToCommunities.java View File

16
     private String longitude;
16
     private String longitude;
17
 
17
 
18
     private String latitude;
18
     private String latitude;
19
+    
20
+    private String userName;
21
+    
22
+    private String loginName;
19
 
23
 
20
     public Integer getId() {
24
     public Integer getId() {
21
         return id;
25
         return id;
80
     public void setLatitude(String latitude) {
84
     public void setLatitude(String latitude) {
81
         this.latitude = latitude == null ? null : latitude.trim();
85
         this.latitude = latitude == null ? null : latitude.trim();
82
     }
86
     }
87
+    
88
+    public String getUserName() {
89
+        return userName;
90
+    }
91
+    
92
+    public void setUserName(String userName) {
93
+        this.userName = userName;
94
+    }
95
+    
96
+    public String getLoginName() {
97
+        return loginName;
98
+    }
99
+    
100
+    public void setLoginName(String loginName) {
101
+        this.loginName = loginName;
102
+    }
83
 }
103
 }

+ 135
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TpUser.java View File

1
+package com.community.huiju.model;
2
+
3
+import java.util.Date;
4
+
5
+public class TpUser {
6
+    private Integer id;
7
+
8
+    private Integer communityId;
9
+
10
+    private String userName;
11
+
12
+    private String loginName;
13
+
14
+    private String loginPassword;
15
+
16
+    private String status;
17
+
18
+    private String remark;
19
+
20
+    private String email;
21
+
22
+    private String headPortrait;
23
+
24
+    private Integer createUser;
25
+
26
+    private Date createDate;
27
+
28
+    private Integer updateUser;
29
+
30
+    private Date updateDate;
31
+
32
+    public Integer getId() {
33
+        return id;
34
+    }
35
+
36
+    public void setId(Integer id) {
37
+        this.id = id;
38
+    }
39
+
40
+    public Integer getCommunityId() {
41
+        return communityId;
42
+    }
43
+
44
+    public void setCommunityId(Integer communityId) {
45
+        this.communityId = communityId;
46
+    }
47
+
48
+    public String getUserName() {
49
+        return userName;
50
+    }
51
+
52
+    public void setUserName(String userName) {
53
+        this.userName = userName == null ? null : userName.trim();
54
+    }
55
+
56
+    public String getLoginName() {
57
+        return loginName;
58
+    }
59
+
60
+    public void setLoginName(String loginName) {
61
+        this.loginName = loginName == null ? null : loginName.trim();
62
+    }
63
+
64
+    public String getLoginPassword() {
65
+        return loginPassword;
66
+    }
67
+
68
+    public void setLoginPassword(String loginPassword) {
69
+        this.loginPassword = loginPassword == null ? null : loginPassword.trim();
70
+    }
71
+
72
+    public String getStatus() {
73
+        return status;
74
+    }
75
+
76
+    public void setStatus(String status) {
77
+        this.status = status == null ? null : status.trim();
78
+    }
79
+
80
+    public String getRemark() {
81
+        return remark;
82
+    }
83
+
84
+    public void setRemark(String remark) {
85
+        this.remark = remark == null ? null : remark.trim();
86
+    }
87
+
88
+    public String getEmail() {
89
+        return email;
90
+    }
91
+
92
+    public void setEmail(String email) {
93
+        this.email = email == null ? null : email.trim();
94
+    }
95
+
96
+    public String getHeadPortrait() {
97
+        return headPortrait;
98
+    }
99
+
100
+    public void setHeadPortrait(String headPortrait) {
101
+        this.headPortrait = headPortrait == null ? null : headPortrait.trim();
102
+    }
103
+
104
+    public Integer getCreateUser() {
105
+        return createUser;
106
+    }
107
+
108
+    public void setCreateUser(Integer createUser) {
109
+        this.createUser = createUser;
110
+    }
111
+
112
+    public Date getCreateDate() {
113
+        return createDate;
114
+    }
115
+
116
+    public void setCreateDate(Date createDate) {
117
+        this.createDate = createDate;
118
+    }
119
+
120
+    public Integer getUpdateUser() {
121
+        return updateUser;
122
+    }
123
+
124
+    public void setUpdateUser(Integer updateUser) {
125
+        this.updateUser = updateUser;
126
+    }
127
+
128
+    public Date getUpdateDate() {
129
+        return updateDate;
130
+    }
131
+
132
+    public void setUpdateDate(Date updateDate) {
133
+        this.updateDate = updateDate;
134
+    }
135
+}

+ 33
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/model/TpUserCommunity.java View File

1
+package com.community.huiju.model;
2
+
3
+public class TpUserCommunity {
4
+    private Integer id;
5
+
6
+    private Integer communityId;
7
+
8
+    private Integer tpUserId;
9
+
10
+    public Integer getId() {
11
+        return id;
12
+    }
13
+
14
+    public void setId(Integer id) {
15
+        this.id = id;
16
+    }
17
+
18
+    public Integer getCommunityId() {
19
+        return communityId;
20
+    }
21
+
22
+    public void setCommunityId(Integer communityId) {
23
+        this.communityId = communityId;
24
+    }
25
+
26
+    public Integer getTpUserId() {
27
+        return tpUserId;
28
+    }
29
+
30
+    public void setTpUserId(Integer tpUserId) {
31
+        this.tpUserId = tpUserId;
32
+    }
33
+}

+ 21
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/CommunityServiceI.java View File

14
 	 * @return
14
 	 * @return
15
 	 */
15
 	 */
16
 	List<ToCommunities> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize);
16
 	List<ToCommunities> getCommunitys(ToCommunities toCommunities, Integer pageNum, Integer pageSize);
17
+	
18
+	/**
19
+	 * 添加新的小区
20
+	 * @param toCommunities
21
+	 * @return
22
+	 */
23
+	Integer addCommunity(ToCommunities toCommunities);
24
+	
25
+	/**
26
+	 * 根据id获取详情数据
27
+	 * @param id
28
+	 * @return
29
+	 */
30
+	ToCommunities getCommunityById(Integer id);
31
+	
32
+	/**
33
+	 * 根据小区id更新数据
34
+	 * @param toCommunities
35
+	 * @return
36
+	 */
37
+	Integer updateCommunityById(ToCommunities toCommunities);
17
 }
38
 }

+ 59
- 0
CODE/smart-community/operate-api/src/main/java/com/community/huiju/service/impl/CommunityServiceImpl.java View File

1
 package com.community.huiju.service.impl;
1
 package com.community.huiju.service.impl;
2
 
2
 
3
+import com.community.commom.constant.Constant;
3
 import com.community.huiju.dao.ToCommunitiesMapper;
4
 import com.community.huiju.dao.ToCommunitiesMapper;
5
+import com.community.huiju.dao.TpUserCommunityMapper;
6
+import com.community.huiju.dao.TpUserMapper;
4
 import com.community.huiju.model.ToCommunities;
7
 import com.community.huiju.model.ToCommunities;
8
+import com.community.huiju.model.TpUser;
9
+import com.community.huiju.model.TpUserCommunity;
5
 import com.community.huiju.service.CommunityServiceI;
10
 import com.community.huiju.service.CommunityServiceI;
6
 import com.github.pagehelper.PageHelper;
11
 import com.github.pagehelper.PageHelper;
7
 import org.springframework.beans.factory.annotation.Autowired;
12
 import org.springframework.beans.factory.annotation.Autowired;
8
 import org.springframework.stereotype.Service;
13
 import org.springframework.stereotype.Service;
14
+import org.springframework.transaction.annotation.Transactional;
9
 
15
 
16
+import java.util.Date;
10
 import java.util.List;
17
 import java.util.List;
11
 
18
 
12
 /**
19
 /**
14
  * @date 2018-10-31
21
  * @date 2018-10-31
15
  */
22
  */
16
 @Service("communityService")
23
 @Service("communityService")
24
+@Transactional
17
 public class CommunityServiceImpl implements CommunityServiceI {
25
 public class CommunityServiceImpl implements CommunityServiceI {
18
 	
26
 	
19
 	@Autowired
27
 	@Autowired
20
 	private ToCommunitiesMapper toCommunitiesMapper;
28
 	private ToCommunitiesMapper toCommunitiesMapper;
21
 	
29
 	
30
+	@Autowired
31
+	private TpUserMapper tpUserMapper;
32
+	
33
+	@Autowired
34
+	private TpUserCommunityMapper tpUserCommunityMapper;
35
+	
22
 	/**
36
 	/**
23
 	 * 分页获取小区列表
37
 	 * 分页获取小区列表
24
 	 * @param toCommunities
38
 	 * @param toCommunities
34
 		List<ToCommunities> list = toCommunitiesMapper.selectByCommunityName(toCommunities);
48
 		List<ToCommunities> list = toCommunitiesMapper.selectByCommunityName(toCommunities);
35
 		return list;
49
 		return list;
36
 	}
50
 	}
51
+	
52
+	@Override
53
+	public Integer addCommunity(ToCommunities toCommunities) {
54
+		Integer size = toCommunitiesMapper.insertSelective(toCommunities);
55
+		if (size < 1){
56
+			return 0;
57
+		}
58
+		
59
+		//构建用户信息
60
+		TpUser tpUser = new TpUser();
61
+		tpUser.setCommunityId(toCommunities.getId());
62
+		tpUser.setUserName(toCommunities.getUserName());
63
+		tpUser.setLoginName(toCommunities.getLoginName());
64
+		tpUser.setCreateDate(new Date());
65
+		tpUser.setCreateUser(1);
66
+		tpUser.setStatus(Constant.EFFECTIVE);
67
+		//插入用户信息
68
+		tpUserMapper.insertSelective(tpUser);
69
+		//维护住户端用户与社区关系表
70
+		TpUserCommunity tpUserCommunity = new TpUserCommunity();
71
+		tpUserCommunity.setTpUserId(tpUser.getId());
72
+		tpUserCommunity.setCommunityId(tpUser.getCommunityId());
73
+		tpUserCommunityMapper.insertSelective(tpUserCommunity);
74
+		return size;
75
+	}
76
+	
77
+	/**
78
+	 * 根据详情获取小区数据
79
+	 * @param id
80
+	 * @return
81
+	 */
82
+	@Override
83
+	public ToCommunities getCommunityById(Integer id) {
84
+		return toCommunitiesMapper.selectByPrimaryKey(id);
85
+	}
86
+	
87
+	/**
88
+	 * 根据小区id更新数据
89
+	 * @param toCommunities
90
+	 * @return
91
+	 */
92
+	@Override
93
+	public Integer updateCommunityById(ToCommunities toCommunities) {
94
+		return toCommunitiesMapper.updateByPrimaryKeySelective(toCommunities);
95
+	}
37
 }
96
 }

+ 16
- 2
CODE/smart-community/operate-api/src/main/resources/mapper/ToCommunitiesMapper.xml View File

10
     <result column="district_id" property="districtId" jdbcType="INTEGER" />
10
     <result column="district_id" property="districtId" jdbcType="INTEGER" />
11
     <result column="longitude" property="longitude" jdbcType="VARCHAR" />
11
     <result column="longitude" property="longitude" jdbcType="VARCHAR" />
12
     <result column="latitude" property="latitude" jdbcType="VARCHAR" />
12
     <result column="latitude" property="latitude" jdbcType="VARCHAR" />
13
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
14
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
13
   </resultMap>
15
   </resultMap>
14
   <sql id="Base_Column_List" >
16
   <sql id="Base_Column_List" >
15
     id, community_name, community_alias, province_id, city_id, district_id, longitude, 
17
     id, community_name, community_alias, province_id, city_id, district_id, longitude, 
16
-    latitude
18
+    latitude,user_name,login_name
17
   </sql>
19
   </sql>
18
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
20
   <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
19
     select 
21
     select 
33
       #{provinceId,jdbcType=INTEGER}, #{cityId,jdbcType=INTEGER}, #{districtId,jdbcType=INTEGER}, 
35
       #{provinceId,jdbcType=INTEGER}, #{cityId,jdbcType=INTEGER}, #{districtId,jdbcType=INTEGER}, 
34
       #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR})
36
       #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR})
35
   </insert>
37
   </insert>
36
-  <insert id="insertSelective" parameterType="com.community.huiju.model.ToCommunities" >
38
+  <insert id="insertSelective" parameterType="com.community.huiju.model.ToCommunities" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
37
     insert into to_communities
39
     insert into to_communities
38
     <trim prefix="(" suffix=")" suffixOverrides="," >
40
     <trim prefix="(" suffix=")" suffixOverrides="," >
39
       <if test="id != null" >
41
       <if test="id != null" >
60
       <if test="latitude != null" >
62
       <if test="latitude != null" >
61
         latitude,
63
         latitude,
62
       </if>
64
       </if>
65
+      <if test="userName != null" >
66
+        user_name,
67
+      </if>
68
+      <if test="loginName != null" >
69
+        login_name,
70
+      </if>
63
     </trim>
71
     </trim>
64
     <trim prefix="values (" suffix=")" suffixOverrides="," >
72
     <trim prefix="values (" suffix=")" suffixOverrides="," >
65
       <if test="id != null" >
73
       <if test="id != null" >
86
       <if test="latitude != null" >
94
       <if test="latitude != null" >
87
         #{latitude,jdbcType=VARCHAR},
95
         #{latitude,jdbcType=VARCHAR},
88
       </if>
96
       </if>
97
+      <if test="userName != null" >
98
+        #{userName,jdbcType=VARCHAR},
99
+      </if>
100
+      <if test="loginName != null" >
101
+        #{loginName,jdbcType=VARCHAR},
102
+      </if>
89
     </trim>
103
     </trim>
90
   </insert>
104
   </insert>
91
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToCommunities" >
105
   <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.ToCommunities" >

+ 71
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TpUserCommunityMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TpUserCommunityMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpUserCommunity" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="tp_user_id" property="tpUserId" jdbcType="INTEGER" />
8
+  </resultMap>
9
+  <sql id="Base_Column_List" >
10
+    id, community_id, tp_user_id
11
+  </sql>
12
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
13
+    select 
14
+    <include refid="Base_Column_List" />
15
+    from tp_user_community
16
+    where id = #{id,jdbcType=INTEGER}
17
+  </select>
18
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
19
+    delete from tp_user_community
20
+    where id = #{id,jdbcType=INTEGER}
21
+  </delete>
22
+  <insert id="insert" parameterType="com.community.huiju.model.TpUserCommunity" >
23
+    insert into tp_user_community (id, community_id, tp_user_id
24
+      )
25
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{tpUserId,jdbcType=INTEGER}
26
+      )
27
+  </insert>
28
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpUserCommunity" >
29
+    insert into tp_user_community
30
+    <trim prefix="(" suffix=")" suffixOverrides="," >
31
+      <if test="id != null" >
32
+        id,
33
+      </if>
34
+      <if test="communityId != null" >
35
+        community_id,
36
+      </if>
37
+      <if test="tpUserId != null" >
38
+        tp_user_id,
39
+      </if>
40
+    </trim>
41
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
42
+      <if test="id != null" >
43
+        #{id,jdbcType=INTEGER},
44
+      </if>
45
+      <if test="communityId != null" >
46
+        #{communityId,jdbcType=INTEGER},
47
+      </if>
48
+      <if test="tpUserId != null" >
49
+        #{tpUserId,jdbcType=INTEGER},
50
+      </if>
51
+    </trim>
52
+  </insert>
53
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpUserCommunity" >
54
+    update tp_user_community
55
+    <set >
56
+      <if test="communityId != null" >
57
+        community_id = #{communityId,jdbcType=INTEGER},
58
+      </if>
59
+      <if test="tpUserId != null" >
60
+        tp_user_id = #{tpUserId,jdbcType=INTEGER},
61
+      </if>
62
+    </set>
63
+    where id = #{id,jdbcType=INTEGER}
64
+  </update>
65
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpUserCommunity" >
66
+    update tp_user_community
67
+    set community_id = #{communityId,jdbcType=INTEGER},
68
+      tp_user_id = #{tpUserId,jdbcType=INTEGER}
69
+    where id = #{id,jdbcType=INTEGER}
70
+  </update>
71
+</mapper>

+ 188
- 0
CODE/smart-community/operate-api/src/main/resources/mapper/TpUserMapper.xml View File

1
+<?xml version="1.0" encoding="UTF-8" ?>
2
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
3
+<mapper namespace="com.community.huiju.dao.TpUserMapper" >
4
+  <resultMap id="BaseResultMap" type="com.community.huiju.model.TpUser" >
5
+    <id column="id" property="id" jdbcType="INTEGER" />
6
+    <result column="community_id" property="communityId" jdbcType="INTEGER" />
7
+    <result column="user_name" property="userName" jdbcType="VARCHAR" />
8
+    <result column="login_name" property="loginName" jdbcType="VARCHAR" />
9
+    <result column="login_password" property="loginPassword" jdbcType="VARCHAR" />
10
+    <result column="status" property="status" jdbcType="CHAR" />
11
+    <result column="remark" property="remark" jdbcType="VARCHAR" />
12
+    <result column="email" property="email" jdbcType="VARCHAR" />
13
+    <result column="head_portrait" property="headPortrait" jdbcType="VARCHAR" />
14
+    <result column="create_user" property="createUser" jdbcType="INTEGER" />
15
+    <result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
16
+    <result column="update_user" property="updateUser" jdbcType="INTEGER" />
17
+    <result column="update_date" property="updateDate" jdbcType="TIMESTAMP" />
18
+  </resultMap>
19
+  <sql id="Base_Column_List" >
20
+    id, community_id, user_name, login_name, login_password, status, remark, email, head_portrait, 
21
+    create_user, create_date, update_user, update_date
22
+  </sql>
23
+  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
24
+    select 
25
+    <include refid="Base_Column_List" />
26
+    from tp_user
27
+    where id = #{id,jdbcType=INTEGER}
28
+  </select>
29
+  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
30
+    delete from tp_user
31
+    where id = #{id,jdbcType=INTEGER}
32
+  </delete>
33
+  <insert id="insert" parameterType="com.community.huiju.model.TpUser" >
34
+    insert into tp_user (id, community_id, user_name, 
35
+      login_name, login_password, status, 
36
+      remark, email, head_portrait, 
37
+      create_user, create_date, update_user, 
38
+      update_date)
39
+    values (#{id,jdbcType=INTEGER}, #{communityId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR}, 
40
+      #{loginName,jdbcType=VARCHAR}, #{loginPassword,jdbcType=VARCHAR}, #{status,jdbcType=CHAR}, 
41
+      #{remark,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{headPortrait,jdbcType=VARCHAR}, 
42
+      #{createUser,jdbcType=INTEGER}, #{createDate,jdbcType=TIMESTAMP}, #{updateUser,jdbcType=INTEGER}, 
43
+      #{updateDate,jdbcType=TIMESTAMP})
44
+  </insert>
45
+  <insert id="insertSelective" parameterType="com.community.huiju.model.TpUser" useGeneratedKeys="true" keyProperty="id" keyColumn="id">
46
+    insert into tp_user
47
+    <trim prefix="(" suffix=")" suffixOverrides="," >
48
+      <if test="id != null" >
49
+        id,
50
+      </if>
51
+      <if test="communityId != null" >
52
+        community_id,
53
+      </if>
54
+      <if test="userName != null" >
55
+        user_name,
56
+      </if>
57
+      <if test="loginName != null" >
58
+        login_name,
59
+      </if>
60
+      <if test="loginPassword != null" >
61
+        login_password,
62
+      </if>
63
+      <if test="status != null" >
64
+        status,
65
+      </if>
66
+      <if test="remark != null" >
67
+        remark,
68
+      </if>
69
+      <if test="email != null" >
70
+        email,
71
+      </if>
72
+      <if test="headPortrait != null" >
73
+        head_portrait,
74
+      </if>
75
+      <if test="createUser != null" >
76
+        create_user,
77
+      </if>
78
+      <if test="createDate != null" >
79
+        create_date,
80
+      </if>
81
+      <if test="updateUser != null" >
82
+        update_user,
83
+      </if>
84
+      <if test="updateDate != null" >
85
+        update_date,
86
+      </if>
87
+    </trim>
88
+    <trim prefix="values (" suffix=")" suffixOverrides="," >
89
+      <if test="id != null" >
90
+        #{id,jdbcType=INTEGER},
91
+      </if>
92
+      <if test="communityId != null" >
93
+        #{communityId,jdbcType=INTEGER},
94
+      </if>
95
+      <if test="userName != null" >
96
+        #{userName,jdbcType=VARCHAR},
97
+      </if>
98
+      <if test="loginName != null" >
99
+        #{loginName,jdbcType=VARCHAR},
100
+      </if>
101
+      <if test="loginPassword != null" >
102
+        #{loginPassword,jdbcType=VARCHAR},
103
+      </if>
104
+      <if test="status != null" >
105
+        #{status,jdbcType=CHAR},
106
+      </if>
107
+      <if test="remark != null" >
108
+        #{remark,jdbcType=VARCHAR},
109
+      </if>
110
+      <if test="email != null" >
111
+        #{email,jdbcType=VARCHAR},
112
+      </if>
113
+      <if test="headPortrait != null" >
114
+        #{headPortrait,jdbcType=VARCHAR},
115
+      </if>
116
+      <if test="createUser != null" >
117
+        #{createUser,jdbcType=INTEGER},
118
+      </if>
119
+      <if test="createDate != null" >
120
+        #{createDate,jdbcType=TIMESTAMP},
121
+      </if>
122
+      <if test="updateUser != null" >
123
+        #{updateUser,jdbcType=INTEGER},
124
+      </if>
125
+      <if test="updateDate != null" >
126
+        #{updateDate,jdbcType=TIMESTAMP},
127
+      </if>
128
+    </trim>
129
+  </insert>
130
+  <update id="updateByPrimaryKeySelective" parameterType="com.community.huiju.model.TpUser" >
131
+    update tp_user
132
+    <set >
133
+      <if test="communityId != null" >
134
+        community_id = #{communityId,jdbcType=INTEGER},
135
+      </if>
136
+      <if test="userName != null" >
137
+        user_name = #{userName,jdbcType=VARCHAR},
138
+      </if>
139
+      <if test="loginName != null" >
140
+        login_name = #{loginName,jdbcType=VARCHAR},
141
+      </if>
142
+      <if test="loginPassword != null" >
143
+        login_password = #{loginPassword,jdbcType=VARCHAR},
144
+      </if>
145
+      <if test="status != null" >
146
+        status = #{status,jdbcType=CHAR},
147
+      </if>
148
+      <if test="remark != null" >
149
+        remark = #{remark,jdbcType=VARCHAR},
150
+      </if>
151
+      <if test="email != null" >
152
+        email = #{email,jdbcType=VARCHAR},
153
+      </if>
154
+      <if test="headPortrait != null" >
155
+        head_portrait = #{headPortrait,jdbcType=VARCHAR},
156
+      </if>
157
+      <if test="createUser != null" >
158
+        create_user = #{createUser,jdbcType=INTEGER},
159
+      </if>
160
+      <if test="createDate != null" >
161
+        create_date = #{createDate,jdbcType=TIMESTAMP},
162
+      </if>
163
+      <if test="updateUser != null" >
164
+        update_user = #{updateUser,jdbcType=INTEGER},
165
+      </if>
166
+      <if test="updateDate != null" >
167
+        update_date = #{updateDate,jdbcType=TIMESTAMP},
168
+      </if>
169
+    </set>
170
+    where id = #{id,jdbcType=INTEGER}
171
+  </update>
172
+  <update id="updateByPrimaryKey" parameterType="com.community.huiju.model.TpUser" >
173
+    update tp_user
174
+    set community_id = #{communityId,jdbcType=INTEGER},
175
+      user_name = #{userName,jdbcType=VARCHAR},
176
+      login_name = #{loginName,jdbcType=VARCHAR},
177
+      login_password = #{loginPassword,jdbcType=VARCHAR},
178
+      status = #{status,jdbcType=CHAR},
179
+      remark = #{remark,jdbcType=VARCHAR},
180
+      email = #{email,jdbcType=VARCHAR},
181
+      head_portrait = #{headPortrait,jdbcType=VARCHAR},
182
+      create_user = #{createUser,jdbcType=INTEGER},
183
+      create_date = #{createDate,jdbcType=TIMESTAMP},
184
+      update_user = #{updateUser,jdbcType=INTEGER},
185
+      update_date = #{updateDate,jdbcType=TIMESTAMP}
186
+    where id = #{id,jdbcType=INTEGER}
187
+  </update>
188
+</mapper>

+ 452
- 428
文档/MYSQL/smartCommunity.pdb
File diff suppressed because it is too large
View File


+ 452
- 428
文档/MYSQL/smartCommunity.pdm
File diff suppressed because it is too large
View File