<?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="MdeActivityCategoryMapper" >
  <resultMap id="BaseResultMap" type="com.wechat.model.dbEntity.MdeActivityCategory" >
    <id column="ACT_ID" property="actId" jdbcType="INTEGER" />
    <result column="ACT_TITLE" property="actTitle" jdbcType="VARCHAR" />
    <result column="ACT_INTRODUCTION_CN" property="actIntroductionCn" jdbcType="VARCHAR" />
    <result column="ACT_INTRODUCTION_EN" property="actIntroductionEn" jdbcType="VARCHAR" />
    <result column="ACT_RULE_CN" property="actRuleCn" jdbcType="VARCHAR" />
    <result column="ACT_RULE_EN" property="actRuleEn" jdbcType="VARCHAR" />
    <result column="START_TIME" property="startTime" jdbcType="TIMESTAMP" />
    <result column="STOP_TIME" property="stopTime" jdbcType="TIMESTAMP" />
    <result column="VERSION_NO" property="versionNo" jdbcType="INTEGER" />
    <result column="REMARKS" property="remarks" jdbcType="VARCHAR" />
    <result column="DEL_FLAG" property="delFlag" jdbcType="INTEGER" />
    <result column="CREATE_BY" property="createBy" jdbcType="VARCHAR" />
    <result column="CREATE_DATE" property="createDate" jdbcType="TIMESTAMP" />
    <result column="UPDATE_BY" property="updateBy" jdbcType="VARCHAR" />
    <result column="UPDATE_DATE" property="updateDate" jdbcType="TIMESTAMP" />
  </resultMap>
  <sql id="Base_Column_List" >
    ACT_ID, ACT_TITLE, ACT_INTRODUCTION_CN, ACT_INTRODUCTION_EN, ACT_RULE_CN, ACT_RULE_EN, 
    START_TIME, STOP_TIME, VERSION_NO, REMARKS, DEL_FLAG, CREATE_BY, CREATE_DATE, UPDATE_BY, 
    UPDATE_DATE
  </sql>
  
  <select id="getActivityInfo" resultType="com.wechat.model.dto.ActivityInfoDto"  >
    select 
    	STOP_TIME as stopTime,
   		ACT_INTRODUCTION_CN as actIntroductionCn, 
   		ACT_INTRODUCTION_EN as actIntroductionEn, 
   		ACT_RULE_CN as actRuleCn, 
   		ACT_RULE_EN as actRuleEn
    from mde_activity_category
    where ACT_ID = #{actId}
     and DEL_FLAG = 0
  </select>
  
  <select id="getActIds" resultType="java.lang.String"  >
    <![CDATA[ 
	    select 
	    	ACT_ID as actId
	    from mde_activity_category
	    where START_TIME <= NOW()
	     and  STOP_TIME > NOW()
	     and DEL_FLAG = 0
	     order by START_TIME desc
	 ]]>
  </select>
  

  <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
    select 
    <include refid="Base_Column_List" />
    from mde_activity_category
    where ACT_ID = #{actId,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
    delete from mde_activity_category
    where ACT_ID = #{actId,jdbcType=INTEGER}
  </delete>
  
  
</mapper>