<?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.YmFeedBacksMapper">
<resultMap id="YmFeedBacksResultMap" type="com.lymsh.yimiao.main.data.model.YmFeedBacks">
<result column="id" property="id" jdbcType="INTEGER" />
<result column="content" property="content" jdbcType="VARCHAR" />
<result column="type" property="type" jdbcType="INTEGER" />
<result column="reply_id" property="replyId" jdbcType="INTEGER" />
<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="addYmFeedBacks" keyProperty="id" useGeneratedKeys="false" parameterType="com.lymsh.yimiao.main.data.model.YmFeedBacks">
<selectKey resultType="int" keyProperty="id" order="BEFORE">
SELECT FEEDBACK_SEQ.nextval AS id
FROM dual
</selectKey>
insert into ym_feedbacks (id,content,type,reply_id,created,yn,publish_id,publish_name)
values (#{id,jdbcType=INTEGER},#{content,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{replyId,jdbcType=INTEGER}
,#{created,jdbcType=TIMESTAMP},#{yn,jdbcType=INTEGER},#{publishId,jdbcType=INTEGER},#{publishName,jdbcType=VARCHAR})
</insert>
<update id="updateYmFeedBacks" parameterType="com.lymsh.yimiao.main.data.model.YmFeedBacks">
update ym_feedbacks <set><if test="id != null and id >= 0">
id = #{id,jdbcType=INTEGER},
</if>
<if test="content != null and content != ''">
content = #{content,jdbcType=VARCHAR},
</if>
<if test="type != null and type >= 0">
type = #{type,jdbcType=INTEGER},
</if>
<if test="replyId != null and replyId >= 0">
reply_id = #{replyId,jdbcType=INTEGER},
</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="deleteYmFeedBacks" parameterType="java.lang.Integer">
</delete>
<select id="getYmFeedBacks" resultMap="YmFeedBacksResultMap" parameterType="java.lang.Integer">
select id,content,type,reply_id,created,yn,publish_id,publish_name
</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="YmFeedBacksCondition">
<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="type != null and type >= 0">
and type = #{type,jdbcType=INTEGER}
</if>
<if test="replyId != null and replyId >= 0">
and reply_id = #{replyId,jdbcType=INTEGER}
</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="queryYmFeedBacks" resultMap="YmFeedBacksResultMap" parameterType="com.lymsh.yimiao.main.data.model.YmFeedBacksQuery">
select id,content,type,reply_id,created,yn,publish_id,publish_name
from ym_feedbacks
<include refid="YmFeedBacksCondition" />
<include refid="orderAndLimit" />
</select>
<select id="queryYmFeedBacksCount" resultType="int" parameterType="com.lymsh.yimiao.main.data.model.YmFeedBacksQuery">
select count(1) from ym_feedbacks
<include refid="YmFeedBacksCondition" />
</select>
</mapper>