欣影管理平台新增电压等级接口
parent
cb0a6a2c8b
commit
b7be61c7fd
@ -0,0 +1,57 @@
|
||||
package com.shxy.xymanager_admin.controller;
|
||||
|
||||
import com.shxy.xymanager_common.annotation.Log;
|
||||
import com.shxy.xymanager_common.base.BaseController;
|
||||
import com.shxy.xymanager_common.base.ResponseReult;
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.bean.ServiceStatus;
|
||||
import com.shxy.xymanager_common.model.DyLineTreeListModel;
|
||||
import com.shxy.xymanager_common.model.DyListModel;
|
||||
import com.shxy.xymanager_common.vo.TerminalIdVo;
|
||||
import com.shxy.xymanager_service.service.DyLevelService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiResponse;
|
||||
import io.swagger.annotations.ApiResponses;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
|
||||
@Api(value = "电压等级接口", tags = "电压等级接口描述")
|
||||
@RestController
|
||||
@Slf4j
|
||||
public class DyLevelController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
DyLevelService dyLevelService;
|
||||
|
||||
@ApiOperation(value = "获取电压等级树状列表接口", notes = "获取电压等级树状列表接口", httpMethod = "POST")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
||||
@RequestMapping("/getdyTreeList")
|
||||
@Log(title = "获取电压等级树状列表接口", type = "查询")
|
||||
public ResponseReult<DyLineTreeListModel> getdyTreeList() {
|
||||
ServiceBody<DyLineTreeListModel> serviceBody = dyLevelService.getdyTreeList();
|
||||
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||
return ResponseReult.success(serviceBody.getData());
|
||||
} else {
|
||||
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "获取电压等级列表", notes = "获取电压等级列表", httpMethod = "POST")
|
||||
@ApiResponses({@ApiResponse(code = 200, message = "请求成功"), @ApiResponse(code = 400, message = "请求参数没填好"), @ApiResponse(code = 404, message = "请求路径没有或页面跳转路径不对")})
|
||||
@RequestMapping("/getdyList")
|
||||
@Log(title = "获取电压等级列表", type = "查询")
|
||||
public ResponseReult<DyListModel> getdyList() {
|
||||
ServiceBody<DyListModel> serviceBody = dyLevelService.getdyList();
|
||||
if (serviceBody.getCode() == ServiceStatus.SUCCESS) {
|
||||
return ResponseReult.success(serviceBody.getData());
|
||||
} else {
|
||||
return ResponseReult.error(serviceBody.getCode(), serviceBody.getMsg());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package com.shxy.xymanager_common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DyLineAndTerminalDto {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer dyValue;
|
||||
|
||||
private List<LineAndTerminalDto> list;
|
||||
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
package com.shxy.xymanager_common.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 线路和电压等级名称对象
|
||||
*/
|
||||
@Data
|
||||
public class LineAndDyNameDto {
|
||||
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String bsManufacturer;
|
||||
|
||||
private Integer dyLevelId;
|
||||
|
||||
private String dyLevelName;
|
||||
|
||||
private Integer status;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package com.shxy.xymanager_common.entity;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class DyLevel implements Serializable {
|
||||
private Integer id;
|
||||
|
||||
private String name;
|
||||
|
||||
private Integer dyValue;
|
||||
|
||||
private Integer status;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
private Date updateTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package com.shxy.xymanager_common.model;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 电压等级列表
|
||||
*/
|
||||
@Data
|
||||
@ApiModel(value = "获取电压等级列表", description = "获取电压等级列表信息")
|
||||
public class DyListModel implements Serializable {
|
||||
@ApiModelProperty(value = "电压等级列表", example = "[]")
|
||||
private List<DyBean> list;
|
||||
|
||||
@Data
|
||||
public static class DyBean {
|
||||
|
||||
@ApiModelProperty(value = "电压编号", example = "123456")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "电压名称", example = "AAAA")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "电压大小", example = "AAAA")
|
||||
private Integer dyValue;
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.shxy.xymanager_common.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
@Data
|
||||
@ApiModel(value = "分页对象", description = "分页对象描述")
|
||||
public class PageVo {
|
||||
@Min(value = 1, message = "分页位置最小从1开始")
|
||||
@ApiModelProperty(value = "分页位置从1开始", required = true, example = "1")
|
||||
private int pageindex;
|
||||
|
||||
@Min(value = 1, message = "分页大小最小为1")
|
||||
@ApiModelProperty(value = "分页大小", required = true, example = "1")
|
||||
private int pagesize;
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package com.shxy.xymanager_dao.dao;
|
||||
|
||||
import com.shxy.xymanager_common.dto.DyLineAndTerminalDto;
|
||||
import com.shxy.xymanager_common.entity.DyLevel;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DyLevelDao {
|
||||
int deleteByPrimaryKey(Integer id);
|
||||
|
||||
int insert(DyLevel record);
|
||||
|
||||
int insertSelective(DyLevel record);
|
||||
|
||||
DyLevel selectByPrimaryKey(Integer id);
|
||||
|
||||
List<DyLevel> selectAll(@Param("status") Integer status);
|
||||
|
||||
List<DyLineAndTerminalDto> selectTreeList(@Param("status") Integer status);
|
||||
|
||||
int updateByPrimaryKeySelective(DyLevel record);
|
||||
|
||||
int updateByPrimaryKey(DyLevel record);
|
||||
}
|
@ -0,0 +1,153 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.shxy.xymanager_dao.dao.DyLevelDao">
|
||||
<resultMap id="BaseResultMap" type="com.shxy.xymanager_common.entity.DyLevel">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="dy_value" jdbcType="INTEGER" property="dyValue"/>
|
||||
<result column="status" jdbcType="INTEGER" property="status"/>
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="LineAndTerminalMap" type="com.shxy.xymanager_common.dto.DyLineAndTerminalDto">
|
||||
<id column="id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="dyvalue" jdbcType="INTEGER" property="dyValue"/>
|
||||
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.dto.LineAndTerminalDto">
|
||||
<id column="line_id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="line_name" jdbcType="VARCHAR" property="name"/>
|
||||
<result column="bs_manufacturer" jdbcType="VARCHAR" property="bsManufacturer"/>
|
||||
<result column="dy_level_id" jdbcType="INTEGER" property="dyLevel"/>
|
||||
<collection property="list" javaType="list" ofType="com.shxy.xymanager_common.entity.Terminals">
|
||||
<result column="term_id" jdbcType="INTEGER" property="id"/>
|
||||
<result column="tower_id" jdbcType="INTEGER" property="towerid"/>
|
||||
<result column="cmdid" jdbcType="VARCHAR" property="cmdid"/>
|
||||
<result column="equip_name" jdbcType="VARCHAR" property="equipName"/>
|
||||
<result column="display_name" jdbcType="VARCHAR" property="displayName"/>
|
||||
<result column="model" jdbcType="VARCHAR" property="model"/>
|
||||
</collection>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<sql id="Base_Column_List">
|
||||
id, name, dy_value, status, create_time, update_time
|
||||
</sql>
|
||||
<select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from dy_level
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</select>
|
||||
|
||||
<select id="selectAll" parameterType="java.lang.Integer" resultMap="BaseResultMap">
|
||||
select
|
||||
<include refid="Base_Column_List"/>
|
||||
from dy_level
|
||||
where status = #{status}
|
||||
</select>
|
||||
|
||||
<select id="selectTreeList" resultMap="LineAndTerminalMap">
|
||||
select
|
||||
z.id as id,
|
||||
z.name as name,
|
||||
z.dy_value as dyvalue,
|
||||
x.id as line_id,
|
||||
x.name as line_name,
|
||||
x.bs_manufacturer as bs_manufacturer,
|
||||
x.dy_level_id as dy_level_id,
|
||||
y.id as term_id,
|
||||
y.tower_id as tower_id,
|
||||
y.cmdid as cmdid,
|
||||
y.equip_name as equip_name,
|
||||
y.display_name as display_name,
|
||||
y.model as model
|
||||
from `lines` x,
|
||||
terminals y,
|
||||
dy_level z
|
||||
where z.id = x.dy_level_id and x.id = y.line_id and x.status = #{status} and y.status = #{status} and z.status = #{status}
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="insert" parameterType="com.shxy.xymanager_common.entity.DyLevel">
|
||||
insert into dy_level (id, name, dy_value,
|
||||
status, create_time, update_time
|
||||
)
|
||||
values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{dyValue,jdbcType=INTEGER},
|
||||
#{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.shxy.xymanager_common.entity.DyLevel">
|
||||
insert into dy_level
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
id,
|
||||
</if>
|
||||
<if test="name != null">
|
||||
name,
|
||||
</if>
|
||||
<if test="dyValue != null">
|
||||
dy_value,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="name != null">
|
||||
#{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dyValue != null">
|
||||
#{dyValue,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.shxy.xymanager_common.entity.DyLevel">
|
||||
update dy_level
|
||||
<set>
|
||||
<if test="name != null">
|
||||
name = #{name,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="dyValue != null">
|
||||
dy_value = #{dyValue,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status,jdbcType=INTEGER},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP},
|
||||
</if>
|
||||
</set>
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
<update id="updateByPrimaryKey" parameterType="com.shxy.xymanager_common.entity.DyLevel">
|
||||
update dy_level
|
||||
set name = #{name,jdbcType=VARCHAR},
|
||||
dy_value = #{dyValue,jdbcType=INTEGER},
|
||||
status = #{status,jdbcType=INTEGER},
|
||||
create_time = #{createTime,jdbcType=TIMESTAMP},
|
||||
update_time = #{updateTime,jdbcType=TIMESTAMP}
|
||||
where id = #{id,jdbcType=INTEGER}
|
||||
</update>
|
||||
</mapper>
|
@ -0,0 +1,78 @@
|
||||
package com.shxy.xymanager_service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.dto.DyLineAndTerminalDto;
|
||||
import com.shxy.xymanager_common.entity.DyLevel;
|
||||
import com.shxy.xymanager_common.entity.Lines;
|
||||
import com.shxy.xymanager_common.enums.CommonStatus;
|
||||
import com.shxy.xymanager_common.exception.Asserts;
|
||||
import com.shxy.xymanager_common.model.DyLineTreeListModel;
|
||||
import com.shxy.xymanager_common.model.DyListModel;
|
||||
import com.shxy.xymanager_common.vo.TerminalIdVo;
|
||||
import com.shxy.xymanager_dao.dao.DyLevelDao;
|
||||
import com.shxy.xymanager_service.service.DyLevelService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 装置通道实现层
|
||||
*/
|
||||
@Service
|
||||
@Slf4j
|
||||
public class DyLevelServiceImpl implements DyLevelService {
|
||||
|
||||
@Autowired
|
||||
DyLevelDao dyLevelDao;
|
||||
|
||||
/**
|
||||
* 获取电压线路树状接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServiceBody<DyLineTreeListModel> getdyTreeList() {
|
||||
DyLineTreeListModel model = new DyLineTreeListModel();
|
||||
List<DyLineAndTerminalDto> list = dyLevelDao.selectTreeList(CommonStatus.EFFECTIVE.value());
|
||||
boolean empty = CollectionUtil.isEmpty(list);
|
||||
if (empty) {
|
||||
model.setList(new ArrayList<>());
|
||||
} else {
|
||||
List<DyLineTreeListModel.DyListBean> beans = BeanUtil.copyToList(list, DyLineTreeListModel.DyListBean.class);
|
||||
for (int i = 0; i < beans.size(); i++) {
|
||||
for (int j = 0; j < beans.get(i).getList().size(); j++) {
|
||||
for (int k = 0; k < beans.get(i).getList().get(j).getList().size(); k++) {
|
||||
beans.get(i).getList().get(j).getList().get(k).setName(list.get(i).getList().get(j).getList().get(k).getDisplayName());
|
||||
}
|
||||
}
|
||||
}
|
||||
model.setList(beans);
|
||||
}
|
||||
return Asserts.success(model);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取电压等级列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ServiceBody<DyListModel> getdyList() {
|
||||
DyListModel model = new DyListModel();
|
||||
List<DyLevel> list = dyLevelDao.selectAll(CommonStatus.EFFECTIVE.value());
|
||||
boolean empty = CollectionUtil.isEmpty(list);
|
||||
if (empty) {
|
||||
model.setList(new ArrayList<>());
|
||||
} else {
|
||||
List<DyListModel.DyBean> models = BeanUtil.copyToList(list, DyListModel.DyBean.class);
|
||||
model.setList(models);
|
||||
}
|
||||
return Asserts.success(model);
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package com.shxy.xymanager_service.service;
|
||||
|
||||
import com.shxy.xymanager_common.bean.ServiceBody;
|
||||
import com.shxy.xymanager_common.model.DyLineTreeListModel;
|
||||
import com.shxy.xymanager_common.model.DyListModel;
|
||||
import com.shxy.xymanager_common.vo.TerminalIdVo;
|
||||
|
||||
/**
|
||||
* 电压等级接口
|
||||
*
|
||||
* @author 晶晶
|
||||
*/
|
||||
public interface DyLevelService {
|
||||
/**
|
||||
* 获取电压线路树状接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ServiceBody<DyLineTreeListModel> getdyTreeList();
|
||||
|
||||
|
||||
/**
|
||||
* 获取电压等级列表
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
ServiceBody<DyListModel> getdyList();
|
||||
|
||||
}
|
Loading…
Reference in New Issue