TdCActivitySMapper.xml 4.06 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.zteits.pay.mapper.smapper.TdCActivitySMapper">
  <resultMap id="BaseResultMap" type="com.zteits.pay.domain.TdCActivity">
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="url" jdbcType="VARCHAR" property="url" />
    <result column="jump_url" jdbcType="VARCHAR" property="jumpUrl" />
    <result column="jump_type" jdbcType="INTEGER" property="jumpType" />
    <result column="jump_activity_name" jdbcType="VARCHAR" property="jumpActivityName" />
    <result column="activity_type" jdbcType="INTEGER" property="activityType" />
    <result column="remark" jdbcType="VARCHAR" property="remark" />
    <result column="is_login" jdbcType="INTEGER" property="isLogin" />
    <result column="data_state" jdbcType="INTEGER" property="dataState" />
    <result column="create_empid" jdbcType="VARCHAR" property="createEmpid" />
    <result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
    <result column="modfiy_empid" jdbcType="VARCHAR" property="modfiyEmpid" />
    <result column="modfiy_date" jdbcType="TIMESTAMP" property="modfiyDate" />
    <result column="org_id" jdbcType="BIGINT" property="orgId" />
    <result column="org_name" jdbcType="VARCHAR" property="orgName" />
    <result column="begin_time" jdbcType="TIMESTAMP" property="beginTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="activity_status" jdbcType="INTEGER" property="activityStatus" />
  </resultMap>
  <sql id="Base_Column_List">
     id, url, jump_url, jump_type, activity_type, jump_activity_name, remark, is_login,
    data_state, create_empid, create_date, modfiy_empid, modfiy_date, org_id, org_name,
    begin_time, end_time, activity_status
  </sql>
  <select id="selectAtcivityList" parameterType="com.zteits.clouds.api.dto.pay.param.QueryActivityByOrgIdRequest" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from td_c_activity
    where  data_state = 1 and activity_status = 1
    <if test="activityType != null">
      and activity_type = #{activityType,jdbcType=INTEGER}
    </if>
    <if test="activityTypeList != null and activityTypeList.size >0">
      and activity_type in
      <foreach collection="activityTypeList" item="activityType" open="(" close=")" separator=",">
        #{activityType}
      </foreach>
    </if>
    <if test="orgId != null">
      and org_id = #{orgId,jdbcType=BIGINT}
    </if>
    <if test="queryDate!=null">
      and begin_time &lt;= #{queryDate} and end_time &gt;= #{queryDate}
    </if>
	
  </select>
  <select id="queryTdCActivityForPage" parameterType="com.zteits.clouds.api.dto.pay.param.TdCActivityQueryRequest" resultMap="BaseResultMap">
 	select
 		<include refid="Base_Column_List" />
    from td_c_activity
    where  1 = 1
    
    <!-- 上架状态-->
    <if test="activityStatus != null ">
 	 	and activity_status = #{activityStatus}
 	 </if>
 	 
 	 
 	 <!-- 生效-->
	<if test="dataState != null and dataState == 1">
		and begin_time &lt;= sysdate()
		and end_time &gt;= #{nowDate}
		and data_state = 1
	</if>
	<!-- 未生效-->
	<if test="dataState != null and dataState == 0">
		and begin_time &gt; #{nowDate}
		and data_state = 1
	</if>
	<!-- 失效 -->
	<if test="dataState != null and dataState == 2">
		and (
		    end_time &lt; #{nowDate}
		 	or data_state = 0
		 )
	</if>
	    <!-- 跳转类型-->
 	  <if test="activityTypes != null and activityTypes.size >0">
      and activity_type in
      <foreach collection="activityTypes" item="activityType" open="(" close=")" separator=",">
        #{activityType}
      </foreach>
    </if>
    <!-- 类型  -->
 	  <if test="jumpTypes != null and jumpTypes.size >0">
      and jump_type in
      <foreach collection="jumpTypes" item="jumpType" open="(" close=")" separator=",">
        #{jumpType}
      </foreach>
    </if>
 	 <if test="orgId != null">
      and org_id = #{orgId,jdbcType=BIGINT}
    </if>
    order by create_date desc
</select>


</mapper>