|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package com.bookstore.bookmall.product.service.impl;
|
|
|
|
|
|
|
|
|
|
import com.alibaba.nacos.shaded.io.grpc.netty.shaded.io.netty.util.internal.StringUtil;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
@ -26,4 +27,29 @@ public class AttrGroupServiceImpl extends ServiceImpl<AttrGroupDao, AttrGroupEnt
|
|
|
|
|
return new PageUtils(page);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public PageUtils querypage(Map<String, Object> params, Long catelogId) {
|
|
|
|
|
if (catelogId == 0) {
|
|
|
|
|
IPage<AttrGroupEntity> page = this.page(
|
|
|
|
|
new Query<AttrGroupEntity>().getPage(params),
|
|
|
|
|
new QueryWrapper<AttrGroupEntity>());
|
|
|
|
|
return new PageUtils(page);
|
|
|
|
|
}else {
|
|
|
|
|
//多字段模糊检索
|
|
|
|
|
//select * from pms_attr_group where catelog_id=? and (attr_group_id=key or attr_group_name like %key% or descript=key)
|
|
|
|
|
String key = (String) params.get("key");
|
|
|
|
|
//数据库chax
|
|
|
|
|
QueryWrapper<AttrGroupEntity> wrapper = new QueryWrapper<AttrGroupEntity>().eq("catelog_id", catelogId);
|
|
|
|
|
if (!StringUtil.isNullOrEmpty(key)){
|
|
|
|
|
//将wrapper构造以后用这个查询
|
|
|
|
|
wrapper.and((obj)->{
|
|
|
|
|
obj.eq("attr_group_id",key).or().like("attr_group_name", key)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
IPage<AttrGroupEntity> page = this.page(
|
|
|
|
|
new Query<AttrGroupEntity>().getPage(params), wrapper);
|
|
|
|
|
return new PageUtils(page)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|