add(base): 新增电柜信息下拉树功能

- 新增电柜信息下拉树结构接口和页面功能
- 在 BaseCabinetInfo 模块中添加树形结构相关的代码
- 在 BaseBusbarInfo 页面中集成电柜信息下拉树
- 修改母排信息查询接口,增加电柜别名字段
IOT
zch 1 year ago
parent 99ab951133
commit a73a1ff7af

@ -2,6 +2,8 @@ package com.ruoyi.base.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.ruoyi.base.domain.baseCabinetInfoTreeSelects;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
@ -23,7 +25,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
/** /**
* Controller * Controller
* *
* @author ruoyi * @author ruoyi
* @date 2024-10-31 * @date 2024-10-31
*/ */
@ -101,4 +103,13 @@ public class BaseCabinetInfoController extends BaseController
{ {
return toAjax(baseCabinetInfoService.deleteBaseCabinetInfoByObjIds(objIds)); return toAjax(baseCabinetInfoService.deleteBaseCabinetInfoByObjIds(objIds));
} }
/**
*
* */
@PostMapping("/getBaseCabinetInfoTree")
public AjaxResult getBaseCabinetInfoTree(@RequestBody BaseCabinetInfo baseCabinetInfo) {
List<baseCabinetInfoTreeSelects> list = baseCabinetInfoService.selectCabinetInfoTreeList(baseCabinetInfo);
return success(list);
}
} }

@ -1,7 +1,10 @@
package com.ruoyi.base.domain; package com.ruoyi.base.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -10,7 +13,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* base_busbar_info * base_busbar_info
* *
* @author zangch * @author zangch
* @date 2024-10-31 * @date 2024-10-31
*/ */
@ -72,124 +75,147 @@ public class BaseBusbarInfo extends BaseEntity
@Excel(name = "是否拍照:1-是;0-否") @Excel(name = "是否拍照:1-是;0-否")
private Long isPictures; private Long isPictures;
public void setObjId(Long objId) /** 电柜别名 */
@Excel(name = "电柜别名")
private String cabinetAlias;
private List<BaseBusbarInfo> children = new ArrayList<BaseBusbarInfo>();
public void setObjId(Long objId)
{ {
this.objId = objId; this.objId = objId;
} }
public Long getObjId() public Long getObjId()
{ {
return objId; return objId;
} }
public void setBusbarCode(Long busbarCode) public void setBusbarCode(Long busbarCode)
{ {
this.busbarCode = busbarCode; this.busbarCode = busbarCode;
} }
public Long getBusbarCode() public Long getBusbarCode()
{ {
return busbarCode; return busbarCode;
} }
public void setBusbarAlias(String busbarAlias) public void setBusbarAlias(String busbarAlias)
{ {
this.busbarAlias = busbarAlias; this.busbarAlias = busbarAlias;
} }
public String getBusbarAlias() public String getBusbarAlias()
{ {
return busbarAlias; return busbarAlias;
} }
public void setCabinetCode(Long cabinetCode) public void setCabinetCode(Long cabinetCode)
{ {
this.cabinetCode = cabinetCode; this.cabinetCode = cabinetCode;
} }
public Long getCabinetCode() public Long getCabinetCode()
{ {
return cabinetCode; return cabinetCode;
} }
public void setBusbarDist(BigDecimal busbarDist) public void setBusbarDist(BigDecimal busbarDist)
{ {
this.busbarDist = busbarDist; this.busbarDist = busbarDist;
} }
public BigDecimal getBusbarDist() public BigDecimal getBusbarDist()
{ {
return busbarDist; return busbarDist;
} }
public void setIsChecked(Long isChecked) public void setIsChecked(Long isChecked)
{ {
this.isChecked = isChecked; this.isChecked = isChecked;
} }
public Long getIsChecked() public Long getIsChecked()
{ {
return isChecked; return isChecked;
} }
public void setIsEnd(Long isEnd) public void setIsEnd(Long isEnd)
{ {
this.isEnd = isEnd; this.isEnd = isEnd;
} }
public Long getIsEnd() public Long getIsEnd()
{ {
return isEnd; return isEnd;
} }
public void setIsFlag(Long isFlag) public void setIsFlag(Long isFlag)
{ {
this.isFlag = isFlag; this.isFlag = isFlag;
} }
public Long getIsFlag() public Long getIsFlag()
{ {
return isFlag; return isFlag;
} }
public void setCreatedBy(String createdBy) public void setCreatedBy(String createdBy)
{ {
this.createdBy = createdBy; this.createdBy = createdBy;
} }
public String getCreatedBy() public String getCreatedBy()
{ {
return createdBy; return createdBy;
} }
public void setCreatedTime(Date createdTime) public void setCreatedTime(Date createdTime)
{ {
this.createdTime = createdTime; this.createdTime = createdTime;
} }
public Date getCreatedTime() public Date getCreatedTime()
{ {
return createdTime; return createdTime;
} }
public void setUpdatedBy(String updatedBy) public void setUpdatedBy(String updatedBy)
{ {
this.updatedBy = updatedBy; this.updatedBy = updatedBy;
} }
public String getUpdatedBy() public String getUpdatedBy()
{ {
return updatedBy; return updatedBy;
} }
public void setUpdatedTime(Date updatedTime) public void setUpdatedTime(Date updatedTime)
{ {
this.updatedTime = updatedTime; this.updatedTime = updatedTime;
} }
public Date getUpdatedTime() public Date getUpdatedTime()
{ {
return updatedTime; return updatedTime;
} }
public void setIsPictures(Long isPictures) public void setIsPictures(Long isPictures)
{ {
this.isPictures = isPictures; this.isPictures = isPictures;
} }
public Long getIsPictures() public Long getIsPictures()
{ {
return isPictures; return isPictures;
} }
public String getCabinetAlias() {
return cabinetAlias;
}
public void setCabinetAlias(String cabinetAlias) {
this.cabinetAlias = cabinetAlias;
}
public List<BaseBusbarInfo> getChildren() {
return children;
}
public void setChildren(List<BaseBusbarInfo> children) {
this.children = children;
}
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -207,6 +233,7 @@ public class BaseBusbarInfo extends BaseEntity
.append("updatedBy", getUpdatedBy()) .append("updatedBy", getUpdatedBy())
.append("updatedTime", getUpdatedTime()) .append("updatedTime", getUpdatedTime())
.append("isPictures", getIsPictures()) .append("isPictures", getIsPictures())
.append("cabinetAlias", getCabinetAlias())
.toString(); .toString();
} }
} }

