|
@@ -74,7 +74,7 @@ public class WxUserService extends BaseService {
|
|
|
wxUserDepart.setFourthDepartName(departs.get(3).getName());
|
|
|
wxUserDepart.setFourthDepartId(departs.get(3).getId());
|
|
|
}
|
|
|
- dbUserDepart = selectWxUserDepart(userId, departId);
|
|
|
+ dbUserDepart = selectWxUserDepartByUserIdAndDepartId(userId, departId);
|
|
|
if (dbUserDepart == null) {
|
|
|
save("WxUserMapper.saveWxUserDepart", wxUserDepart);
|
|
|
} else {
|
|
@@ -84,9 +84,14 @@ public class WxUserService extends BaseService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public WxUserDepart selectWxUserDepart(String userId, Long departId) throws Exception {
|
|
|
+ public WxUserDepart selectWxUserDepartByUserIdAndDepartId(String userId, Long departId) throws Exception {
|
|
|
WxUserDepart wxUserDepart = WxUserDepart.builder().userId(userId).departId(departId).build();
|
|
|
- return (WxUserDepart) findObject("WxUserMapper.selectWxUserDepart", wxUserDepart);
|
|
|
+ return (WxUserDepart) findObject("WxUserMapper.selectWxUserDepartByUserIdAndDepartId", wxUserDepart);
|
|
|
+ }
|
|
|
+
|
|
|
+ @SuppressWarnings("unchecked")
|
|
|
+ public List<WxUserDepart> selectWxUserDepartsByUserId(String userId) throws Exception {
|
|
|
+ return (List<WxUserDepart>) findObject("WxUserMapper.selectWxUserDepartsByUserId", userId);
|
|
|
}
|
|
|
|
|
|
public WxUser selectById(String userId) throws Exception {
|
|
@@ -104,4 +109,15 @@ public class WxUserService extends BaseService {
|
|
|
public List<String> selectAllUserIds() throws Exception {
|
|
|
return (List<String>) findList("WxUserMapper.selectAllUserIds", null);
|
|
|
}
|
|
|
+
|
|
|
+ public String getFullDepartName(String userId) throws Exception {
|
|
|
+ List<WxUserDepart> wxUserDeparts = selectWxUserDepartsByUserId(userId);
|
|
|
+ StringBuffer sb = new StringBuffer();
|
|
|
+ for(WxUserDepart wxUserDepart : wxUserDeparts) {
|
|
|
+ if(sb.indexOf(wxUserDepart.getFullDepartName()) < 0) {
|
|
|
+ sb.append(wxUserDepart.getFullDepartName()).append(";");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return sb.substring(0, sb.length() - 1);
|
|
|
+ }
|
|
|
}
|