change - 监控单元信息添加导入功能

main
wenjy 3 years ago
parent a79762b3dc
commit fbb42c700d

@ -67,6 +67,15 @@
<artifactId>ruoyi-generator</artifactId> <artifactId>ruoyi-generator</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>
<build> <build>

@ -4,6 +4,7 @@ import java.util.Date;
import java.util.List; import java.util.List;
import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
import org.apache.shiro.authz.annotation.RequiresPermissions; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
@ -22,6 +23,7 @@ import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import org.springframework.web.multipart.MultipartFile;
/** /**
* Controller * Controller
@ -51,12 +53,45 @@ public class BaseMonitorunitInfoController extends BaseController
@RequiresPermissions("base:monitorUnitInfo:list") @RequiresPermissions("base:monitorUnitInfo:list")
@PostMapping("/list") @PostMapping("/list")
@ResponseBody @ResponseBody
public List<BaseMonitorunitInfo> list(BaseMonitorunitInfo baseMonitorunitInfo) public List<BaseMonitorunitInfoDto> list(BaseMonitorunitInfo baseMonitorunitInfo)
{ {
List<BaseMonitorunitInfo> list = baseMonitorunitInfoService.selectBaseMonitorunitInfoList(baseMonitorunitInfo); List<BaseMonitorunitInfoDto> list = baseMonitorunitInfoService.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
return list; return list;
} }
/**
*
* @author WenJY
* @date 2022/2/7 9:57
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@RequiresPermissions("base:monitorUnitInfo:importTemplate")
@GetMapping("/importTemplate")
@ResponseBody
public AjaxResult importTemplate() {
ExcelUtil<BaseMonitorunitInfo> util = new ExcelUtil<BaseMonitorunitInfo>(BaseMonitorunitInfo.class);
return util.importTemplateExcel("监控单元信息");
}
/**
*
* @author WenJY
* @date 2022/2/7 9:58
* @param file
* @param updateSupport
* @return com.ruoyi.common.core.domain.AjaxResult
*/
@RequiresPermissions("base:monitorUnitInfo:importData")
@PostMapping("/importData")
@ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception {
ExcelUtil<BaseMonitorunitInfo> util = new ExcelUtil<BaseMonitorunitInfo>(BaseMonitorunitInfo.class);
//读取file文件将文件内容转为list集合
List<BaseMonitorunitInfo> baseMonitorunitInfoList = util.importExcel(file.getInputStream());
String message = baseMonitorunitInfoService.importMould(baseMonitorunitInfoList,updateSupport);
return AjaxResult.success(message);
}
/** /**
* *
*/ */

