标签:String,项目,key,------,import,alatus,ware,com,商城 From: https://blog.csdn.net/2201_75960169/article/details/140156714package com.alatus.mall.ware.service.impl; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.alatus.common.utils.PageUtils; import com.alatus.common.utils.Query; import com.alatus.mall.ware.dao.PurchaseDetailDao; import com.alatus.mall.ware.entity.PurchaseDetailEntity; import com.alatus.mall.ware.service.PurchaseDetailService; @Service("purchaseDetailService") public class PurchaseDetailServiceImpl extends ServiceImpl<PurchaseDetailDao, PurchaseDetailEntity> implements PurchaseDetailService { @Override public PageUtils queryPage(Map<String, Object> params) { QueryWrapper<PurchaseDetailEntity> queryWrapper = new QueryWrapper<PurchaseDetailEntity>(); String key = (String) params.get("key"); if(!StringUtils.isEmpty(key)){ queryWrapper.and(wrapper -> { wrapper.eq("sku_id",key).or().eq("purchase_id",key); }); } String status = (String) params.get("status"); if(!StringUtils.isEmpty(status)){ queryWrapper.eq("status",status); } String wareId = (String) params.get("wareId"); if(!StringUtils.isEmpty(wareId)){ queryWrapper.eq("ware_id",wareId); } IPage<PurchaseDetailEntity> page = this.page( new Query<PurchaseDetailEntity>().getPage(params), queryWrapper ); return new PageUtils(page); } }
package com.alatus.mall.ware.service.impl; import org.apache.commons.lang.StringUtils; import org.springframework.stereotype.Service; import java.util.Map; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.alatus.common.utils.PageUtils; import com.alatus.common.utils.Query; import com.alatus.mall.ware.dao.PurchaseDetailDao; import com.alatus.mall.ware.entity.PurchaseDetailEntity; import com.alatus.mall.ware.service.PurchaseDetailService; @Service("purchaseDetailService") public class PurchaseDetailServiceImpl extends ServiceImpl<PurchaseDetailDao, PurchaseDetailEntity> implements PurchaseDetailService { @Override public PageUtils queryPage(Map<String, Object> params) { QueryWrapper<PurchaseDetailEntity> queryWrapper = new QueryWrapper<PurchaseDetailEntity>(); String key = (String) params.get("key"); if(!StringUtils.isEmpty(key)){ queryWrapper.and(wrapper -> { wrapper.eq("sku_id",key).or().eq("purchase_id",key); }); } String status = (String) params.get("status"); if(!StringUtils.isEmpty(status)){ queryWrapper.eq("status",status); } String wareId = (String) params.get("wareId"); if(!StringUtils.isEmpty(wareId)){ queryWrapper.eq("ware_id",wareId); } IPage<PurchaseDetailEntity> page = this.page( new Query<PurchaseDetailEntity>().getPage(params), queryWrapper ); return new PageUtils(page); } }