@ -1,7 +1,10 @@
package com.ruoyi.base.domain; package com.ruoyi.base.domain;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle; import org.apache.commons.lang3.builder.ToStringStyle;
@ -10,7 +13,7 @@ import com.ruoyi.common.core.domain.BaseEntity;
/** /**
* base_cabinet_info * base_cabinet_info
* *
* @author ruoyi * @author ruoyi
* @date 2024-10-31 * @date 2024-10-31
*/ */
@ -63,107 +66,118 @@ public class BaseCabinetInfo extends BaseEntity
/** 旋转角度 */ /** 旋转角度 */
@Excel(name = "旋转角度") @Excel(name = "旋转角度")
private BigDecimal rotateAngle; private BigDecimal rotateAngle;
/*
public List<BaseBusbarInfo> children = new ArrayList<BaseBusbarInfo>();*/
public void setObjId(Long objId) public void setObjId(Long objId)
{ {
this.objId = objId; this.objId = objId;
} }
public Long getObjId() public Long getObjId()
{ {
return objId; return objId;
} }
public void setCabinetCode(Long cabinetCode) public void setCabinetCode(Long cabinetCode)
{ {
this.cabinetCode = cabinetCode; this.cabinetCode = cabinetCode;
} }
public Long getCabinetCode() public Long getCabinetCode()
{ {
return cabinetCode; return cabinetCode;
} }
public void setCabinetAlias(String cabinetAlias) public void setCabinetAlias(String cabinetAlias)
{ {
this.cabinetAlias = cabinetAlias; this.cabinetAlias = cabinetAlias;
} }
public String getCabinetAlias() public String getCabinetAlias()
{ {
return cabinetAlias; return cabinetAlias;
} }
public void setIsChecked(Long isChecked) public void setIsChecked(Long isChecked)
{ {
this.isChecked = isChecked; this.isChecked = isChecked;
} }
public Long getIsChecked() public Long getIsChecked()
{ {
return isChecked; return isChecked;
} }
public void setIsFlag(Long isFlag) public void setIsFlag(Long isFlag)
{ {
this.isFlag = isFlag; this.isFlag = isFlag;
} }
public Long getIsFlag() public Long getIsFlag()
{ {
return isFlag; return isFlag;
} }
public void setCreatedBy(String createdBy) public void setCreatedBy(String createdBy)
{ {
this.createdBy = createdBy; this.createdBy = createdBy;
} }
public String getCreatedBy() public String getCreatedBy()
{ {
return createdBy; return createdBy;
} }
public void setCreatedTime(Date createdTime) public void setCreatedTime(Date createdTime)
{ {
this.createdTime = createdTime; this.createdTime = createdTime;
} }
public Date getCreatedTime() public Date getCreatedTime()
{ {
return createdTime; return createdTime;
} }
public void setUpdatedBy(String updatedBy) public void setUpdatedBy(String updatedBy)
{ {
this.updatedBy = updatedBy; this.updatedBy = updatedBy;
} }
public String getUpdatedBy() public String getUpdatedBy()
{ {
return updatedBy; return updatedBy;
} }
public void setUpdatedTime(Date updatedTime) public void setUpdatedTime(Date updatedTime)
{ {
this.updatedTime = updatedTime; this.updatedTime = updatedTime;
} }
public Date getUpdatedTime() public Date getUpdatedTime()
{ {
return updatedTime; return updatedTime;
} }
public void setIsRotate(Long isRotate) public void setIsRotate(Long isRotate)
{ {
this.isRotate = isRotate; this.isRotate = isRotate;
} }
public Long getIsRotate() public Long getIsRotate()
{ {
return isRotate; return isRotate;
} }
public void setRotateAngle(BigDecimal rotateAngle) public void setRotateAngle(BigDecimal rotateAngle)
{ {
this.rotateAngle = rotateAngle; this.rotateAngle = rotateAngle;
} }
public BigDecimal getRotateAngle() public BigDecimal getRotateAngle()
{ {
return rotateAngle; return rotateAngle;
} }
/*
public List<BaseBusbarInfo> getChildren() {
return children;
}
public void setChildren(List<BaseBusbarInfo> children) {
this.children = children;
}*/
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)

