From 31fbe2a0b88bd33b3aef4b362b1aa849f566cc17 Mon Sep 17 00:00:00 2001
From: Administrator <1144154118@qq.com>
Date: 星期三, 23 八月 2023 17:29:09 +0800
Subject: [PATCH] 管线接口
---
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java | 56 +++++++++++
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesMapper.java | 4
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/IArdTubesService.java | 8 +
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesDetailsMapper.java | 3
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubes.java | 6 +
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesController.java | 174 ++++++++++++++++++++++------------
ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubesParam.java | 35 +++++++
7 files changed, 223 insertions(+), 63 deletions(-)
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesController.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesController.java
index 81601eb..aff35ac 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesController.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/controller/ArdTubesController.java
@@ -5,9 +5,14 @@
import javax.servlet.http.HttpServletResponse;
import com.ruoyi.alarmpoints.tube.domain.ArdTubes;
+import com.ruoyi.alarmpoints.tube.domain.ArdTubesParam;
import com.ruoyi.alarmpoints.tube.service.IArdTubesService;
+import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.poi.ExcelUtil;
+import com.ruoyi.system.service.ISysDeptService;
+import com.ruoyi.system.service.ISysUserService;
+import com.ruoyi.utils.result.Results;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -42,77 +47,124 @@
@Resource
private IArdTubesService ardTubesService;
+ @Autowired
+ private ISysUserService sysUserService;
+
+ @Autowired
+ private ISysDeptService sysDeptService;
+
+// /**
+// * 鏌ヨ绠$嚎绠$悊鍒楄〃
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:list')")
+// @GetMapping("/list")
+// @ApiOperation("鏌ヨ绠$嚎绠$悊鍒楄〃")
+// public TableDataInfo list(ArdTubes ardTubes)
+// {
+// startPage();
+// List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes);
+// return getDataTable(list);
+// }
+//
+// /**
+// * 瀵煎嚭绠$嚎绠$悊鍒楄〃
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:export')")
+// @Log(title = "绠$嚎绠$悊", businessType = BusinessType.EXPORT)
+// @PostMapping("/export")
+// @ApiOperation("瀵煎嚭绠$嚎绠$悊鍒楄〃")
+// public void export(HttpServletResponse response, ArdTubes ardTubes)
+// {
+// List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes);
+// ExcelUtil<ArdTubes> util = new ExcelUtil<ArdTubes>(ArdTubes.class);
+// util.exportExcel(response, list, "绠$嚎绠$悊鏁版嵁");
+// }
+//
+// /**
+// * 鑾峰彇绠$嚎绠$悊璇︾粏淇℃伅
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:query')")
+// @GetMapping(value = "/{id}")
+// @ApiOperation("閫氳繃ID鑾峰彇绠$嚎绠$悊璇︾粏淇℃伅")
+// public AjaxResult getInfo(@PathVariable("id") String id)
+// {
+// return success(ardTubesService.selectArdTubesById(id));
+// }
+//
+// /**
+// * 鏂板绠$嚎绠$悊
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:add')")
+// @Log(title = "绠$嚎绠$悊", businessType = BusinessType.INSERT)
+// @PostMapping
+// @ApiOperation("鏂板绠$嚎绠$悊")
+// public AjaxResult add(@RequestBody ArdTubes ardTubes)
+// {
+// return toAjax(ardTubesService.insertArdTubes(ardTubes));
+// }
+//
+// /**
+// * 淇敼绠$嚎绠$悊
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:edit')")
+// @Log(title = "绠$嚎绠$悊", businessType = BusinessType.UPDATE)
+// @PutMapping
+// @ApiOperation("淇敼绠$嚎绠$悊")
+// public AjaxResult edit(@RequestBody ArdTubes ardTubes)
+// {
+// return toAjax(ardTubesService.updateArdTubes(ardTubes));
+// }
+//
+// /**
+// * 鍒犻櫎绠$嚎绠$悊
+// */
+// @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:remove')")
+// @Log(title = "绠$嚎绠$悊", businessType = BusinessType.DELETE)
+// @DeleteMapping("/{ids}")
+// @ApiOperation("鍒犻櫎绠$嚎绠$悊")
+// public AjaxResult remove(@PathVariable String[] ids)
+// {
+// return toAjax(ardTubesService.deleteArdTubesByIds(ids));
+// }
+
+
/**
- * 鏌ヨ绠$嚎绠$悊鍒楄〃
+ * 鏌ヨ鍗曟潯绠$嚎鏁版嵁
*/
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:list')")
- @GetMapping("/list")
- @ApiOperation("鏌ヨ绠$嚎绠$悊鍒楄〃")
- public TableDataInfo list(ArdTubes ardTubes)
- {
- startPage();
- List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes);
- return getDataTable(list);
+ @GetMapping("/one/{id}")
+ @ApiOperation("鏌ヨ鍗曟潯绠$嚎鏁版嵁")
+ public Results one(@PathVariable String id) {
+ return ardTubesService.tubeById(id);
}
/**
- * 瀵煎嚭绠$嚎绠$悊鍒楄〃
+ * 鏌ヨ鏉冮檺涓嬪叏閮ㄧ绾挎暟鎹�
*/
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:export')")
- @Log(title = "绠$嚎绠$悊", businessType = BusinessType.EXPORT)
- @PostMapping("/export")
- @ApiOperation("瀵煎嚭绠$嚎绠$悊鍒楄〃")
- public void export(HttpServletResponse response, ArdTubes ardTubes)
- {
- List<ArdTubes> list = ardTubesService.selectArdTubesList(ardTubes);
- ExcelUtil<ArdTubes> util = new ExcelUtil<ArdTubes>(ArdTubes.class);
- util.exportExcel(response, list, "绠$嚎绠$悊鏁版嵁");
+ @GetMapping("/tobeList")
+ @ApiOperation("鏌ヨ鏉冮檺涓嬪叏閮ㄧ绾挎暟鎹�")
+ public Results tobeList() {
+ String usersId = SecurityUtils.getUserId();
+ //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+ SysUser sysUser = sysUserService.selectUserById(usersId);
+ //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ //鏍规嵁deptList鑾峰彇鎵�鏈夌绾挎暟鎹�
+ return ardTubesService.tobeList(deptList);
}
/**
- * 鑾峰彇绠$嚎绠$悊璇︾粏淇℃伅
+ * 鏌ヨ骞剁瓫閫夋潈闄愪笅鎵�鏈夌绾挎暟鎹�
*/
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:query')")
- @GetMapping(value = "/{id}")
- @ApiOperation("閫氳繃ID鑾峰彇绠$嚎绠$悊璇︾粏淇℃伅")
- public AjaxResult getInfo(@PathVariable("id") String id)
- {
- return success(ardTubesService.selectArdTubesById(id));
+ @GetMapping("/conditionList")
+ @ApiOperation("鏌ヨ骞剁瓫閫夋潈闄愪笅鎵�鏈夌绾挎暟鎹�")
+ public Results conditionList(ArdTubesParam ardTubesParam) {
+ String usersId = SecurityUtils.getUserId();
+ //鏍规嵁userId鏌ヨ閮ㄩ棬Id
+ SysUser sysUser = sysUserService.selectUserById(usersId);
+ //鏍规嵁褰撳墠deptId鎴栬�呭綋鍓嶅強鎵�灞炰笅绾х殑鎵�鏈塪eptId
+ List<Long> deptList = sysDeptService.deptIdBySub(sysUser.getDeptId());
+ ardTubesParam.setDeptList(deptList);
+ return ardTubesService.conditionList(ardTubesParam);
}
- /**
- * 鏂板绠$嚎绠$悊
- */
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:add')")
- @Log(title = "绠$嚎绠$悊", businessType = BusinessType.INSERT)
- @PostMapping
- @ApiOperation("鏂板绠$嚎绠$悊")
- public AjaxResult add(@RequestBody ArdTubes ardTubes)
- {
- return toAjax(ardTubesService.insertArdTubes(ardTubes));
- }
-
- /**
- * 淇敼绠$嚎绠$悊
- */
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:edit')")
- @Log(title = "绠$嚎绠$悊", businessType = BusinessType.UPDATE)
- @PutMapping
- @ApiOperation("淇敼绠$嚎绠$悊")
- public AjaxResult edit(@RequestBody ArdTubes ardTubes)
- {
- return toAjax(ardTubesService.updateArdTubes(ardTubes));
- }
-
- /**
- * 鍒犻櫎绠$嚎绠$悊
- */
- @PreAuthorize("@ss.hasPermi('alarmpoints:tubes:remove')")
- @Log(title = "绠$嚎绠$悊", businessType = BusinessType.DELETE)
- @DeleteMapping("/{ids}")
- @ApiOperation("鍒犻櫎绠$嚎绠$悊")
- public AjaxResult remove(@PathVariable String[] ids)
- {
- return toAjax(ardTubesService.deleteArdTubesByIds(ids));
- }
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubes.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubes.java
index 93d7d93..3a74d12 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubes.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubes.java
@@ -1,5 +1,6 @@
package com.ruoyi.alarmpoints.tube.domain;
+import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
@@ -7,6 +8,8 @@
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
+
+import java.util.List;
/**
* 绠$嚎绠$悊瀵硅薄 ard_tubes
@@ -50,4 +53,7 @@
@ApiModelProperty(hidden = true)
private String userId;
+ @TableField(exist = false)
+ private List<ArdTubesDetails> ardTubesDetails;
+
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubesParam.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubesParam.java
new file mode 100644
index 0000000..6319b8e
--- /dev/null
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/domain/ArdTubesParam.java
@@ -0,0 +1,35 @@
+package com.ruoyi.alarmpoints.tube.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.ruoyi.common.annotation.Excel;
+import com.ruoyi.common.core.domain.BaseEntity;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 绠$嚎绠$悊瀵硅薄 ard_tubes
+ *
+ * @author 鍒樿嫃涔�
+ * @date 2023-03-13
+ */
+@Data
+public class ArdTubesParam
+{
+ /** 鍚嶇О */
+ private String name;
+
+ /** 绫诲瀷 */
+ private String type;
+
+ /** 绠″緞 */
+ private String pipeDiameter;
+
+ /** 棰滆壊 */
+ private String color;
+
+ @TableField(exist = false)
+ private List<Long> deptList;
+
+}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesDetailsMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesDetailsMapper.java
index c125a66..228187a 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesDetailsMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesDetailsMapper.java
@@ -2,6 +2,7 @@
import java.util.List;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.alarmpoints.tube.domain.ArdTubesDetails;
import org.apache.ibatis.annotations.Param;
@@ -11,7 +12,7 @@
* @author 鍒樿嫃涔�
* @date 2023-03-13
*/
-public interface ArdTubesDetailsMapper
+public interface ArdTubesDetailsMapper extends BaseMapper<ArdTubesDetails>
{
/**
* 鏌ヨ绠$嚎璇︾粏
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesMapper.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesMapper.java
index 029a6e8..718786c 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesMapper.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/mapper/ArdTubesMapper.java
@@ -1,6 +1,8 @@
package com.ruoyi.alarmpoints.tube.mapper;
import java.util.List;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.alarmpoints.tube.domain.ArdTubes;
/**
@@ -9,7 +11,7 @@
* @author 鍒樿嫃涔�
* @date 2023-03-13
*/
-public interface ArdTubesMapper
+public interface ArdTubesMapper extends BaseMapper<ArdTubes>
{
/**
* 鏌ヨ绠$嚎绠$悊
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/IArdTubesService.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/IArdTubesService.java
index 3468789..465d0c4 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/IArdTubesService.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/IArdTubesService.java
@@ -2,6 +2,8 @@
import java.util.List;
import com.ruoyi.alarmpoints.tube.domain.ArdTubes;
+import com.ruoyi.alarmpoints.tube.domain.ArdTubesParam;
+import com.ruoyi.utils.result.Results;
/**
* 绠$嚎绠$悊Service鎺ュ彛
@@ -58,4 +60,10 @@
* @return 缁撴灉
*/
public int deleteArdTubesById(String id);
+
+ Results tubeById(String id);
+
+ Results tobeList(List<Long> deptList);
+
+ Results conditionList(ArdTubesParam ardTubesParam);
}
diff --git a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
index 1dee4da..836e2ca 100644
--- a/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
+++ b/ard-work/src/main/java/com/ruoyi/alarmpoints/tube/service/impl/ArdTubesServiceImpl.java
@@ -2,15 +2,19 @@
import java.util.List;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.ruoyi.alarmpoints.tube.domain.ArdTubes;
import com.ruoyi.alarmpoints.tube.domain.ArdTubesDetails;
+import com.ruoyi.alarmpoints.tube.domain.ArdTubesParam;
import com.ruoyi.alarmpoints.tube.mapper.ArdTubesDetailsMapper;
import com.ruoyi.alarmpoints.tube.mapper.ArdTubesMapper;
import com.ruoyi.alarmpoints.tube.service.IArdTubesService;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
+import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
+import com.ruoyi.utils.result.Results;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
@@ -129,4 +133,56 @@
}
return ardTubesMapper.deleteArdTubesById(id);
}
+
+ @Override
+ public Results tubeById(String id) {
+ ArdTubes ardTubes = ardTubesMapper.selectById(id);
+ if(ardTubes!=null){
+ QueryWrapper<ArdTubesDetails> queryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("tube_id",id);
+ List<ArdTubesDetails> list = ardTubesDetailsMapper.selectList(queryWrapper);
+ ardTubes.setArdTubesDetails(list);
+ }
+ return Results.succeed(ardTubes);
+ }
+
+ @Override
+ public Results tobeList(List<Long> deptList) {
+ QueryWrapper<ArdTubes> queryWrapper = new QueryWrapper<>();
+ queryWrapper.in("dept_id",deptList);
+ List<ArdTubes> list = ardTubesMapper.selectList(queryWrapper);
+ if(list.size()>0){
+ for (int i = 0; i < list.size(); i++) {
+ ArdTubes ardTubes = list.get(i);
+ QueryWrapper<ArdTubesDetails> detailsQueryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("tube_id",ardTubes.getId());
+ List<ArdTubesDetails> details = ardTubesDetailsMapper.selectList(detailsQueryWrapper);
+ ardTubes.setArdTubesDetails(details);
+ }
+ }
+ return Results.succeed(list);
+ }
+
+ @Override
+ public Results conditionList(ArdTubesParam ardTubesParam) {
+ QueryWrapper<ArdTubes> queryWrapper = new QueryWrapper<>();
+ queryWrapper.in("dept_id",ardTubesParam.getDeptList())
+ .eq(!StringUtils.isBlank(ardTubesParam.getName()),"name",ardTubesParam.getName())
+ .eq(!StringUtils.isBlank(ardTubesParam.getType()),"type",ardTubesParam.getType())
+ .eq(!StringUtils.isBlank(ardTubesParam.getPipeDiameter()),"pipe_diameter",ardTubesParam.getPipeDiameter())
+ .eq(!StringUtils.isBlank(ardTubesParam.getColor()),"color",ardTubesParam.getColor());
+ List<ArdTubes> list = ardTubesMapper.selectList(queryWrapper);
+ if(list.size()>0){
+ for (int i = 0; i < list.size(); i++) {
+ ArdTubes ardTubes = list.get(i);
+ QueryWrapper<ArdTubesDetails> detailsQueryWrapper = new QueryWrapper<>();
+ queryWrapper.eq("tube_id",ardTubes.getId());
+ List<ArdTubesDetails> details = ardTubesDetailsMapper.selectList(detailsQueryWrapper);
+ ardTubes.setArdTubesDetails(details);
+ }
+ }
+ return Results.succeed(list);
+ }
+
+
}
--
Gitblit v1.9.3