From 3dbefbc9bc504637f58ee4e8de8df0224728631d Mon Sep 17 00:00:00 2001
From: wuxw <928255095@qq.com>
Date: 星期一, 17 十二月 2018 23:08:59 +0800
Subject: [PATCH] 小区服务功能测试完成,包括 添加小区 修改小区 小区成员加入 小区成员退出

---
 java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml |  279 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 278 insertions(+), 1 deletions(-)

diff --git a/java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml b/java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
index 2a7636f..effbe90 100644
--- a/java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
+++ b/java110-config/src/main/resources/mapper/user/UserServiceDaoImplMapper.xml
@@ -2,7 +2,7 @@
 <!DOCTYPE mapper
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="userServiceDAOImpl">
+<mapper namespace="userServiceDaoImpl">
 
     <resultMap type="com.java110.entity.user.Cust" id="custMap">
         <id column="custId" jdbcType="VARCHAR" property="custId"/>
@@ -148,4 +148,281 @@
         and status_cd = '0'
     </select>
 
+    <!-- 淇濆瓨鐢ㄦ埛淇℃伅 -->
+    <insert id="saveBusinessUserInfo" parameterType="map">
+        insert into business_user(b_id,user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,operate)
+        values(#{bId},#{userId},#{name},#{email},#{address},#{password},#{locationCd},#{age},#{sex},#{tel},#{levelCd},#{operate})
+    </insert>
+
+    <!-- 淇濆瓨鐢ㄦ埛灞炴�� -->
+    <insert id="saveBusinessUserAttr" parameterType="map">
+        insert into business_user_attr(b_id,user_id,attr_id,spec_cd,value,operate)
+        values(#{bId},#{userId},#{attrId},#{specCd},#{value},#{operate})
+    </insert>
+    <!-- 瀹炰緥鏁版嵁 -->
+    <insert id="saveUserInfoInstance" parameterType="map">
+        insert into u_user(user_id,name,email,address,password,location_cd,age,sex,tel,level_cd,b_id,status_cd)
+        select bu.user_id,bu.name,bu.email,bu.address,bu.password,bu.location_cd,bu.age,bu.sex,bu.tel,bu.level_cd,bu.b_id,'0' from business_user bu where bu.operate = 'ADD' and bu.b_id=#{b_id}
+    </insert>
+
+    <insert id="saveUserAttrInstance" parameterType="map">
+        insert into u_user_attr(attr_id,user_id,spec_cd,value,b_id,status_cd)
+        select bua.attr_id,bua.user_id,bua.spec_cd,bua.value,bua.b_id,'0' from business_user_attr bua where bua.operate='ADD' and bua.b_id=#{b_id}
+    </insert>
+
+    <update id="updateUserInfoInstance" parameterType="map">
+        update u_user u set u.status_cd = #{statusCd}
+        <if test="newBId != null and newBId != ''">
+            ,u.b_id = #{newBId}
+        </if>
+        <if test="name !=null and name != ''">
+            ,u.name= #{name}
+        </if>
+        <if test="email !=null and email != ''">
+            ,u.email= #{email}
+        </if>
+        <if test="address !=null and address != ''">
+            ,u.address= #{address}
+        </if>
+        <if test="password !=null and password != ''">
+            ,u.password= #{password}
+        </if>
+        <if test="locationCd !=null and locationCd != ''">
+            ,u.location_cd= #{locationCd}
+        </if>
+        <if test="age !=null and age != ''">
+            ,u.age= #{age}
+        </if>
+        <if test="sex !=null and sex != ''">
+            ,u.sex= #{sex}
+        </if>
+        <if test="tel !=null and tel != ''">
+            ,u.tel= #{tel}
+        </if>
+        where 1 = 1
+        <if test="bId != null and bId != ''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId !=''">
+            and u.user_id = #{userId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and u.attr_id = #{attrId}
+        </if>
+    </update>
+
+    <update id="updateUserAttrInstance" parameterType="map">
+        update u_user_attr ua set ua.status_cd = #{statusCd} where 1 = 1
+        <if test="bId != null and bId != ''">
+            and ua.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId !=''">
+            and ua.user_id = #{userId}
+        </if>
+    </update>
+
+
+
+    <!-- 鏌ヨ鐢ㄦ埛淇℃伅 Business -->
+    <select id="queryBusinessUserInfo" parameterType="map" resultType="map">
+        select u.user_id,u.name,u.email,u.address,u.password,u.location_cd,
+        u.age,u.sex,u.tel,u.level_cd,u.b_id,u.operate
+        from business_user u where 1 = 1
+        <if test="operate != null and operate != ''">
+           and u.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and u.user_id = #{userId}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ鐢ㄦ埛灞炴�т俊鎭� Business-->
+    <select id="queryBusinessUserInfoAttrs" parameterType="map" resultType="map">
+        select u.attr_id,u.user_id,u.spec_cd,u.value,u.b_id,u.operate
+        from business_user_attr u where 1 = 1
+        <if test="operate != null and operate != ''">
+            and u.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and u.user_id = #{userId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and u.attr_id = #{attrId}
+        </if>
+    </select>
+
+    <!-- 鏌ヨ鐢ㄦ埛淇℃伅 -->
+    <select id="queryUserInfo" parameterType="map" resultType="map">
+        select u.user_id,u.name,u.email,u.address,u.password,u.location_cd,
+        u.age,u.sex,u.tel,u.level_cd,u.b_id
+        from u_user u where 1= 1
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and u.user_id = #{userId}
+        </if>
+        <if test="statusCd !=null and statusCd != ''">
+            and u.status_cd = #{statusCd}
+        </if>
+    </select>
+
+
+
+    <!-- 鏌ヨ鐢ㄦ埛灞炴�т俊鎭� -->
+    <select id="queryUserInfoAttrs" parameterType="map" resultType="map">
+        select u.attr_id,u.user_id,u.spec_cd,u.value,u.b_id
+        from u_user_attr u where u.status_cd = '0'
+        <if test="bId != null and bId !=''">
+            and u.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and u.user_id = #{userId}
+        </if>
+        <if test="attrId != null and attrId != ''">
+            and u.attr_id = #{attrId}
+        </if>
+    </select>
+
+
+    <!--淇濆瓨鐢ㄦ埛鍦板潃淇℃伅 add by wuxw 2018-06-29 -->
+    <insert id="saveBusinessUserAddress" parameterType="map">
+        insert into business_user_address(address_id,b_id,user_id,tel,postal_code,address,is_default,operate)
+        values(#{addressId},#{bId},#{userId},#{tel},#{postalCode},#{address},#{isDefault},#{operate})
+    </insert>
+
+
+    <!-- 鏌ヨ鐢ㄦ埛鍦板潃淇℃伅 add by wuxw 2018-06-29-->
+    <select id="queryBusinessUserAddress" parameterType="map" resultType="map">
+        select ua.address_id,ua.b_id,ua.user_id,ua.tel,ua.postal_code,ua.address,ua.is_default,ua.operate
+        from business_user_address ua where 1 = 1
+        <if test="operate != null and operate != ''">
+            and ua.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and ua.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and ua.user_id = #{userId}
+        </if>
+    </select>
+
+    <!-- 淇濆瓨鐢ㄦ埛鍦板潃 Business 鏁版嵁鍒� Instance add by wuxw 2018-06-29 -->
+    <insert id="saveUserAddressInstance" parameterType="map">
+        insert into u_user_address(address_id,b_id,user_id,tel,postal_code,address,is_default,status_cd)
+        select ua.address_id,ua.b_id,ua.user_id,ua.tel,ua.postal_code,ua.address,ua.is_default,'0'
+        from business_user_address ua where 1 = 1
+        ua.operate = 'ADD' and ua.b_id=#{b_id}
+    </insert>
+
+    <!-- 浣滃簾鐢ㄦ埛鍦板潃淇℃伅鏁版嵁 add by wuxw 2018-06-29-->
+    <update id="updateUserAddressInstance" parameterType="map">
+        update u_user_address ua set ua.status_cd = #{statusCd} where 1 = 1
+        <if test="bId != null and bId != ''">
+            and ua.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId !=''">
+            and ua.user_id = #{userId}
+        </if>
+        <if test="addressId != null and addressId != ''">
+            and ua.address_id = #{addressId}
+        </if>
+    </update>
+
+
+    <!--淇濆瓨鐢ㄦ埛鎵撴爣淇℃伅 add by wuxw 2018-06-29 -->
+    <insert id="saveBusinessUserTag" parameterType="map">
+        insert into business_user_tag(tag_id,b_id,user_id,tag_cd,remark,operate)
+        values(#{tagId},#{bId},#{userId},#{tagCd},#{remark},#{operate})
+    </insert>
+
+
+    <!-- 鏌ヨ鐢ㄦ埛鍦板潃淇℃伅 add by wuxw 2018-06-29-->
+    <select id="queryBusinessUserTag" parameterType="map" resultType="map">
+        select ut.tag_id,ut.b_id,ut.user_id,ut.tag_cd,ut.remark,ut.operate
+        from business_user_tag ut where 1 = 1
+        <if test="operate != null and operate != ''">
+            and ut.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and ut.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and ut.user_id = #{userId}
+        </if>
+    </select>
+
+    <!-- 淇濆瓨鐢ㄦ埛鍦板潃 Business 鏁版嵁鍒� Instance add by wuxw 2018-06-29 -->
+    <insert id="saveUserTagInstance" parameterType="map">
+        insert into u_user_tag(tag_id,b_id,user_id,tag_cd,remark,status_cd)
+        select ut.tag_id,ut.b_id,ut.user_id,ut.tag_cd,ut.remark,'0'
+        from business_user_tag ut where 1 = 1
+        ut.operate = 'ADD' and ut.b_id=#{b_id}
+    </insert>
+
+    <!-- 浣滃簾鐢ㄦ埛鍦板潃淇℃伅鏁版嵁 add by wuxw 2018-06-29-->
+    <update id="updateUserTagInstance" parameterType="map">
+        update u_user_tag ut set ut.status_cd = #{statusCd} where 1 = 1
+        <if test="bId != null and bId != ''">
+            and ut.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId !=''">
+            and ut.user_id = #{userId}
+        </if>
+        <if test="addressId != null and addressId != ''">
+            and ut.address_id = #{tagId}
+        </if>
+    </update>
+
+
+
+    <!--淇濆瓨鐢ㄦ埛璇佷欢淇℃伅 add by wuxw 2018-06-29 -->
+    <insert id="saveBusinessUserCredentials" parameterType="map">
+        insert into business_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,operate)
+        values(#{credentialsId},#{bId},#{userId},#{credentialsCd},#{value},#{operate})
+    </insert>
+
+
+    <!-- 鏌ヨ鐢ㄦ埛鍦板潃淇℃伅 add by wuxw 2018-06-29-->
+    <select id="queryBusinessUserCredentials" parameterType="map" resultType="map">
+        select uc.credentials_id,uc.b_id,uc.user_id,uc.credentials_cd,uc.value,uc.operate
+        from business_user_credentials uc where 1 = 1
+        <if test="operate != null and operate != ''">
+            and uc.operate = #{operate}
+        </if>
+        <if test="bId != null and bId !=''">
+            and uc.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId != ''">
+            and uc.user_id = #{userId}
+        </if>
+    </select>
+
+    <!-- 淇濆瓨鐢ㄦ埛鍦板潃 Business 鏁版嵁鍒� Instance add by wuxw 2018-06-29 -->
+    <insert id="saveUserCredentialsInstance" parameterType="map">
+        insert into u_user_credentials(credentials_id,b_id,user_id,credentials_cd,value,status_cd)
+        select uc.credentials_id,uc.b_id,uc.user_id,uc.credentials_cd,uc.value,'0'
+        from business_user_credentials uc where 1 = 1
+        uc.operate = 'ADD' and uc.b_id=#{b_id}
+    </insert>
+
+    <!-- 浣滃簾鐢ㄦ埛鍦板潃淇℃伅鏁版嵁 add by wuxw 2018-06-29-->
+    <update id="updateUserCredentialsInstance" parameterType="map">
+        update u_user_credentials uc set uc.status_cd = #{statusCd} where 1 = 1
+        <if test="bId != null and bId != ''">
+            and uc.b_id = #{bId}
+        </if>
+        <if test="userId != null and userId !=''">
+            and uc.user_id = #{userId}
+        </if>
+        <if test="addressId != null and addressId != ''">
+            and uc.credentials_id = #{credentialsId}
+        </if>
+    </update>
 </mapper>

--
Gitblit v1.8.0