修复了收藏后重新编辑数据,收藏的数据没有更新问题
优化逻辑,取消收藏时(逻辑删除),再次收藏此数据,由之前的添加一条新收藏的数据更改为更新原来数据的逻辑删除字段值
This commit is contained in:
+17
-5
@@ -8,6 +8,7 @@ import com.adc.da.person.page.PersonCollectEOPage;
|
||||
import com.adc.da.person.service.IPersonCollectEOService;
|
||||
import com.adc.da.util.LoginUserUtil;
|
||||
import com.adc.da.util.UUIDUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -78,12 +79,20 @@ public class PersonCollectEOController extends BaseController<TsPersonCollect> {
|
||||
@PostMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
// @RequiresPermissions("person:personCollect:create")
|
||||
public ResponseMessage<TsPersonCollect> create(@RequestBody TsPersonCollect tsPersonCollect) throws Exception {
|
||||
// String userId = LoginUserUtil.getUserId();
|
||||
|
||||
tsPersonCollect.setId(UUIDUtils.randomUUID20());
|
||||
tsPersonCollect.setValidFlag(0);
|
||||
tsPersonCollect.setCreationTime(new Date());
|
||||
|
||||
tsPersonCollect.setModifyTime(new Date());
|
||||
tsPersonCollect.setValidFlag(0);
|
||||
|
||||
//如果这个用户已经收藏过这个标准,则更新个人收藏表
|
||||
int line=personCollectEOService.updateByUserIdAndCollectResId(tsPersonCollect);
|
||||
if (personCollectEOService.updateByUserIdAndCollectResId(tsPersonCollect)>0) {
|
||||
return Result.success("0","收藏成功,请到'我的收藏'中查看相关信息。", tsPersonCollect);
|
||||
}
|
||||
|
||||
//用户没有收藏过时,在表中添加
|
||||
tsPersonCollect.setId(UUIDUtils.randomUUID20());
|
||||
tsPersonCollect.setCreationTime(new Date());
|
||||
|
||||
|
||||
personCollectEOService.save(tsPersonCollect);
|
||||
@@ -93,10 +102,13 @@ public class PersonCollectEOController extends BaseController<TsPersonCollect> {
|
||||
|
||||
|
||||
@ApiOperation(value = "|PersonCollectEO|修改")
|
||||
@PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE)
|
||||
@PutMapping(consumes = APPLICATION_JSON_UTF8_VALUE,value = "/updatePersonCollect")
|
||||
// @RequiresPermissions("person:personCollect:update")
|
||||
public ResponseMessage<TsPersonCollect> update(@RequestBody TsPersonCollect tsPersonCollect) throws Exception {
|
||||
tsPersonCollect.setModifyTime(new Date());
|
||||
|
||||
// tsPersonCollect.setValidFlag(0);
|
||||
|
||||
personCollectEOService.updateById(tsPersonCollect);
|
||||
return Result.success(tsPersonCollect);
|
||||
}
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.util.List;
|
||||
*/
|
||||
public interface PersonCollectEODao extends BaseMapper<TsPersonCollect> {
|
||||
|
||||
public int updateByUserIdAndCollectResId(TsPersonCollect tsPersonCollect);
|
||||
|
||||
public List<TsPersonCollect> queryByList(BasePage page);
|
||||
|
||||
public int queryByCount(BasePage var1);
|
||||
|
||||
@@ -10,6 +10,8 @@ import java.util.List;
|
||||
|
||||
public interface IPersonCollectEOService extends IService<TsPersonCollect> {
|
||||
|
||||
public int updateByUserIdAndCollectResId(TsPersonCollect tsPersonCollect);
|
||||
|
||||
public List<TsPersonCollect> queryByPage(PersonCollectEOPage page);
|
||||
|
||||
public List<TsPersonCollect> queryByList(PersonCollectEOPage page);
|
||||
|
||||
+5
@@ -36,12 +36,17 @@ public class PersonCollectEOServiceImpl extends ServiceImpl<PersonCollectEODao,
|
||||
|
||||
|
||||
|
||||
|
||||
@Autowired
|
||||
private PersonNoteEODao personNoteEODao;
|
||||
@Autowired
|
||||
private PersonCollectEODao personCollectEODao;
|
||||
|
||||
|
||||
@Override
|
||||
public int updateByUserIdAndCollectResId(TsPersonCollect tsPersonCollect) {
|
||||
return personCollectEODao.updateByUserIdAndCollectResId(tsPersonCollect);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TsPersonCollect> queryByPage(PersonCollectEOPage page) {
|
||||
|
||||
Reference in New Issue
Block a user