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