|
@@ -0,0 +1,142 @@
|
|
|
+package com.iotechn.unimall.admin.api.tourism.impl;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.apache.ibatis.session.RowBounds;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.util.StringUtils;
|
|
|
+
|
|
|
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
|
|
|
+import com.baomidou.mybatisplus.mapper.Wrapper;
|
|
|
+import com.iotechn.unimall.core.exception.ServiceException;
|
|
|
+import com.iotechn.unimall.data.util.ExcelUtil;
|
|
|
+import com.iotechn.unimall.data.mapper.LikeCollectionInfoMapper;
|
|
|
+import com.iotechn.unimall.data.domain.LikeCollectionInfo;
|
|
|
+import com.iotechn.unimall.admin.api.tourism.ILikeCollectionInfoService;
|
|
|
+import com.iotechn.unimall.data.model.Page;
|
|
|
+import java.util.Date;
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 记录点赞收藏信息Service业务层处理
|
|
|
+ *
|
|
|
+ * @author jlb
|
|
|
+ * @date 2023-06-08
|
|
|
+ */
|
|
|
+@Service
|
|
|
+public class LikeCollectionInfoServiceImpl implements ILikeCollectionInfoService{
|
|
|
+ @Autowired
|
|
|
+ private LikeCollectionInfoMapper likeCollectionInfoMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean add(LikeCollectionInfo likeCollectionInfo) throws ServiceException {
|
|
|
+ Date now = new Date();
|
|
|
+ likeCollectionInfo.setGmtCreate(now);
|
|
|
+ likeCollectionInfo.setGmtUpdate(now);
|
|
|
+ return likeCollectionInfoMapper.insert(likeCollectionInfo)>0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Page<LikeCollectionInfo> list(Long infoId,Long commonId,String nickname,String commentContent,Long commentId,String commentName,String interactionFlag,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
+ Wrapper<LikeCollectionInfo> wrapper = new EntityWrapper<LikeCollectionInfo>();
|
|
|
+ if (!StringUtils.isEmpty(infoId)) {
|
|
|
+ wrapper.eq("info_id", infoId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nickname)) {
|
|
|
+ wrapper.eq("nickname", nickname);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentContent)) {
|
|
|
+ wrapper.eq("comment_content", commentContent);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentId)) {
|
|
|
+ wrapper.eq("comment_id", commentId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentName)) {
|
|
|
+ wrapper.eq("comment_name", commentName);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(interactionFlag)) {
|
|
|
+ wrapper.eq("interaction_flag", interactionFlag);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
+ }
|
|
|
+ wrapper.eq("delete_flag", 0);
|
|
|
+ List<LikeCollectionInfo> list = likeCollectionInfoMapper.selectPage(new RowBounds((page - 1) * limit, limit), wrapper);
|
|
|
+ Integer count = likeCollectionInfoMapper.selectCount(wrapper);
|
|
|
+ return new Page<LikeCollectionInfo>(list, page, limit, count);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public Boolean delete(String id) {
|
|
|
+ String[] ids = String.valueOf(id).split(",");
|
|
|
+ for (String tt:ids) {
|
|
|
+ LikeCollectionInfo tmp = likeCollectionInfoMapper.selectById(Long.parseLong(tt));
|
|
|
+ if(tmp != null){
|
|
|
+ tmp.setDeleteFlag(1l);
|
|
|
+ likeCollectionInfoMapper.updateById(tmp);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Boolean update(LikeCollectionInfo likeCollectionInfo) throws ServiceException {
|
|
|
+ Date now = new Date();
|
|
|
+ likeCollectionInfo.setGmtUpdate(now);
|
|
|
+ return likeCollectionInfoMapper.updateById(likeCollectionInfo)>0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public LikeCollectionInfo get(Long id) throws ServiceException {
|
|
|
+ return likeCollectionInfoMapper.selectById(id);
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public String export(Long infoId,Long commonId,String nickname,String commentContent,Long commentId,String commentName,String interactionFlag,Date gmtCreate,Date gmtUpdate,Long deleteFlag, Integer page, Integer limit)throws ServiceException {
|
|
|
+ Wrapper<LikeCollectionInfo> wrapper = new EntityWrapper<LikeCollectionInfo>();
|
|
|
+ if (!StringUtils.isEmpty(infoId)) {
|
|
|
+ wrapper.eq("info_id", infoId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commonId)) {
|
|
|
+ wrapper.eq("common_id", commonId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(nickname)) {
|
|
|
+ wrapper.eq("nickname", nickname);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentContent)) {
|
|
|
+ wrapper.eq("comment_content", commentContent);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentId)) {
|
|
|
+ wrapper.eq("comment_id", commentId);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(commentName)) {
|
|
|
+ wrapper.eq("comment_name", commentName);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(interactionFlag)) {
|
|
|
+ wrapper.eq("interaction_flag", interactionFlag);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtCreate)) {
|
|
|
+ wrapper.eq("gmt_create", gmtCreate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(gmtUpdate)) {
|
|
|
+ wrapper.eq("gmt_update", gmtUpdate);
|
|
|
+ }
|
|
|
+ if (!StringUtils.isEmpty(deleteFlag)) {
|
|
|
+ wrapper.eq("delete_flag", deleteFlag);
|
|
|
+ }
|
|
|
+ List<LikeCollectionInfo> list = likeCollectionInfoMapper.selectList(wrapper);
|
|
|
+ ExcelUtil<LikeCollectionInfo> util = new ExcelUtil<LikeCollectionInfo>(LikeCollectionInfo.class);
|
|
|
+ return util.exportExcel(list, "操作日志");
|
|
|
+ }
|
|
|
+}
|