IMCampaignMapper.xml
2.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?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.sibu.orderHelper.integral.dao.IMCampaginDao">
<select id="listImCampagin" resultMap="IMCampaignCategoryMap">
SELECT
im_campaign_category_id,`name`,image_url,sort_index,campagin_type
FROM
im_campaign_category where delete_flag = 1 and is_show = 1 and campagin_type=#{campaginType}
order by sort_index
LIMIT 0, 50
</select>
<select id="selectCampaginProduct" resultMap="CampaginProductResult" parameterType="java.util.Map">
<foreach collection="campagins" item="item" index="index" open="" close="" separator=" UNION all ">
(
select cp.id, cp.campaign_id, cp.product_id from campaign_product cp
left join im_product imp on cp.product_id=imp.im_product_id
left join im_product_inventory imi on cp.product_id=imi.im_product_id
where cp.campaign_id =#{item.imCampaignCategoryId} and cp.product_type = 1 AND cp.is_show = 1 and imp.is_show = 1 and imp.delete_flag = 1 and
imp.audit_flag = 100
<choose>
<when test="sortType == 'comprehensiveRetailPrice'">
ORDER BY cp.campaign_sort_index,imp.retail_price,imi.cost desc
</when>
<otherwise>
ORDER BY cp.campaign_sort_index,imp.member_price,imi.cost desc
</otherwise>
</choose>
limit 2
)
</foreach>
</select>
<resultMap type="IMCampaignCategoryBean" id="IMCampaignCategoryMap">
<id column="im_campaign_category_id" property="imCampaignCategoryId"/>
<result column="name" property="name" />
<result column="image_url" property="imageUrl" />
<result column="sort_index" property="sortIndex" />
<result column="is_show" property="isShow" />
<result column="campagin_type" property="campaginType" />
</resultMap>
<resultMap id="CampaginProductResult" type="com.sibu.orderHelper.integral.reponse.CampaginProductResponse">
<id column="id" property="id"/>
<result column="campaign_id" property="campaginId"/>
<result column="product_id" property="productId"/>
</resultMap>
</mapper>