提交 49774175 编写于 作者: N nicky

修正一下商品品目信息搜索

上级 675f8169
package com.muses.taoshop.web.controller.portal;
import com.muses.taoshop.item.entity.ItemCategory;
import com.muses.taoshop.item.entity.ItemDto;
import com.muses.taoshop.item.entity.ItemVo;
import com.muses.taoshop.item.entity.ItemList;
import com.muses.taoshop.item.service.IItemCategoryService;
import com.muses.taoshop.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
......@@ -15,7 +14,7 @@ import java.util.List;
/**
* <pre>
* 商品类别控制类
* 商品品类控制类
* </pre>
*
* @author nicky
......@@ -32,12 +31,19 @@ public class ItemCategoryController extends BaseController{
@Autowired
IItemCategoryService iItemCategoryService;
@RequestMapping(value = "/toCategoryList/{categoryId}")
/**
* 根据品类id检索商品信息
* @param categoryId
* @return
*/
@GetMapping(value = "/toCategoryList/{categoryId}")
public ModelAndView toCategoryList(@PathVariable("categoryId")int categoryId) {
ModelAndView mv = this.getModelAndView();
mv.setViewName("item/item_category");
List<ItemVo> items = iItemCategoryService.listItemByCategoryId(categoryId);
List<ItemList> items = iItemCategoryService.listItemByCategoryId(categoryId);
mv.addObject("items", items);
return mv;
}
}
......@@ -2,6 +2,7 @@ package com.muses.taoshop.web.controller.user;
import com.muses.taoshop.web.controller.BaseController;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
......@@ -25,7 +26,7 @@ public class UserController extends BaseController{
* 跳转用户中心
* @return
*/
@RequestMapping("/toUserCenter")
@GetMapping("/toUserCenter")
public ModelAndView toUserCenter(){
ModelAndView mv = this.getModelAndView();
mv.setViewName("user/portal_user_center");
......
......@@ -14,38 +14,6 @@
</p>
<a href="#" class="more">更多</a>
</div>
<div class="all-brands-item">
<h3>手机套<em>91折起</em></h3>
<p>
<a href="#">银联充值</a>
<a href="#">易充值</a>
</p>
<a href="#" class="more">更多</a>
</div>
<div class="all-brands-item">
<h3>手机配件</h3>
<p>
<a href="#">2000元起</a>
<a href="#">3000元起</a>
</p>
<a href="#" class="more">更多</a>
</div>
<div class="all-brands-item">
<h3>杯子照片<em>91折起</em></h3>
<p>
<a href="#">银联充值</a>
<a href="#">易充值</a>
</p>
<a href="#" class="more">更多</a>
</div>
<div class="all-brands-item">
<h3>优惠促销</h3>
<p>
<a href="#">话费服务</a>
<a href="#">话费服务</a>
</p>
<a href="#" class="more">更多</a>
</div>
</dd>
</dl>
<script>
......
......@@ -135,115 +135,17 @@
</div>
<!--//排序-->
<!--商品列表-->
<div class="phoneList clearfix m10-b">
<div class="phoneList clearfix m10-b" th:each="i : ${items}">
<div class="phoneList-wrap">
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
<a href="#"><img th:src="${i.imgPath}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
<a href="#" th:text="${i.itemName}">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
</p>
</div>
<div class="phoneListItem">
<p class="item-img">
<a href="#"><img th:src="@{/static/picture/img_phoneList_240x240.jpg}" /></a>
</p>
<p class="item-name">
<a href="#">苹果(APPLE)iPhone 4S 8G版</a>
</p>
<p class="item-info">北京电信购机</p>
<p class="item-price"><em>2098</em></p>
<p class="item-price" th:text="${'¥'+i.skuPrice}"><em>2098</em></p>
<p class="item-btn">
<a href="#" class="btn btn-gray">加入购物车</a>
<a href="#" class="btn btn-red">立即购买</a>
......
......@@ -43,25 +43,25 @@
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
<div class="img-big">
<a th:href="@{${itemDetail.imgPath}}" ><img width="350" height="350" th:src="@{${itemDetail.imgPath}}" /></a>
<a th:href="${itemDetail.imgPath}" ><img width="350" height="350" th:src="${itemDetail.imgPath}" /></a>
</div>
</div>
<!--//图片展示-->
......@@ -69,14 +69,14 @@
<div class="spec-lists">
<div class="spec-items">
<ul class="clearfix" id="slider">
<li class="selected"><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li><span><img th:src="@{${itemDetail.imgPath}}" /></span></li>
<li class="selected"><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
<li><span><img th:src="${itemDetail.imgPath}" /></span></li>
</ul>
</div>
</div>
......
......@@ -6,7 +6,7 @@ import java.util.List;
/**
* <pre>
* 商品详情DTO类
* 商品详情VO类
* </pre>
*
* @author nicky
......
......@@ -15,29 +15,26 @@ import lombok.Data;
* </pre>
*/
@Data
public class ItemVo {
public class ItemList {
/**
* spu编号
* spu id
*/
private String spuCode;
private Long spuId;
/**
* 商品名称
*/
private String itemName;
/**
* 品类id
*/
private Long categoryId;
/**
* 品牌id
* sku id
*/
private Long brandId;
private Long skuId;
/**
* 商家id
* 商品价钱
*/
private Long shopId;
private Long skuPrice;
/**
* 品目名称
* 图片路径
*/
private String categoryName;
private String imgPath;
}
package com.muses.taoshop.item.service;
import com.muses.taoshop.item.entity.ItemCategory;
import com.muses.taoshop.item.entity.ItemDto;
import com.muses.taoshop.item.entity.ItemVo;
import com.muses.taoshop.item.entity.ItemList;
import java.util.List;
......@@ -35,5 +34,5 @@ public interface IItemCategoryService {
* 根据品目id获取商品信息
* @return
*/
List<ItemVo> listItemByCategoryId(int categoryId);
List<ItemList> listItemByCategoryId(int categoryId);
}
package com.muses.taoshop.item.mapper;
import com.muses.taoshop.item.entity.ItemCategory;
import com.muses.taoshop.item.entity.ItemDto;
import com.muses.taoshop.item.entity.ItemVo;
import com.muses.taoshop.item.entity.ItemList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
......@@ -14,5 +13,5 @@ public interface ItemCategoryMapper {
List<ItemCategory> listCategory();
List<ItemVo> listItemByCategoryId(@Param("categoryId") int categoryId);
List<ItemList> listItemByCategoryId(@Param("categoryId") int categoryId);
}
\ No newline at end of file
package com.muses.taoshop.item.service;
import com.muses.taoshop.item.entity.ItemCategory;
import com.muses.taoshop.item.entity.ItemDto;
import com.muses.taoshop.item.entity.ItemVo;
import com.muses.taoshop.item.entity.ItemList;
import com.muses.taoshop.item.mapper.ItemCategoryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -52,7 +51,7 @@ public class ItemCategoryServiceImpl implements IItemCategoryService{
* @return
*/
@Override
public List<ItemVo> listItemByCategoryId(int categoryId) {
public List<ItemList> listItemByCategoryId(int categoryId) {
return itemCategoryMapper.listItemByCategoryId(categoryId);
}
......
......@@ -32,16 +32,17 @@
FROM item_category t
</select>
<!-- 根据品目id获取商品信息-->
<select id="listItemByCategoryId" resultType="ItemVo">
<select id="listItemByCategoryId" resultType="ItemList">
SELECT
spu.spu_code,
spu.item_name,
spu.category_id,
spu.brand_id,
spu.shop_id,
ic.category_name
spu.id AS spuId,
spu.item_name AS itemName,
sku.id AS skuId,
sku.price AS skuPrice,
sku.img_path AS imgPath
FROM
item_spu spu
LEFT JOIN item_sku sku
ON sku.spu_id = spu.id
LEFT JOIN item_category ic
ON ic.id = spu.category_id
WHERE spu.category_id = #{categoryId}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册