zxl
80 分钟以前 1d418c5dfdc5316244795996ac722d6762b3541a
framework/src/main/resources/mapper/lmk/PrizeRecordMapper.xml
@@ -16,6 +16,8 @@
        <result column="prize_img" property="prizeImg" />
        <result column="prize_num_id" property="prizeNumId" />
        <result column="activity_prize_ref_id" property="activityPrizeRefId" />
        <result column="distribute_status" property="distributeStatus" />
        <result column="distribute_status" property="distributeStatus"/>
    </resultMap>
@@ -37,7 +39,8 @@
            LPR.prize_img,
            LPR.prize_num_id,
            LPR.activity_prize_ref_id,
            LPR.id
            LPR.id,
            LPR.distribute_status
        FROM
            lmk_prize_record LPR
        WHERE
@@ -58,11 +61,104 @@
            LPR.prize_img,
            LPR.prize_num_id,
            LPR.activity_prize_ref_id,
            LPR.distribute_status,
            LPR.create_time,
            LPR.id
        FROM
            lmk_prize_record LPR
        WHERE
            LPR.delete_flag = 0
        <if test="query.nickName != null and query.nickName !=''">
            AND LPR.nick_name like CONCAT('%',#{query.nickName},'%')
        </if>
        <if test="query.activityName != null and query.activityName !=''">
            AND LPR.prize_activity_name like CONCAT('%',#{query.activityName},'%')
        </if>
        <if test="query.prizeStatus != null and query.prizeStatus !=''">
            AND LPR.prize_status  = #{query.prizeStatus}
        </if>
        <if test="query.distributeStatus != null and query.distributeStatus !=''">
            AND LPR.distribute_status  = #{query.distributeStatus}
        </if>
        <if test="query.startTime != null">AND LPR.create_time >= #{query.startTime}</if>
        <if test="query.endTime != null">AND LPR.create_time &lt;= #{query.endTime}</if>
    </select>
    <select id="getByUserIdPage" resultMap="BaseResultMap">
        SELECT
        LPR.user_id,
        LPR.nick_name,
        LPR.prize_activity_id,
        LPR.prize_activity_name,
        LPR.prize_activity_cover,
        LPR.prize_status,
        LPR.prize_content,
        LPR.prize_id,
        LPR.prize_img,
        LPR.prize_num_id,
        LPR.activity_prize_ref_id,
        LPR.distribute_status,
        LPR.id,
        LPR.create_time
        FROM
        lmk_prize_record LPR
        WHERE
        LPR.delete_flag = 0
        AND LPR.user_id = #{userId}
    </select>
    <select id="getExportData" resultMap="BaseResultMap">
        SELECT
        LPR.user_id,
        LPR.nick_name,
        LPR.prize_activity_id,
        LPR.prize_activity_name,
        LPR.prize_activity_cover,
        LPR.prize_status,
        LPR.prize_content,
        LPR.prize_id,
        LPR.prize_img,
        LPR.prize_num_id,
        LPR.activity_prize_ref_id,
        LPR.distribute_status,
        LPR.create_time,
        LPR.id
        FROM
        lmk_prize_record LPR
        WHERE
        LPR.delete_flag = 0
        <if test="query.nickName != null and query.nickName !=''">
            AND LPR.nick_name like CONCAT('%',#{query.nickName},'%')
        </if>
        <if test="query.activityName != null and query.activityName !=''">
            AND LPR.prize_activity_name like CONCAT('%',#{query.activityName},'%')
        </if>
        <if test="query.prizeStatus != null and query.prizeStatus !=''">
            AND LPR.prize_status  = #{query.prizeStatus}
        </if>
        <if test="query.distributeStatus != null and query.distributeStatus !=''">
            AND LPR.distribute_status  = #{query.distributeStatus}
        </if>
        <if test="query.startTime != null">AND LPR.create_time >= #{query.startTime}</if>
        <if test="query.endTime != null">AND LPR.create_time &lt;= #{query.endTime}</if>
    </select>
    <resultMap id="getPrizeRecordListByTimeMap" type="cn.lili.modules.lmk.domain.vo.PrizeRecordTimeVO">
        <result property="activityPrizeRefId" column="activity_prize_ref_id"/>
        <result property="prizeActivityId" column="prize_activity_id"/>
        <result property="total" column="total"/>
    </resultMap>
    <select id="getPrizeRecordListByTime" resultMap="getPrizeRecordListByTimeMap">
        SELECT
            activity_prize_ref_id,
            prize_activity_id,
            count(*) total
        FROM
            lmk_prize_record
        WHERE
            prize_activity_id = #{query.recordActivityId}
          AND delete_flag = 0
          AND create_time BETWEEN #{query.startTime}
            AND #{query.endTime}
        GROUP BY
            activity_prize_ref_id,
            prize_activity_id;
    </select>
</mapper>