<?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.panzhihua.service_community.dao.ComActRaffleRecordDao">
|
|
<resultMap type="com.panzhihua.service_community.entity.ComActRaffleRecord" id="ComActRaffleRecordBaseResultMap">
|
<result property="id" column="id"/>
|
<result property="userId" column="user_id"/>
|
<result property="createTime" column="create_time"/>
|
<result property="prizeId" column="prize_id"/>
|
<result property="staffId" column="staff_id"/>
|
<result property="staffTime" column="staff_time"/>
|
<result property="status" column="status"/>
|
</resultMap>
|
|
<select id="selectByUserId" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO">
|
select t.*, t1.image, t1.name as prizeName, t2.nick_name, t2.phone, t2.`name` as username, t3.name as staffName
|
from com_act_raffle_record t
|
left join com_act_raffle_prize t1 on t.prize_id = t1.id
|
left join sys_user t2 on t.user_id = t2.user_id
|
left join sys_user t3 on t.staff_id = t3.user_id
|
where 1=1 <if test="userId !=null and userId !=0"> and t.user_id = #{userId} </if>
|
and t.raffle_id = #{raffleId}
|
</select>
|
|
<select id="pageList" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO">
|
select t.*, t1.image, t1.name as prizeName, t2.nick_name, t2.phone, t2.`name` as username, t3.name as staffName,t4.raffle_start_time as raffleStartTime,t4.raffle_stop_time as raffleStopTime
|
from com_act_raffle_record t
|
left join com_act_raffle_prize t1 on t.prize_id = t1.id
|
left join sys_user t2 on t.user_id = t2.user_id
|
left join sys_user t3 on t.staff_id = t3.user_id
|
left join com_act_raffle t4 on t.raffle_id = t4.id
|
<where>
|
t.status >0
|
<if test="commonPage.status!=null">
|
and t.status = #{commonPage.status}
|
</if>
|
<if test="commonPage.keyword!=null and commonPage.keyword!=''">
|
and (t2.name like concat('%',#{commonPage.keyword},'%') or t2.phone like
|
concat('%',#{commonPage.keyword},'%') or t1.name like concat('%',#{commonPage.keyword},'%') )
|
</if>
|
<if test="commonPage.paramId !=null">
|
and t.raffle_id = #{commonPage.paramId}
|
</if>
|
<if test="commonPage.userId !=null">
|
and t.user_id = #{commonPage.userId}
|
</if>
|
<if test="commonPage.paramId2 !=null">
|
and t.staff_id = #{commonPage.paramId2}
|
</if>
|
</where>
|
order by t.create_time desc
|
</select>
|
|
<select id="export" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordExcelVO">
|
select t.*, t1.image as imageUrl, t1.name as prizeName, t2.nick_name, t2.phone, t2.`name` as username, t3.name as staffName
|
from com_act_raffle_record t
|
left join com_act_raffle_prize t1 on t.prize_id = t1.id
|
left join sys_user t2 on t.user_id = t2.user_id
|
left join sys_user t3 on t.staff_id = t3.user_id
|
<where>
|
<if test="commonPage.status!=null">
|
and t.status = #{commonPage.status}
|
</if>
|
<if test="commonPage.keyword!=null and commonPage.keyword!=''">
|
and (t2.name like concat('%',#{commonPage.keyword},'%') or t2.phone like
|
concat('%',#{commonPage.keyword},'%') or t1.name like concat('%',#{commonPage.keyword},'%') )
|
</if>
|
<if test="commonPage.paramId !=null">
|
and t.raffle_id = #{commonPage.paramId}
|
</if>
|
<if test="commonPage.userId !=null">
|
and t.user_id = #{commonPage.userId}
|
</if>
|
</where>
|
order by t.create_time desc
|
</select>
|
|
<select id="selectOneById" resultType="com.panzhihua.common.model.vos.community.raffle.ComActRaffleRecordVO">
|
select t.*, t1.`name` as prizeName, t1.image,t2.phone, t2.`name` as username, t3.name as staffName
|
from com_act_raffle_record t
|
LEFT JOIN com_act_raffle_prize t1 on t.prize_id = t1.id
|
left join sys_user t2 on t.user_id = t2.user_id
|
left join sys_user t3 on t.staff_id = t3.user_id
|
where t.id=#{id}
|
</select>
|
|
<update id="updateStatusByRaffleId">
|
update com_act_raffle_record set status = 3 where raffle_id = #{id} and status = 1
|
</update>
|
</mapper>
|