package com.ibeetl.admin.console.service;
|
|
|
import com.ibeetl.admin.console.dao.XzxUserAuthInfoDao;
|
import com.ibeetl.admin.core.entity.CoreFunction;
|
import com.ibeetl.admin.core.entity.XzxUserAuthInfo;
|
import com.ibeetl.admin.core.rbac.tree.FunctionItem;
|
import com.ibeetl.admin.core.service.CoreBaseService;
|
import com.ibeetl.admin.core.util.FunctionBuildUtil;
|
import com.ibeetl.admin.core.util.PlatformException;
|
import com.ibeetl.admin.core.web.dto.FunctionNodeView;
|
import org.beetl.sql.core.engine.PageQuery;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import java.util.ArrayList;
|
import java.util.List;
|
/**
|
* XzxUserAuthInfo Service
|
*/
|
|
@Service
|
@Transactional
|
public class XzxUserAuthInfoService extends CoreBaseService<XzxUserAuthInfo>{
|
|
@Autowired private XzxUserAuthInfoDao xzxUserAuthInfoDao;
|
|
public PageQuery<XzxUserAuthInfo>queryByCondition(PageQuery query){
|
PageQuery ret = xzxUserAuthInfoDao.queryByCondition(query);
|
queryListAfter(ret.getList());
|
return ret;
|
}
|
public List<FunctionNodeView> buildViewList() {
|
List<FunctionNodeView> viewList = new ArrayList<>();
|
List<XzxUserAuthInfo> list = xzxUserAuthInfoDao.all();
|
//由于表设计原因前端顶层已经写死,如有需求从此次开始修改
|
//客户管理
|
FunctionNodeView userManager= new FunctionNodeView();
|
userManager.setCode("KH");
|
userManager.setName("客户管理");
|
userManager.setId(Long.parseLong("10000"));
|
List<FunctionNodeView> userChildren = new ArrayList<>();
|
//数据统计
|
FunctionNodeView dateManager= new FunctionNodeView();
|
dateManager.setCode("SJ");
|
dateManager.setName("数据统计");
|
dateManager.setId(Long.parseLong("10001"));
|
List<FunctionNodeView> dateChildren = new ArrayList<>();
|
//物品价格
|
FunctionNodeView productManager= new FunctionNodeView();
|
productManager.setCode("WP");
|
productManager.setName("物品价格");
|
productManager.setId(Long.parseLong("10002"));
|
List<FunctionNodeView> productChildren = new ArrayList<>();
|
for (XzxUserAuthInfo authInfo:list) {
|
/*FunctionNodeView view = new FunctionNodeView();
|
view.setName(authInfo.getAuthName());
|
view.setCode(authInfo.getAuthCode());
|
view.setId(authInfo.getId());*/
|
|
if(authInfo.getCategoryCode().equals(userManager.getCode())){
|
FunctionNodeView uc = new FunctionNodeView();
|
uc.setName(authInfo.getAuthName());
|
uc.setCode(authInfo.getAuthCode());
|
uc.setId(authInfo.getId());
|
userChildren.add(uc);
|
}else if(authInfo.getCategoryCode().equals(dateManager.getCode())){
|
FunctionNodeView uc = new FunctionNodeView();
|
uc.setName(authInfo.getAuthName());
|
uc.setCode(authInfo.getAuthCode());
|
uc.setId(authInfo.getId());
|
dateChildren.add(uc);
|
}else{
|
FunctionNodeView uc = new FunctionNodeView();
|
uc.setName(authInfo.getAuthName());
|
uc.setCode(authInfo.getAuthCode());
|
uc.setId(authInfo.getId());
|
productChildren.add(uc);
|
}
|
//viewList.add(view);
|
}
|
userManager.setChildren(userChildren);
|
dateManager.setChildren(dateChildren);
|
productManager.setChildren(productChildren);
|
viewList.add(userManager);
|
viewList.add(dateManager);
|
viewList.add(productManager);
|
return viewList;
|
}
|
|
public void batchDelXzxUserAuthInfo(List<Long> ids){
|
try {
|
xzxUserAuthInfoDao.batchDelXzxUserAuthInfoByIds(ids);
|
} catch (Exception e) {
|
throw new PlatformException("批量删除XzxUserAuthInfo失败", e);
|
}
|
}
|
}
|