123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- <?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.CmHeheReductionDao">
-
- <sql id="cmHeheReductionColumns">
- a.id AS "id",
- a.name AS "name",
- a.reducedAmount AS "reducedAmount",
- a.touchPrice AS "touchPrice",
- a.shareNum AS "shareNum",
- a.startTime AS "startTime",
- a.endTime AS "endTime",
- a.addTime AS "addTime"
- </sql>
-
- <sql id="cmHeheReductionJoins">
- </sql>
-
- <select id="get" resultType="CmHeheReduction">
- SELECT
- <include refid="cmHeheReductionColumns"/>
- FROM cm_hehe_reduction a
- <include refid="cmHeheReductionJoins"/>
- WHERE a.id = #{id}
- </select>
-
- <select id="findList" resultType="CmHeheReduction">
- SELECT
- <include refid="cmHeheReductionColumns"/>
- FROM cm_hehe_reduction a
- <include refid="cmHeheReductionJoins"/>
- <where>
-
- <if test="name != null and name != ''">
- AND a.name LIKE
- <if test="dbName == 'oracle'">'%'||#{name}||'%'</if>
- <if test="dbName == 'mssql'">'%'+#{name}+'%'</if>
- <if test="dbName == 'mysql'">concat('%',#{name},'%')</if>
- </if>
- <if test="status != null">
- <if test="status == 1">
- and NOW() <![CDATA[ < ]]> a.startTime
- </if>
- <if test="status == 2">
- and NOW() <![CDATA[ >= ]]> a.startTime and NOW() <![CDATA[ <= ]]> a.endTime
- </if>
- <if test="status == 3">
- and NOW() <![CDATA[ > ]]> a.endTime
- </if>
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- order by a.addTime desc
- </otherwise>
- </choose>
- </select>
-
- <select id="findAllList" resultType="CmHeheReduction">
- SELECT
- <include refid="cmHeheReductionColumns"/>
- FROM cm_hehe_reduction a
- <include refid="cmHeheReductionJoins"/>
- <where>
-
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findUserList" resultType="com.caimei.modules.hehe.entity.CmHeheReductionUser">
- select ru.id,chu.nickName,chu.mobile,ru.shareType,ru.shareTime
- from cm_hehe_reduction_user ru
- left join user u on ru.userId = u.userID
- left join cm_hehe_user chu on u.userID = chu.userId
- where reductionId = #{reductionId}
- <if test="nickName != null and nickName != ''">
- and chu.nickName like concat('%',#{nickName},'%')
- </if>
- <if test="mobile != null and mobile != ''">
- and chu.mobile like concat('%',#{mobile},'%')
- </if>
- <if test="shareType != null">
- and ru.shareType = #{shareType}
- </if>
- order by shareTime desc
- </select>
- <select id="getAllTime" resultType="com.caimei.modules.hehe.entity.CmHeheReduction">
- select id, startTime,endTime from cm_hehe_reduction;
- </select>
- <insert id="insert" parameterType="CmHeheReduction" keyProperty="id" useGeneratedKeys="true">
- INSERT INTO cm_hehe_reduction(
- name,
- reducedAmount,
- touchPrice,
- shareNum,
- startTime,
- endTime,
- addTime
- ) VALUES (
- #{name},
- #{reducedAmount},
- #{touchPrice},
- #{shareNum},
- #{startTime},
- #{endTime},
- NOW()
- )
- </insert>
-
- <update id="update">
- UPDATE cm_hehe_reduction SET
- name = #{name},
- reducedAmount = #{reducedAmount},
- touchPrice = #{touchPrice},
- shareNum = #{shareNum},
- startTime = #{startTime},
- endTime = #{endTime}
- WHERE id = #{id}
- </update>
- <update id="updateStatus">
- update cm_hehe_reduction set
- <if test="status == 3">
- endTime = NOW()
- </if>
- <if test="status == 2">
- startTime = NOW()
- </if>
- where id = #{id}
- </update>
- <update id="updateTime">
- update cm_hehe_reduction
- set startTime = #{startTime}, endTime = #{endTime}
- where id = #{id}
- </update>
- <delete id="delete">
- DELETE FROM cm_hehe_reduction
- WHERE id = #{id}
- </delete>
-
- </mapper>
|