|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- <?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="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" />
- <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_type" jdbcType="INTEGER" property="activityType"/>
- <result column="signup_examine" jdbcType="INTEGER" property="signupExamine"/>
- <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"/>
- <result column="selectques" jdbcType="VARCHAR" property="selectques"/>
-
- </resultMap>
-
- <sql id="allColumns">
- `id`,`tenant_id`,`parent_tenant_id`,`cover_img`,`title`,`sub_title`,`detail`,`html`,`activity_type`,`signup_examine`,`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`,`selectques`
- </sql>
-
- <sql id="dynamicWhereConditions">
- where `is_del` = 0
-
- <if test=" null != id ">
- and `id` = #{id}
-
- </if>
- <if test=" null != tenantId and '' != tenantId">
- and `tenant_id` = #{tenantId}
- </if>
- <if test=" null != parentTenantId and '' != parentTenantId">
- and `parent_tenant_id` = #{parentTenantId}
- </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 != activityType ">
- and `activity_type` = #{activityType}
- </if>
- <if test=" null != signupExamine ">
- and `signup_examine` = #{signupExamine}
- </if>
-
- <if test=" null != status and status lt 3">
- and `status` = #{status}
- </if>
-
- <if test=" null != status and status == 3">
- and `status` >= 2 and `status` <= 3
- </if>
-
- <if test=" null != status and status == 4">
- and `status` > 0
- </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 != startDate and null != endDate ">-->
- <!-- and `create_time` between #{starttime} and #{endtime}-->
- <!-- </if>-->
-
- <if test=" null != startDate and null != endDate ">
- and not(`activity_end_time` < #{startDate, jdbcType=TIMESTAMP} or `activity_start_time` > #{endDate, jdbcType=TIMESTAMP})
- <!-- and ((`activity_start_time` >= #{startDate} and `activity_start_time` <= #{endDate})
- or (`activity_end_time` >= #{startDate} and `activity_end_time` <= #{endDate})
- or (`activity_start_time` <= #{startDate} and `activity_end_time` >= #{endDate}))-->
- </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 > 0 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>
-
- <delete id="deleteById" parameterType="Long">
- update wx_activity set is_del = 1, update_time=now() where id = #{id}
- </delete>
-
-
- </mapper>
|