From bb810a1472d51c222d833c57123bb4a4e84ad027 Mon Sep 17 00:00:00 2001 From: blank <2649084208@qq.com> Date: Wed, 17 Jan 2024 15:35:41 +0800 Subject: [PATCH] =?UTF-8?q?rtu=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rtudata/controller/RtuDataController.java | 107 ++++++++++++++++++ .../ruoyi/code/rtudata/domain/RtuData.java | 56 +++++++++ .../code/rtudata/mapper/RtuDataMapper.java | 20 ++++ .../code/rtudata/service/IRtuDataService.java | 23 ++++ .../service/impl/RtuDataServiceImpl.java | 44 +++++++ .../mapper/rtudata/RtuDataMapper.xml | 10 ++ 6 files changed, 260 insertions(+) create mode 100644 ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java create mode 100644 ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java create mode 100644 ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java create mode 100644 ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java create mode 100644 ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java create mode 100644 ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java new file mode 100644 index 0000000..ec1fcc5 --- /dev/null +++ b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/controller/RtuDataController.java @@ -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 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 list = rtuDataService.list(); + ExcelUtil util = new ExcelUtil(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(); + } + +} diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java new file mode 100644 index 0000000..4815c2b --- /dev/null +++ b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/domain/RtuData.java @@ -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; + + +} diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java new file mode 100644 index 0000000..99c8f2c --- /dev/null +++ b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/mapper/RtuDataMapper.java @@ -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 +{ + + List tabsList(); +} diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java new file mode 100644 index 0000000..660afd7 --- /dev/null +++ b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/IRtuDataService.java @@ -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 +{ + /** + * 查询 + */ + R queryPage(Map params); + + R tabsList(); +} diff --git a/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java new file mode 100644 index 0000000..cc64b78 --- /dev/null +++ b/ruoyi-code/src/main/java/com/ruoyi/code/rtudata/service/impl/RtuDataServiceImpl.java @@ -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 implements IRtuDataService +{ + @Override + public R queryPage(Map params) { + IPage page = this.page( + new Query().getPage(params), + new QueryWrapper() + .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 list = baseMapper.tabsList(); + return R.ok().put("data", list); + } + +} diff --git a/ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml b/ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml new file mode 100644 index 0000000..5c5c538 --- /dev/null +++ b/ruoyi-code/src/main/resources/mapper/rtudata/RtuDataMapper.xml @@ -0,0 +1,10 @@ + + + + + +