收藏bug
This commit is contained in:
+30
-2
@@ -2,12 +2,16 @@ package com.jero.modules.personal.controller;
|
||||
|
||||
import java.util.Map;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.jero.common.api.vo.Result;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.personal.entity.LawsStandardCollection;
|
||||
import com.jero.modules.personal.service.ILawsStandardCollectionService;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.system.base.controller.JeroController;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -53,6 +57,14 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
@ApiOperation(value="标准收藏-国内收藏", notes="标准收藏-国内收藏")
|
||||
@PostMapping(value = "/domestic/add")
|
||||
public Result<T> domesticAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsStandardCollection::getStandardId, lawsStandardCollection.getStandardId());
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK("不能重复收藏!");
|
||||
}
|
||||
lawsStandardCollection.setSource("1");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK("操作成功!");
|
||||
@@ -79,7 +91,15 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
@ApiOperation(value="标准收藏-海外收藏", notes="标准收藏-海外收藏")
|
||||
@PostMapping(value = "/overseas/add")
|
||||
public Result<T> overseasAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
|
||||
lawsStandardCollection.setSource("2");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsStandardCollection::getStandardId, lawsStandardCollection.getStandardId());
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK("不能重复收藏!");
|
||||
}
|
||||
lawsStandardCollection.setSource("2");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
@@ -105,7 +125,15 @@ public class LawsStandardCollectionController extends JeroController<LawsStandar
|
||||
@ApiOperation(value="标准收藏-企标收藏", notes="标准收藏-企标收藏")
|
||||
@PostMapping(value = "/enterprise/add")
|
||||
public Result<T> enterpriseAdd(@Validated @RequestBody LawsStandardCollection lawsStandardCollection) {
|
||||
lawsStandardCollection.setSource("3");
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsStandardCollection::getStandardId, lawsStandardCollection.getStandardId());
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
int count = lawsStandardCollectionService.count();
|
||||
if (count > 0){
|
||||
return Result.OK("不能重复收藏!");
|
||||
}
|
||||
lawsStandardCollection.setSource("3");
|
||||
lawsStandardCollectionService.add(lawsStandardCollection);
|
||||
return Result.OK("操作成功!");
|
||||
}
|
||||
|
||||
+6
-1
@@ -1,5 +1,6 @@
|
||||
package com.jero.modules.personal.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.jero.common.system.vo.LoginUser;
|
||||
import com.jero.modules.laws.common.service.ILawsCommonService;
|
||||
@@ -112,6 +113,10 @@ public class LawsStandardCollectionServiceImpl extends ServiceImpl<LawsStandardC
|
||||
*/
|
||||
@Override
|
||||
public void deleteById(String id) {
|
||||
removeById(id);
|
||||
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||
LambdaQueryWrapper<LawsStandardCollection> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(LawsStandardCollection::getStandardId, id);
|
||||
wrapper.eq(LawsStandardCollection::getCollectorId, sysUser.getId());
|
||||
remove(wrapper);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user