提交 7c728232 authored 作者: zgy's avatar zgy

分类商品新增价格排序

上级 816ca35c
...@@ -6,6 +6,7 @@ import com.diaoyun.zion.chinafrica.service.TbCfGoodstypeService; ...@@ -6,6 +6,7 @@ import com.diaoyun.zion.chinafrica.service.TbCfGoodstypeService;
import com.diaoyun.zion.chinafrica.service.TbCfStationItemService; import com.diaoyun.zion.chinafrica.service.TbCfStationItemService;
import com.diaoyun.zion.chinafrica.vo.StationToGoodsType; import com.diaoyun.zion.chinafrica.vo.StationToGoodsType;
import com.diaoyun.zion.master.base.Result; import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -36,34 +37,36 @@ public class GoodsTypeController { ...@@ -36,34 +37,36 @@ public class GoodsTypeController {
@RequestMapping("/getGoodsTypeList") @RequestMapping("/getGoodsTypeList")
@GetMapping @GetMapping
public Map<String,List<StationToGoodsType>> getGoodsTypeList() { public Map<String, List<StationToGoodsType>> getGoodsTypeList() {
Map<String,List<StationToGoodsType>> map = new HashMap<>(); Map<String, List<StationToGoodsType>> map = new HashMap<>();
List<StationToGoodsType> listStation = new ArrayList<StationToGoodsType>(); List<StationToGoodsType> listStation = new ArrayList<StationToGoodsType>();
List<TbCfGoodstypeEntity> list = tbCfGoodstypeService.queryList(null); List<TbCfGoodstypeEntity> list = tbCfGoodstypeService.queryList(null);
for (TbCfGoodstypeEntity goods:list) { for (TbCfGoodstypeEntity goods : list) {
StationToGoodsType goodsType = new StationToGoodsType(); StationToGoodsType goodsType = new StationToGoodsType();
goodsType.setCategoryId(goods.getGoodstypeId()); goodsType.setCategoryId(goods.getGoodstypeId());
goodsType.setGoodstypetitle(goods.getGoodstypeTitle()); goodsType.setGoodstypetitle(goods.getGoodstypeTitle());
goodsType.setGoodstypeUrl(goods.getGoodstypeUrl()); goodsType.setGoodstypeUrl(goods.getGoodstypeUrl());
List<TbCfStationItemEntity> station = tbCfStationItemService.getGoodsTypeList(goods.getGoodstypeId()); List<TbCfStationItemEntity> station = tbCfStationItemService.getGoodsTypeList(goods.getGoodstypeId());
goodsType.setStationlist(station); goodsType.setStationlist(station);
listStation.add(goodsType); listStation.add(goodsType);
} }
map.put("data",listStation); map.put("data", listStation);
return map; return map;
} }
@RequestMapping("/getItemStationList") @RequestMapping("/getItemStationList")
@GetMapping @GetMapping
public Result getItemStationList(@RequestParam(required = false) Integer pageNum, public Result getItemStationList(@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize, @RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) String categoryId) { @RequestParam(required = false) String categoryId,
@RequestParam(required = false) String order
) {
if (pageNum == null) { if (pageNum == null) {
pageNum = 1; pageNum = 1;
} }
if (pageSize == null) { if (pageSize == null) {
pageSize = 6; pageSize = 6;
} }
return tbCfStationItemService.getItemStationList(pageNum,pageSize,categoryId); return tbCfStationItemService.getItemStationList(pageNum, pageSize, categoryId,order);
} }
} }
...@@ -21,7 +21,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> { ...@@ -21,7 +21,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
* *
* @return * @return
*/ */
List<TbCfStationItemEntity> getItemStationList(String categoryId); List<TbCfStationItemEntity> getItemStationList(@Param("categoryId") String categoryId, @Param("order") String order);
/** /**
* 根据主键一级分类实体集合 * 根据主键一级分类实体集合
...@@ -36,7 +36,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> { ...@@ -36,7 +36,7 @@ public interface TbCfStationItemDao extends BaseDao<TbCfStationItemEntity> {
* @param name * @param name
* @return * @return
*/ */
List<TbCfStationItemEntity> searchItems(@Param("name") String name, @Param("order")String order); List<TbCfStationItemEntity> searchItems(@Param("name") String name, @Param("order") String order);
/** /**
......
...@@ -86,7 +86,7 @@ public interface TbCfStationItemService { ...@@ -86,7 +86,7 @@ public interface TbCfStationItemService {
* @param pageSize * @param pageSize
* @return * @return
*/ */
Result getItemStationList(Integer pageNum, Integer pageSize, String categoryId); Result getItemStationList(Integer pageNum, Integer pageSize, String categoryId,String order);
/** /**
* 首页商品 * 首页商品
......
...@@ -102,10 +102,10 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService { ...@@ -102,10 +102,10 @@ public class TbCfStationItemServiceImpl implements TbCfStationItemService {
} }
@Override @Override
public Result getItemStationList(Integer pageNum, Integer pageSize, String categoryId) { public Result getItemStationList(Integer pageNum, Integer pageSize, String categoryId, String order) {
Result<PageInfo> result = new Result<>(); Result<PageInfo> result = new Result<>();
startPage(pageNum, pageSize); startPage(pageNum, pageSize);
List<TbCfStationItemEntity> tbCfStationItemList = tbCfStationItemDao.getItemStationList(categoryId); List<TbCfStationItemEntity> tbCfStationItemList = tbCfStationItemDao.getItemStationList(categoryId, order);
PageInfo<TbCfStationItemEntity> pageInfo = new PageInfo<>(tbCfStationItemList); PageInfo<TbCfStationItemEntity> pageInfo = new PageInfo<>(tbCfStationItemList);
result.setData(pageInfo); result.setData(pageInfo);
return result; return result;
......
...@@ -166,26 +166,30 @@ ...@@ -166,26 +166,30 @@
<!--获取商品独立站--> <!--获取商品独立站-->
<select id="getItemStationList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity"> <select id="getItemStationList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select `item_id`, select
`item_code`, `item_id`,
`item_name`, `item_code`,
`item_brief`, `item_name`,
`item_category`, `item_brief`,
`item_price`, `item_category`,
`discount_price`, `item_price`,
`item_url`, `discount_price`,
`item_img`, `item_url`,
`item_num`, `item_img`,
`item_count`, `item_num`,
`platform_code`, `item_count`,
`platform_name`, `platform_code`,
`enable_flag`, `platform_name`,
`create_time`, `enable_flag`,
`item_categorytwo`, `create_time`,
`item_descrition_id` `item_categorytwo`,
from tb_cf_station_item `item_descrition_id`
from tb_cf_station_item
where enable_flag=1 and item_category = #{categoryId} where enable_flag=1 and item_category = #{categoryId}
order by item_num desc order by
<if test="order != null">item_price ${order},</if>
item_num desc
</select> </select>
<select id="getGoodsTypeList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity"> <select id="getGoodsTypeList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
...@@ -229,7 +233,8 @@ ...@@ -229,7 +233,8 @@
`create_time`, `create_time`,
`item_categorytwo`, `item_categorytwo`,
`item_descrition_id` `item_descrition_id`
from tb_cf_station_item where enable_flag=1 and (item_name like concat('%',#{name},'%') or item_brief like concat('%',#{name},'%') from tb_cf_station_item where enable_flag=1 and (item_name like concat('%',#{name},'%') or item_brief like
concat('%',#{name},'%')
or item_tags like concat('%',#{name},'%')) or item_tags like concat('%',#{name},'%'))
<if test="order != null "> <if test="order != null ">
order by item_price ${order} order by item_price ${order}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论