Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
nmy 2023-12-05 21:33:02 +08:00
commit 64771537ce
6 changed files with 15 additions and 7 deletions

View File

@ -33,4 +33,5 @@ public class UserCollect extends BaseEntity
@Excel(name = "收藏时间")
private String time;
private Boolean isCollect;
}

View File

@ -2,6 +2,8 @@ package com.bonus.zlpt.equip.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.util.BooleanUtil;
import com.bonus.zlpt.common.core.utils.poi.ExcelUtil;
import com.bonus.zlpt.common.core.web.controller.BaseController;
import com.bonus.zlpt.common.core.web.domain.AjaxResult;
@ -94,7 +96,12 @@ public class UserCollectController extends BaseController
@PutMapping
public AjaxResult edit(@RequestBody UserCollect userCollect)
{
return toAjax(userCollectService.updateUserCollect(userCollect));
if (BooleanUtil.isTrue(userCollect.getIsCollect())) {
userCollectService.deleteUserCollectByMaId(userCollect.getMaId());
return toAjax(userCollectService.insertUserCollect(userCollect));
} else {
return toAjax(userCollectService.deleteUserCollectByMaId(userCollect.getMaId()));
}
}
/**

View File

@ -62,7 +62,7 @@ public interface UserCollectMapper
主键
* @return 结果
*/
public int deleteUserCollectById(Long id);
public int deleteUserCollectByMaId(Long id);
/**
* 批量删除我的收藏

View File

@ -72,5 +72,5 @@ public interface IUserCollectService
主键
* @return 结果
*/
public int deleteUserCollectById(Long id);
public int deleteUserCollectByMaId(Long id);
}

View File

@ -101,8 +101,8 @@ public class UserCollectServiceImpl implements IUserCollectService
* @return 结果
*/
@Override
public int deleteUserCollectById(Long id)
public int deleteUserCollectByMaId(Long maId)
{
return userCollectMapper.deleteUserCollectById(id);
return userCollectMapper.deleteUserCollectByMaId(maId);
}
}

View File

@ -55,8 +55,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</update>
<delete id="deleteUserCollectById" parameterType="Long">
delete from ma_user_collect where id = #{id}
<delete id="deleteUserCollectByMaId" parameterType="Long">
delete from ma_user_collect where ma_id = #{maId}
</delete>
<delete id="deleteUserCollectByIds" parameterType="String">