首页接口完善
This commit is contained in:
parent
7d80b4329a
commit
25cc88c64e
@ -1,6 +1,8 @@
|
||||
package com.macro.mall.portal.dao;
|
||||
|
||||
import com.macro.mall.model.CmsSubject;
|
||||
import com.macro.mall.model.PmsBrand;
|
||||
import com.macro.mall.model.PmsProduct;
|
||||
import com.macro.mall.portal.domain.FlashPromotionProduct;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@ -15,9 +17,24 @@ public interface HomeDao {
|
||||
/**
|
||||
* 获取推荐品牌
|
||||
*/
|
||||
List<PmsBrand> getRecommendBrand();
|
||||
List<PmsBrand> getRecommendBrandList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取秒杀商品
|
||||
*/
|
||||
List<FlashPromotionProduct> getFlashProductList(@Param("flashPromotionId") Long flashPromotionId, @Param("sessionId") Long sessionId);
|
||||
|
||||
/**
|
||||
* 获取新品推荐
|
||||
*/
|
||||
List<PmsProduct> getNewProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
/**
|
||||
* 获取人气推荐
|
||||
*/
|
||||
List<PmsProduct> getHotProductList(@Param("offset") Integer offset,@Param("limit") Integer limit);
|
||||
|
||||
/**
|
||||
* 获取推荐专题
|
||||
*/
|
||||
List<CmsSubject> getRecommendSubjectList(@Param("offset") Integer offset, @Param("limit") Integer limit);
|
||||
}
|
||||
|
@ -38,9 +38,15 @@ public class HomeServiceImpl implements HomeService {
|
||||
//获取首页广告
|
||||
result.setAdvertiseList(getHomeAdvertiseList());
|
||||
//获取推荐品牌
|
||||
result.setBrandList(homeDao.getRecommendBrand());
|
||||
result.setBrandList(homeDao.getRecommendBrandList(0,4));
|
||||
//获取秒杀信息
|
||||
result.setHomeFlashPromotion(getHomeFlashPromotion());
|
||||
//获取新品推荐
|
||||
result.setNewProductList(homeDao.getNewProductList(0,4));
|
||||
//获取人气推荐
|
||||
result.setHotProductList(homeDao.getHotProductList(0,4));
|
||||
//获取推荐专题
|
||||
result.setSubjectList(homeDao.getRecommendSubjectList(0,4));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -1,21 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.macro.mall.portal.dao.HomeDao">
|
||||
<resultMap id="flashPromotionProduct" type="com.macro.mall.portal.domain.FlashPromotionProduct" extends="com.macro.mall.mapper.PmsProductMapper.BaseResultMap">
|
||||
<result column="flash_promotion_price" property="flashPromotionPrice" />
|
||||
<result column="flash_promotion_count" property="flashPromotionCount" />
|
||||
<result column="flash_promotion_limit" property="flashPromotionLimit" />
|
||||
<resultMap id="flashPromotionProduct" type="com.macro.mall.portal.domain.FlashPromotionProduct"
|
||||
extends="com.macro.mall.mapper.PmsProductMapper.BaseResultMap">
|
||||
<result column="flash_promotion_price" property="flashPromotionPrice"/>
|
||||
<result column="flash_promotion_count" property="flashPromotionCount"/>
|
||||
<result column="flash_promotion_limit" property="flashPromotionLimit"/>
|
||||
</resultMap>
|
||||
<select id="getRecommendBrand" resultMap="com.macro.mall.mapper.PmsBrandMapper.BaseResultMap">
|
||||
SELECT
|
||||
pb.*
|
||||
|
||||
<select id="getRecommendBrandList" resultMap="com.macro.mall.mapper.PmsBrandMapper.BaseResultMap">
|
||||
SELECT b.*
|
||||
FROM
|
||||
sms_home_brand hb
|
||||
LEFT JOIN pms_brand pb ON hb.brand_id = pb.id
|
||||
AND recommend_status = 1
|
||||
LEFT JOIN pms_brand b ON hb.brand_id = b.id
|
||||
WHERE
|
||||
hb.recommend_status = 1
|
||||
AND b.show_status = 1
|
||||
ORDER BY
|
||||
hb.sort DESC
|
||||
LIMIT #{offset}, #{limit}
|
||||
</select>
|
||||
|
||||
<select id="getFlashProductList" resultMap="flashPromotionProduct">
|
||||
SELECT
|
||||
pr.flash_promotion_price,
|
||||
@ -29,4 +34,43 @@
|
||||
pr.flash_promotion_id = #{flashPromotionId}
|
||||
AND pr.flash_promotion_session_id = #{sessionId}
|
||||
</select>
|
||||
|
||||
<select id="getNewProductList" resultMap="com.macro.mall.mapper.PmsProductMapper.BaseResultMap">
|
||||
SELECT p.*
|
||||
FROM
|
||||
sms_home_new_product hp
|
||||
LEFT JOIN pms_product p ON hp.product_id = p.id
|
||||
WHERE
|
||||
hp.recommend_status = 1
|
||||
AND p.publish_status = 1
|
||||
ORDER BY
|
||||
hp.sort DESC
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
<select id="getHotProductList" resultMap="com.macro.mall.mapper.PmsProductMapper.BaseResultMap">
|
||||
SELECT p.*
|
||||
FROM
|
||||
sms_home_recommend_product hp
|
||||
LEFT JOIN pms_product p ON hp.product_id = p.id
|
||||
WHERE
|
||||
hp.recommend_status = 1
|
||||
AND p.publish_status = 1
|
||||
ORDER BY
|
||||
hp.sort DESC
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
|
||||
<select id="getRecommendSubjectList" resultMap="com.macro.mall.mapper.CmsSubjectMapper.BaseResultMap">
|
||||
SELECT s.*
|
||||
FROM
|
||||
sms_home_recommend_subject hs
|
||||
LEFT JOIN cms_subject s ON hs.subject_id = s.id
|
||||
WHERE
|
||||
hs.recommend_status = 1
|
||||
AND s.show_status = 1
|
||||
ORDER BY
|
||||
hs.sort DESC
|
||||
LIMIT #{offset}, #{limit};
|
||||
</select>
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user