<?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.slodon.b2b2c.dao.write.member.MemberFeedbackWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.member.pojo.MemberFeedback">
    <id column="feedback_id" property="feedbackId" />
    <result column="type_id" property="typeId" />
    <result column="content" property="content" />
    <result column="image" property="image" />
    <result column="phone" property="phone" />
    <result column="member_id" property="memberId" />
    <result column="state" property="state" />
    <result column="create_time" property="createTime" />
    <result column="handler" property="handler" />
    <result column="handle_time" property="handleTime" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="typeId != null">
        `type_id`,
      </if>
      <if test="content != null">
        `content`,
      </if>
      <if test="image != null">
        `image`,
      </if>
      <if test="phone != null">
        `phone`,
      </if>
      <if test="memberId != null">
        `member_id`,
      </if>
      <if test="state != null">
        `state`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="handler != null">
        `handler`,
      </if>
      <if test="handleTime != null">
        `handle_time`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `feedback_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.feedbackIdNotEquals != null">
          AND `feedback_id` != #{example.feedbackIdNotEquals}
        </if>
        <if test="example.feedbackIdIn != null">
          AND `feedback_id` in (${example.feedbackIdIn})
        </if>
        <if test="example.typeId != null">
          AND `type_id` = #{example.typeId}
        </if>
        <if test="example.content != null">
          AND `content` = #{example.content}
        </if>
        <if test="example.contentLike != null">
          AND `content` like concat('%',#{example.contentLike},'%')
        </if>
        <if test="example.image != null">
          AND `image` = #{example.image}
        </if>
        <if test="example.phone != null">
          AND `phone` = #{example.phone}
        </if>
        <if test="example.memberId != null">
          AND `member_id` = #{example.memberId}
        </if>
        <if test="example.state != null">
          AND `state` = #{example.state}
        </if>
        <if test="example.createTimeAfter != null">
          AND `create_time` <![CDATA[ >= ]]> #{example.createTimeAfter}
        </if>
        <if test="example.createTimeBefore != null">
          AND `create_time` <![CDATA[ <= ]]> #{example.createTimeBefore}
        </if>
        <if test="example.handler != null">
          AND `handler` = #{example.handler}
        </if>
        <if test="example.handleTimeAfter != null">
          AND `handle_time` <![CDATA[ >= ]]> #{example.handleTimeAfter}
        </if>
        <if test="example.handleTimeBefore != null">
          AND `handle_time` <![CDATA[ <= ]]> #{example.handleTimeBefore}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `feedback_id` DESC
  </sql>
  <sql id="orderByOther">
    order by ${example.orderBy}
  </sql>
  <!--分组条件-->
  <sql id="groupBy">
    group by ${example.groupBy}
  </sql>
  <!--分页条件-->
  <sql id="limit">
    <if test="size != null and size &gt; 0">
      limit #{startRow},#{size}
    </if>
  </sql>
  <!--查询符合条件的记录数-->
  <select id="countByExample" parameterType="com.slodon.b2b2c.member.example.MemberFeedbackExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `member_feedback`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `member_feedback`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `member_feedback`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(所有字段)-->
  <select id="listPageByExample" resultMap="resultMap">
    SELECT
      *
    FROM `member_feedback`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--查询符合条件的记录(指定字段)-->
  <select id="listFieldsByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `member_feedback`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
  </select>
  <!--分页查询符合条件的记录(指定字段)-->
  <select id="listFieldsPageByExample" resultMap="resultMap">
    SELECT
      ${fields}
    FROM `member_feedback`
    <include refid="whereCondition" />
    <if test="example.groupBy != null">
      <include refid="groupBy" />
    </if>
    <choose>
      <when test="example.orderBy != null">
        <include refid="orderByOther" />
      </when>
      <otherwise>
        <include refid="orderBy" />
      </otherwise>
    </choose>
    <include refid="limit" />
  </select>
  <!--根据条件删除记录，可多条删除-->
  <delete id="deleteByExample">
    DELETE FROM `member_feedback`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `member_feedback`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="feedback_id" keyProperty="feedbackId" parameterType="com.slodon.b2b2c.member.pojo.MemberFeedback" useGeneratedKeys="true">
    INSERT INTO `member_feedback`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="typeId != null">
        #{typeId},
      </if>
      <if test="content != null">
        #{content},
      </if>
      <if test="image != null">
        #{image},
      </if>
      <if test="phone != null">
        #{phone},
      </if>
      <if test="memberId != null">
        #{memberId},
      </if>
      <if test="state != null">
        #{state},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="handler != null">
        #{handler},
      </if>
      <if test="handleTime != null">
        #{handleTime},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `member_feedback`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.typeId != null">
        `type_id` = #{record.typeId},
      </if>
      <if test="record.content != null">
        `content` = #{record.content},
      </if>
      <if test="record.image != null">
        `image` = #{record.image},
      </if>
      <if test="record.phone != null">
        `phone` = #{record.phone},
      </if>
      <if test="record.memberId != null">
        `member_id` = #{record.memberId},
      </if>
      <if test="record.state != null">
        `state` = #{record.state},
      </if>
      <if test="record.createTime != null">
        `create_time` = #{record.createTime},
      </if>
      <if test="record.handler != null">
        `handler` = #{record.handler},
      </if>
      <if test="record.handleTime != null">
        `handle_time` = #{record.handleTime},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `member_feedback`
    <trim prefix="SET" suffixOverrides=",">
      <if test="typeId != null">
        `type_id` = #{typeId},
      </if>
      <if test="content != null">
        `content` = #{content},
      </if>
      <if test="image != null">
        `image` = #{image},
      </if>
      <if test="phone != null">
        `phone` = #{phone},
      </if>
      <if test="memberId != null">
        `member_id` = #{memberId},
      </if>
      <if test="state != null">
        `state` = #{state},
      </if>
      <if test="createTime != null">
        `create_time` = #{createTime},
      </if>
      <if test="handler != null">
        `handler` = #{handler},
      </if>
      <if test="handleTime != null">
        `handle_time` = #{handleTime},
      </if>
    </trim>
    WHERE `feedback_id` = #{feedbackId}
  </update>
</mapper>