|
|
<?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.yoho.unions.dal.UnionShareMessageMapper" >
|
|
|
<resultMap id="BaseResultMap" type="com.yoho.unions.dal.model.UnionShareMessage" >
|
|
|
<id column="id" property="id" jdbcType="INTEGER" />
|
|
|
<result column="content" property="content" jdbcType="VARCHAR" />
|
|
|
<result column="image" property="image" jdbcType="VARCHAR" />
|
|
|
<result column="url" property="url" jdbcType="VARCHAR" />
|
|
|
<result column="priority" property="priority" jdbcType="INTEGER" />
|
|
|
<result column="start_time" property="startTime" jdbcType="INTEGER" />
|
|
|
<result column="end_time" property="endTime" jdbcType="INTEGER" />
|
|
|
<result column="create_time" property="createTime" jdbcType="INTEGER" />
|
|
|
<result column="update_time" property="updateTime" jdbcType="INTEGER" />
|
|
|
</resultMap>
|
|
|
<sql id="Base_Column_List" >
|
|
|
id, content, image, url, priority, start_time, end_time,
|
|
|
create_time, update_time
|
|
|
</sql>
|
|
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Integer" >
|
|
|
select
|
|
|
<include refid="Base_Column_List" />
|
|
|
from union_share_message
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</select>
|
|
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Integer" >
|
|
|
delete from union_share_message
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</delete>
|
|
|
<insert id="insert" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
|
|
|
insert into union_share_message (content, image, url, priority, start_time, end_time,
|
|
|
create_time, update_time)
|
|
|
values (#{content,jdbcType=VARCHAR}, #{image,jdbcType=VARCHAR}, #{url,jdbcType=VARCHAR}, #{priority,jdbcType=INTEGER},
|
|
|
#{startTime,jdbcType=INTEGER}, #{endTime,jdbcType=INTEGER}, #{createTime,jdbcType=INTEGER},
|
|
|
#{updateTime,jdbcType=INTEGER}
|
|
|
)
|
|
|
</insert>
|
|
|
|
|
|
<update id="updateByPrimaryKeySelective" parameterType="com.yoho.unions.dal.model.UnionShareMessage" >
|
|
|
update union_share_message
|
|
|
<set >
|
|
|
<if test="content != null" >
|
|
|
content = #{content,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="image != null" >
|
|
|
image = #{image,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="url != null" >
|
|
|
url = #{url,jdbcType=VARCHAR},
|
|
|
</if>
|
|
|
<if test="priority != null" >
|
|
|
priority = #{priority,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="startTime != null" >
|
|
|
start_time = #{startTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="endTime != null" >
|
|
|
end_time = #{endTime,jdbcType=INTEGER},
|
|
|
</if>
|
|
|
<if test="updateTime != null" >
|
|
|
update_time = #{updateTime,jdbcType=DECIMAL},
|
|
|
</if>
|
|
|
</set>
|
|
|
where id = #{id,jdbcType=INTEGER}
|
|
|
</update>
|
|
|
|
|
|
<sql id="Query_Message_Sql" >
|
|
|
<if test="startTime != null">
|
|
|
and start_time >= #{startTime}
|
|
|
</if>
|
|
|
<if test="endTime != null">
|
|
|
and end_time <= #{endTime}
|
|
|
</if>
|
|
|
<if test="isEffective != null and isEffective==true">
|
|
|
and start_time <= UNIX_TIMESTAMP() and end_time >=UNIX_TIMESTAMP()
|
|
|
</if>
|
|
|
</sql>
|
|
|
|
|
|
<select id="selectTotalByCondition" resultType="java.lang.Integer"
|
|
|
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
|
|
|
select count(id)
|
|
|
from union_share_message
|
|
|
where 1=1
|
|
|
<include refid="Query_Message_Sql" />
|
|
|
</select>
|
|
|
|
|
|
<select id="selectByCondition" resultMap="BaseResultMap"
|
|
|
parameterType="com.yoho.service.model.union.request.UnionShareMessageReqBO">
|
|
|
select <include refid="Base_Column_List" />
|
|
|
from union_share_message
|
|
|
where 1=1
|
|
|
<include refid="Query_Message_Sql" />
|
|
|
order by priority desc, update_time desc
|
|
|
<if test="start!=null and size != null">
|
|
|
limit #{start},#{size}
|
|
|
</if>
|
|
|
</select>
|
|
|
|
|
|
</mapper> |
|
|
\ No newline at end of file |
...
|
...
|
|