临时提交

This commit is contained in:
648540858
2024-08-23 11:25:45 +08:00
parent ae0235c0f8
commit 5169eb66a3
9 changed files with 39 additions and 30 deletions

View File

@@ -10,7 +10,7 @@ import lombok.Data;
@Schema(description = "业务分组树")
public class GroupTree extends Group{
@Schema(description = "树节点Id")
@Schema(description = "是否有子节点")
private String treeId;
@Schema(description = "是否有子节点")

View File

@@ -343,7 +343,7 @@ public interface CommonGBChannelMapper {
@Select("<script>" +
" select " +
" concat('channel_', id) as tree_id," +
" id," +
" coalesce(gb_device_id, device_id) as device_id," +
" coalesce(gb_name, name) as name, " +
" coalesce(gb_parent_id, parent_id) as parent_device_id, " +

View File

@@ -62,8 +62,7 @@ public interface GroupMapper {
@Select(" <script>" +
" SELECT " +
" *," +
" concat('group_', id) as tree_id," +
" * , " +
" 0 as type," +
" false as is_leaf" +
" from wvp_common_group " +
@@ -76,8 +75,7 @@ public interface GroupMapper {
@Select(" <script>" +
" SELECT " +
" concat('group_', id) as tree_id," +
" *, " +
" * , " +
" 0 as type," +
" false as is_leaf" +
" from wvp_common_group " +
@@ -90,7 +88,6 @@ public interface GroupMapper {
@Select(" <script>" +
" SELECT " +
" *," +
" concat('group_', id) as tree_id," +
" 0 as type," +
" false as is_leaf" +
" from wvp_common_group " +
@@ -119,7 +116,7 @@ public interface GroupMapper {
@Update(" UPDATE wvp_common_group " +
" SET parent_device_id=#{group.deviceId}, business_group = #{group.businessGroup}" +
" WHERE parentId = #{parentId}")
" WHERE parent_id = #{parentId}")
int updateChild(@Param("parentId") Integer parentId, Group group);
@Select(" <script>" +

View File

@@ -140,6 +140,24 @@ public class ChannelProvider {
}
public String queryByGbDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append("where device_db_id in ( ");
Collection<Integer> ids = (Collection<Integer>)params.get("deviceIds");
boolean first = true;
for (Integer id : ids) {
if (!first) {
sqlBuild.append(",");
}
sqlBuild.append(id);
first = false;
}
sqlBuild.append(" )");
return sqlBuild.toString() ;
}
public String queryByDeviceIds(Map<String, Object> params ){
StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql());
sqlBuild.append("where id in ( ");

View File

@@ -618,7 +618,7 @@ public class GbChannelServiceImpl implements IGbChannelService {
@Override
public void deleteChannelToGroup(String parentId, String businessGroup, List<Integer> channelIds) {
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByGbDeviceIds(channelIds);
List<CommonGBChannel> channelList = commonGBChannelMapper.queryByIds(channelIds);
if (channelList.isEmpty()) {
throw new ControllerException(ErrorCode.ERROR100.getCode(), "所有通道Id不存在");
}

View File

@@ -165,9 +165,9 @@ public class GroupServiceImpl implements IGroupService {
}
// 查询含有的通道
Group parentGroup = groupManager.queryOne(parentId);
if (parentGroup != null && !parentGroup.getDeviceId().equals(parentGroup.getBusinessGroup())) {
if (parentGroup != null ) {
List<GroupTree> groupTreesForChannel = commonGBChannelMapper.queryForGroupTreeByParentId(query, parentGroup.getDeviceId());
if (ObjectUtils.isEmpty(groupTreesForChannel)) {
if (!ObjectUtils.isEmpty(groupTreesForChannel)) {
groupTrees.addAll(groupTreesForChannel);
}
}