@ -0,0 +1,104 @@
package com.ruoyi.base.domain;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.core.domain.entity.SysMenu;
import java.io.Serializable;
import java.util.List;
import java.util.stream.Collectors;
/**
* baseCabinetInfoTreeSelects
*
* @author zangch
*/
public class baseCabinetInfoTreeSelects implements Serializable
{
private static final long serialVersionUID = 1L;
/** 节点ID */
private Long id;
/** 节点名称 */
private String label;
private String code;
/** 子节点 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<baseCabinetInfoTreeSelects> children;
public baseCabinetInfoTreeSelects()
{
}
public baseCabinetInfoTreeSelects(SysDept dept)
{
this.id = dept.getDeptId();
this.label = dept.getDeptName();
}
public baseCabinetInfoTreeSelects(BaseCabinetInfo baseCabinetInfo){
this.id = baseCabinetInfo.getObjId();
this.label = baseCabinetInfo.getCabinetAlias();
this.code = baseCabinetInfo.getCabinetCode().toString();
}
public baseCabinetInfoTreeSelects(BaseBusbarInfo baseBusbarInfo) {
this.id = baseBusbarInfo.getObjId();
this.label = baseBusbarInfo.getBusbarAlias();
this.code = baseBusbarInfo.getBusbarCode().toString();
}
public baseCabinetInfoTreeSelects(SysMenu menu)
{
this.id = menu.getMenuId();
this.label = menu.getMenuName();
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public Long getId()
{
return id;
}
public void setId(Long id)
{
this.id = id;
}
public String getLabel()
{
return label;
}
public void setLabel(String label)
{
this.label = label;
}
public List<baseCabinetInfoTreeSelects> getChildren()
{
return children;
}
public void setChildren(List<baseCabinetInfoTreeSelects> children)
{
this.children = children;
}
}

@ -3,17 +3,19 @@ package com.ruoyi.base.service;
import java.util.List; import java.util.List;
import com.ruoyi.base.domain.BaseCabinetInfo; import com.ruoyi.base.domain.BaseCabinetInfo;
import com.ruoyi.base.domain.baseCabinetInfoTreeSelects;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-10-31 * @date 2024-10-31
*/ */
public interface IBaseCabinetInfoService public interface IBaseCabinetInfoService
{ {
/** /**
* *
* *
* @param objId * @param objId
* @return * @return
*/ */
@ -21,7 +23,7 @@ public interface IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -29,7 +31,7 @@ public interface IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -37,7 +39,7 @@ public interface IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -45,7 +47,7 @@ public interface IBaseCabinetInfoService
/** /**
* *
* *
* @param objIds * @param objIds
* @return * @return
*/ */
@ -53,9 +55,16 @@ public interface IBaseCabinetInfoService
/** /**
* *
* *
* @param objId * @param objId
* @return * @return
*/ */
public int deleteBaseCabinetInfoByObjId(Long objId); public int deleteBaseCabinetInfoByObjId(Long objId);
/**
*
*
* @return
*/
List<baseCabinetInfoTreeSelects> selectCabinetInfoTreeList(BaseCabinetInfo baseCabinetInfo);
} }

@ -1,6 +1,12 @@
package com.ruoyi.base.service.impl; package com.ruoyi.base.service.impl;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import com.ruoyi.base.domain.baseCabinetInfoTreeSelects;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.ruoyi.base.mapper.BaseCabinetInfoMapper; import com.ruoyi.base.mapper.BaseCabinetInfoMapper;
@ -9,19 +15,19 @@ import com.ruoyi.base.service.IBaseCabinetInfoService;
/** /**
* Service * Service
* *
* @author ruoyi * @author ruoyi
* @date 2024-10-31 * @date 2024-10-31
*/ */
@Service @Service
public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
{ {
@Autowired @Autowired
private BaseCabinetInfoMapper baseCabinetInfoMapper; private BaseCabinetInfoMapper baseCabinetInfoMapper;
/** /**
* *
* *
* @param objId * @param objId
* @return * @return
*/ */
@ -33,7 +39,7 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -45,7 +51,7 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -65,7 +71,7 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
/** /**
* *
* *
* @param baseCabinetInfo * @param baseCabinetInfo
* @return * @return
*/ */
@ -85,7 +91,7 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
/** /**
* *
* *
* @param objIds * @param objIds
* @return * @return
*/ */
@ -97,7 +103,7 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
/** /**
* *
* *
* @param objId * @param objId
* @return * @return
*/ */
@ -106,4 +112,109 @@ public class BaseCabinetInfoServiceImpl implements IBaseCabinetInfoService
{ {
return baseCabinetInfoMapper.deleteBaseCabinetInfoByObjId(objId); return baseCabinetInfoMapper.deleteBaseCabinetInfoByObjId(objId);
} }
/**
*
*
* @return
*/
public List<baseCabinetInfoTreeSelects> selectCabinetInfoTreeList(BaseCabinetInfo baseCabinetInfo){
List<BaseCabinetInfo> baseCabinetInfos = baseCabinetInfoMapper.selectBaseCabinetInfoList(baseCabinetInfo);
return baseCabinetInfos.stream().map(baseCabinetInfoTreeSelects::new).collect(Collectors.toList());
}
/*
*/
/**
*
*
* @param
* @return
*//*
@Override
public List<TreeSelects> buildCabinetInfoTreeSelect(List<BaseCabinetInfo> baseCabinetInfos)
{
List<BaseCabinetInfo> deptTrees = buildCabinetInfoTree(baseCabinetInfos);
return deptTrees.stream().map(TreeSelects::new).collect(Collectors.toList());
}
*/
/**
*
*
* @param
* @return
*//*
@Override
public List<BaseCabinetInfo> buildMonitorInfoTree(List<BaseCabinetInfo> baseCabinetInfos)
{
List<BaseCabinetInfo> returnList = new ArrayList<BaseCabinetInfo>();
List<Long> tempList = baseCabinetInfos.stream().map(BaseCabinetInfo::getObjId).collect(Collectors.toList());
for (BaseCabinetInfo baseMonitorInfo : baseCabinetInfos)
{
// 如果是顶级节点, 遍历该父节点的所有子节点
if (!tempList.contains(baseMonitorInfo.getParentId()))
{
recursionFn(baseCabinetInfos, baseMonitorInfo);
returnList.add(baseMonitorInfo);
}
}
if (returnList.isEmpty())
{
returnList = baseCabinetInfos;
}
return returnList;
}
*/
/**
*
*//*
private void recursionFn(List<BaseCabinetInfo> list, BaseCabinetInfo t)
{
// 得到子节点列表
List<BaseCabinetInfo> childList = getChildList(list, t);
t.setChildren(childList);
for (BaseCabinetInfo tChild : childList)
{
if (hasChild(list, tChild))
{
recursionFn(list, tChild);
}
}
}
*/
/**
*
*//*
private List<BaseCabinetInfo> getChildList(List<BaseCabinetInfo> list, BaseCabinetInfo t)
{
List<BaseCabinetInfo> tlist = new ArrayList<BaseCabinetInfo>();
Iterator<BaseCabinetInfo> it = list.iterator();
while (it.hasNext())
{
BaseCabinetInfo n = (BaseCabinetInfo) it.next();
if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().longValue() == t.getObjId().longValue())
{
tlist.add(n);
}
}
return tlist;
}
*/
/**
*
*//*
private boolean hasChild(List<BaseCabinetInfo> list, BaseCabinetInfo t)
{
return getChildList(list, t).size() > 0;
}
*/
} }

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.base.mapper.BaseBusbarInfoMapper"> <mapper namespace="com.ruoyi.base.mapper.BaseBusbarInfoMapper">
<resultMap type="BaseBusbarInfo" id="BaseBusbarInfoResult"> <resultMap type="BaseBusbarInfo" id="BaseBusbarInfoResult">
<result property="objId" column="obj_id" /> <result property="objId" column="obj_id" />
<result property="busbarCode" column="busbar_code" /> <result property="busbarCode" column="busbar_code" />
@ -19,35 +19,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updatedBy" column="updated_by" /> <result property="updatedBy" column="updated_by" />
<result property="updatedTime" column="updated_time" /> <result property="updatedTime" column="updated_time" />
<result property="isPictures" column="is_pictures" /> <result property="isPictures" column="is_pictures" />
<result property="cabinetAlias" column="cabinet_alias"/>
</resultMap> </resultMap>
<sql id="selectBaseBusbarInfoVo"> <sql id="selectBaseBusbarInfoVo">
select obj_id, busbar_code, busbar_alias, cabinet_code, busbar_dist, is_checked, is_end, is_flag, remark, created_by, created_time, updated_by, updated_time, is_pictures from base_busbar_info select bbi.obj_id,
bbi.busbar_code,
bbi.busbar_alias,
bbi.cabinet_code,
bbi.busbar_dist,
bbi.is_checked, is_end,
bbi.is_flag,
bbi.remark,
bbi.created_by,
bbi.created_time,
bbi.updated_by,
bbi.updated_time,
bbi.is_pictures ,
bci.cabinet_alias
from base_busbar_info bbi
LEFT JOIN base_cabinet_info bci on bci.cabinet_code = bbi.cabinet_code
</sql> </sql>
<select id="selectBaseBusbarInfoList" parameterType="BaseBusbarInfo" resultMap="BaseBusbarInfoResult"> <select id="selectBaseBusbarInfoList" parameterType="BaseBusbarInfo" resultMap="BaseBusbarInfoResult">
<include refid="selectBaseBusbarInfoVo"/> <include refid="selectBaseBusbarInfoVo"/>
<where> <where>
<if test="objId != null "> and obj_id = #{objId}</if> <if test="objId != null "> and bbi.obj_id = #{objId}</if>
<if test="busbarCode != null "> and busbar_code = #{busbarCode}</if> <if test="busbarCode != null "> and bbi.busbar_code = #{busbarCode}</if>
<if test="busbarAlias != null and busbarAlias != ''"> and busbar_alias = #{busbarAlias}</if> <if test="busbarAlias != null and busbarAlias != ''"> and bbi.busbar_alias = #{busbarAlias}</if>
<if test="cabinetCode != null "> and cabinet_code = #{cabinetCode}</if> <if test="cabinetCode != null "> and bbi.cabinet_code = #{cabinetCode}</if>
<if test="busbarDist != null "> and busbar_dist = #{busbarDist}</if> <if test="busbarDist != null "> and bbi.busbar_dist = #{busbarDist}</if>
<if test="isChecked != null "> and is_checked = #{isChecked}</if> <if test="isChecked != null "> and bbi.is_checked = #{isChecked}</if>
<if test="isEnd != null "> and is_end = #{isEnd}</if> <if test="isEnd != null "> and bbi.is_end = #{isEnd}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if> <if test="isFlag != null "> and bbi.is_flag = #{isFlag}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if> <if test="remark != null and remark != ''"> and bbi.remark = #{remark}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="createdBy != null and createdBy != ''"> and bbi.created_by = #{createdBy}</if>
<if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if> <if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and bbi.created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if> <if test="updatedBy != null and updatedBy != ''"> and bbi.updated_by = #{updatedBy}</if>
<if test="params.beginUpdatedTime != null and params.beginUpdatedTime != '' and params.endUpdatedTime != null and params.endUpdatedTime != ''"> and updated_time between #{params.beginUpdatedTime} and #{params.endUpdatedTime}</if> <if test="params.beginUpdatedTime != null and params.beginUpdatedTime != '' and params.endUpdatedTime != null and params.endUpdatedTime != ''"> and bbi.updated_time between #{params.beginUpdatedTime} and #{params.endUpdatedTime}</if>
<if test="isPictures != null "> and is_pictures = #{isPictures}</if> <if test="isPictures != null "> and bbi.is_pictures = #{isPictures}</if>
<if test="cabinetAlias != null and cabinetAlias != ''"> and bci.cabinet_alias like concat('%', #{cabinetAlias}, '%')</if>
</where> </where>
</select> </select>
<select id="selectBaseBusbarInfoByObjId" parameterType="Long" resultMap="BaseBusbarInfoResult"> <select id="selectBaseBusbarInfoByObjId" parameterType="Long" resultMap="BaseBusbarInfoResult">
<include refid="selectBaseBusbarInfoVo"/> <include refid="selectBaseBusbarInfoVo"/>
where obj_id = #{objId} where bbi.obj_id = #{objId}
</select> </select>
<insert id="insertBaseBusbarInfo" parameterType="BaseBusbarInfo" useGeneratedKeys="true" keyProperty="objId"> <insert id="insertBaseBusbarInfo" parameterType="BaseBusbarInfo" useGeneratedKeys="true" keyProperty="objId">
@ -109,9 +127,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteBaseBusbarInfoByObjIds" parameterType="String"> <delete id="deleteBaseBusbarInfoByObjIds" parameterType="String">
delete from base_busbar_info where obj_id in delete from base_busbar_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")"> <foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId} #{objId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

@ -3,7 +3,7 @@
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.base.mapper.BaseCabinetInfoMapper"> <mapper namespace="com.ruoyi.base.mapper.BaseCabinetInfoMapper">
<resultMap type="BaseCabinetInfo" id="BaseCabinetInfoResult"> <resultMap type="BaseCabinetInfo" id="BaseCabinetInfoResult">
<result property="objId" column="obj_id" /> <result property="objId" column="obj_id" />
<result property="cabinetCode" column="cabinet_code" /> <result property="cabinetCode" column="cabinet_code" />
@ -20,30 +20,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectBaseCabinetInfoVo"> <sql id="selectBaseCabinetInfoVo">
select obj_id, cabinet_code, cabinet_alias, is_checked, is_flag, remark, created_by, created_time, updated_by, updated_time, is_rotate, rotate_angle from base_cabinet_info select bci.obj_id,
bci.cabinet_code,
bci.cabinet_alias,
bci.is_checked,
bci.is_flag,
bci.remark,
bci.created_by,
bci.created_time,
bci.updated_by,
bci.updated_time,
bci.is_rotate,
bci.rotate_angle
from base_cabinet_info bci
LEFT JOIN base_busbar_info bbi on bci.cabinet_code = bbi.cabinet_code
</sql> </sql>
<select id="selectBaseCabinetInfoList" parameterType="BaseCabinetInfo" resultMap="BaseCabinetInfoResult"> <select id="selectBaseCabinetInfoList" parameterType="BaseCabinetInfo" resultMap="BaseCabinetInfoResult">
<include refid="selectBaseCabinetInfoVo"/> <include refid="selectBaseCabinetInfoVo"/>
<where> <where>
<if test="objId != null "> and obj_id = #{objId}</if> <if test="objId != null "> and bci.obj_id = #{objId}</if>
<if test="cabinetCode != null "> and cabinet_code = #{cabinetCode}</if> <if test="cabinetCode != null "> and bci.cabinet_code = #{cabinetCode}</if>
<if test="cabinetAlias != null and cabinetAlias != ''"> and cabinet_alias = #{cabinetAlias}</if> <if test="cabinetAlias != null and cabinetAlias != ''"> and bci.cabinet_alias = #{cabinetAlias}</if>
<if test="isChecked != null "> and is_checked = #{isChecked}</if> <if test="isChecked != null "> and bci.is_checked = #{isChecked}</if>
<if test="isFlag != null "> and is_flag = #{isFlag}</if> <if test="isFlag != null "> and bci.is_flag = #{isFlag}</if>
<if test="remark != null and remark != ''"> and remark = #{remark}</if> <if test="remark != null and remark != ''"> and bci.remark = #{remark}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="createdBy != null and createdBy != ''"> and bci.created_by = #{createdBy}</if>
<if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if> <if test="params.beginCreatedTime != null and params.beginCreatedTime != '' and params.endCreatedTime != null and params.endCreatedTime != ''"> and bci.created_time between #{params.beginCreatedTime} and #{params.endCreatedTime}</if>
<if test="updatedBy != null and updatedBy != ''"> and updated_by = #{updatedBy}</if> <if test="updatedBy != null and updatedBy != ''"> and bci.updated_by = #{updatedBy}</if>
<if test="params.beginUpdatedTime != null and params.beginUpdatedTime != '' and params.endUpdatedTime != null and params.endUpdatedTime != ''"> and updated_time between #{params.beginUpdatedTime} and #{params.endUpdatedTime}</if> <if test="params.beginUpdatedTime != null and params.beginUpdatedTime != '' and params.endUpdatedTime != null and params.endUpdatedTime != ''"> and bci.updated_time between #{params.beginUpdatedTime} and #{params.endUpdatedTime}</if>
<if test="isRotate != null "> and is_rotate = #{isRotate}</if> <if test="isRotate != null "> and bci.is_rotate = #{isRotate}</if>
<if test="rotateAngle != null "> and rotate_angle = #{rotateAngle}</if> <if test="rotateAngle != null "> and bci.rotate_angle = #{rotateAngle}</if>
</where> </where>
</select> </select>
<select id="selectBaseCabinetInfoByObjId" parameterType="Long" resultMap="BaseCabinetInfoResult"> <select id="selectBaseCabinetInfoByObjId" parameterType="Long" resultMap="BaseCabinetInfoResult">
<include refid="selectBaseCabinetInfoVo"/> <include refid="selectBaseCabinetInfoVo"/>
where obj_id = #{objId} where bci.obj_id = #{objId}
</select> </select>
<insert id="insertBaseCabinetInfo" parameterType="BaseCabinetInfo" useGeneratedKeys="true" keyProperty="objId"> <insert id="insertBaseCabinetInfo" parameterType="BaseCabinetInfo" useGeneratedKeys="true" keyProperty="objId">
@ -99,9 +112,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<delete id="deleteBaseCabinetInfoByObjIds" parameterType="String"> <delete id="deleteBaseCabinetInfoByObjIds" parameterType="String">
delete from base_cabinet_info where obj_id in delete from base_cabinet_info where obj_id in
<foreach item="objId" collection="array" open="(" separator="," close=")"> <foreach item="objId" collection="array" open="(" separator="," close=")">
#{objId} #{objId}
</foreach> </foreach>
</delete> </delete>
</mapper> </mapper>

@ -42,3 +42,12 @@ export function delBaseCabinetInfo(objId) {
method: 'delete' method: 'delete'
}) })
} }
// 查询计量设备信息下拉树结构
export function getBaseCabinetInfoTree(data) {
return request({
url: '/base/baseCabinetInfo/getBaseCabinetInfoTree',
method: 'post',
data: data
})
}

