<?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.yeshi.fanli.dao.mybatis.homemodule.FloatADMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
|
<id column="fa_id" property="id" jdbcType="BIGINT" />
|
<result column="fa_name" property="name" jdbcType="VARCHAR" />
|
<result column="fa_picture" property="picture" jdbcType="VARCHAR" />
|
<result column="fa_show_mode" property="showMode" jdbcType="VARCHAR" />
|
<result column="fa_params" property="params" jdbcType="VARCHAR" />
|
<result column="fa_jump_need_login" property="jumpNeedLogin"
|
jdbcType="VARCHAR" />
|
<result column="fa_start_time" property="startTime" jdbcType="TIMESTAMP" />
|
<result column="fa_end_time" property="endTime" jdbcType="TIMESTAMP" />
|
<result column="fa_position" property="position" jdbcType="VARCHAR" />
|
<result column="fa_order" property="order" jdbcType="INTEGER" />
|
<result column="fa_type" property="type" jdbcType="INTEGER" />
|
<result column="fa_state" property="state" jdbcType="INTEGER" />
|
<result column="fa_create_time" property="createTime" jdbcType="TIMESTAMP" />
|
<result column="fa_update_time" property="updateTime" jdbcType="TIMESTAMP" />
|
<result column="fa_play_sound" property="playSound" jdbcType="BOOLEAN" />
|
<result column="fa_type_enum" property="typeEnum" typeHandler="com.yeshi.fanli.util.mybatishandler.FloatADTypeEnumHandler"/>
|
<association property="jumpDetail" column="fa_jumpid"
|
javaType="com.yeshi.fanli.entity.common.JumpDetailV2">
|
<id column="fa_jumpid" property="id" jdbcType="BIGINT" />
|
</association>
|
|
</resultMap>
|
<sql id="Base_Column_List">fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_play_sound,fa_type_enum
|
</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap"
|
parameterType="java.lang.Long">
|
select
|
<include refid="Base_Column_List" />
|
from yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
|
yeshi_ec_float_ad where fa_id = #{id,jdbcType=BIGINT}
|
</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD"
|
useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_float_ad
|
(fa_id,fa_name,fa_picture,fa_show_mode,fa_jumpid,fa_params,fa_jump_need_login,fa_start_time,fa_end_time,fa_position,fa_order,fa_type,fa_state,fa_create_time,fa_update_time,fa_play_sound,fa_type_enum)
|
values
|
(#{id,jdbcType=BIGINT},#{name,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{showMode,jdbcType=VARCHAR},#{jumpDetail.id,jdbcType=BIGINT},#{params,jdbcType=VARCHAR},#{jumpNeedLogin,jdbcType=VARCHAR},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{position,jdbcType=VARCHAR},#{order,jdbcType=INTEGER},#{type,jdbcType=INTEGER},#{state,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{playSound,jdbcType=BOOLEAN},#{typeEnum,jdbcType=VARCHAR})
|
</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD"
|
useGeneratedKeys="true" keyProperty="id">
|
insert into yeshi_ec_float_ad
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">fa_id,</if>
|
<if test="name != null">fa_name,</if>
|
<if test="picture != null">fa_picture,</if>
|
<if test="showMode != null">fa_show_mode,</if>
|
<if test="jumpDetail != null">fa_jumpid,</if>
|
<if test="params != null">fa_params,</if>
|
<if test="jumpNeedLogin != null">fa_jump_need_login,</if>
|
<if test="startTime != null">fa_start_time,</if>
|
<if test="endTime != null">fa_end_time,</if>
|
<if test="position != null">fa_position,</if>
|
<if test="order != null">fa_order,</if>
|
<if test="type != null">fa_type,</if>
|
<if test="state != null">fa_state,</if>
|
<if test="createTime != null">fa_create_time,</if>
|
<if test="updateTime != null">fa_update_time,</if>
|
<if test="playSound != null">fa_play_sound,</if>
|
<if test="typeEnum != null">fa_type_enum,</if>
|
</trim>
|
values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="name != null">#{name,jdbcType=VARCHAR},</if>
|
<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
<if test="showMode != null">#{showMode,jdbcType=VARCHAR},</if>
|
<if test="jumpDetail != null">#{jumpDetail.id,jdbcType=BIGINT},</if>
|
<if test="params != null">#{params,jdbcType=VARCHAR},</if>
|
<if test="jumpNeedLogin != null">#{jumpNeedLogin,jdbcType=VARCHAR},</if>
|
<if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="position != null">#{position,jdbcType=VARCHAR},</if>
|
<if test="order != null">#{order,jdbcType=INTEGER},</if>
|
<if test="type != null">#{type,jdbcType=INTEGER},</if>
|
<if test="state != null">#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="playSound != null">#{playSound,jdbcType=BOOLEAN},</if>
|
<if test="typeEnum != null">#{typeEnum,jdbcType=VARCHAR}</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">update
|
yeshi_ec_float_ad set fa_name = #{name,jdbcType=VARCHAR},fa_picture =
|
#{picture,jdbcType=VARCHAR},fa_show_mode =
|
#{showMode,jdbcType=VARCHAR},fa_jumpid =
|
#{jumpDetail.id,jdbcType=BIGINT},fa_params =
|
#{params,jdbcType=VARCHAR},fa_jump_need_login =
|
#{jumpNeedLogin,jdbcType=VARCHAR},fa_start_time =
|
#{startTime,jdbcType=TIMESTAMP},fa_end_time =
|
#{endTime,jdbcType=TIMESTAMP},fa_position =
|
#{position,jdbcType=VARCHAR},fa_order =
|
#{order,jdbcType=INTEGER},fa_type = #{type,jdbcType=INTEGER},fa_state
|
= #{state,jdbcType=INTEGER},fa_create_time =
|
#{createTime,jdbcType=TIMESTAMP},fa_update_time =
|
#{updateTime,jdbcType=TIMESTAMP} ,fa_play_sound
|
=#{playSound,jdbcType=BOOLEAN},fa_type_enum
|
=#{typeEnum,jdbcType=VARCHAR} where fa_id = #{id,jdbcType=BIGINT}
|
</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.homemodule.FloatAD">
|
update yeshi_ec_float_ad
|
<set>
|
<if test="name != null">fa_name=#{name,jdbcType=VARCHAR},</if>
|
<if test="picture != null">fa_picture=#{picture,jdbcType=VARCHAR},</if>
|
<if test="showMode != null">fa_show_mode=#{showMode,jdbcType=VARCHAR},</if>
|
<if test="jumpDetail != null">fa_jumpid=#{jumpDetail.id,jdbcType=BIGINT},</if>
|
<if test="params != null">fa_params=#{params,jdbcType=VARCHAR},</if>
|
<if test="jumpNeedLogin != null">fa_jump_need_login=#{jumpNeedLogin,jdbcType=VARCHAR},
|
</if>
|
<if test="startTime != null">fa_start_time=#{startTime,jdbcType=TIMESTAMP},</if>
|
<if test="endTime != null">fa_end_time=#{endTime,jdbcType=TIMESTAMP},</if>
|
<if test="position != null">fa_position=#{position,jdbcType=VARCHAR},</if>
|
<if test="order != null">fa_order=#{order,jdbcType=INTEGER},</if>
|
<if test="type != null">fa_type=#{type,jdbcType=INTEGER},</if>
|
<if test="state != null">fa_state=#{state,jdbcType=INTEGER},</if>
|
<if test="createTime != null">fa_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">fa_update_time=#{updateTime,jdbcType=TIMESTAMP},</if>
|
<if test="playSound !=null">fa_play_sound =#{playSound,jdbcType=BOOLEAN},</if>
|
<if test="typeEnum !=null">fa_type_enum =#{typeEnum,jdbcType=VARCHAR},</if>
|
</set>
|
where fa_id = #{id,jdbcType=BIGINT}
|
</update>
|
<delete id="deleteByPrimaryKeyList" parameterType="java.util.List">
|
delete from yeshi_ec_float_ad WHERE fa_id in
|
<foreach collection="list" item="item" open="(" separator=","
|
close=")">#{item}</foreach>
|
</delete>
|
<select id="listQuery" resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_float_ad fd WHERE 1=1
|
<if test="key != null and key !='' ">AND fd.`fa_name` LIKE '%${key}%'</if>
|
<if test="state != null">AND fd.`fa_state` = #{state}</if>
|
ORDER BY fd.`fa_position`,fd.`fa_order` LIMIT ${start},${count}
|
</select>
|
<select id="countQuery" resultType="java.lang.Long">
|
SELECT IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd WHERE 1=1
|
<if test="key != null and key !='' ">AND fd.`fa_name` LIKE '%${key}%'</if>
|
<if test="state != null">AND fd.`fa_state` = #{state}</if>
|
</select>
|
<select id="getMaxOrderByPosition" resultType="java.lang.Integer">SELECT
|
IFNULL(MAX(fa_order),0) FROM yeshi_ec_float_ad WHERE fa_position =
|
#{position}
|
</select>
|
<select id="getByAdjoinOrder" resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position}
|
<if test="type == -1">AND
|
fd.`fa_order` <![CDATA[<]]>
|
#{order} ORDER BY fd.`fa_order` desc
|
</if>
|
<if test="type == 1">AND
|
fd.`fa_order` <![CDATA[>]]>
|
#{order} ORDER BY fd.`fa_order`
|
</if>
|
LIMIT 1
|
</select>
|
<select id="countByPosition" resultType="java.lang.Integer">SELECT
|
IFNULL(COUNT(fd.`fa_id`),0) FROM yeshi_ec_float_ad fd WHERE
|
fd.`fa_position` = #{position}
|
</select>
|
<select id="ListByPrimaryKey" parameterType="java.util.List"
|
resultMap="BaseResultMap">
|
SELECT
|
<include refid="Base_Column_List" />
|
FROM yeshi_ec_float_ad WHERE fa_id in
|
<foreach collection="list" item="item" open="(" separator=","
|
close=")">#{item}</foreach>
|
</select>
|
<select id="getEffectiveFloatAD" resultMap="BaseResultMap">SELECT
|
* FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position} AND
|
fd.`fa_state` = 1 AND IF(fd.`fa_start_time` IS
|
NULL,TRUE,fd.`fa_start_time`<![CDATA[<=]]>
|
NOW()) AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]>
|
NOW())
|
<if test="type != null">AND fa_type = #{type}</if>
|
ORDER BY fd.`fa_order` LIMIT 1
|
</select>
|
<select id="getValidFloatAD" resultMap="BaseResultMap">SELECT
|
* FROM yeshi_ec_float_ad fd WHERE fd.`fa_position` = #{position} AND
|
fd.`fa_state` = 1 AND IF(fd.`fa_start_time` IS
|
NULL,TRUE,fd.`fa_start_time`<![CDATA[<=]]>
|
NOW()) AND IF(fd.`fa_end_time` IS NULL,TRUE,fd.`fa_end_time` <![CDATA[>=]]>
|
NOW())
|
<if test="type != null">AND fa_type = #{type}</if>
|
ORDER BY fd.`fa_order`
|
</select>
|
</mapper>
|