|
@@ -98,25 +98,16 @@ public class WXCpDepartUtil {
|
|
return depatmentId;
|
|
return depatmentId;
|
|
}
|
|
}
|
|
|
|
|
|
- public static Long createOrUpdate(Long id, Long parentId, String name) throws WxErrorException {
|
|
|
|
- if(id == null) {
|
|
|
|
- Map<String, Long> map = getChildDepartMap(parentId);
|
|
|
|
- Long depatmentId = map.get(name);
|
|
|
|
- if (depatmentId == null) {
|
|
|
|
- WxCpDepart depart = new WxCpDepart();
|
|
|
|
- depart.setName(name);
|
|
|
|
- depart.setParentId(parentId);
|
|
|
|
- depatmentId = departService.create(depart);
|
|
|
|
- }
|
|
|
|
- return depatmentId;
|
|
|
|
- } else {
|
|
|
|
|
|
+ public static Long createOrUpdate(Long parentId, String name) throws WxErrorException {
|
|
|
|
+ Map<String, Long> map = getChildDepartMap(parentId);
|
|
|
|
+ Long depatmentId = map.get(name);
|
|
|
|
+ if (depatmentId == null) {
|
|
WxCpDepart depart = new WxCpDepart();
|
|
WxCpDepart depart = new WxCpDepart();
|
|
- depart.setId(id);
|
|
|
|
depart.setName(name);
|
|
depart.setName(name);
|
|
depart.setParentId(parentId);
|
|
depart.setParentId(parentId);
|
|
- departService.update(depart);
|
|
|
|
- return id;
|
|
|
|
|
|
+ depatmentId = departService.create(depart);
|
|
}
|
|
}
|
|
|
|
+ return depatmentId;
|
|
}
|
|
}
|
|
|
|
|
|
public static List<WxCpDepart> getAllChildDeparts(Long id) throws WxErrorException {
|
|
public static List<WxCpDepart> getAllChildDeparts(Long id) throws WxErrorException {
|