<?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.push.PushGoodsMapper">
|
<resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.PushGoods">
|
<id column="pg_id" property="id" jdbcType="BIGINT"/>
|
<result column="pg_alert_title" property="alertTitle" jdbcType="VARCHAR"/>
|
<result column="pg_alert_content" property="alertContent" jdbcType="VARCHAR"/>
|
<result column="pg_title" property="title" jdbcType="VARCHAR"/>
|
<result column="pg_content" property="content" jdbcType="VARCHAR"/>
|
<result column="pg_picture" property="picture" jdbcType="VARCHAR"/>
|
<result column="pg_uid" property="uid" jdbcType="BIGINT"/>
|
<result column="pg_versions" property="versions" jdbcType="VARCHAR"/>
|
<result column="pg_remark" property="remark" jdbcType="VARCHAR"/>
|
<result column="pg_is_push" property="isPush" jdbcType="INTEGER"/>
|
<result column="pg_control_time" property="controlTime" jdbcType="TIMESTAMP"/>
|
<result column="pg_push_time" property="pushTime" jdbcType="TIMESTAMP"/>
|
<result column="pg_createtime" property="createTime" jdbcType="TIMESTAMP"/>
|
<result column="pg_updatetime" property="updateTime" jdbcType="TIMESTAMP"/>
|
</resultMap>
|
<sql id="Base_Column_List">pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_remark,pg_is_push,pg_control_time,pg_push_time,pg_createtime,pg_updatetime</sql>
|
<select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long">select
|
<include refid="Base_Column_List"/>from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT}
|
</select>
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_push_goods where pg_id = #{id,jdbcType=BIGINT}</delete>
|
<insert id="insert" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods (pg_id,pg_alert_title,pg_alert_content,pg_title,pg_content,pg_picture,pg_uid,pg_versions,pg_remark,pg_is_push,pg_control_time,pg_push_time,pg_createtime,pg_updatetime) values (#{id,jdbcType=BIGINT},#{alertTitle,jdbcType=VARCHAR},#{alertContent,jdbcType=VARCHAR},#{title,jdbcType=VARCHAR},#{content,jdbcType=VARCHAR},#{picture,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{versions,jdbcType=VARCHAR},#{remark,jdbcType=VARCHAR},#{isPush,jdbcType=INTEGER},#{controlTime,jdbcType=TIMESTAMP},#{pushTime,jdbcType=TIMESTAMP},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP})</insert>
|
<insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.PushGoods" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_push_goods
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">pg_id,</if>
|
<if test="alertTitle != null">pg_alert_title,</if>
|
<if test="alertContent != null">pg_alert_content,</if>
|
<if test="title != null">pg_title,</if>
|
<if test="content != null">pg_content,</if>
|
<if test="picture != null">pg_picture,</if>
|
<if test="uid != null">pg_uid,</if>
|
<if test="versions != null">pg_versions,</if>
|
<if test="remark != null">pg_remark,</if>
|
<if test="isPush != null">pg_is_push,</if>
|
<if test="controlTime != null">pg_control_time,</if>
|
<if test="pushTime != null">pg_push_time,</if>
|
<if test="createTime != null">pg_createtime,</if>
|
<if test="updateTime != null">pg_updatetime,</if>
|
</trim>values
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
<if test="id != null">#{id,jdbcType=BIGINT},</if>
|
<if test="alertTitle != null">#{alertTitle,jdbcType=VARCHAR},</if>
|
<if test="alertContent != null">#{alertContent,jdbcType=VARCHAR},</if>
|
<if test="title != null">#{title,jdbcType=VARCHAR},</if>
|
<if test="content != null">#{content,jdbcType=VARCHAR},</if>
|
<if test="picture != null">#{picture,jdbcType=VARCHAR},</if>
|
<if test="uid != null">#{uid,jdbcType=BIGINT},</if>
|
<if test="versions != null">#{versions,jdbcType=VARCHAR},</if>
|
<if test="remark != null">#{remark,jdbcType=VARCHAR},</if>
|
<if test="isPush != null">#{isPush,jdbcType=INTEGER},</if>
|
<if test="controlTime != null">#{controlTime,jdbcType=TIMESTAMP},</if>
|
<if test="pushTime != null">#{pushTime,jdbcType=TIMESTAMP},</if>
|
<if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
|
</trim>
|
</insert>
|
<update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods set pg_alert_title = #{alertTitle,jdbcType=VARCHAR},pg_alert_content = #{alertContent,jdbcType=VARCHAR},pg_title = #{title,jdbcType=VARCHAR},pg_content = #{content,jdbcType=VARCHAR},pg_picture = #{picture,jdbcType=VARCHAR},pg_uid = #{uid,jdbcType=BIGINT},pg_versions = #{versions,jdbcType=VARCHAR},pg_remark = #{remark,jdbcType=VARCHAR},pg_is_push = #{isPush,jdbcType=INTEGER},pg_control_time = #{controlTime,jdbcType=TIMESTAMP},pg_push_time = #{pushTime,jdbcType=TIMESTAMP},pg_createtime = #{createTime,jdbcType=TIMESTAMP},pg_updatetime = #{updateTime,jdbcType=TIMESTAMP} where pg_id = #{id,jdbcType=BIGINT}</update>
|
<update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.PushGoods">update yeshi_ec_push_goods
|
<set>
|
<if test="alertTitle != null">pg_alert_title=#{alertTitle,jdbcType=VARCHAR},</if>
|
<if test="alertContent != null">pg_alert_content=#{alertContent,jdbcType=VARCHAR},</if>
|
<if test="title != null">pg_title=#{title,jdbcType=VARCHAR},</if>
|
<if test="content != null">pg_content=#{content,jdbcType=VARCHAR},</if>
|
<if test="picture != null">pg_picture=#{picture,jdbcType=VARCHAR},</if>
|
<if test="uid != null">pg_uid=#{uid,jdbcType=BIGINT},</if>
|
<if test="versions != null">pg_versions=#{versions,jdbcType=VARCHAR},</if>
|
<if test="remark != null">pg_remark=#{remark,jdbcType=VARCHAR},</if>
|
<if test="isPush != null">pg_is_push=#{isPush,jdbcType=INTEGER},</if>
|
<if test="controlTime != null">pg_control_time=#{controlTime,jdbcType=TIMESTAMP},</if>
|
<if test="pushTime != null">pg_push_time=#{pushTime,jdbcType=TIMESTAMP},</if>
|
<if test="createTime != null">pg_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
|
<if test="updateTime != null">pg_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
|
</set> where pg_id = #{id,jdbcType=BIGINT}
|
</update>
|
<delete id="deleteBatchByPrimaryKey" parameterType="java.util.List">
|
delete from yeshi_ec_push_goods where pg_id in
|
<foreach item="item" collection="list" open="(" separator=","
|
close=")">#{item}</foreach>
|
</delete>
|
|
<select id="listQuery" resultMap="BaseResultMap">
|
SELECT <include refid="Base_Column_List" />,IF(`pg_control_time` IS NOT NULL,pg_control_time,`pg_createtime`) AS orderyTime FROM yeshi_ec_push_goods
|
WHERE 1=1
|
<if test='key != null and key != ""'>
|
AND (pg_alert_title like '%${key}%' or pg_alert_content like '%${key}%')
|
</if>
|
<if test='state != null'>
|
AND pg_is_push = #{state}
|
</if>
|
ORDER BY orderyTime DESC
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countQuery" resultType="java.lang.Long">
|
SELECT IFNULL(count(pg_id),0) FROM yeshi_ec_push_goods
|
WHERE 1=1
|
<if test='key != null and key != ""'>
|
AND (pg_alert_title like '%${key}%' or pg_alert_content like '%${key}%')
|
</if>
|
<if test='state != null'>
|
AND pg_is_push = #{state}
|
</if>
|
</select>
|
|
<select id="listHistoryByPushTime" resultMap="BaseResultMap">
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_push_goods
|
WHERE pg_is_push = 1 AND <![CDATA[pg_push_time >= #{pushTime}]]>
|
AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
|
ORDER BY pg_push_time desc
|
LIMIT ${start},${count}
|
</select>
|
|
<select id="countHistoryByPushTime" resultType="java.lang.Long">
|
SELECT IFNULL(count(pg_id),0) FROM yeshi_ec_push_goods
|
WHERE pg_is_push = 1 AND <![CDATA[pg_push_time >= #{pushTime}]]>
|
AND (pg_uid is null <if test='uid != null'>or pg_uid = #{uid} </if>)
|
</select>
|
|
<select id="listByPushState" resultMap="BaseResultMap" parameterType="java.util.List">
|
SELECT <include refid="Base_Column_List" /> FROM yeshi_ec_push_goods
|
WHERE pg_is_push = 1 AND pg_id in
|
<foreach item="item" collection="list" open="(" separator=","
|
close=")">#{item}</foreach>
|
</select>
|
|
<select id="listTask" resultMap="BaseResultMap">
|
SELECT * FROM `yeshi_ec_push_goods` p
|
WHERE p.`pg_is_push` = 0 AND p.`pg_control_time` IS NOT NULL
|
AND p.`pg_control_time` <![CDATA[<=]]> NOW()
|
</select>
|
</mapper>
|
|