|
- <?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.iformall.mapper.WxActivityMapper">
- <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxActivity">
- <id column="id" jdbcType="BIGINT" property="id"/>
- <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/>
- <result column="cover_img" jdbcType="VARCHAR" property="coverImg"/>
- <result column="title" jdbcType="VARCHAR" property="title"/>
- <result column="sub_title" jdbcType="VARCHAR" property="subTitle"/>
- <result column="detail" jdbcType="VARCHAR" property="detail"/>
- <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
- <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
- <result column="type" jdbcType="INTEGER" property="type"/>
- <result column="status" jdbcType="INTEGER" property="status"/>
- <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
- <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
- <result column="html" jdbcType="VARCHAR" property="html"/>
- <result column="person_limit" jdbcType="INTEGER" property="personLimit"/>
- <result column="activity_start_time" jdbcType="TIMESTAMP" property="activityStartTime"/>
- <result column="activity_end_time" jdbcType="TIMESTAMP" property="activityEndTime"/>
- <result column="use_credit" jdbcType="INTEGER" property="useCredit"/>
- <result column="credit" jdbcType="INTEGER" property="credit"/>
- <result column="question" jdbcType="VARCHAR" property="question"/>
- <result column="is_expired" jdbcType="INTEGER" property="isExpired"/>
- <result column="use_img" jdbcType="INTEGER" property="useImg"/>
- <result column="img_detail" jdbcType="VARCHAR" property="imgDetail"/>
- <result column="send_msg" jdbcType="INTEGER" property="sendMsg"/>
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`person_limit`,`activity_start_time`,`activity_end_time`,
- `use_credit`,`credit`,`type`,`status`,`start_time`,`end_time`,`question`,`is_expired`,`create_time`,`update_time`,`use_img`,
- `img_detail`,`send_msg`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where 1 = 1
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
- <if test=" null != tenantId ">
- and `tenant_id` = #{tenantId}
- </if>
-
- <if test=" null != title ">
- and `title` like concat('%', #{title},'%')
- </if>
-
- <if test=" null != subTitle ">
- and `sub_title` like concat('%', #{subTitle},'%')
- </if>
-
- <if test=" null != detail ">
- and `detail` like concat('%', #{detail},'%')
- </if>
-
- <if test=" null != type ">
- and `type` = #{type}
- </if>
-
- <if test=" null != status ">
- and `status` = #{status}
- </if>
-
- <if test=" null != createTime ">
- and `create_time` = #{createTime}
- </if>
-
- <if test=" null != updateTime ">
- and `update_time` = #{updateTime}
- </if>
-
- <if test=" null != useCredit ">
- and `use_credit` = #{useCredit}
- </if>
- <if test=" null != isExpired ">
- and `is_expired` = #{isExpired}
- </if>
-
- <if test=" null != starttime and null!=endtime ">
- and `create_time` between #{starttime} and #{endtime}
- </if>
-
- <if test=" null != sendMsg ">
- and `send_msg` = #{sendMsg}
- </if>
-
- <if test=" null != ids ">
- and id in
- <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")">
- #{idItem}
- </foreach>
- </if>
- <if test=" null != sortColumns">order by ${sortColumns}</if>
- </sql>
-
- <select id="findList" parameterType="com.iformall.domain.po.WxActivity" resultMap="BaseResultMap">
- select
- <include refid="allColumns"/>
- from wx_activity
- <include refid="dynamicWhereConditions"/>
- </select>
-
-
- <select id="queryNotify" parameterType="com.iformall.domain.po.WxActivity"
- resultType="com.iformall.domain.po.WxActivity">
- select id,title,activity_start_time,tenant_id from wx_activity
- where status=${status}
- and DATEDIFF(activity_start_time,now())=3
- </select>
-
- <update id="activityExipred" parameterType="com.iformall.domain.po.WxActivity">
- update wx_activity set is_expired=${isExpired},update_time=#{updateTime} where status=${status} and now()>end_time
- </update>
-
- <update id="activityCompletion" parameterType="com.iformall.domain.po.WxActivity">
- update wx_activity set status=#{status},update_time=#{updateTime} where status!=${status} and now()>activity_end_time
- </update>
-
-
- </mapper>
|