傅行帆 6 years ago
parent
commit
442a62aac5

+ 4
- 4
CODE/smart-community/property-api/src/main/java/com/community/huiju/dao/ToCommunitiesMapper.java View File

19
 public interface ToCommunitiesMapper extends BaseMapper<ToCommunities> {
19
 public interface ToCommunitiesMapper extends BaseMapper<ToCommunities> {
20
 
20
 
21
     /**
21
     /**
22
-     * 根据 用户Id 查询出
23
-     * @param userId
22
+     * 根据 电话号码 查询出
23
+     * @param phone
24
      * @return
24
      * @return
25
      */
25
      */
26
-    @Select("SELECT tc.* FROM tp_user_community tuc LEFT JOIN to_communities tc on tuc.community_id = tc.id WHERE tuc.tp_user_id=#{userId}")
27
-    List<ToCommunities> selectUserById(Integer userId);
26
+    @Select("SELECT tc.* FROM tp_user tu LEFT JOIN to_communities tc ON tu.community_id = tc.id WHERE tu.login_name = #{phone}")
27
+    List<ToCommunities> selectUserById(String phone);
28
 
28
 
29
 }
29
 }

+ 4
- 22
CODE/smart-community/property-api/src/main/java/com/community/huiju/service/impl/UserServiceImpl.java View File

67
         // 查询用户
67
         // 查询用户
68
         QueryWrapper<User> queryWrapper = new QueryWrapper<>();
68
         QueryWrapper<User> queryWrapper = new QueryWrapper<>();
69
         queryWrapper.eq("login_name", phone);
69
         queryWrapper.eq("login_name", phone);
70
+        queryWrapper.eq("community_id", communityId);
70
         User user = userMapper.selectOne(queryWrapper) ;
71
         User user = userMapper.selectOne(queryWrapper) ;
71
         if (null == user) {
72
         if (null == user) {
72
             responseBean.addError("当前手机号不存在, 请联系运营人员!");
73
             responseBean.addError("当前手机号不存在, 请联系运营人员!");
73
             return responseBean;
74
             return responseBean;
74
         }
75
         }
75
 
76
 
76
-        // 查询这个用户是否有这个小区的管理
77
-        QueryWrapper<TpUserCommunity> userCommunityQueryWrapper = new QueryWrapper<>();
78
-        userCommunityQueryWrapper.eq("tp_user_id", user.getId());
79
-        userCommunityQueryWrapper.eq("community_id", communityId);
80
-        TpUserCommunity tpUserCommunity = tpUserCommunityMapper.selectOne(userCommunityQueryWrapper);
81
-        if (null == tpUserCommunity) {
82
-            responseBean.addError("当前手机号未绑定该社区");
83
-            return responseBean;
84
-        }
85
-
86
         UserVO userVO = new UserVO();
77
         UserVO userVO = new UserVO();
87
-
88
-        // 设置为当前小区Id
89
-        user.setCommunityId(tpUserCommunity.getCommunityId());
90
-
91
         // 查询该用户的权限
78
         // 查询该用户的权限
92
         // 获取用户权限
79
         // 获取用户权限
93
         getUserRole(user,userVO);
80
         getUserRole(user,userVO);
104
         checkPhoneAndCode(phone, code);
91
         checkPhoneAndCode(phone, code);
105
 
92
 
106
         // 获取这个用户所管理的小区
93
         // 获取这个用户所管理的小区
107
-        // 查询用户
108
-        QueryWrapper<User> queryWrapper = new QueryWrapper<>();
109
-        queryWrapper.eq("login_name", phone);
110
-        User user = userMapper.selectOne(queryWrapper);
111
-        if (null == user) {
94
+        List<ToCommunities> toCommunities = toCommunitiesMapper.selectUserById(phone);
95
+        if (toCommunities.size() < 1) {
112
             responseBean.addError("当前手机号不存在, 请联系运营人员!");
96
             responseBean.addError("当前手机号不存在, 请联系运营人员!");
113
             return responseBean;
97
             return responseBean;
114
         }
98
         }
115
-
116
-        List<ToCommunities> toCommunities = toCommunitiesMapper.selectUserById(user.getId());
99
+        
117
         responseBean.addSuccess(toCommunities);
100
         responseBean.addSuccess(toCommunities);
118
-
119
         return responseBean;
101
         return responseBean;
120
     }
102
     }
121
 
103
 

+ 5
- 3
文档/MYSQL/smartCommunity.pdb View File

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1546498194" Name="smartCommunity" Objects="713" Symbols="81" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
2
+<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1546501440" Name="smartCommunity" Objects="713" Symbols="81" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
3
 <!-- do not edit this file -->
