Browse Source

优化

platform-api
blankk 2 years ago
parent
commit
84630b0c85
  1. 7
      ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java
  2. 2
      ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraMapper.java
  3. 2
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraService.java
  4. 5
      ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java
  5. 108
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java
  6. 70
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/domain/ScStationInfo.java
  7. 19
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/mapper/ScStationInfoMapper.java
  8. 24
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/IScStationInfoService.java
  9. 37
      ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/impl/ScStationInfoServiceImpl.java
  10. 11
      ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml
  11. 7
      ruoyi-code/src/main/resources/mapper/scStationInfo/ScStationInfoMapper.xml

7
ruoyi-code/src/main/java/com/ruoyi/code/camera/controller/CameraController.java

@ -141,5 +141,12 @@ public class CameraController extends BaseController @@ -141,5 +141,12 @@ public class CameraController extends BaseController
return R.ok().put("data",cameraService.getCameraList());
}
/**
* 根据站点表的id查询摄像头信息
*/
@RequestMapping("/cameraBySid/{sid}")
public R getCameraBySid(@PathVariable("sid") Long sid) {
return R.ok().put("data",cameraService.getCameraBySid(sid));
}
}

2
ruoyi-code/src/main/java/com/ruoyi/code/camera/mapper/CameraMapper.java

@ -17,4 +17,6 @@ public interface CameraMapper extends BaseMapper<Camera> @@ -17,4 +17,6 @@ public interface CameraMapper extends BaseMapper<Camera>
{
List<Camera> queryCameraList();
Camera queryCameraBYSid(Long sid);
}

2
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/ICameraService.java

@ -27,4 +27,6 @@ public interface ICameraService extends IService<Camera> @@ -27,4 +27,6 @@ public interface ICameraService extends IService<Camera>
void outline(String loginID);
List<Camera> getCameraList();
Camera getCameraBySid(Long sid);
}

5
ruoyi-code/src/main/java/com/ruoyi/code/camera/service/impl/CameraServiceImpl.java

@ -96,4 +96,9 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme @@ -96,4 +96,9 @@ public class CameraServiceImpl extends ServiceImpl<CameraMapper, Camera> impleme
public List<Camera> getCameraList() {
return baseMapper.queryCameraList();
}
@Override
public Camera getCameraBySid(Long sid) {
return baseMapper.queryCameraBYSid(sid);
}
}

108
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/controller/ScStationInfoController.java

@ -0,0 +1,108 @@ @@ -0,0 +1,108 @@
package com.ruoyi.code.sctaationinfo.controller;
import java.util.List;
import java.util.Arrays;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.annotation.Resource;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.core.page.R;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* 水尺-测站信息Controller
*
* @author ruoyi
* @date 2022-06-28
*/
@RestController
@RequestMapping("/system/info")
public class ScStationInfoController extends BaseController
{
@Resource
private IScStationInfoService scStationInfoService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('system:info:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return scStationInfoService.queryPage(params);
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('system:info:query')")
public R info(@PathVariable("id") Long id){
ScStationInfo scStationInfo = scStationInfoService.getById(id);
return R.ok().put("data", scStationInfo);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('system:info:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ScStationInfo scStationInfo)
{
List<ScStationInfo> list = scStationInfoService.list();
ExcelUtil<ScStationInfo> util = new ExcelUtil<ScStationInfo>(ScStationInfo.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "ScStationInfo", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('system:info:add')")
public R add(@RequestBody ScStationInfo scStationInfo){
scStationInfoService.save(scStationInfo);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('system:info:edit')")
@Log(title = "ScStationInfo", businessType = BusinessType.UPDATE)
public R edit(@RequestBody ScStationInfo scStationInfo){
scStationInfoService.updateById(scStationInfo);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('system:info:remove')")
@Log(title = "ScStationInfo", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
scStationInfoService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

70
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/domain/ScStationInfo.java

@ -0,0 +1,70 @@ @@ -0,0 +1,70 @@
package com.ruoyi.code.sctaationinfo.domain;
import java.math.BigDecimal;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import java.io.Serializable;
import lombok.Data;
/**
* 水尺-测站信息对象 sc_station_info
*
* @author ruoyi
* @date 2022-06-28
*/
@Data
@TableName("sc_station_info")
public class ScStationInfo implements Serializable
{
private static final long serialVersionUID = 1L;
/** 测站id */
@TableId(type = IdType.INPUT)
private Long id;
/** 测站名称 */
private String stnm;
/** 经度 */
private BigDecimal longitude;
/** 纬度 */
private BigDecimal latitude;
/** 测站状态: 0正常,1信道故障,5站点关闭 */
private String status;
/** 测站编码 */
private String staid;
/** 河流 */
private String rvnm;
/** 水系 */
private String hnnm;
/** 流域 */
private String bsnm;
/** 站址 */
private String stlc;
/** 测站编码 */
private String isState;
/** 保证水位 */
private BigDecimal bzsw;
/** 摄像头编号 */
@TableField(updateStrategy = FieldStrategy.IGNORED)
private String cameraSn;
/** 删除标识0未删除,1已删除 */
private String delFlag;
}

19
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/mapper/ScStationInfoMapper.java

@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
package com.ruoyi.code.sctaationinfo.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* Mapper接口
*
* @author ruoyi
* @date 2022-06-28
*/
@Mapper
public interface ScStationInfoMapper extends BaseMapper<ScStationInfo>
{
}

24
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/IScStationInfoService.java

@ -0,0 +1,24 @@ @@ -0,0 +1,24 @@
package com.ruoyi.code.sctaationinfo.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.common.core.page.R;
import java.util.List;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2022-06-28
*/
public interface IScStationInfoService extends IService<ScStationInfo>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
}

37
ruoyi-code/src/main/java/com/ruoyi/code/sctaationinfo/service/impl/ScStationInfoServiceImpl.java

@ -0,0 +1,37 @@ @@ -0,0 +1,37 @@
package com.ruoyi.code.sctaationinfo.service.impl;
import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.code.camera.domain.Camera;
import com.ruoyi.code.sctaationinfo.domain.ScStationInfo;
import com.ruoyi.code.sctaationinfo.mapper.ScStationInfoMapper;
import com.ruoyi.code.sctaationinfo.service.IScStationInfoService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.springframework.stereotype.Service;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2022-06-28
*/
@Service("scStationInfoService")
public class ScStationInfoServiceImpl extends ServiceImpl<ScStationInfoMapper, ScStationInfo> implements IScStationInfoService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<ScStationInfo> page = this.page(
new Query<ScStationInfo>().getPage(params),
new QueryWrapper<ScStationInfo>()
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
}

11
ruoyi-code/src/main/resources/mapper/camera/CameraMapper.xml

@ -9,4 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" @@ -9,4 +9,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select camera_sn from sc_station_info
)
</select>
<select id="queryCameraBYSid" resultType="com.ruoyi.code.camera.domain.Camera">
select
c.*
from
camera c,
sc_station_info s
where
c.devsn = s.camera_sn
and s.id = #{sid}
</select>
</mapper>

7
ruoyi-code/src/main/resources/mapper/scStationInfo/ScStationInfoMapper.xml

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
<?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.ruoyi.code.sctaationinfo.mapper.ScStationInfoMapper">
</mapper>
Loading…
Cancel
Save