1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- <?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.FloorDao">
- <insert id="insertFloor" keyColumn="id" keyProperty="id" parameterType="com.caimei.modules.homepage.enity.Floor"
- useGeneratedKeys="true">
- insert into cm_mall_floor (organizeId, topic, sort, enabledStatus, addTime)
- values (#{organizeId}, #{topic}, #{sort}, #{enabledStatus}, now())
- </insert>
- <insert id="insertFloorProduct">
- insert into cm_mall_floor_product(floorId, productId, sort)
- VALUES (#{id}, #{productId}, #{sort})
- </insert>
- <update id="checkStatus">
- UPDATE cm_mall_floor
- SET enabledStatus=
- (CASE
- WHEN enabledStatus = 1
- THEN 0
- ELSE 1 END)
- WHERE id = #{id}
- </update>
- <delete id="delProduct">
- delete
- from cm_mall_floor_product
- where floorId = #{id}
- </delete>
- <select id="findList" resultType="com.caimei.modules.homepage.enity.Floor">
- select id, organizeId, topic, enabledStatus, addTime, sort
- from cm_mall_floor
- <where>
- organizeID = #{organizeId}
- <if test="topic != null and topic != ''">
- AND topic LIKE concat('%',#{topic},'%')
- </if>
- <if test="enabledStatus != null">
- AND enabledStatus = #{enabledStatus}
- </if>
- </where>
- order by sort asc
- </select>
- <select id="findProducts" resultType="com.caimei.modules.homepage.enity.BackProduct">
- select DISTINCT p.name as productName,
- p.mainImage,
- p.productId,
- copi.validFlag,
- cmp.sort
- from cm_mall_floor_product cmp
- left join product p on cmp.productId = p.productID
- left join cm_organize_product_info copi on cmp.productId = copi.productId
- where cmp.floorId = #{id}
- group by p.productId
- order by cmp.sort
- </select>
- </mapper>
|