add 添加个人模块
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserPersonalMenuService;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
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.SarUserPersonalMenu;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import com.adc.da.base.web.BaseController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "福田标准法规--个人中心--我的板块")
|
||||||
|
@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-personal-menu")
|
||||||
|
public class SarUserPersonalMenuController extends BaseController<SarUserPersonalMenu> {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarUserPersonalMenuService iSarUserPersonalMenuService;
|
||||||
|
|
||||||
|
@ApiOperation("获取用户的板块列表")
|
||||||
|
@GetMapping("/getList")
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> getList(SarUserPersonalMenuEO eo){
|
||||||
|
return iSarUserPersonalMenuService.getUserPersonalMenu(eo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation("更新用户的板块列表")
|
||||||
|
@PostMapping("/update")
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> update(@RequestBody SarUserPersonalMenuEO eo){
|
||||||
|
return iSarUserPersonalMenuService.updateUserPersonalMenu(eo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+6
-73
@@ -26,7 +26,7 @@ import java.util.Date;
|
|||||||
* @since 2021-06-21
|
* @since 2021-06-21
|
||||||
*/
|
*/
|
||||||
@RestController
|
@RestController
|
||||||
@Api(description = "福田标准法规--个人中心--我的收藏")
|
@Api(tags = "福田标准法规--个人中心--我的收藏")
|
||||||
@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-star")
|
@RequestMapping("/${restPath}/sarPersonalCenter/sar-user-star")
|
||||||
public class SarUserStarController extends BaseController<SarUserStar> {
|
public class SarUserStarController extends BaseController<SarUserStar> {
|
||||||
|
|
||||||
@@ -36,98 +36,31 @@ public class SarUserStarController extends BaseController<SarUserStar> {
|
|||||||
@ApiOperation("获取用户收藏列表")
|
@ApiOperation("获取用户收藏列表")
|
||||||
@GetMapping("/getList")
|
@GetMapping("/getList")
|
||||||
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO) {
|
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO) {
|
||||||
if (sarUserStarEO.getUserId() == null) {
|
return iSarUserStarService.getUserStarList(sarUserStarEO);
|
||||||
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<SarUserStar> 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<SarUserStar> page = iSarUserStarService.page(new Page<>(sarUserStarEO.getCurrent(), sarUserStarEO.getSize()), wrapper);
|
|
||||||
while (page.getRecords().remove(null)) ;
|
|
||||||
return Result.success(page);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ApiOperation("批量删除用户收藏")
|
@ApiOperation("批量删除用户收藏")
|
||||||
@PostMapping("/deleteList")
|
@PostMapping("/deleteList")
|
||||||
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars) {
|
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars) {
|
||||||
if (sarUserStars.getUserId() == null) {
|
return iSarUserStarService.deleteList(sarUserStars);
|
||||||
return Result.error("userId不能为空");
|
|
||||||
}
|
|
||||||
if (!(sarUserStars.getSarUserStars() == null || sarUserStars.getSarUserStars().size() <= 0)) {
|
|
||||||
for (SarUserStar sarUserStar : sarUserStars.getSarUserStars()) {
|
|
||||||
if (sarUserStar.getId() != null) {
|
|
||||||
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
|
||||||
sarUserStarQueryWrapper.eq("id", sarUserStar.getId());
|
|
||||||
sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
|
|
||||||
iSarUserStarService.remove(sarUserStarQueryWrapper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return getUserStarList(sarUserStars);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation("删除用户收藏")
|
@ApiOperation("删除用户收藏")
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete")
|
||||||
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars) {
|
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars) {
|
||||||
if (sarUserStars.getUserId() == null) {
|
return iSarUserStarService.deleteById(sarUserStars);
|
||||||
return Result.error("userId不能为空");
|
|
||||||
}
|
|
||||||
if (!(sarUserStars.getId() == null && sarUserStars.getUrl() == null)) {
|
|
||||||
return Result.error("url或id不能为空");
|
|
||||||
}
|
|
||||||
QueryWrapper<SarUserStar> 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("添加用户收藏")
|
@ApiOperation("添加用户收藏")
|
||||||
@PostMapping("/addStar")
|
@PostMapping("/addStar")
|
||||||
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar) {
|
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar) {
|
||||||
if (sarUserStar.getUserId() == null) {
|
return iSarUserStarService.addStar(sarUserStar);
|
||||||
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("获取当前用户是否收藏该页面")
|
@ApiOperation("获取当前用户是否收藏该页面")
|
||||||
@GetMapping("/isStar")
|
@GetMapping("/isStar")
|
||||||
public ResponseMessage<Boolean> isStar(String userId, String url) {
|
public ResponseMessage<Boolean> isStar(String userId, String url) {
|
||||||
if (userId == null) {
|
return iSarUserStarService.isStar(userId,url);
|
||||||
return Result.error("userId不能为空");
|
|
||||||
}
|
|
||||||
if (url == null) {
|
|
||||||
return Result.error("url不能为空");
|
|
||||||
}
|
|
||||||
|
|
||||||
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
|
||||||
sarUserStarQueryWrapper.eq("user_id", userId);
|
|
||||||
sarUserStarQueryWrapper.eq("url", url);
|
|
||||||
int count = iSarUserStarService.count(sarUserStarQueryWrapper);
|
|
||||||
|
|
||||||
return Result.success(count > 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.dao;
|
||||||
|
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
public interface SarUserPersonalMenuDao extends BaseMapper<SarUserPersonalMenu> {
|
||||||
|
|
||||||
|
}
|
||||||
+38
@@ -0,0 +1,38 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||||
|
|
||||||
|
import com.adc.da.base.entity.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="SarUserPersonalMenu对象", description="")
|
||||||
|
public class SarUserPersonalMenu extends BaseEntity {
|
||||||
|
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String menuName;
|
||||||
|
|
||||||
|
private String menuId;
|
||||||
|
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
private String menuUrl;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.entity;
|
||||||
|
|
||||||
|
import com.adc.da.base.entity.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
@ApiModel(value="SarUserPersonalMenu批量操作对象", description="")
|
||||||
|
public class SarUserPersonalMenuEO extends SarUserPersonalMenu {
|
||||||
|
|
||||||
|
@ApiModelProperty("当页数量")
|
||||||
|
private Integer size=20;
|
||||||
|
|
||||||
|
@ApiModelProperty("当前页数")
|
||||||
|
private Integer current=1;
|
||||||
|
|
||||||
|
@ApiModelProperty("操作信息")
|
||||||
|
private List<SarUserPersonalMenu> sarUserPersonalMenus;
|
||||||
|
}
|
||||||
+2
-2
@@ -14,10 +14,10 @@ import java.util.List;
|
|||||||
public class SarUserStarEO extends SarUserStar{
|
public class SarUserStarEO extends SarUserStar{
|
||||||
|
|
||||||
@ApiModelProperty("当页数量")
|
@ApiModelProperty("当页数量")
|
||||||
private Integer size;
|
private Integer size=20;
|
||||||
|
|
||||||
@ApiModelProperty("当前页数")
|
@ApiModelProperty("当前页数")
|
||||||
private Integer current;
|
private Integer current=1;
|
||||||
|
|
||||||
@ApiModelProperty("操作信息")
|
@ApiModelProperty("操作信息")
|
||||||
private List<SarUserStar> sarUserStars;
|
private List<SarUserStar> sarUserStars;
|
||||||
|
|||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.service;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
public interface ISarUserPersonalMenuService extends IService<SarUserPersonalMenu> {
|
||||||
|
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> getUserPersonalMenu(SarUserPersonalMenuEO eo);
|
||||||
|
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> updateUserPersonalMenu(SarUserPersonalMenuEO eo);
|
||||||
|
|
||||||
|
public void updateUserPersonalMenuForRole(List<SarUserPersonalMenu> menus);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
+10
-1
@@ -1,7 +1,12 @@
|
|||||||
package com.adc.da.slrs.sarPersonalCenter.service;
|
package com.adc.da.slrs.sarPersonalCenter.service;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -12,5 +17,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
* @since 2021-06-21
|
* @since 2021-06-21
|
||||||
*/
|
*/
|
||||||
public interface ISarUserStarService extends IService<SarUserStar> {
|
public interface ISarUserStarService extends IService<SarUserStar> {
|
||||||
|
public ResponseMessage<IPage<SarUserStar>> getUserStarList(SarUserStarEO sarUserStarEO);
|
||||||
|
public ResponseMessage<IPage<SarUserStar>> deleteList(@RequestBody SarUserStarEO sarUserStars);
|
||||||
|
public ResponseMessage<Boolean> deleteById(@RequestBody SarUserStarEO sarUserStars);
|
||||||
|
public ResponseMessage<Boolean> addStar(@RequestBody SarUserStar sarUserStar);
|
||||||
|
public ResponseMessage<Boolean> isStar(String userId, String url);
|
||||||
}
|
}
|
||||||
|
|||||||
+40
@@ -0,0 +1,40 @@
|
|||||||
|
package com.adc.da.slrs.sarPersonalCenter.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenu;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.dao.SarUserPersonalMenuDao;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserPersonalMenuEO;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserPersonalMenuService;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author zyl
|
||||||
|
* @since 2021-06-22
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class SarUserPersonalMenuServiceImpl extends ServiceImpl<SarUserPersonalMenuDao, SarUserPersonalMenu> implements ISarUserPersonalMenuService {
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> getUserPersonalMenu(SarUserPersonalMenuEO eo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<IPage<SarUserPersonalMenu>> updateUserPersonalMenu(SarUserPersonalMenuEO eo) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateUserPersonalMenuForRole(List<SarUserPersonalMenu> menus) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
+105
@@ -1,10 +1,20 @@
|
|||||||
package com.adc.da.slrs.sarPersonalCenter.service.impl;
|
package com.adc.da.slrs.sarPersonalCenter.service.impl;
|
||||||
|
|
||||||
|
import com.adc.da.http.ResponseMessage;
|
||||||
|
import com.adc.da.http.Result;
|
||||||
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStar;
|
||||||
import com.adc.da.slrs.sarPersonalCenter.dao.SarUserStarDao;
|
import com.adc.da.slrs.sarPersonalCenter.dao.SarUserStarDao;
|
||||||
|
import com.adc.da.slrs.sarPersonalCenter.entity.SarUserStarEO;
|
||||||
import com.adc.da.slrs.sarPersonalCenter.service.ISarUserStarService;
|
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 com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -17,4 +27,99 @@ import org.springframework.stereotype.Service;
|
|||||||
@Service
|
@Service
|
||||||
public class SarUserStarServiceImpl extends ServiceImpl<SarUserStarDao, SarUserStar> implements ISarUserStarService {
|
public class SarUserStarServiceImpl extends ServiceImpl<SarUserStarDao, SarUserStar> implements ISarUserStarService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISarUserStarService iSarUserStarService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<IPage<SarUserStar>> 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<SarUserStar> 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<SarUserStar> page = iSarUserStarService.page(new Page<>(sarUserStarEO.getCurrent(), sarUserStarEO.getSize()), wrapper);
|
||||||
|
while (page.getRecords().remove(null)) ;
|
||||||
|
return Result.success(page);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<IPage<SarUserStar>> 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<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
||||||
|
sarUserStarQueryWrapper.eq("id", sarUserStar.getId());
|
||||||
|
sarUserStarQueryWrapper.eq("user_id", sarUserStars.getUserId());
|
||||||
|
iSarUserStarService.remove(sarUserStarQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return getUserStarList(sarUserStars);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<Boolean> 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<SarUserStar> 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<Boolean> 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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResponseMessage<Boolean> isStar(String userId, String url) {
|
||||||
|
if (userId == null) {
|
||||||
|
return Result.error("userId不能为空");
|
||||||
|
}
|
||||||
|
if (url == null) {
|
||||||
|
return Result.error("url不能为空");
|
||||||
|
}
|
||||||
|
|
||||||
|
QueryWrapper<SarUserStar> sarUserStarQueryWrapper = new QueryWrapper<>();
|
||||||
|
sarUserStarQueryWrapper.eq("user_id", userId);
|
||||||
|
sarUserStarQueryWrapper.eq("url", url);
|
||||||
|
int count = iSarUserStarService.count(sarUserStarQueryWrapper);
|
||||||
|
|
||||||
|
return Result.success(count > 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
<?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.adc.da.slrs.sarPersonalCenter.dao.SarUserPersonalMenuDao">
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user