123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- <?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.caimei.modules.homepage.dao.ActiveDao">
- <insert id="insertActive" keyColumn="id" keyProperty="id" parameterType="com.caimei.modules.homepage.enity.Active"
- useGeneratedKeys="true">
- insert into cm_mall_active (organizeId, topic, enabledStatus, activeType, addTime)
- VALUES (#{organizeId}, #{topic}, #{enabledStatus}, #{activeType}, now())
- </insert>
- <insert id="insertImages" keyColumn="id" keyProperty="id"
- parameterType="com.caimei.modules.homepage.enity.ActiveImages"
- useGeneratedKeys="true">
- insert into cm_mall_active_image(activeId, image,topic)
- VALUES (#{activeId}, #{image},#{topic})
- </insert>
- <insert id="insertProducts">
- insert into cm_mall_active_product(activeId, productId, sort)
- VALUES (#{id}, #{productId}, #{sort})
- </insert>
- <insert id="insertImageProduct">
- insert into cm_mall_active_product(activeId, imageId, productId, sort)
- values (#{activeId}, #{imageId},#{productId}, #{sort})
- </insert>
- <update id="updateActive">
- update cm_mall_active
- <set>
- <if test="topic != null and topic !=''">
- topic = #{topic},
- </if>
- <if test="enabledStatus != null">
- enabledStatus = #{enabledStatus}
- </if>
- </set>
- where id = #{id}
- </update>
- <update id="checkActiveStatus">
- UPDATE cm_mall_active
- SET enabledStatus=
- (CASE
- WHEN enabledStatus = 1
- THEN 0
- ELSE 1 END)
- WHERE id = #{id}
- </update>
- <delete id="delProducts">
- delete
- from cm_mall_active_product
- where activeId = #{id}
- </delete>
- <delete id="delImages">
- delete
- from cm_mall_active_image
- where activeId = #{id}
- </delete>
- <delete id="delActive">
- delete
- from cm_mall_active
- where id = #{id}
- </delete>
- <delete id="delActiveImage">
- delete
- from cm_mall_active_image
- where activeId = #{id}
- </delete>
- <delete id="delActiveProduct">
- delete
- from cm_mall_active_product
- where activeId = #{id}
- </delete>
- <select id="findActiveList" resultType="com.caimei.modules.homepage.enity.Active">
- select id, organizeId, topic, enabledstatus, activeType, addtime
- from cm_mall_active
- <where>
- organizeID = #{organizeId}
- <if test="topic != null and topic != ''">
- AND topic LIKE concat('%',#{topic},'%')
- </if>
- <if test="enabledStatus != null">
- AND enabledStatus = #{enabledStatus}
- </if>
- <if test="activeType !=null">
- AND activeType = #{activeType}
- </if>
- </where>
- order by addTime desc
- </select>
- <select id="findActiveById" resultType="com.caimei.modules.homepage.enity.Active">
- select id, organizeId, topic, enabledStatus, activeType, addTime
- from cm_mall_active
- where id = #{id}
- </select>
- <select id="findImageList" resultType="com.caimei.modules.homepage.enity.ActiveImages">
- select id, image, topic
- from cm_mall_active_image
- where activeId = #{id}
- </select>
- <select id="findProducts" resultType="com.caimei.modules.homepage.enity.BackProduct">
- select DISTINCT p.name as productName,
- p.mainImage,
- cmop.productId as productId,
- cmop.validFlag,
- cmp.sort
- from cm_mall_active_product cmp
- left join cm_organize_product_info cmop on cmp.productId = cmop.productId
- left join product p on cmop.productId = p.productID
- where cmp.activeId = #{id} and cmop.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productID)
- </select>
- <select id="findProductsByImage" resultType="com.caimei.modules.homepage.enity.BackProduct">
- select DISTINCT p.name as productName,
- p.mainImage,
- cmop.productId as productId,
- cmop.validFlag,
- cmp.sort
- from cm_mall_active_product cmp
- left join cm_organize_product_info cmop on cmp.productId = cmop.productId
- left join product p on cmop.productId = p.productID
- where cmp.imageId = #{id} and cmop.organizeId=(SELECT SUBSTRING(groundMall, 1, 1)FROM product WHERE productID=p.productID)
- </select>
- </mapper>
|