|
@ -17,14 +17,17 @@ |
|
|
|
|
|
|
|
|
package com.epmet.service.impl; |
|
|
package com.epmet.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.constant.FieldConstant; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
import com.epmet.commons.tools.page.PageData; |
|
|
|
|
|
import com.epmet.commons.tools.security.dto.TokenDto; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
import com.epmet.dao.GuideCollectionDao; |
|
|
import com.epmet.dao.GuideCollectionDao; |
|
|
import com.epmet.dto.GuideCollectionDTO; |
|
|
import com.epmet.dto.GuideCollectionDTO; |
|
|
|
|
|
import com.epmet.dto.form.GuideFormDTO; |
|
|
import com.epmet.entity.GuideCollectionEntity; |
|
|
import com.epmet.entity.GuideCollectionEntity; |
|
|
import com.epmet.service.GuideCollectionService; |
|
|
import com.epmet.service.GuideCollectionService; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
|
import org.apache.commons.lang3.StringUtils; |
|
@ -97,4 +100,36 @@ public class GuideCollectionServiceImpl extends BaseServiceImpl<GuideCollectionD |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* @param tokenDto |
|
|
|
|
|
* @param formDTO |
|
|
|
|
|
* @Description 收藏指南 |
|
|
|
|
|
* @Param tokenDto |
|
|
|
|
|
* @Param formDTO |
|
|
|
|
|
* @Return |
|
|
|
|
|
* @Author zhaoqifeng |
|
|
|
|
|
* @Date 2021/9/9 9:46 |
|
|
|
|
|
*/ |
|
|
|
|
|
@Override |
|
|
|
|
|
public void collection(TokenDto tokenDto, GuideFormDTO formDTO) { |
|
|
|
|
|
//获取指南收藏信息
|
|
|
|
|
|
LambdaQueryWrapper<GuideCollectionEntity> wrapper = new LambdaQueryWrapper<>(); |
|
|
|
|
|
wrapper.eq(GuideCollectionEntity::getGuideId, formDTO.getGuideId()); |
|
|
|
|
|
wrapper.eq(GuideCollectionEntity::getUserId, tokenDto.getUserId()); |
|
|
|
|
|
wrapper.eq(GuideCollectionEntity::getApp, tokenDto.getApp()); |
|
|
|
|
|
wrapper.eq(GuideCollectionEntity::getCustomerId, tokenDto.getCustomerId()); |
|
|
|
|
|
GuideCollectionEntity entity = baseDao.selectOne(wrapper); |
|
|
|
|
|
//如果没有收藏记录,则添加收藏,有就删除收藏
|
|
|
|
|
|
if (null == entity) { |
|
|
|
|
|
entity = new GuideCollectionEntity(); |
|
|
|
|
|
entity.setCustomerId(tokenDto.getCustomerId()); |
|
|
|
|
|
entity.setUserId(tokenDto.getUserId()); |
|
|
|
|
|
entity.setGuideId(formDTO.getGuideId()); |
|
|
|
|
|
entity.setApp(tokenDto.getApp()); |
|
|
|
|
|
insert(entity); |
|
|
|
|
|
} else { |
|
|
|
|
|
deleteById(entity.getId()); |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
} |
|
|
} |