Commit d0de2145 authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/dev' into dev

parents cb14c891 078f1c53
...@@ -372,26 +372,31 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> { ...@@ -372,26 +372,31 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
if (CollectionUtils.isEmpty(query.getTagIds())) { if (CollectionUtils.isEmpty(query.getTagIds())) {
setQueryTagIds(query); setQueryTagIds(query);
} }
List<GoodDataVO> list = mapper.getList(query);
List<TourGood> list = mapper.getList(query);
return handleResultList(list, query); return handleResultList(list, query);
} }
private List handleResultList(List<TourGood> list, WebsiteQuery query) { private List handleResultList(List<GoodDataVO> list, WebsiteQuery query) {
int size=0; int size=0;
if (list != null) { if (list != null) {
size = list.size(); size = list.size();
} }
if (size!= query.getLimit()) { if (size!= query.getLimit()) {
List<Integer> ids = list.parallelStream().map(TourGood::getId).collect(Collectors.toList()); List<Integer> ids = list.parallelStream().map(GoodDataVO::getId).collect(Collectors.toList());
Example example =new Example(TourGood.class); Example example =new Example(TourGood.class);
example.createCriteria().andNotIn("id",ids).andEqualTo("status",1).andEqualTo("isDel",0); example.createCriteria().andNotIn("id",ids).andEqualTo("status",1).andEqualTo("isDel",0);
example.orderBy("rank").asc().orderBy("crtTime").desc(); example.orderBy("rank").asc().orderBy("crtTime").desc();
PageHelper.startPage(1,query.getLimit()-size); PageHelper.startPage(1,query.getLimit()-size);
List<TourGood> tourGoods = mapper.selectByExample(example); List<TourGood> tourGoods = mapper.selectByExample(example);
list.addAll(tourGoods); for (TourGood tourGood : tourGoods) {
GoodDataVO goodDataVO = new GoodDataVO();
goodDataVO.setId(tourGood.getId());
goodDataVO.setName(tourGood.getName());
goodDataVO.setImgUrl(tourGood.getCover());
goodDataVO.setPrice(tourGood.getPrice().toString());
list.add(goodDataVO);
}
} }
return list; return list;
} }
......
...@@ -38,7 +38,7 @@ public interface TourGoodMapper extends Mapper<TourGood> { ...@@ -38,7 +38,7 @@ public interface TourGoodMapper extends Mapper<TourGood> {
*/ */
List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size); List<GoodDataVO> findAllByHome(@Param("start") Integer start, @Param("size") Integer size);
List<TourGood> getList(WebsiteQuery query); List<GoodDataVO> getList(WebsiteQuery query);
List newTour(Integer limit); List newTour(Integer limit);
} }
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
ORDER BY g.rank DESC ,g.id DESC ORDER BY g.rank DESC ,g.id DESC
</select> </select>
<select id="getList" resultType="com.xxfc.platform.tour.entity.TourGood"> <select id="getList" resultType="com.github.wxiaoqi.security.common.vo.GoodDataVO">
SELECT SELECT
g.id AS `id`, g.id AS `id`,
g. NAME AS `name`, g. NAME AS `name`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment