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

分类商品新增价格排序

上级 816ca35c
......@@ -6,6 +6,7 @@ import com.diaoyun.zion.chinafrica.service.TbCfGoodstypeService;
import com.diaoyun.zion.chinafrica.service.TbCfStationItemService;
import com.diaoyun.zion.chinafrica.vo.StationToGoodsType;
import com.diaoyun.zion.master.base.Result;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -36,11 +37,11 @@ public class GoodsTypeController {
@RequestMapping("/getGoodsTypeList")
@GetMapping
public Map<String,List<StationToGoodsType>> getGoodsTypeList() {
Map<String,List<StationToGoodsType>> map = new HashMap<>();
public Map<String, List<StationToGoodsType>> getGoodsTypeList() {
Map<String, List<StationToGoodsType>> map = new HashMap<>();
List<StationToGoodsType> listStation = new ArrayList<StationToGoodsType>();
List<TbCfGoodstypeEntity> list = tbCfGoodstypeService.queryList(null);
for (TbCfGoodstypeEntity goods:list) {
for (TbCfGoodstypeEntity goods : list) {
StationToGoodsType goodsType = new StationToGoodsType();
goodsType.setCategoryId(goods.getGoodstypeId());
goodsType.setGoodstypetitle(goods.getGoodstypeTitle());
......@@ -49,7 +50,7 @@ public class GoodsTypeController {
goodsType.setStationlist(station);
listStation.add(goodsType);
}
map.put("data",listStation);
map.put("data", listStation);
return map;
}
......@@ -57,13 +58,15 @@ public class GoodsTypeController {
@GetMapping
public Result getItemStationList(@RequestParam(required = false) Integer pageNum,
@RequestParam(required = false) Integer pageSize,
@RequestParam(required = false) String categoryId) {
@RequestParam(required = false) String categoryId,
@RequestParam(required = false) String order
) {
if (pageNum == null) {
pageNum = 1;
}
if (pageSize == null) {
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> {
*
* @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> {
* @param name
* @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 {
* @param pageSize
* @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 {
}
@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<>();
startPage(pageNum, pageSize);
List<TbCfStationItemEntity> tbCfStationItemList = tbCfStationItemDao.getItemStationList(categoryId);
List<TbCfStationItemEntity> tbCfStationItemList = tbCfStationItemDao.getItemStationList(categoryId, order);
PageInfo<TbCfStationItemEntity> pageInfo = new PageInfo<>(tbCfStationItemList);
result.setData(pageInfo);
return result;
......
......@@ -166,7 +166,8 @@
<!--获取商品独立站-->
<select id="getItemStationList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
select `item_id`,
select
`item_id`,
`item_code`,
`item_name`,
`item_brief`,
......@@ -185,7 +186,10 @@
`item_descrition_id`
from tb_cf_station_item
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 id="getGoodsTypeList" resultType="com.diaoyun.zion.chinafrica.entity.TbCfStationItemEntity">
......@@ -229,7 +233,8 @@
`create_time`,
`item_categorytwo`,
`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},'%'))
<if test="order != null ">
order by item_price ${order}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论