ActivityMapper.xml 1.89 KB
<?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.yohoufo.dal.promotion.IActivityMapper">
    <resultMap id="BaseResultMap" type="com.yohoufo.dal.promotion.model.Activity">
        <id column="id" jdbcType="INTEGER" property="id" />
        <result column="activity_name" property="activityName"  jdbcType="VARCHAR"/>
        <result column="label" property="label"  jdbcType="VARCHAR"/>
        <result column="start_time" property="startTime"  jdbcType="INTEGER"/>
        <result column="end_time" property="endTime"  jdbcType="INTEGER"/>
        <result column="promotion_type" property="promotionType"  jdbcType="INTEGER"/>
        <result column="product_limit_type" property="productLimitType"  jdbcType="VARCHAR"/>
        <result column="join_limit_type" property="joinLimitType"  jdbcType="INTEGER"/>
        <result column="join_limit_times" property="joinLimitTimes"  jdbcType="INTEGER"/>
        <result column="status" property="status"  jdbcType="INTEGER"/>
        <result column="create_time" property="createTime"  jdbcType="INTEGER"/>
        <result column="update_time" property="updateTime"  jdbcType="INTEGER"/>
        <result column="business_client" property="businessClient"  jdbcType="VARCHAR"/>
    </resultMap>

    <sql id="Base_Column_List" >
        id, activity_name, label, start_time, end_time, promotion_type, product_limit_type,
        join_limit_type, join_limit_times, status, create_time, update_time, business_client
    </sql>

    <select id="selectRunningActivity" parameterType="java.lang.Integer" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"/> from promotion_activity
        where status = 1
        and #{currentTime, jdbcType=INTEGER} between start_time and end_time
        order by id desc
        limit 50
    </select>

</mapper>