临时提交

pull/1642/head
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 = "业务分组树") @Schema(description = "业务分组树")
public class GroupTree extends Group{ public class GroupTree extends Group{
@Schema(description = "树节点Id") @Schema(description = "是否有子节点")
private String treeId; private String treeId;
@Schema(description = "是否有子节点") @Schema(description = "是否有子节点")

View File

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

View File

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

View File

@ -140,6 +140,24 @@ public class ChannelProvider {
} }
public String queryByGbDeviceIds(Map<String, Object> params ){ 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(); StringBuilder sqlBuild = new StringBuilder();
sqlBuild.append(getBaseSelectSql()); sqlBuild.append(getBaseSelectSql());
sqlBuild.append("where id in ( "); sqlBuild.append("where id in ( ");

View File

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

View File

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

View File

@ -15,7 +15,7 @@
<vue-easy-tree <vue-easy-tree
class="flow-tree" class="flow-tree"
ref="veTree" ref="veTree"
node-key="id" node-key="deviceId"
height="78vh" height="78vh"
lazy lazy
style="padding: 2rem 0 2rem 0.5rem" style="padding: 2rem 0 2rem 0.5rem"
@ -55,7 +55,6 @@ export default {
data() { data() {
return { return {
props: { props: {
id: "treeId",
label: "name", label: "name",
}, },
showCode: false, showCode: false,
@ -74,7 +73,7 @@ export default {
loadNode: function (node, resolve) { loadNode: function (node, resolve) {
if (node.level === 0) { if (node.level === 0) {
resolve([{ resolve([{
id: "", deviceId: "",
name: "根资源组", name: "根资源组",
isLeaf: false, isLeaf: false,
type: 0 type: 0
@ -255,7 +254,7 @@ export default {
method: 'post', method: 'post',
url: `/api/common/channel/group/device/add`, url: `/api/common/channel/group/device/add`,
data: { data: {
parentId: node.data.id, parentId: node.data.deviceId,
businessGroup: node.data.businessGroup, businessGroup: node.data.businessGroup,
deviceIds: deviceIds, deviceIds: deviceIds,
} }
@ -322,8 +321,9 @@ export default {
id: 0, id: 0,
name: "", name: "",
deviceId: "", deviceId: "",
parentDeviceId: node.level > 2 ? node.data.id:"", parentDeviceId: node.level > 2 ? node.data.deviceId:"",
businessGroup: node.level > 2 ? node.data.businessGroup: node.data.id, parentId: node.data.id,
businessGroup: node.level > 2 ? node.data.businessGroup: node.data.deviceId,
},form => { },form => {
node.loaded = false node.loaded = false
node.expand(); node.expand();
@ -331,13 +331,7 @@ export default {
}, },
editGroup: function (id, node) { editGroup: function (id, node) {
console.log(node) console.log(node)
this.$refs.groupEdit.openDialog({ this.$refs.groupEdit.openDialog(node.data,form => {
id: node.data.dbId,
name: node.data.label,
deviceId: node.data.id,
parentDeviceId: node.data.parentDeviceId,
businessGroup: node.data.businessGroup,
},form => {
node.parent.loaded = false node.parent.loaded = false
node.parent.expand(); node.parent.expand();
}, id); }, id);

View File

@ -50,9 +50,9 @@
<el-table-column label="类型" min-width="100"> <el-table-column label="类型" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.gbDeviceDbId"></el-tag> <el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" v-if="scope.row.streamPushId"></el-tag> <el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" v-if="scope.row.streamProxyId"></el-tag> <el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>

View File

@ -50,9 +50,9 @@
<el-table-column label="类型" min-width="100"> <el-table-column label="类型" min-width="100">
<template slot-scope="scope"> <template slot-scope="scope">
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-tag size="medium" v-if="scope.row.gbDeviceDbId"></el-tag> <el-tag size="medium" effect="plain" v-if="scope.row.gbDeviceDbId"></el-tag>
<el-tag size="medium" v-if="scope.row.streamPushId"></el-tag> <el-tag size="medium" effect="plain" type="success" v-if="scope.row.streamPushId"></el-tag>
<el-tag size="medium" v-if="scope.row.streamProxyId"></el-tag> <el-tag size="medium" effect="plain" type="warning" v-if="scope.row.streamProxyId"></el-tag>
</div> </div>
</template> </template>
</el-table-column> </el-table-column>