| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?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.ym.mec.biz.dal.dao.LuckDrawLogDao">
- <resultMap id="BaseResultMap" type="com.ym.mec.biz.dal.entity.LuckDrawLog">
- <id column="id_" property="id" jdbcType="BIGINT" />
- <result column="group_id_" property="groupId" jdbcType="INTEGER" />
- <result column="prize_id_" property="prizeId" jdbcType="INTEGER" />
- <result column="user_id_" property="userId" jdbcType="BIGINT" />
- <result column="create_on_" property="createOn" jdbcType="TIMESTAMP" />
- <result column="name_" property="luckDrawPrize.name" jdbcType="VARCHAR" />
- <result column="reward_type_" property="luckDrawPrize.rewardType" typeHandler="com.ym.mec.common.dal.CustomEnumTypeHandler" />
- </resultMap>
-
- <resultMap id="BaseResultMapExt" type="com.ym.mec.biz.dal.entity.LuckDrawLog" extends="BaseResultMap">
- <result column="username_" property="user.username" jdbcType="VARCHAR" />
- <result column="phone_" property="user.phone" jdbcType="VARCHAR" />
- <result column="organ_name_" property="user.organName" jdbcType="VARCHAR" />
- </resultMap>
- <sql id="Base_Column_List">
- l.id_,l.group_id_, l.prize_id_,d.name_,d.reward_type_, l.user_id_, l.create_on_
- </sql>
- <sql id="queryCondition">
- <where>
- <if test="prizeId != null">
- and l.prize_id_ = #{id}
- </if>
- <if test="userId != null">
- and l.user_id_ = #{userId}
- </if>
- <if test="name != null">
- and d.name_ like concat('%',#{name},'%')
- </if>
- <if test="rewardType != null">
- and d.reward_type_ like concat('%',#{rewardType},'%')
- </if>
- <if test="groupId != null">
- and l.group_id_ = #{groupId}
- </if>
- <if test="startDate != null">
- and l.create_on_ >= #{startDate}
- </if>
- <if test="endDate != null">
- and l.create_on_ <= #{endDate}
- </if>
- <if test="organId != null">
- and u.organ_id_ = #{organId}
- </if>
- </where>
- </sql>
- <select id="get" resultMap="BaseResultMap" parameterType="java.lang.Long">
- select
- <include refid="Base_Column_List" />
- from luck_draw_log l left join luck_draw_prize d on
- l.prize_id_ = d.id_
- where l.id_ = #{id,jdbcType=BIGINT}
- </select>
- <delete id="delete" parameterType="java.lang.Long">
- delete from
- luck_draw_log
- where id_ = #{id,jdbcType=BIGINT}
- </delete>
- <insert id="insert" parameterType="com.ym.mec.biz.dal.entity.LuckDrawLog">
- insert into
- luck_draw_log (id_,group_id_, prize_id_, user_id_,
- create_on_)
- values
- (#{id,jdbcType=BIGINT}, #{groupId,jdbcType=INTEGER}, #{prizeId,jdbcType=INTEGER},
- #{userId,jdbcType=BIGINT},
- #{createOn,jdbcType=TIMESTAMP})
- </insert>
- <update id="update" parameterType="com.ym.mec.biz.dal.entity.LuckDrawLog">
- update luck_draw_log
- <set>
- <if test="groupId != null">
- group_id_ = #{groupId,jdbcType=INTEGER},
- </if>
- <if test="prizeId != null">
- prize_id_ = #{prizeId,jdbcType=INTEGER},
- </if>
- <if test="userId != null">
- user_id_ = #{userId,jdbcType=BIGINT},
- </if>
- <if test="createOn != null">
- create_on_ = #{createOn,jdbcType=TIMESTAMP},
- </if>
- </set>
- where id_ = #{id,jdbcType=BIGINT}
- </update>
- <select id="queryCount" parameterType="map" resultType="int">
- select count(*) from luck_draw_log l
- left join luck_draw_prize d on l.prize_id_ = d.id_
- left join sys_user u on u.id_=l.user_id_
- <include refid="queryCondition" />
- </select>
- <select id="queryPage" parameterType="map" resultMap="BaseResultMapExt">
- select <include refid="Base_Column_List" />,u.username_,u.phone_,o.name_ organ_name_ from luck_draw_log l
- left join luck_draw_prize d on l.prize_id_ = d.id_
- left join sys_user u on u.id_=l.user_id_
- left join organization o on o.id_ = u.organ_id_
- <include refid="queryCondition" />
- order by l.create_on_ desc
- <include refid="global.limit" />
- </select>
- </mapper>
|