权限接口修改

dev
liuguijing 1 year ago
parent 3e4c3c2ceb
commit a92695f5bf

@ -1,6 +1,5 @@
package com.shxy.xymanager_dao.dao;
import com.shxy.xymanager_common.dto.TerminalInfoDto;
import com.shxy.xymanager_common.dto.TerminalsWithHeart;
import com.shxy.xymanager_common.entity.TerminalStatus;
import org.apache.ibatis.annotations.Param;

@ -58,7 +58,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from lines
from `lines`
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>

@ -135,7 +135,7 @@
distinct
</if>
<include refid="Base_Column_List" />
from towers
from terminals
<if test="_parameter != null">
<include refid="Example_Where_Clause" />
</if>

@ -41,7 +41,7 @@
</where>
</sql>
<sql id="Base_Column_List">
id, name, line_id, create_time, update_time, status, order
id, name, line_id, create_time, update_time, `order`,status
</sql>
<select id="selectByExample" parameterType="com.shxy.xymanager_common.entity.TowersExample" resultMap="BaseResultMap">
select

@ -40,7 +40,6 @@ public class DyLevelServiceImpl implements DyLevelService {
@Autowired
DyLevelDao dyLevelDao;
@Autowired
TerminalChannelMapperDao terminalChannelMapperDao;

@ -1,18 +1,15 @@
package com.shxy.xymanager_service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import com.shxy.xymanager_common.bean.PermissionDetail;
import com.shxy.xymanager_common.bean.ServiceBody;
import com.shxy.xymanager_common.dto.DyLineAndTerminalWithHeartDto;
import com.shxy.xymanager_common.dto.LineAndTerminalWithHeartDto;
import com.shxy.xymanager_common.dto.TerminalsWithHeart;
import com.shxy.xymanager_common.entity.*;
import com.shxy.xymanager_common.enums.CommonStatus;
import com.shxy.xymanager_common.enums.PermissionDetailEnum;
import com.shxy.xymanager_common.exception.ApiException;
import com.shxy.xymanager_common.exception.Asserts;
import com.shxy.xymanager_common.model.PermissionDyLineTreeListModel;
import com.shxy.xymanager_common.util.XyNumberUtils;
import com.shxy.xymanager_dao.dao.*;
import com.shxy.xymanager_service.service.RoleService;
import lombok.extern.slf4j.Slf4j;
@ -21,9 +18,9 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import static com.shxy.xymanager_common.constant.Constants.SUPER_ADMIN;
@ -172,7 +169,6 @@ public class RoleServiceImpl implements RoleService {
@Override
public ServiceBody<PermissionDyLineTreeListModel> getPermissionTree() {
PermissionDyLineTreeListModel model = new PermissionDyLineTreeListModel();
List<DyLineAndTerminalWithHeartDto> list = dyLevelDao.selectPermissionListTreeList();
List<DyLevel> dyLevels = dyLevelDao.selectByExample(new DyLevelExample());
List<Lines> lines = linesDao.selectByExample(new LinesExample());
List<Towers> towers = towerDao.selectByExample(new TowersExample());
@ -183,29 +179,56 @@ public class RoleServiceImpl implements RoleService {
model.setList(new ArrayList<>());
} else {
model.setList(dyLevels);
for (DyLevel dyLevel : dyLevels) {
Integer dyid = dyLevel.getId();
for (Lines line : lines) {
Integer linedyLevelId = line.getDyLevelId();
if (XyNumberUtils.compare(dyid, linedyLevelId) == 0) {
dyLevel.getList().add(line);
HashMap<Integer, DyLevel> dymap = new HashMap<>();
HashMap<Integer, Lines> linemap = new HashMap<>();
HashMap<Integer, Towers> towermap = new HashMap<>();
HashMap<Integer, Terminals> termmap = new HashMap<>();
for (DyLevel ditem : dyLevels) {
dymap.put(ditem.getId(), ditem);
}
for (Towers tower : towers) {
Integer towerlineId = tower.getLineId();
Integer towerId = tower.getId();
if (XyNumberUtils.compare(towerlineId, towerId) == 0) {
line.getList().add(tower);
for (Lines litem : lines) {
linemap.put(litem.getId(), litem);
}
for (Terminals term : terminals) {
Integer termtowerid = term.getTowerid();
if (XyNumberUtils.compare(termtowerid, towerId) == 0) {
tower.getList().add(term);
for (Towers titem : towers) {
towermap.put(titem.getId(), titem);
}
for (Terminals termitem : terminals) {
termmap.put(termitem.getId(), termitem);
}
for (Terminals termitem : terminals) {
Integer towerid = termitem.getTowerid();
if (towerid != null) {
Towers towers1 = towermap.get(towerid);
if (BeanUtil.isNotEmpty(towers1)) {
towers1.getList().add(termitem);
}
}
}
for (Towers titem : towers) {
Integer lineId = titem.getLineId();
if (lineId != null) {
Lines lines1 = linemap.get(lineId);
if (BeanUtil.isNotEmpty(lines1)) {
lines1.getList().add(titem);
}
}
}
for (Lines litem : lines) {
Integer dyLevelId = litem.getDyLevelId();
if (dyLevelId != null) {
DyLevel dyLevel = dymap.get(dyLevelId);
if (BeanUtil.isNotEmpty(dyLevel)) {
dyLevel.getList().add(litem);
}
}
}
ArrayList<DyLevel> dyLevellist = new ArrayList<>(dymap.values());
model.setList(dyLevellist);
}
return Asserts.success(model);

Loading…
Cancel
Save