中自EMS-远程控制
This commit is contained in:
@ -0,0 +1,48 @@
|
|||||||
|
package com.ho.business.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.ho.common.tools.constant.CommonConstant;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StationRemoteControl implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "id")
|
||||||
|
private Integer id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电站id")
|
||||||
|
private Integer stationId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "电站名称")
|
||||||
|
private String stationName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "远程访问ip、也可以是域名")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "端口")
|
||||||
|
private String port;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "账号")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内网ip")
|
||||||
|
private String intranetIp;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "ems页面类型")
|
||||||
|
private String type;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = CommonConstant.DATE)
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = CommonConstant.DATE)
|
||||||
|
@ApiModelProperty(value = "修改时间")
|
||||||
|
private Date updateTime;
|
||||||
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
package com.ho.business.vo.req;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StationRemoteControlPageVo extends StationRemoteControl {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "第几页")
|
||||||
|
private Integer pageNum=1;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页数量")
|
||||||
|
private Integer pageSize=10;
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,21 @@
|
|||||||
|
package com.ho.business.mapper;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface StationRemoteControlMapper {
|
||||||
|
void insert(@Param("entity") StationRemoteControl entity);
|
||||||
|
|
||||||
|
void update(@Param("entity") StationRemoteControl entity);
|
||||||
|
|
||||||
|
void delete(@Param("id") Integer id);
|
||||||
|
|
||||||
|
StationRemoteControl search(@Param("stationId") Integer stationId);
|
||||||
|
|
||||||
|
List<StationRemoteControl> selectList(@Param("vo") StationRemoteControlPageVo vo);
|
||||||
|
}
|
||||||
@ -0,0 +1,17 @@
|
|||||||
|
package com.ho.business.service;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
|
||||||
|
public interface StationRemoteControlService {
|
||||||
|
void insert(StationRemoteControl entity);
|
||||||
|
|
||||||
|
void update(StationRemoteControl entity);
|
||||||
|
|
||||||
|
void delete(Integer id);
|
||||||
|
|
||||||
|
StationRemoteControl search(Integer stationId);
|
||||||
|
|
||||||
|
PageResult<StationRemoteControl> selectPageList(StationRemoteControlPageVo vo);
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
package com.ho.business.service.impl;
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageHelper;
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.mapper.StationRemoteControlMapper;
|
||||||
|
import com.ho.business.service.StationRemoteControlService;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
import com.ho.common.tools.util.PageUtils;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
public class StationRemoteControlServiceImpl implements StationRemoteControlService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
StationRemoteControlMapper stationRemoteControlMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insert(StationRemoteControl entity) {
|
||||||
|
stationRemoteControlMapper.insert(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void update(StationRemoteControl entity) {
|
||||||
|
stationRemoteControlMapper.update(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void delete(Integer id) {
|
||||||
|
stationRemoteControlMapper.delete(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StationRemoteControl search(Integer stationId) {
|
||||||
|
return stationRemoteControlMapper.search(stationId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PageResult<StationRemoteControl> selectPageList(StationRemoteControlPageVo vo) {
|
||||||
|
PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
|
||||||
|
List<StationRemoteControl> list = stationRemoteControlMapper.selectList(vo);
|
||||||
|
return PageUtils.getPageResult(new PageInfo<>(list));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,99 @@
|
|||||||
|
<?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.ho.business.mapper.StationRemoteControlMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.ho.business.entity.StationRemoteControl"
|
||||||
|
useGeneratedKeys="true">
|
||||||
|
insert into station_remote_control
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="entity.id != null">id,</if>
|
||||||
|
<if test="entity.stationId != null">station_id,</if>
|
||||||
|
<if test="entity.ip != null">ip,</if>
|
||||||
|
<if test="entity.port != null">port,</if>
|
||||||
|
<if test="entity.userName != null">user_name,</if>
|
||||||
|
<if test="entity.password != null">password,</if>
|
||||||
|
<if test="entity.intranetIp != null">intranet_ip,</if>
|
||||||
|
<if test="entity.type != null">type,</if>
|
||||||
|
<if test="entity.createTime != null">create_time,</if>
|
||||||
|
<if test="entity.updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="entity.id != null">#{entity.id,jdbcType=INTEGER},</if>
|
||||||
|
<if test="entity.stationId != null">#{entity.stationId,jdbcType=INTEGER},</if>
|
||||||
|
<if test="entity.ip != null">#{entity.ip,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.port != null">#{entity.port,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.userName != null">#{entity.userName,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.password != null">#{entity.password,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.intranetIp != null">#{entity.intranetIp,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.type != null">#{entity.type,jdbcType=VARCHAR},</if>
|
||||||
|
<if test="entity.createTime != null">#{entity.createTime,jdbcType=TIMESTAMP},</if>
|
||||||
|
<if test="entity.updateTime != null">#{entity.updateTime,jdbcType=TIMESTAMP},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
<update id="update" parameterType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
update station_remote_control
|
||||||
|
<set>
|
||||||
|
<if test="entity.ip != null">
|
||||||
|
ip = #{entity.ip,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.port != null">
|
||||||
|
port = #{entity.port,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.userName != null">
|
||||||
|
user_name = #{entity.userName,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.password != null">
|
||||||
|
password = #{entity.password,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.intranetIp != null">
|
||||||
|
intranet_ip = #{entity.intranetIp,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.type != null">
|
||||||
|
type = #{entity.type,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
<if test="entity.updateTime != null">
|
||||||
|
update_time = #{entity.updateTime,jdbcType=VARCHAR},
|
||||||
|
</if>
|
||||||
|
</set>
|
||||||
|
where id = #{entity.id,jdbcType=INTEGER}
|
||||||
|
</update>
|
||||||
|
<delete id="delete">
|
||||||
|
delete from station_remote_control where id = #{id,jdbcType=INTEGER}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<select id="search" resultType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
select s.*,t.name stationName from station_remote_control s
|
||||||
|
left join station t on s.station_id = t.id
|
||||||
|
<where>
|
||||||
|
<if test="stationId != null and stationId !=''">
|
||||||
|
and s.station_id = #{stationId}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectList" resultType="com.ho.business.entity.StationRemoteControl">
|
||||||
|
select s.*,t.name stationName from station_remote_control s
|
||||||
|
left join station t on s.station_id = t.id
|
||||||
|
<where>
|
||||||
|
<if test="vo.stationId != null and vo.stationId !=''">
|
||||||
|
and s.station_id = #{vo.stationId}
|
||||||
|
</if>
|
||||||
|
<if test="vo.stationName != null and vo.stationName !=''">
|
||||||
|
and t.name like concat('%',#{vo.stationName},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.intranetIp != null and vo.intranetIp !=''">
|
||||||
|
and s.intranet_ip like concat('%',#{vo.intranetIp},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.ip != null and vo.ip !=''">
|
||||||
|
and s.ip like concat('%',#{vo.ip},'%')
|
||||||
|
</if>
|
||||||
|
<if test="vo.type != null and vo.type !=''">
|
||||||
|
and s.type = #{vo.type}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
order by s.create_time desc
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@ -0,0 +1,72 @@
|
|||||||
|
package com.ho.business.controller;
|
||||||
|
|
||||||
|
import com.ho.business.entity.StationRemoteControl;
|
||||||
|
import com.ho.business.service.StationRemoteControlService;
|
||||||
|
import com.ho.business.vo.req.StationRemoteControlPageVo;
|
||||||
|
import com.ho.common.tools.annotation.LogAnnotation;
|
||||||
|
import com.ho.common.tools.constant.ContextConstant;
|
||||||
|
import com.ho.common.tools.exception.BaseResponseCode;
|
||||||
|
import com.ho.common.tools.exception.BusinessException;
|
||||||
|
import com.ho.common.tools.exception.DataResult;
|
||||||
|
import com.ho.common.tools.util.PageResult;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.Valid;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
@RequestMapping(ContextConstant.BUSINESS + "stationRemote")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "业务模块-电站远控管理")
|
||||||
|
public class StationRemoteController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StationRemoteControlService stationRemoteControlService;
|
||||||
|
|
||||||
|
@PostMapping("saveOrUpdate")
|
||||||
|
@ApiOperation(value = "新增/修改远控电站信息")
|
||||||
|
@LogAnnotation(title = "电站远控管理", action = "新增/修改新增远控电站信息")
|
||||||
|
public DataResult saveOrUpdate(@RequestBody @Valid StationRemoteControl entity) {
|
||||||
|
if(entity==null){
|
||||||
|
throw new BusinessException(BaseResponseCode.DATA_NOT_EXISTS);
|
||||||
|
}
|
||||||
|
if(entity.getId()==null){
|
||||||
|
//新增
|
||||||
|
StationRemoteControl stationRemoteControl = stationRemoteControlService.search(entity.getStationId());
|
||||||
|
if (stationRemoteControl != null) {
|
||||||
|
throw new BusinessException(BaseResponseCode.STATION_ALREADY_EXISTS);
|
||||||
|
}
|
||||||
|
entity.setCreateTime(new Date());
|
||||||
|
stationRemoteControlService.insert(entity);
|
||||||
|
}else{
|
||||||
|
//修改
|
||||||
|
entity.setUpdateTime(new Date());
|
||||||
|
stationRemoteControlService.update(entity);
|
||||||
|
}
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("delete")
|
||||||
|
@ApiOperation(value = "删除远控电站信息")
|
||||||
|
@LogAnnotation(title = "电站远控管理", action = "删除远控电站信息")
|
||||||
|
public DataResult delete(@RequestBody Integer id) {
|
||||||
|
stationRemoteControlService.delete(id);
|
||||||
|
return DataResult.success();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("search")
|
||||||
|
@ApiOperation(value = "查询远控电站信息")
|
||||||
|
public DataResult<StationRemoteControl> search(@RequestBody StationRemoteControlPageVo vo) {
|
||||||
|
StationRemoteControl stationRemoteControl=stationRemoteControlService.search(vo.getStationId());
|
||||||
|
return DataResult.success(stationRemoteControl);
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("pageList")
|
||||||
|
@ApiOperation(value = "查询远控电站信息")
|
||||||
|
public DataResult<PageResult<StationRemoteControl>> pageList(@RequestBody StationRemoteControlPageVo vo) {
|
||||||
|
PageResult<StationRemoteControl> page = stationRemoteControlService.selectPageList(vo);
|
||||||
|
return DataResult.success(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user