Browse Source

rtu数据

master
blank 10 months ago
parent
commit
bb810a1472
  1. 107
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java
  2. 56
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java
  3. 20
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java
  4. 23
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java
  5. 44
      ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java
  6. 10
      ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml

107
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java

@ -0,0 +1,107 @@ @@ -0,0 +1,107 @@
package com.ruoyi.code.rtudata.controller;
import com.ruoyi.code.rtudata.domain.RtuData;
import com.ruoyi.code.rtudata.service.IRtuDataService;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* 数据列表Controller
*
* @author ruoyi
* @date 2024-01-17
*/
@RestController
@RequestMapping("/rtudata/rtudata")
public class RtuDataController extends BaseController
{
@Resource
private IRtuDataService rtuDataService;
/**
* 查询列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:list')")
@RequestMapping("/list")
public R list(@RequestParam Map<String, Object> params){
return rtuDataService.queryPage(params);
}
/**
* 查询标签列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:list')")
@RequestMapping("/tabsList")
public R tabsList(){
return rtuDataService.tabsList();
}
/**
* 获取详细信息
*/
@RequestMapping("/info/{id}")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:query')")
public R info(@PathVariable("id") Long id){
RtuData rtuData = rtuDataService.getById(id);
return R.ok().put("data", rtuData);
}
/**
* 导出列表
*/
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:export')")
@Log(title = "列表", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, RtuData rtuData)
{
List<RtuData> list = rtuDataService.list();
ExcelUtil<RtuData> util = new ExcelUtil<RtuData>(RtuData.class);
util.exportExcel(response, list, "列表数据");
}
/**
* 新增
*/
@RequestMapping("/add")
@Log(title = "RtuData", businessType = BusinessType.INSERT)
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:add')")
public R add(@RequestBody RtuData rtuData){
rtuDataService.save(rtuData);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/edit")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:edit')")
@Log(title = "RtuData", businessType = BusinessType.UPDATE)
public R edit(@RequestBody RtuData rtuData){
rtuDataService.updateById(rtuData);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete/{ids}")
@PreAuthorize("@ss.hasPermi('rtudata:rtudata:remove')")
@Log(title = "RtuData", businessType = BusinessType.DELETE)
public R delete(@PathVariable Long[] ids){
rtuDataService.removeByIds(Arrays.asList(ids));
return R.ok();
}
}

56
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
package com.ruoyi.code.rtudata.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.baomidou.mybatisplus.annotation.IdType;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.TableId;
import com.ruoyi.common.annotation.Excel;
import java.io.Serializable;
import lombok.Data;
/**
* 数据列表对象 rtu_data
*
* @author ruoyi
* @date 2024-01-17
*/
@Data
@TableName("rtu_data")
public class RtuData implements Serializable
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
@TableId(type = IdType.INPUT)
private Long id;
/** 遥测站地址 */
private Long sid;
/** 遥测站分类码 */
private String type;
/** 监测项 */
private String item;
/** 监测码 */
private String itemCode;
/** 监测值 */
private String val;
/** 单位 */
private String unit;
/** 观测时间 */
private Date dt;
/** 上报时间 */
private Date updDt;
}

20
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java

@ -0,0 +1,20 @@ @@ -0,0 +1,20 @@
package com.ruoyi.code.rtudata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.code.rtudata.domain.RtuData;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* Mapper接口
*
* @author ruoyi
* @date 2024-01-17
*/
@Mapper
public interface RtuDataMapper extends BaseMapper<RtuData>
{
List<RtuData> tabsList();
}

23
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java

@ -0,0 +1,23 @@ @@ -0,0 +1,23 @@
package com.ruoyi.code.rtudata.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.code.rtudata.domain.RtuData;
import com.ruoyi.common.core.page.R;
import java.util.Map;
/**
* Service接口
*
* @author ruoyi
* @date 2024-01-17
*/
public interface IRtuDataService extends IService<RtuData>
{
/**
* 查询
*/
R queryPage(Map<String, Object> params);
R tabsList();
}

44
ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java

@ -0,0 +1,44 @@ @@ -0,0 +1,44 @@
package com.ruoyi.code.rtudata.service.impl;
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.rtudata.domain.RtuData;
import com.ruoyi.code.rtudata.mapper.RtuDataMapper;
import com.ruoyi.code.rtudata.service.IRtuDataService;
import com.ruoyi.common.core.page.R;
import com.ruoyi.common.utils.Query;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* Service业务层处理
*
* @author ruoyi
* @date 2024-01-17
*/
@Service("rtuDataService")
public class RtuDataServiceImpl extends ServiceImpl<RtuDataMapper, RtuData> implements IRtuDataService
{
@Override
public R queryPage(Map<String, Object> params) {
IPage<RtuData> page = this.page(
new Query<RtuData>().getPage(params),
new QueryWrapper<RtuData>()
.eq(ObjectUtils.isNotEmpty(params.get("itemCode")),"item_code",params.get("itemCode"))
.orderByDesc("dt")
);
return R.ok().put("count", page.getTotal()).put("data", page.getRecords());
}
@Override
public R tabsList() {
List<RtuData> list = baseMapper.tabsList();
return R.ok().put("data", list);
}
}

10
ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml

@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
<?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.rtudata.mapper.RtuDataMapper">
<select id="tabsList" resultType="com.ruoyi.code.rtudata.domain.RtuData">
SELECT DISTINCT item,item_code FROM `rtu_data`
</select>
</mapper>
Loading…
Cancel
Save