123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?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.hehe.dao.CmHeheActivityDao">
-
- <sql id="cmHeheActivityColumns">
- a.id AS "id",
- a.name AS "name",
- a.status AS "status",
- a.listImage AS "listImage",
- a.detailsImage AS "detailsImage",
- a.beginTime AS "beginTime",
- a.endTime AS "endTime",
- a.addTime AS "addTime",
- a.delFlag AS "delFlag"
- </sql>
-
- <sql id="cmHeheActivityJoins">
- </sql>
-
- <select id="get" resultType="CmHeheActivity">
- SELECT
- <include refid="cmHeheActivityColumns"/>
- FROM cm_hehe_activity a
- <include refid="cmHeheActivityJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="CmHeheActivity">
- SELECT
- <include refid="cmHeheActivityColumns"/>
- FROM cm_hehe_activity a
- <include refid="cmHeheActivityJoins"/>
- <where>
- a.delFlag = 0
- <if test="name != null and name != ''">
- AND a.name LIKE concat('%',#{name},'%')
- </if>
- <if test="status != null and status != ''">
- AND a.status = #{status}
- </if>
- <if test="activityStatus == 1">
- AND a.beginTime <![CDATA[ > ]]> NOW()
- </if>
- <if test="activityStatus == 2">
- AND NOW() BETWEEN a.beginTime AND a.endTime
- </if>
- <if test="activityStatus == 3">
- AND a.endTime <![CDATA[ < ]]> NOW()
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- ORDER BY addTime DESC
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="CmHeheActivity">
- SELECT
- <include refid="cmHeheActivityColumns"/>
- FROM cm_hehe_activity a
- <include refid="cmHeheActivityJoins"/>
- <where>
-
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
-
- <insert id="insert" parameterType="CmHeheActivity" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_hehe_activity(
- name,
- status,
- listImage,
- detailsImage,
- beginTime,
- endTime,
- addTime,
- delFlag
- ) VALUES (
- #{name},
- #{status},
- #{listImage},
- #{detailsImage},
- #{beginTime},
- #{endTime},
- NOW(),
- 0
- )
- </insert>
-
- <update id="update">
- UPDATE cm_hehe_activity SET
- name = #{name},
- status = #{status},
- listImage = #{listImage},
- detailsImage = #{detailsImage},
- beginTime = #{beginTime},
- endTime = #{endTime}
- WHERE id = #{id}
- </update>
-
- <update id="delete">
- UPDATE cm_hehe_activity SET delFlag = 1 WHERE id = #{id}
- </update>
- <update id="updateStatusById">
- UPDATE cm_hehe_activity SET status = #{status} WHERE id = #{id}
- </update>
- <update id="deleteActivityProduct">
- UPDATE cm_hehe_activity_product SET delFlag = 1 WHERE activityId = #{activityId}
- </update>
- <delete id="deleteUserActivity">
- DELETE FROM cm_hehe_user_activity WHERE activityId = #{activityId}
- </delete>
- <delete id="deleteActivityLadder">
- DELETE FROM cm_hehe_activity_ladder WHERE activityId = #{activityId}
- </delete>
- </mapper>
|