Description or Example
# 核心代码
```java
@RequestMapping("/list")
// @RequiresPermissions("coupon:seckillskurelation:list")
public R list(@RequestParam Map<String, Object> params){
// PageUtils page = seckillSkuRelationService.queryPage(params);
PageUtils page = seckillSkuRelationService.queryByParams(params);
return R.ok().put("page", page);
}
```
```java
@Override
public PageUtils queryByParams(Map<String, Object> params) {
String key = (String) params.get("key"); // 全文解锁条件
String promotionId = (String) params.get("promotion_id"); // 活动id
String promotionSessionId = (String) params.get("promotion_session_id"); // 场次id
LambdaQueryWrapper<SeckillSkuRelationEntity> queryWrapper = new LambdaQueryWrapper<>();
if (StringUtils.isNotBlank(key)) { // 如果检索关键字不为空
queryWrapper.and(
queryWrapper1 ->
queryWrapper1.like(SeckillSkuRelationEntity::getPromotionId, key)
.or()
.like(SeckillSkuRelationEntity::getPromotionSessionId, key)
);
}
if (StringUtils.isNotBlank(promotionId)) { // 如果活动不为空
queryWrapper.eq(SeckillSkuRelationEntity::getPromotionId, promotionId);
}
if (StringUtils.isNotBlank(promotionSessionId)) { // 如果场次不为空
queryWrapper.eq(SeckillSkuRelationEntity::getPromotionSessionId, promotionSessionId);
}
IPage<SeckillSkuRelationEntity> iPage = this.page(
new Query<SeckillSkuRelationEntity>().getPage(params),
queryWrapper
);
return new PageUtils(iPage);
}
```