@ -1,97 +1,110 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro"> <html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head> <head>
<th:block th:include="include :: header('监控单元信息列表')" /> <th:block th:include="include :: header('监控单元信息列表')"/>
</head> </head>
<body class="gray-bg"> <body class="gray-bg">
<div class="container-div"> <div class="container-div">
<div class="row"> <div class="row">
<div class="col-sm-12 search-collapse"> <div class="col-sm-12 search-collapse">
<form id="formId"> <form id="formId">
<div class="select-list"> <div class="select-list">
<ul> <ul>
<li> <li>
<label style="width: 95px">监控单元编号:</label> <label style="width: 95px">监控单元编号:</label>
<input type="text" name="monitorunitId"/> <input type="text" name="monitorunitId"/>
</li> </li>
<li> <li>
<label style="width: 95px">监控单元名称:</label> <label style="width: 95px">监控单元名称:</label>
<input type="text" name="monitorunitName"/> <input type="text" name="monitorunitName"/>
</li> </li>
<li> <li>
<label style="width: 95px">监控单元类型:</label> <label style="width: 95px">监控单元类型:</label>
<select name="monitorunitType" th:with="type=${@monitorunitTypeService.getMonitorunitType()}"> <select name="monitorunitType"
<option value="">所有</option> th:with="type=${@monitorunitTypeService.getMonitorunitType()}">
<option th:each="dict : ${type}" th:text="${dict.monitorunittypeName}" th:value="${dict.monitorunittypeId}"></option> <option value="">所有</option>
</select> <option th:each="dict : ${type}" th:text="${dict.monitorunittypeName}"
</li> th:value="${dict.monitorunittypeId}"></option>
<li> </select>
<label style="width: 90px">所属变电站:</label> </li>
<select name="substationId" th:with="substationInfo=${@substationInfoService.getSubstationInfo()}"> <li>
<option value="">所有</option> <label style="width: 90px">所属变电站:</label>
<option th:each="substation : ${substationInfo}" th:text="${substation.substationName}" th:value="${substation.substationId}"></option> <select name="substationId"
</select> th:with="substationInfo=${@substationInfoService.getSubstationInfo()}">
</li> <option value="">所有</option>
<li> <option th:each="substation : ${substationInfo}" th:text="${substation.substationName}"
<label>是否启用:</label> th:value="${substation.substationId}"></option>
<select name="enableFlag" th:with="type=${@dict.getType('enable_flag')}"> </select>
<option value="">所有</option> </li>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option> <li>
</select> <label>是否启用:</label>
</li> <select name="enableFlag" th:with="type=${@dict.getType('enable_flag')}">
<li> <option value="">所有</option>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i class="fa fa-search"></i>&nbsp;搜索</a> <option th:each="dict : ${type}" th:text="${dict.dictLabel}"
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a> th:value="${dict.dictValue}"></option>
</li> </select>
</ul> </li>
</div> <li>
</form> <a class="btn btn-primary btn-rounded btn-sm" onclick="$.treeTable.search()"><i
</div> class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group"> <div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="base:monitorUnitInfo:add"> <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="base:monitorUnitInfo:add">
<i class="fa fa-plus"></i> 新增 <i class="fa fa-plus"></i> 新增
</a> </a>
<a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="base:monitorUnitInfo:edit"> <a class="btn btn-primary" onclick="$.operate.edit()" shiro:hasPermission="base:monitorUnitInfo:edit">
<i class="fa fa-edit"></i> 修改 <i class="fa fa-edit"></i> 修改
</a> </a>
<a class="btn btn-info" id="expandAllBtn"> <a class="btn btn-info" onclick="$.table.importExcel() " shiro:hasPermission="base:monitorUnitInfo:import">
<i class="fa fa-exchange"></i> 展开/折叠 <i class="fa fa-upload"></i> 导入
</a> </a>
</div> <a class="btn btn-info" id="expandAllBtn">
<div class="col-sm-12 select-table table-striped"> <i class="fa fa-exchange"></i> 展开/折叠
<table id="bootstrap-tree-table"></table> </a>
</div> </div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-tree-table"></table>
</div> </div>
</div> </div>
<th:block th:include="include :: footer" /> </div>
<script th:inline="javascript"> <th:block th:include="include :: footer"/>
var addFlag = [[${@permission.hasPermi('base:monitorUnitInfo:add')}]]; <script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('base:monitorUnitInfo:edit')}]]; var addFlag = [[${@permission.hasPermi('base:monitorUnitInfo:add')}]];
var removeFlag = [[${@permission.hasPermi('base:monitorUnitInfo:remove')}]]; var editFlag = [[${@permission.hasPermi('base:monitorUnitInfo:edit')}]];
var enableFlagDatas = [[${@dict.getType('enable_flag')}]]; var removeFlag = [[${@permission.hasPermi('base:monitorUnitInfo:remove')}]];
var prefix = ctx + "base/monitorUnitInfo"; var enableFlagDatas = [[${@dict.getType('enable_flag')}]];
var prefix = ctx + "base/monitorUnitInfo";
$(function() { $(function () {
var options = { var options = {
code: "monitorunitId", code: "monitorunitId",
parentCode: "parentId", parentCode: "parentId",
expandColumn: "2", expandColumn: "2",
uniqueId: "objId", uniqueId: "objId",
url: prefix + "/list", url: prefix + "/list",
createUrl: prefix + "/add/{id}", createUrl: prefix + "/add/{id}",
updateUrl: prefix + "/edit/{id}", updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove/{id}", removeUrl: prefix + "/remove/{id}",
exportUrl: prefix + "/export", exportUrl: prefix + "/export",
modalName: "监控单元信息", importUrl: prefix + "/importData",
columns: [{ importTemplateUrl: prefix + "/importTemplate",
field: 'selectItem', modalName: "监控单元信息",
radio: true columns: [{
field: 'selectItem',
radio: true
},
{
field: 'objId',
title: '标识',
visible: false
}, },
{
field:'objId',
title: '标识'
},
{ {
field: 'monitorunitId', field: 'monitorunitId',
title: '监控单元编号', title: '监控单元编号',
@ -103,17 +116,17 @@
align: 'left' align: 'left'
}, },
{ {
field: 'parentId', field: 'parentName',
title: '父级监控单元', title: '父级监控单元',
align: 'left' align: 'left'
}, },
{ {
field: 'monitorunitType', field: 'monitorunitTypeName',
title: '监控单元类型', title: '监控单元类型',
align: 'left' align: 'left'
}, },
{ {
field: 'substationId', field: 'substationName',
title: '所属变电站', title: '所属变电站',
align: 'left' align: 'left'
}, },
@ -121,7 +134,7 @@
field: 'enableFlag', field: 'enableFlag',
title: '是否启用', title: '是否启用',
align: 'left', align: 'left',
formatter: function(value, row, index) { formatter: function (value, row, index) {
return $.table.selectDictLabel(enableFlagDatas, value); return $.table.selectDictLabel(enableFlagDatas, value);
} }
}, },
@ -129,7 +142,7 @@
title: '操作', title: '操作',
align: 'center', align: 'center',
align: 'left', align: 'left',
formatter: function(value, row, index) { formatter: function (value, row, index) {
var actions = []; var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objId + '\')"><i class="fa fa-edit"></i>编辑</a> '); actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.objId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.objId + '\')"><i class="fa fa-plus"></i>新增</a> '); actions.push('<a class="btn btn-info btn-xs ' + addFlag + '" href="javascript:void(0)" onclick="$.operate.add(\'' + row.objId + '\')"><i class="fa fa-plus"></i>新增</a> ');
@ -137,9 +150,25 @@
return actions.join(''); return actions.join('');
} }
}] }]
}; };
$.treeTable.init(options); $.treeTable.init(options);
}); });
</script> </script>
<!-- 导入区域 -->
<script id="importTpl" type="text/template">
<form enctype="multipart/form-data" class="mt20 mb10">
<div class="col-xs-offset-1">
<input type="file" id="file" name="file"/>
<div class="mt10 pt5">
<input type="checkbox" id="updateSupport" name="updateSupport" title="如果登录账户已经存在,更新这条数据。"> 是否更新已经存在的用户数据
&nbsp; <a onclick="$.table.importTemplate()" class="btn btn-default btn-xs"><i
class="fa fa-file-excel-o"></i> 下载模板</a>
</div>
<font color="red" class="pull-left mt10">
提示仅允许导入“xls”或“xlsx”格式文件
</font>
</div>
</form>
</script>
</body> </body>
</html> </html>

