|
@@ -1,10 +1,12 @@
|
|
|
package com.ym.mec.biz.service.impl;
|
|
|
|
|
|
import com.ym.mec.biz.dal.dao.MemberPrivilegesItemDao;
|
|
|
+import com.ym.mec.biz.dal.dao.MemberRankPrivilegesDao;
|
|
|
import com.ym.mec.biz.dal.entity.MemberPrivilegesItem;
|
|
|
import com.ym.mec.biz.dal.page.MemberPrivilegesItemQueryInfo;
|
|
|
import com.ym.mec.biz.service.MemberPrivilegesItemService;
|
|
|
import com.ym.mec.common.dal.BaseDAO;
|
|
|
+import com.ym.mec.common.exception.BizException;
|
|
|
import com.ym.mec.common.page.PageInfo;
|
|
|
import com.ym.mec.common.service.impl.BaseServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
@@ -19,6 +21,8 @@ public class MemberPrivilegesItemServiceImpl extends BaseServiceImpl<Integer, Me
|
|
|
|
|
|
@Autowired
|
|
|
private MemberPrivilegesItemDao memberPrivilegesItemDao;
|
|
|
+ @Autowired
|
|
|
+ private MemberRankPrivilegesDao memberRankPrivilegesDao;
|
|
|
|
|
|
@Override
|
|
|
public BaseDAO<Integer, MemberPrivilegesItem> getDAO() {
|
|
@@ -38,17 +42,26 @@ public class MemberPrivilegesItemServiceImpl extends BaseServiceImpl<Integer, Me
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void recursiveDel(Integer parentId) {
|
|
|
- List<MemberPrivilegesItem> memberPrivilegesItems = memberPrivilegesItemDao.findList(parentId);
|
|
|
+ public void recursiveDel(Integer memberPrivilegesItemId) {
|
|
|
+// MemberPrivilegesItem privilegesItem = memberPrivilegesItemDao.get(memberPrivilegesItemId);
|
|
|
+// Integer parentId = privilegesItem.getParentId();
|
|
|
+ //当前功能原有父级是否被会员使用
|
|
|
+// if(memberRankPrivilegesDao.hasPrivileges(parentId)){
|
|
|
+// throw new BizException("修改失败:该功能已被使用");
|
|
|
+// }
|
|
|
+ if(memberRankPrivilegesDao.hasPrivileges(memberPrivilegesItemId)){
|
|
|
+ throw new BizException("删除失败:该功能已被使用");
|
|
|
+ }
|
|
|
+ List<MemberPrivilegesItem> memberPrivilegesItems = memberPrivilegesItemDao.findList(memberPrivilegesItemId);
|
|
|
for (MemberPrivilegesItem item : memberPrivilegesItems) {
|
|
|
item = getTree(item);
|
|
|
}
|
|
|
List<Integer> collect = memberPrivilegesItems.stream().map(e -> e.getId()).collect(Collectors.toList());
|
|
|
if(collect == null || collect.size() <= 0){
|
|
|
- memberPrivilegesItemDao.delete(parentId);
|
|
|
+ memberPrivilegesItemDao.delete(memberPrivilegesItemId);
|
|
|
return;
|
|
|
}
|
|
|
- collect.add(parentId);
|
|
|
+ collect.add(memberPrivilegesItemId);
|
|
|
memberPrivilegesItemDao.batchDel(collect);
|
|
|
}
|
|
|
|
|
@@ -76,4 +89,21 @@ public class MemberPrivilegesItemServiceImpl extends BaseServiceImpl<Integer, Me
|
|
|
}
|
|
|
return rows;
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void updateItem(MemberPrivilegesItem memberPrivilegesItem) {
|
|
|
+// MemberPrivilegesItem privilegesItem = memberPrivilegesItemDao.get(memberPrivilegesItem.getId());
|
|
|
+// Integer parentId = memberPrivilegesItem.getParentId();
|
|
|
+// if(privilegesItem.getParentId() != parentId){
|
|
|
+ //当前功能原有父级是否被会员使用
|
|
|
+// if(memberRankPrivilegesDao.hasPrivileges(parentId)){
|
|
|
+// throw new BizException("修改失败:该功能已被使用");
|
|
|
+// }
|
|
|
+// }
|
|
|
+ if(memberRankPrivilegesDao.hasPrivileges(memberPrivilegesItem.getId())){
|
|
|
+ throw new BizException("修改失败:该功能已被使用");
|
|
|
+ }
|
|
|
+ memberPrivilegesItemDao.update(memberPrivilegesItem);
|
|
|
+ }
|
|
|
}
|