@ -1,5 +1,36 @@
<template> <template>
<div class="app-container"> <div class="app-container">
<el-row :gutter="28">
<el-col :span="5" :xs="24">
<div class="head-container">
<el-input
v-model="filterBoxName"
placeholder="请输入电柜名称"
clearable
size="small"
prefix-icon="el-icon-search"
style="margin-bottom: 20px"
/>
</div>
<div class="head-container">
<div class="tree-container">
<el-tree
:data="InfoOptions"
:props="props"
:expand-on-click-node="false"
:filter-node-method="filterNode"
ref="tree"
node-key="id"
default-expand-all
highlight-current
@node-click="handleNodeClick"
/>
</div>
</div>
</el-col>
<el-col :span="19" :xs="24">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px"> <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<!-- <el-form-item label="标识编号" prop="objId"> <!-- <el-form-item label="标识编号" prop="objId">
<el-input <el-input
@ -25,14 +56,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="电柜编号" prop="cabinetCode"> <!-- <el-form-item label="电柜编号" prop="cabinetCode">
<el-input <el-input
v-model="queryParams.cabinetCode" v-model="queryParams.cabinetCode"
placeholder="请输入电柜编号" placeholder="请输入电柜编号"
clearable clearable
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>-->
<el-form-item label="母排距离" prop="busbarDist"> <el-form-item label="母排距离" prop="busbarDist">
<el-input <el-input
v-model="queryParams.busbarDist" v-model="queryParams.busbarDist"
@ -240,6 +271,10 @@
</el-table-column> </el-table-column>
</el-table> </el-table>
</el-col>
</el-row>
<pagination <pagination
v-show="total>0" v-show="total>0"
:total="total" :total="total"
@ -335,12 +370,23 @@
<script> <script>
import { listBaseBusbarInfo, getBaseBusbarInfo, delBaseBusbarInfo, addBaseBusbarInfo, updateBaseBusbarInfo } from "@/api/base/baseBusbarInfo"; import { listBaseBusbarInfo, getBaseBusbarInfo, delBaseBusbarInfo, addBaseBusbarInfo, updateBaseBusbarInfo } from "@/api/base/baseBusbarInfo";
import {getBaseCabinetInfoTree} from "@/api/base/baseCabinetInfo";
export default { export default {
name: "BaseBusbarInfo", name: "BaseBusbarInfo",
dicts: ['is_pictures', 'busbar_is_flag', 'busbar_is_end', 'busbar_is_checked'], dicts: ['is_pictures', 'busbar_is_flag', 'busbar_is_end', 'busbar_is_checked'],
data() { data() {
return { return {
//
InfoOptions: [],
//
filterBoxName: undefined,
props:{
children: 'children',
label: 'label'
/* label: (data) => `(编号${data.code}) ${data.label} `*/
},
// //
loading: true, loading: true,
// //
@ -394,6 +440,12 @@ export default {
}, },
created() { created() {
this.getList(); this.getList();
this.getTreeselect();
},
watch: {
filterBoxName(val){
this.$refs.tree.filter(val)
}
}, },
methods: { methods: {
/** 查询母排信息列表 */ /** 查询母排信息列表 */
@ -508,7 +560,33 @@ export default {
this.download('base/baseBusbarInfo/export', { this.download('base/baseBusbarInfo/export', {
...this.queryParams ...this.queryParams
}, `baseBusbarInfo_${new Date().getTime()}.xlsx`) }, `baseBusbarInfo_${new Date().getTime()}.xlsx`)
} },
/** 查询电柜下拉树结构 */
getTreeselect() {
getBaseCabinetInfoTree({}).then(response => {
this.InfoOptions = response.data
})
},
//
filterNode(value, data) {
if (!value) return true
return data.label.indexOf(value) !== -1
},
//
handleNodeClick(data) {
this.queryParams.cabinetCode = data.code
this.handleQuery()
},
} }
}; };
</script> </script>
<style scoped>.tree-container {
height: 666px; /* 设置固定高度 */
overflow-y: auto; /* 添加垂直滚动条 */
}
</style>

Loading…
Cancel
Save