YmNotifications.xml 3.46 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
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
<?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.YmNotificationsMapper">

<resultMap id="YmNotificationsResultMap" type="com.lymsh.yimiao.main.data.model.YmNotifications">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="created" property="created" jdbcType="TIMESTAMP" />
<result column="yn" property="yn" jdbcType="INTEGER" />
<result column="publish_id" property="publishId" jdbcType="INTEGER" />
<result column="publish_name" property="publishName" jdbcType="VARCHAR" />
</resultMap>



<insert id="addYmNotifications" parameterType="com.lymsh.yimiao.main.data.model.YmNotifications">
insert into ym_notifications (id,type,content,created,yn,publish_id,publish_name) values (#{id},#{type},#{content},#{created},#{yn},#{publishId},#{publishName})
</insert>



<update id="updateYmNotifications" parameterType="com.lymsh.yimiao.main.data.model.YmNotifications">
update ym_notifications <set><if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="type != null and type >= 0">
type = #{type,jdbcType=INTEGER},
</if>
<if test="content != null and content != ''">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="created != null">
created = #{created,jdbcType=TIMESTAMP},
</if>
<if test="yn != null and yn >= 0">
yn = #{yn,jdbcType=INTEGER},
</if>
<if test="publishId != null and publishId >= 0">
publish_id = #{publishId,jdbcType=INTEGER},
</if>
<if test="publishName != null and publishName != ''">
publish_name = #{publishName,jdbcType=VARCHAR},
</if>
</set>
</update>


<delete id="deleteYmNotifications" parameterType="java.lang.Integer">
</delete>



<select id="getYmNotifications" resultMap="YmNotificationsResultMap" parameterType="java.lang.Integer">
select id,type,content,created,yn,publish_id,publish_name
from ym_notifications
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="YmNotificationsCondition">
<where>
1 = 1
<if test="id != null and id >= 0">
and id = #{id,jdbcType=INTEGER}
</if>
<if test="type != null and type >= 0">
and type = #{type,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="yn != null and yn >= 0">
and yn = #{yn,jdbcType=INTEGER}
</if>
<if test="publishId != null and publishId >= 0">
and publish_id = #{publishId,jdbcType=INTEGER}
</if>
<if test="publishName != null and publishName != ''">
and publish_name = #{publishName,jdbcType=VARCHAR}
</if>
</where>
</sql>



<select id="queryYmNotifications" resultMap="YmNotificationsResultMap" parameterType="com.lymsh.yimiao.main.data.model.YmNotificationsQuery">
select id,type,content,created,yn,publish_id,publish_name
from ym_notifications
<include refid="YmNotificationsCondition" />
<include refid="orderAndLimit" />
</select>



<select id="queryYmNotificationsCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.YmNotificationsQuery">
select count(1) from ym_notifications
<include refid="YmNotificationsCondition" />
</select>



</mapper>