This commit is contained in:
chc
2023-01-03 09:30:43 +08:00
parent 73aa36fc69
commit a38bc6b534
10 changed files with 95 additions and 27 deletions

View File

@@ -0,0 +1,36 @@
package cn.lili.modules.im.entity.dto;
import cn.hutool.core.text.CharSequenceUtil;
import cn.lili.common.vo.PageVO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author chc
* @since 2022/6/2114:46
*/
@Data
@ApiModel
public class ImQueryParams extends PageVO {
@ApiModelProperty("用户Id")
private String memberId;
@ApiModelProperty("店铺Id")
private String storeId;
public <T> QueryWrapper<T> queryWrapper() {
QueryWrapper<T> queryWrapper = new QueryWrapper<>();
if (CharSequenceUtil.isNotEmpty(memberId)) {
queryWrapper.eq("member_id", memberId);
}
if (CharSequenceUtil.isNotEmpty(storeId)) {
queryWrapper.eq("store_id", storeId);
}
queryWrapper.eq("delete_flag",false);
queryWrapper.orderByDesc("create_time");
return queryWrapper;
}
}

View File

@@ -18,5 +18,6 @@ public enum MessageTypeEnum {
PICTURE,
VOICE,
GOODS,
ORDER,
VIDEO
}

View File

@@ -30,7 +30,7 @@ public class FootPrintQueryParams extends PageVO {
queryWrapper.eq("store_id", storeId);
}
queryWrapper.eq("delete_flag",false);
queryWrapper.orderByDesc("update_time");
queryWrapper.orderByDesc("create_time");
return queryWrapper;
}
}

View File

@@ -44,19 +44,17 @@ public class FootprintServiceImpl extends ServiceImpl<FootprintMapper, FootPrint
queryWrapper.eq(FootPrint::getGoodsId, footPrint.getGoodsId());
//如果已存在某商品记录,则更新其修改时间
//如果不存在则添加记录
//为了保证足迹的排序,将原本足迹删除后重新添加
List<FootPrint> oldPrints = list(queryWrapper);
if (oldPrints != null && !oldPrints.isEmpty()) {
FootPrint oldPrint = oldPrints.get(0);
oldPrint.setSkuId(footPrint.getSkuId());
this.updateById(oldPrint);
return oldPrint;
} else {
footPrint.setCreateTime(new Date());
this.save(footPrint);
//删除超过100条后的记录
this.baseMapper.deleteLastFootPrint(footPrint.getMemberId());
return footPrint;
this.removeById(oldPrint.getId());
}
footPrint.setCreateTime(new Date());
this.save(footPrint);
//删除超过100条后的记录
this.baseMapper.deleteLastFootPrint(footPrint.getMemberId());
return footPrint;
}
@Override