@ -1,5 +1,7 @@
package com.ruoyi.common.core.domain; package com.ruoyi.common.core.domain;
import com.ruoyi.common.annotation.Excel;
/** /**
* Tree * Tree
* *
@ -13,6 +15,7 @@ public class TreeEntity extends BaseEntity
private String parentName; private String parentName;
/** 父菜单ID */ /** 父菜单ID */
@Excel(name = "父级编号")
private String parentId; private String parentId;
/** 显示顺序 */ /** 显示顺序 */

@ -22,6 +22,10 @@
<groupId>com.ruoyi</groupId> <groupId>com.ruoyi</groupId>
<artifactId>ruoyi-common</artifactId> <artifactId>ruoyi-common</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
</dependencies> </dependencies>

@ -15,6 +15,13 @@ public class BaseMonitorunitInfo extends TreeEntity
{ {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
public BaseMonitorunitInfo() {
}
public BaseMonitorunitInfo(String monitorunitId) {
this.monitorunitId = monitorunitId;
}
/** 主键标识 */ /** 主键标识 */
private Long objId; private Long objId;

@ -0,0 +1,18 @@
package com.ruoyi.system.domain.dto;
import com.ruoyi.system.domain.BaseMonitorunitInfo;
import lombok.Data;
/**
* @author WenJY
* @date 20220207 10:12
*/
@Data
public class BaseMonitorunitInfoDto extends BaseMonitorunitInfo {
private String monitorunitTypeName;
private String substationName;
private String parentName;
}

@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
/** /**
* Mapper * Mapper
@ -27,6 +28,15 @@ public interface BaseMonitorunitInfoMapper
*/ */
public List<BaseMonitorunitInfo> selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo); public List<BaseMonitorunitInfo> selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo);
/**
*
* @author WenJY
* @date 2022/2/7 10:23
* @param baseMonitorunitInfo
* @return java.util.List<com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto>
*/
public List<BaseMonitorunitInfoDto> selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo);
/** /**
* *
* *

@ -3,6 +3,7 @@ package com.ruoyi.system.service;
import java.util.List; import java.util.List;
import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseMonitorunitInfo;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
/** /**
* Service * Service
@ -28,6 +29,24 @@ public interface IBaseMonitorunitInfoService
*/ */
public List<BaseMonitorunitInfo> selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo); public List<BaseMonitorunitInfo> selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo);
/**
*
*
* @param baseMonitorunitInfo
* @return
*/
public List<BaseMonitorunitInfoDto> selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo);
/**
*
* @author WenJY
* @date 2022/2/7 9:53
* @param baseMonitorunitInfos
* @param updateSupport
* @return java.lang.String
*/
public String importMould(List<BaseMonitorunitInfo> baseMonitorunitInfos, boolean updateSupport);
/** /**
* *
* *

@ -1,9 +1,15 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.ruoyi.common.core.domain.Ztree; import com.ruoyi.common.core.domain.Ztree;
import com.ruoyi.common.exception.BusinessException;
import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.domain.BaseMonitorunitType;
import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto;
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.system.mapper.BaseMonitorunitInfoMapper; import com.ruoyi.system.mapper.BaseMonitorunitInfoMapper;
@ -47,6 +53,74 @@ public class BaseMonitorunitInfoServiceImpl implements IBaseMonitorunitInfoServi
return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(baseMonitorunitInfo); return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(baseMonitorunitInfo);
} }
/**
*
*
* @param baseMonitorunitInfo
* @return
*/
@Override
public List<BaseMonitorunitInfoDto> selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo)
{
return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo);
}
/**
*
* @author WenJY
* @date 2022/2/7 9:53
* @param baseMonitorunitInfos
* @param updateSupport
* @return java.lang.String
*/
@Override
public String importMould(List<BaseMonitorunitInfo> baseMonitorunitInfos, boolean updateSupport) {
if (StringUtils.isNull(baseMonitorunitInfos) || baseMonitorunitInfos.size() == 0) {
throw new BusinessException("导入标准数据不能为空!");
}
int successNum = 0;
int failureNum = 0;
StringBuilder successMsg = new StringBuilder();
StringBuilder failureMsg = new StringBuilder();
for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfos) {
try {
List<BaseMonitorunitInfo> baseMonitorunitInfoList =
baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo(baseMonitorunitInfo.getMonitorunitId()));
if (baseMonitorunitInfoList.size() == 0) {
baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName());
baseMonitorunitInfo.setCreateTime(new Date());
baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo);
successNum++;
successMsg.append("<br/>" + successNum + "、 " + baseMonitorunitInfo.getMonitorunitName() + " 导入成功");
} else if (updateSupport) {
for (BaseMonitorunitInfo unitInfo : baseMonitorunitInfoList) {
baseMonitorunitInfo.setObjId(unitInfo.getObjId());
baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName());
baseMonitorunitInfo.setUpdateTime(new Date());
baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo);
successNum++;
}
successMsg.append("<br/>" + successNum + "、" + baseMonitorunitInfo.getMonitorunitName() + " 更新成功");
} else {
failureNum++;
failureMsg.append("<br/>" + failureNum + "、" + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 已存在");
}
} catch (Exception e) {
failureNum++;
String msg = "<br/>" + failureNum + "、标准: " + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 导入失败:";
failureMsg.append(msg + e.getMessage());
}
}
if (failureNum > 0) {
failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:");
throw new BusinessException(failureMsg.toString());
} else {
successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:");
}
return successMsg.toString();
}
/** /**
* *
* *

@ -19,6 +19,23 @@
<result property="parentName" column="parent_name" /> <result property="parentName" column="parent_name" />
</resultMap> </resultMap>
<resultMap type="BaseMonitorunitInfoDto" id="BaseMonitorunitInfoDtoResult">
<result property="objId" column="ObjId" />
<result property="monitorunitId" column="MonitorUnit_Id" />
<result property="monitorunitName" column="MonitorUnit_Name" />
<result property="parentId" column="Parent_Id" />
<result property="monitorunitType" column="MonitorUnit_Type" />
<result property="substationId" column="Substation_Id" />
<result property="enableFlag" column="Enable_Flag" />
<result property="createBy" column="Create_By" />
<result property="createTime" column="Create_Time" />
<result property="updateBy" column="Update_By" />
<result property="updateTime" column="Update_Time" />
<result property="parentName" column="parent_name" />
<result property="monitorunitTypeName" column="MonitorUnitType_Name" />
<result property="substationName" column="Substation_Name" />
</resultMap>
<sql id="selectBaseMonitorunitInfoVo"> <sql id="selectBaseMonitorunitInfoVo">
select ObjId, MonitorUnit_Id, MonitorUnit_Name, Parent_Id, MonitorUnit_Type, Substation_Id, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_monitorunit_info select ObjId, MonitorUnit_Id, MonitorUnit_Name, Parent_Id, MonitorUnit_Type, Substation_Id, Enable_Flag, Create_By, Create_Time, Update_By, Update_Time from base_monitorunit_info
</sql> </sql>
@ -36,6 +53,24 @@
order by Parent_Id order by Parent_Id
</select> </select>
<select id="selectBaseMonitorunitInfoDtoList" parameterType="BaseMonitorunitInfo" resultMap="BaseMonitorunitInfoDtoResult">
select t1.objid, t1.monitorunit_id, t1.monitorunit_name, t1.parent_id, t3.MonitorUnit_Name as parent_name,
t1.monitorunit_type,t2.MonitorUnitType_Name, t1.substation_id,t4.Substation_Name,
t1.enable_flag from base_monitorunit_info t1
left join base_monitorunit_type t2 on t1.MonitorUnit_Type = t2.MonitorUnitType_Id
left join base_monitorunit_info t3 on t1.Parent_Id = t3.MonitorUnit_Id
left join base_substation_info t4 on t1.Substation_Id = t4.Substation_Id
<where>
<if test="monitorunitId != null and monitorunitId != ''"> and t1.MonitorUnit_Id like concat('%', #{monitorunitId}, '%')</if>
<if test="monitorunitName != null and monitorunitName != ''"> and t1.MonitorUnit_Name like concat('%', #{monitorunitName}, '%')</if>
<if test="parentId != null and parentId != ''"> and t1.Parent_Id = #{parentId}</if>
<if test="monitorunitType != null "> and t1.MonitorUnit_Type = #{monitorunitType}</if>
<if test="substationId != null and substationId != ''"> and t1.Substation_Id = #{substationId}</if>
<if test="enableFlag != null "> and t1.Enable_Flag = #{enableFlag}</if>
</where>
order by t1.objId
</select>
<select id="selectBaseMonitorunitInfoByObjId" parameterType="Long" resultMap="BaseMonitorunitInfoResult"> <select id="selectBaseMonitorunitInfoByObjId" parameterType="Long" resultMap="BaseMonitorunitInfoResult">
select t.ObjId, t.MonitorUnit_Id, t.MonitorUnit_Name, t.Parent_Id, t.MonitorUnit_Type, t.Substation_Id, t.Enable_Flag, t.Create_By, t.Create_Time, t.Update_By, t.Update_Time, p.MonitorUnit_Name as parent_name select t.ObjId, t.MonitorUnit_Id, t.MonitorUnit_Name, t.Parent_Id, t.MonitorUnit_Type, t.Substation_Id, t.Enable_Flag, t.Create_By, t.Create_Time, t.Update_By, t.Update_Time, p.MonitorUnit_Name as parent_name
from base_monitorunit_info t from base_monitorunit_info t

Loading…
Cancel
Save