YmPushMessages.xml 3.17 KB
   1
   2
   3
   4
   5
   6
   7
   8
   9
  10
  11
  12
  13
  14
  15
  16
  17
  18
  19
  20
  21
  22
  23
  24
  25
  26
  27
  28
  29
  30
  31
  32
  33
  34
  35
  36
  37
  38
  39
  40
  41
  42
  43
  44
  45
  46
  47
  48
  49
  50
  51
  52
  53
  54
  55
  56
  57
  58
  59
  60
  61
  62
  63
  64
  65
  66
  67
  68
  69
  70
  71
  72
  73
  74
  75
  76
  77
  78
  79
  80
  81
  82
  83
  84
  85
  86
  87
  88
  89
  90
  91
  92
  93
  94
  95
  96
  97
  98
  99
 100
 101
 102
 103
 104
 105
 106
<?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.lymsh.yimiao.main.data.dao.YmPushMessagesMapper">

<resultMap id="YmPushMessagesResultMap" type="com.lymsh.yimiao.main.data.model.YmPushMessages">
<id column="id" property="id" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="created" property="created" jdbcType="TIMESTAMP" />
<result column="reception_id" property="receptionId" jdbcType="INTEGER" />
<result column="YN" property="yn" jdbcType="INTEGER" />
</resultMap>



<insert id="addYmPushMessages" keyProperty="id" useGeneratedKeys="false" parameterType="com.lymsh.yimiao.main.data.model.YmPushMessages">
<selectKey resultType="int" keyProperty="id" order="BEFORE">
SELECT MESSAGE_SEQ.nextval AS id
FROM dual
</selectKey>
insert into YM_PUSH_MESSAGES (id,content,created,reception_id,yn) values (#{id,jdbcType=INTEGER},#{content,jdbcType=VARCHAR},#{created,jdbcType=TIMESTAMP},#{receptionId,jdbcType=INTEGER}
,#{yn,jdbcType=INTEGER})
</insert>



<update id="updateYmPushMessages" parameterType="com.lymsh.yimiao.main.data.model.YmPushMessages">
update ym_push_messages <set><if test="content != null and content != ''">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="receptionId != null and receptionId >= 0">
reception_id = #{receptionId,jdbcType=INTEGER},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=INTEGER}
</update>


<delete id="deleteYmPushMessages" parameterType="java.lang.Integer">
delete from ym_push_messages where id = #{id,jdbcType=INTEGER}
</delete>



<select id="getYmPushMessages" resultMap="YmPushMessagesResultMap" parameterType="java.lang.Integer">
select id,content,created,reception_id,yn
from ym_push_messages where id = #{id,jdbcType=INTEGER}
</select>


<sql id="orderAndLimit">
<if test="sort != null and sort != '' ">
order by ${sort}
<if test="need != null">
limit #{offset, jdbcType=INTEGER} , #{limit, jdbcType=INTEGER}
</if>
</if>
</sql>



<sql id="YmPushMessagesCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="content != null and content != ''">
and content = #{content,jdbcType=VARCHAR}
</if>
<if test="created != null">
and created = #{created,jdbcType=TIMESTAMP}
</if>
<if test="receptionId != null and receptionId >= 0">
and reception_id = #{receptionId,jdbcType=INTEGER}
</if>
<if test="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
</where>
</sql>



<select id="queryYmPushMessages" resultMap="YmPushMessagesResultMap" parameterType="com.lymsh.yimiao.main.data.model.YmPushMessagesQuery">
select id,content,created,reception_id,yn
from ym_push_messages
<include refid="YmPushMessagesCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryYmPushMessagesCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.YmPushMessagesQuery">
select count(1) from ym_push_messages
<include refid="YmPushMessagesCondition" />
</select>



</mapper>