3
 <!-- do not edit this file -->
4
 
4
 
5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
6020
 </o:TableSymbol>
6020
 </o:TableSymbol>
6021
 <o:TableSymbol Id="o165">
6021
 <o:TableSymbol Id="o165">
6022
 <a:CreationDate>1546498159</a:CreationDate>
6022
 <a:CreationDate>1546498159</a:CreationDate>
6023
-<a:ModificationDate>1546498194</a:ModificationDate>
6023
+<a:ModificationDate>1546501440</a:ModificationDate>
6024
 <a:IconMode>-1</a:IconMode>
6024
 <a:IconMode>-1</a:IconMode>
6025
-<a:Rect>((94054,8344), (98853,12343))</a:Rect>
6025
+<a:Rect>((90981,1211), (104097,16647))</a:Rect>
6026
+<a:AutoAdjustToText>0</a:AutoAdjustToText>
6026
 <a:LineColor>12615680</a:LineColor>
6027
 <a:LineColor>12615680</a:LineColor>
6027
 <a:FillColor>16570034</a:FillColor>
6028
 <a:FillColor>16570034</a:FillColor>
6028
 <a:ShadowColor>12632256</a:ShadowColor>
6029
 <a:ShadowColor>12632256</a:ShadowColor>
6039
 <a:BrushStyle>6</a:BrushStyle>
6040
 <a:BrushStyle>6</a:BrushStyle>
6040
 <a:GradientFillMode>65</a:GradientFillMode>
6041
 <a:GradientFillMode>65</a:GradientFillMode>
6041
 <a:GradientEndColor>16777215</a:GradientEndColor>
6042
 <a:GradientEndColor>16777215</a:GradientEndColor>
6043
+<a:ManuallyResized>1</a:ManuallyResized>
6042
 <c:Object>
6044
 <c:Object>
6043
 <o:Table Ref="o166"/>
6045
 <o:Table Ref="o166"/>
6044
 </c:Object>
6046
 </c:Object>

+ 5
- 3
文档/MYSQL/smartCommunity.pdm View File

1
 <?xml version="1.0" encoding="UTF-8"?>
1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1546498194" Name="smartCommunity" Objects="713" Symbols="81" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
2
+<?PowerDesigner AppLocale="UTF16" ID="{1EFA7B8F-E5BE-422B-A0AE-B907AA87924F}" Label="" LastModificationDate="1546501440" Name="smartCommunity" Objects="713" Symbols="81" Target="MySQL 5.0" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="16.5.0.3982"?>
3
 <!-- do not edit this file -->
3
 <!-- do not edit this file -->
4
 
4
 
5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
5
 <Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
6020
 </o:TableSymbol>
6020
 </o:TableSymbol>
6021
 <o:TableSymbol Id="o165">
6021
 <o:TableSymbol Id="o165">
6022
 <a:CreationDate>1546498159</a:CreationDate>
6022
 <a:CreationDate>1546498159</a:CreationDate>
6023
-<a:ModificationDate>1546498194</a:ModificationDate>
6023
+<a:ModificationDate>1546501440</a:ModificationDate>
6024
 <a:IconMode>-1</a:IconMode>
6024
 <a:IconMode>-1</a:IconMode>
6025
-<a:Rect>((94054,8344), (98853,12343))</a:Rect>
6025
+<a:Rect>((90981,1211), (104097,16647))</a:Rect>
6026
+<a:AutoAdjustToText>0</a:AutoAdjustToText>
6026
 <a:LineColor>12615680</a:LineColor>
6027
 <a:LineColor>12615680</a:LineColor>
6027
 <a:FillColor>16570034</a:FillColor>
6028
 <a:FillColor>16570034</a:FillColor>
6028
 <a:ShadowColor>12632256</a:ShadowColor>
6029
 <a:ShadowColor>12632256</a:ShadowColor>
6039
 <a:BrushStyle>6</a:BrushStyle>
6040
 <a:BrushStyle>6</a:BrushStyle>
6040
 <a:GradientFillMode>65</a:GradientFillMode>
6041
 <a:GradientFillMode>65</a:GradientFillMode>
6041
 <a:GradientEndColor>16777215</a:GradientEndColor>
6042
 <a:GradientEndColor>16777215</a:GradientEndColor>
6043
+<a:ManuallyResized>1</a:ManuallyResized>
6042
 <c:Object>
6044
 <c:Object>
6043
 <o:Table Ref="o166"/>
6045
 <o:Table Ref="o166"/>
6044
 </c:Object>
6046
 </c:Object>