From 487885d859a4dd2771be06729ba81c9ba58d1636 Mon Sep 17 00:00:00 2001
From: yinglong zhang <1679309912@qq.com>
Date: Mon, 21 Jun 2021 17:49:39 +0800
Subject: [PATCH] =?UTF-8?q?feat=20=E4=BF=AE=E6=94=B9=E6=A0=87=E5=87=86?=
=?UTF-8?q?=E5=90=88=E8=A7=84=E8=AF=84=E4=BC=B0=E7=BB=93=E6=9E=9C=E6=8E=A5?=
=?UTF-8?q?=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../controller/SarUserStarController.java | 134 ++++++++++++++++++
.../sarPersonalCenter/dao/SarUserStarDao.java | 16 +++
.../sarPersonalCenter/entity/SarUserStar.java | 55 +++++++
.../entity/SarUserStarEO.java | 25 ++++
.../service/ISarUserStarService.java | 16 +++
.../service/impl/SarUserStarServiceImpl.java | 20 +++
...ndardComplianceAssessResultController.java | 33 ++++-
.../sarPersonalCenter/SarUserStarMapper.xml | 5 +
8 files changed, 298 insertions(+), 6 deletions(-)
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/controller/SarUserStarController.java
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/dao/SarUserStarDao.java
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStar.java
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStarEO.java
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/ISarUserStarService.java
create mode 100644 adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/impl/SarUserStarServiceImpl.java
create mode 100644 adc-da-slrs/src/main/resources/mybatis/mapper/sarPersonalCenter/SarUserStarMapper.xml
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/controller/SarUserStarController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/controller/SarUserStarController.java
new file mode 100644
index 00000000..b100dd85
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/controller/SarUserStarController.java
@@ -0,0 +1,134 @@
+package com.adc.da.slrs.sarPersonalCenter.controller;
+
+
+import com.adc.da.http.ResponseMessage;
+import com.adc.da.http.Result;
+import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
+import com.adc.da.slrs.sarPersonalCenter.service.ISarUserStarService;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.*;
+import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
+import io.swagger.annotations.Api;
+import com.adc.da.base.web.BaseController;
+
+import java.util.Date;
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ * @author zyl
+ * @since 2021-06-21
+ */
+@RestController
+@Api(description = "福田标准法规--个人中心--我的收藏")
+@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-star")
+public class SarUserStarController extends BaseController {
+
+ @Autowired
+ private ISarUserStarService iSarUserStarService;
+
+ @ApiOperation("获取用户收藏列表")
+ @GetMapping("/getList")
+ public ResponseMessage> getUserStarList(SarUserStarEO sarUserStarEO) {
+ if (sarUserStarEO.getUserId() == null) {
+ return Result.error("userId不能为空");
+ } else {
+ if (sarUserStarEO.getSize() == null || sarUserStarEO.getSize() <= 0) sarUserStarEO.setSize(20);
+ if (sarUserStarEO.getCurrent() == null || sarUserStarEO.getCurrent() <= 0) sarUserStarEO.setCurrent(1);
+ QueryWrapper wrapper = new QueryWrapper<>();
+ wrapper.eq("user_id", sarUserStarEO.getUserId());
+ if(sarUserStarEO.getType()!=null)wrapper.like("type",sarUserStarEO.getType());
+ if(sarUserStarEO.getName()!=null)wrapper.like("name",sarUserStarEO.getName());
+ if(sarUserStarEO.getModular()!=null)wrapper.like("modular",sarUserStarEO.getModular());
+ if(sarUserStarEO.getInfo()!=null)wrapper.like("info",sarUserStarEO.getInfo());
+ if(sarUserStarEO.getUrl()!=null)wrapper.like("url",sarUserStarEO.getUrl());
+ IPage page = iSarUserStarService.page(new Page<>(sarUserStarEO.getCurrent(), sarUserStarEO.getSize()), wrapper);
+ while (page.getRecords().remove(null)) ;
+ return Result.success(page);
+ }
+ }
+
+
+
+ @ApiOperation("批量删除用户收藏")
+ @PostMapping("/deleteList")
+ public ResponseMessage> deleteList(@RequestBody SarUserStarEO sarUserStars) {
+ if (sarUserStars.getUserId() == null) {
+ return Result.error("userId不能为空");
+ }
+ if (!(sarUserStars.getSarUserStars() == null || sarUserStars.getSarUserStars().size() <= 0)) {
+ for (SarUserStar sarUserStar : sarUserStars.getSarUserStars()) {
+ if (sarUserStar.getId() != null) {
+ QueryWrapper sarUserStarQueryWrapper = new QueryWrapper<>();
+ sarUserStarQueryWrapper.eq("id", sarUserStar.getId());
+ sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
+ iSarUserStarService.remove(sarUserStarQueryWrapper);
+ }
+ }
+ }
+ return getUserStarList(sarUserStars);
+ }
+
+ @ApiOperation("删除用户收藏")
+ @PostMapping("/delete")
+ public ResponseMessage deleteById(@RequestBody SarUserStarEO sarUserStars) {
+ if (sarUserStars.getUserId() == null) {
+ return Result.error("userId不能为空");
+ }
+ if (!(sarUserStars.getId() == null && sarUserStars.getUrl() == null)) {
+ return Result.error("url或id不能为空");
+ }
+ QueryWrapper sarUserStarQueryWrapper = new QueryWrapper<>();
+ if(sarUserStars.getId()!=null)sarUserStarQueryWrapper.eq("id", sarUserStars.getId());
+ else sarUserStarQueryWrapper.eq("url", sarUserStars.getUrl());
+ sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
+ iSarUserStarService.remove(sarUserStarQueryWrapper);
+
+ return Result.success(iSarUserStarService.remove(sarUserStarQueryWrapper));
+ }
+
+ @ApiOperation("添加用户收藏")
+ @PostMapping("/addStar")
+ public ResponseMessage addStar(@RequestBody SarUserStar sarUserStar) {
+ if (sarUserStar.getUserId() == null) {
+ return Result.error("userId不能为空");
+ }
+ if (sarUserStar.getUrl() == null
+ && sarUserStar.getModular() == null
+ && sarUserStar.getName() == null
+ && sarUserStar.getType() == null) {
+ return Result.error("数据有误");
+ }
+
+ sarUserStar.setId(null);
+ sarUserStar.setCreateTime(new Date());
+
+ return Result.success(iSarUserStarService.save(sarUserStar));
+ }
+
+ @ApiOperation("获取当前用户是否收藏该页面")
+ @GetMapping("/isStar")
+ public ResponseMessage isStar(String userId, String url) {
+ if (userId == null) {
+ return Result.error("userId不能为空");
+ }
+ if (url == null) {
+ return Result.error("url不能为空");
+ }
+
+ QueryWrapper sarUserStarQueryWrapper = new QueryWrapper<>();
+ sarUserStarQueryWrapper.eq("user_id", userId);
+ sarUserStarQueryWrapper.eq("url", url);
+ int count = iSarUserStarService.count(sarUserStarQueryWrapper);
+
+ return Result.success(count > 0);
+ }
+
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/dao/SarUserStarDao.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/dao/SarUserStarDao.java
new file mode 100644
index 00000000..ede9070d
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/dao/SarUserStarDao.java
@@ -0,0 +1,16 @@
+package com.adc.da.slrs.sarPersonalCenter.dao;
+
+import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ *
+ * Mapper 接口
+ *
+ *
+ * @author zyl
+ * @since 2021-06-21
+ */
+public interface SarUserStarDao extends BaseMapper {
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStar.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStar.java
new file mode 100644
index 00000000..f49bc35e
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStar.java
@@ -0,0 +1,55 @@
+package com.adc.da.slrs.sarPersonalCenter.entity;
+
+import com.adc.da.base.entity.BaseEntity;
+import java.time.LocalDateTime;
+import java.util.Date;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+import org.springframework.format.annotation.DateTimeFormat;
+
+/**
+ *
+ *
+ *
+ *
+ * @author zyl
+ * @since 2021-06-21
+ */
+@EqualsAndHashCode(callSuper = true)
+@Data
+@ApiModel(value="SarUserStar对象", description="")
+public class SarUserStar extends BaseEntity {
+
+ @ApiModelProperty("id")
+ private String id;
+
+ @ApiModelProperty(value = "收藏名")
+ private String name;
+
+ @ApiModelProperty(value = "收藏类型")
+ private String type;
+
+ @ApiModelProperty(value = "收藏具体信息")
+ private String info;
+
+ @ApiModelProperty(value = "用户id")
+ private String userId;
+
+ @ApiModelProperty(value = "所属模块")
+ private String modular;
+
+ @ApiModelProperty(value = "创建时间")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @JsonFormat(locale = "zh", timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
+ private Date createTime;
+
+ @ApiModelProperty(value = "该收藏对应的路由")
+ private String url;
+
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStarEO.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStarEO.java
new file mode 100644
index 00000000..262eeb53
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/entity/SarUserStarEO.java
@@ -0,0 +1,25 @@
+package com.adc.da.slrs.sarPersonalCenter.entity;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.experimental.Accessors;
+
+import java.util.List;
+
+@Data
+@Accessors(chain = true)
+@ApiModel(value="SarUserStar批量操作对象", description="")
+public class SarUserStarEO extends SarUserStar{
+
+ @ApiModelProperty("当页数量")
+ private Integer size;
+
+ @ApiModelProperty("当前页数")
+ private Integer current;
+
+ @ApiModelProperty("操作信息")
+ private List sarUserStars;
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/ISarUserStarService.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/ISarUserStarService.java
new file mode 100644
index 00000000..93922b33
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/ISarUserStarService.java
@@ -0,0 +1,16 @@
+package com.adc.da.slrs.sarPersonalCenter.service;
+
+import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
+import com.baomidou.mybatisplus.extension.service.IService;
+
+/**
+ *
+ * 服务类
+ *
+ *
+ * @author zyl
+ * @since 2021-06-21
+ */
+public interface ISarUserStarService extends IService {
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/impl/SarUserStarServiceImpl.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/impl/SarUserStarServiceImpl.java
new file mode 100644
index 00000000..a12d0cde
--- /dev/null
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarPersonalCenter/service/impl/SarUserStarServiceImpl.java
@@ -0,0 +1,20 @@
+package com.adc.da.slrs.sarPersonalCenter.service.impl;
+
+import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
+import com.adc.da.slrs.sarPersonalCenter.dao.SarUserStarDao;
+import com.adc.da.slrs.sarPersonalCenter.service.ISarUserStarService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 服务实现类
+ *
+ *
+ * @author zyl
+ * @since 2021-06-21
+ */
+@Service
+public class SarUserStarServiceImpl extends ServiceImpl implements ISarUserStarService {
+
+}
diff --git a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java
index 43ba106f..b637499d 100644
--- a/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java
+++ b/adc-da-slrs/src/main/java/com/adc/da/slrs/sarStandardComplianceAssessResult/controller/SarStandardComplianceAssessResultController.java
@@ -61,7 +61,11 @@ public class SarStandardComplianceAssessResultController {
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER",eo.getStandNumber().trim());
}
- return Result.success(iSarStandardComplianceProductAssessService.page(iPage,queryWrapper));
+ IPage page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
+
+ while(page.getRecords().remove(null));
+
+ return Result.success(page);
}else {
if(eo.getPosition()==1){
QueryWrapper queryWrapper = new QueryWrapper<>();
@@ -73,7 +77,10 @@ public class SarStandardComplianceAssessResultController {
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER",eo.getStandNumber().trim());
}
- return Result.success(iSarInterpretationNationalStandardService.page(iPage,queryWrapper));
+ IPage page = iSarInterpretationNationalStandardService.page(iPage, queryWrapper);
+ while(page.getRecords().remove(null));
+
+ return Result.success(page);
}else{
QueryWrapper queryWrapper = new QueryWrapper<>();
IPage iPage = new Page<>(eo.getCurrent(), eo.getSize());
@@ -84,7 +91,10 @@ public class SarStandardComplianceAssessResultController {
if (eo.getStandNumber() != null && !eo.getStandNumber().trim().equals("")) {
queryWrapper.like("STAND_NUMBER",eo.getStandNumber().trim());
}
- return Result.success(iSarInterpretationForeignStandardService.page(iPage,queryWrapper));
+
+ IPage page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
+ while(page.getRecords().remove(null));
+ return Result.success(page);
}
}
}
@@ -96,7 +106,12 @@ public class SarStandardComplianceAssessResultController {
if (eo.getProductName() != null) queryWrapper.like("product_name", eo.getProductName());
if (eo.getStandId() != null) queryWrapper.like("STAND_ID", eo.getStandId());
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
- return Result.success(iSarStandardComplianceProductAssessService.page(iPage, queryWrapper));
+
+ IPage page = iSarStandardComplianceProductAssessService.page(iPage, queryWrapper);
+
+ while(page.getRecords().remove(null));
+
+ return Result.success(page);
}
@ApiOperation(value = "条件查询技术审核符合性清单")
@@ -107,13 +122,19 @@ public class SarStandardComplianceAssessResultController {
QueryWrapper queryWrapper = new QueryWrapper<>();
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
if(eo.getStandId()!=null)queryWrapper.eq("STAND_ID",eo.getStandId());
- return Result.success(iSarInterpretationNationalStandardService.page(iPage, queryWrapper));
+
+ IPage page = iSarInterpretationNationalStandardService.page(iPage, queryWrapper);
+ while(page.getRecords().remove(null));
+ return Result.success(page);
} else {
IPage iPage = new Page<>(eo.getCurrent(), eo.getSize());
QueryWrapper queryWrapper = new QueryWrapper<>();
if (eo.getInterpretationTime() != null) queryWrapper.eq("INTERPRETATION_TIME", eo.getInterpretationTime());
if(eo.getStandId()!=null)queryWrapper.eq("STAND_ID",eo.getStandId());
- return Result.success(iSarInterpretationForeignStandardService.page(iPage, queryWrapper));
+ IPage page = iSarInterpretationForeignStandardService.page(iPage, queryWrapper);
+ while(page.getRecords().remove(null));
+
+ return Result.success(page);
}
}
}
diff --git a/adc-da-slrs/src/main/resources/mybatis/mapper/sarPersonalCenter/SarUserStarMapper.xml b/adc-da-slrs/src/main/resources/mybatis/mapper/sarPersonalCenter/SarUserStarMapper.xml
new file mode 100644
index 00000000..e8b388f4
--- /dev/null
+++ b/adc-da-slrs/src/main/resources/mybatis/mapper/sarPersonalCenter/SarUserStarMapper.xml
@@ -0,0 +1,5 @@
+
+
+
+
+