失效列表分页
This commit is contained in:
@@ -33,7 +33,8 @@ public interface LpkGoodsMapper extends BaseMapper<LpkGoods> {
|
||||
LpkGoods getGoodsByName(@Param("goodName") String goodName);
|
||||
List<GiftBagGoods> getAllGoodsApplet();
|
||||
List<MyGoodsVo> getGoodsApplet( @Param("query") LpkGoodsQuery query);
|
||||
List<MyGoodsVo> getGoodsAppletInvalid( @Param("query") LpkGoodsQuery query);
|
||||
|
||||
IPage<MyGoodsVo> getGoodsAppletInvalid(IPage<LpkGoods> page, @Param(Constants.WRAPPER) QueryWrapper<LpkGoods> qw);
|
||||
|
||||
List<GiftBagGoodss> getAllGoodsApplets(@Param("query") LpkGiftCardQuery query);
|
||||
List<GoodsTypeVo> getType();
|
||||
|
||||
@@ -122,10 +122,9 @@
|
||||
FROM
|
||||
vegetable_cellar r
|
||||
LEFT JOIN lpk_goods s ON s.sid = r.goodsSid
|
||||
WHERE
|
||||
r.customerSid =#{query.customerSid}
|
||||
and date_format(periodValidity,'%Y-%m-%d') < date_format (#{query.now},'%Y-%m-%d')
|
||||
order by periodValidity desc
|
||||
<where>
|
||||
${ew.sqlSegment}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="getAllGoodsApplets" resultType="com.yxt.yythmall.api.appletgiftbag.GiftBagGoodss">
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.yxt.yythmall.biz.lpkgoods;
|
||||
import com.yxt.common.core.query.PagerQuery;
|
||||
import com.yxt.common.core.result.ResultBean;
|
||||
import com.yxt.common.core.vo.PagerVo;
|
||||
import com.yxt.yythmall.api.appletgiftbag.MyGoodsVo;
|
||||
import com.yxt.yythmall.api.lpkgiftcard.LpkGiftCardQuery;
|
||||
import com.yxt.yythmall.api.lpkgoods.*;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -83,8 +84,8 @@ public class LpkGoodsRest {
|
||||
}
|
||||
@ApiOperation("我的菜窖失效列表")
|
||||
@PostMapping("/vegeCellarInvalidList")
|
||||
public ResultBean vegeCellarInvalidList(@RequestBody LpkGoodsQuery query) {
|
||||
return lpkGoodsService.vegeCellarInvalidList(query);
|
||||
public ResultBean<PagerVo<MyGoodsVo>> vegeCellarInvalidList(@RequestBody PagerQuery<LpkGoodsQuery> pq) {
|
||||
return lpkGoodsService.vegeCellarInvalidList(pq);
|
||||
}
|
||||
|
||||
@ApiOperation("我的菜窖类别及数量")
|
||||
|
||||
@@ -257,21 +257,31 @@ public class LpkGoodsService extends MybatisBaseService<LpkGoodsMapper, LpkGoods
|
||||
});
|
||||
return rb.success().setData(vo);
|
||||
}
|
||||
public ResultBean vegeCellarInvalidList(LpkGoodsQuery query) {
|
||||
public ResultBean<PagerVo<MyGoodsVo>> vegeCellarInvalidList(PagerQuery<LpkGoodsQuery> pq) {
|
||||
ResultBean rb=new ResultBean().fail();
|
||||
LpkGoodsQuery query = pq.getParams();
|
||||
if(StringUtils.isBlank(query.getCustomerSid())){
|
||||
return rb.setMsg("参数不全");
|
||||
}
|
||||
QueryWrapper<LpkGoods> qw = new QueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(query.getCustomerSid())) {
|
||||
qw.eq("r.customerSid", query.getCustomerSid());
|
||||
}
|
||||
SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd");
|
||||
query.setNow(sdf.format(new Date()));
|
||||
List<MyGoodsVo> vo =baseMapper.getGoodsAppletInvalid(query);
|
||||
vo.forEach(s->{
|
||||
qw.apply(" date_format(s.periodValidity,'%Y-%m-%d') < date_format ('"+sdf.format(new Date())+"','%Y-%m-%d')");
|
||||
qw.orderByDesc("s.periodValidity");
|
||||
IPage<LpkGoods> page = PagerUtil.queryToPage(pq);
|
||||
IPage<MyGoodsVo> pagging = baseMapper.getGoodsAppletInvalid(page, qw);
|
||||
PagerVo<LpkGoodsVo> p = PagerUtil.pageToVo(pagging, null);
|
||||
List<MyGoodsVo> records = pagging.getRecords();
|
||||
records.forEach(s->{
|
||||
double i=Double.valueOf(s.getGoodsNumber());
|
||||
s.setGoodsNumber(DoubleUtils.removeZeros(String.valueOf((int)i)));
|
||||
s.setWeight(DoubleUtils.removeZeros(s.getWeight()));
|
||||
s.setIconUrl(fileUploadComponent.getUrlPrefix()+s.getIconUrl());
|
||||
});
|
||||
return rb.success().setData(vo);
|
||||
return rb.success().setData(p);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user