<?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.video.AuthorWriteMapper">
  <resultMap id="resultMap" type="com.slodon.b2b2c.video.pojo.Author">
    <id column="author_id" property="authorId" />
    <result column="member_id" property="memberId" />
    <result column="member_name" property="memberName" />
    <result column="member_nickname" property="memberNickname" />
    <result column="member_avatar" property="memberAvatar" />
    <result column="background_image" property="backgroundImage" />
    <result column="introduction" property="introduction" />
    <result column="role_type" property="roleType" />
    <result column="permission_state" property="permissionState" />
    <result column="remark" property="remark" />
    <result column="live_state" property="liveState" />
    <result column="forbid_reason" property="forbidReason" />
    <result column="follow_num" property="followNum" />
    <result column="fans_num" property="fansNum" />
    <result column="like_num" property="likeNum" />
    <result column="video_num" property="videoNum" />
    <result column="goods_num" property="goodsNum" />
    <result column="like_video_num" property="likeVideoNum" />
    <result column="live_num" property="liveNum" />
    <result column="grade" property="grade" />
    <result column="integral" property="integral" />
    <result column="store_id" property="storeId" />
    <result column="store_name" property="storeName" />
    <result column="vendor_id" property="vendorId" />
    <result column="vendor_name" property="vendorName" />
    <result column="create_time" property="createTime" />
    <result column="update_time" property="updateTime" />
  </resultMap>
  <!--除主键外的所有字段，用于插入操作-->
  <sql id="columns">
    <trim suffixOverrides=",">
      <if test="memberId != null">
        `member_id`,
      </if>
      <if test="memberName != null">
        `member_name`,
      </if>
      <if test="memberNickname != null">
        `member_nickname`,
      </if>
      <if test="memberAvatar != null">
        `member_avatar`,
      </if>
      <if test="backgroundImage != null">
        `background_image`,
      </if>
      <if test="introduction != null">
        `introduction`,
      </if>
      <if test="roleType != null">
        `role_type`,
      </if>
      <if test="permissionState != null">
        `permission_state`,
      </if>
      <if test="remark != null">
        `remark`,
      </if>
      <if test="liveState != null">
        `live_state`,
      </if>
      <if test="forbidReason != null">
        `forbid_reason`,
      </if>
      <if test="followNum != null">
        `follow_num`,
      </if>
      <if test="fansNum != null">
        `fans_num`,
      </if>
      <if test="likeNum != null">
        `like_num`,
      </if>
      <if test="videoNum != null">
        `video_num`,
      </if>
      <if test="goodsNum != null">
        `goods_num`,
      </if>
      <if test="likeVideoNum != null">
        `like_video_num`,
      </if>
      <if test="liveNum != null">
        `live_num`,
      </if>
      <if test="grade != null">
        `grade`,
      </if>
      <if test="integral != null">
        `integral`,
      </if>
      <if test="storeId != null">
        `store_id`,
      </if>
      <if test="storeName != null">
        `store_name`,
      </if>
      <if test="vendorId != null">
        `vendor_id`,
      </if>
      <if test="vendorName != null">
        `vendor_name`,
      </if>
      <if test="createTime != null">
        `create_time`,
      </if>
      <if test="updateTime != null">
        `update_time`,
      </if>
    </trim>
  </sql>
  <!--按照主键值进行操作-->
  <sql id="pkWhere">
    WHERE `author_id` = #{primaryKey}
  </sql>
  <!--操作条件-->
  <sql id="whereCondition">
    <if test="example != null">
      <trim prefix="WHERE" prefixOverrides="AND|OR">
        <if test="example.authorIdNotEquals != null">
          AND `author_id` != #{example.authorIdNotEquals}
        </if>
        <if test="example.authorIdIn != null">
          AND `author_id` in (${example.authorIdIn})
        </if>
        <if test="example.memberId != null">
          AND `member_id` = #{example.memberId}
        </if>
        <if test="example.memberName != null">
          AND `member_name` = #{example.memberName}
        </if>
        <if test="example.memberNameLike != null">
          AND `member_name` like concat('%',#{example.memberNameLike},'%')
        </if>
        <if test="example.memberNickname != null">
          AND `member_nickname` = #{example.memberNickname}
        </if>
        <if test="example.memberNicknameLike != null">
          AND `member_nickname` like concat('%',#{example.memberNicknameLike},'%')
        </if>
        <if test="example.memberAvatar != null">
          AND `member_avatar` = #{example.memberAvatar}
        </if>
        <if test="example.backgroundImage != null">
          AND `background_image` = #{example.backgroundImage}
        </if>
        <if test="example.introduction != null">
          AND `introduction` = #{example.introduction}
        </if>
        <if test="example.roleType != null">
          AND `role_type` = #{example.roleType}
        </if>
        <if test="example.permissionState != null">
          AND `permission_state` = #{example.permissionState}
        </if>
        <if test="example.permissionStateIn != null">
          AND `permission_state` in (${example.permissionStateIn})
        </if>
        <if test="example.permissionStateNotIn != null">
          AND `permission_state` not in (${example.permissionStateNotIn})
        </if>
        <if test="example.permissionStateNotEquals != null">
          AND `permission_state` != #{example.permissionStateNotEquals}
        </if>
        <if test="example.remark != null">
          AND `remark` = #{example.remark}
        </if>
        <if test="example.liveState != null">
          AND `live_state` = #{example.liveState}
        </if>
        <if test="example.liveStateIn != null">
          AND `live_state` in (${example.liveStateIn})
        </if>
        <if test="example.liveStateNotIn != null">
          AND `live_state` not in (${example.liveStateNotIn})
        </if>
        <if test="example.liveStateNotEquals != null">
          AND `live_state` != #{example.liveStateNotEquals}
        </if>
        <if test="example.forbidReason != null">
          AND `forbid_reason` = #{example.forbidReason}
        </if>
        <if test="example.forbidReasonLike != null">
          AND `forbid_reason` like concat('%',#{example.forbidReasonLike},'%')
        </if>
        <if test="example.followNum != null">
          AND `follow_num` = #{example.followNum}
        </if>
        <if test="example.fansNum != null">
          AND `fans_num` = #{example.fansNum}
        </if>
        <if test="example.fansNumLike != null">
          AND `fans_num` like concat('%',#{example.fansNumLike},'%')
        </if>
        <if test="example.likeNum != null">
          AND `like_num` = #{example.likeNum}
        </if>
        <if test="example.videoNum != null">
          AND `video_num` = #{example.videoNum}
        </if>
        <if test="example.goodsNum != null">
          AND `goods_num` = #{example.goodsNum}
        </if>
        <if test="example.goodsNumLike != null">
          AND `goods_num` like concat('%',#{example.goodsNumLike},'%')
        </if>
        <if test="example.likeVideoNum != null">
          AND `like_video_num` = #{example.likeVideoNum}
        </if>
        <if test="example.liveNum != null">
          AND `live_num` = #{example.liveNum}
        </if>
        <if test="example.grade != null">
          AND `grade` = #{example.grade}
        </if>
        <if test="example.integral != null">
          AND `integral` = #{example.integral}
        </if>
        <if test="example.storeId != null">
          AND `store_id` = #{example.storeId}
        </if>
        <if test="example.storeName != null">
          AND `store_name` = #{example.storeName}
        </if>
        <if test="example.storeNameLike != null">
          AND `store_name` like concat('%',#{example.storeNameLike},'%')
        </if>
        <if test="example.vendorId != null">
          AND `vendor_id` = #{example.vendorId}
        </if>
        <if test="example.vendorName != null">
          AND `vendor_name` = #{example.vendorName}
        </if>
        <if test="example.vendorNameLike != null">
          AND `vendor_name` like concat('%',#{example.vendorNameLike},'%')
        </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.updateTimeAfter != null">
          AND `update_time` <![CDATA[ >= ]]> #{example.updateTimeAfter}
        </if>
        <if test="example.updateTimeBefore != null">
          AND `update_time` <![CDATA[ <= ]]> #{example.updateTimeBefore}
        </if>
      </trim>
    </if>
  </sql>
  <!--排序条件-->
  <sql id="orderBy">
    ORDER BY `author_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.video.example.AuthorExample" resultType="java.lang.Integer">
    SELECT
      COUNT(*)
    FROM `author`
    <include refid="whereCondition" />
  </select>
  <!--根据主键查询记录-->
  <select id="getByPrimaryKey" resultMap="resultMap">
    SELECT
      *
    FROM `author`
    <include refid="pkWhere" />
  </select>
  <!--查询符合条件的记录(所有字段)-->
  <select id="listByExample" resultMap="resultMap">
    SELECT
      *
    FROM `author`
    <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 `author`
    <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 `author`
    <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 `author`
    <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 `author`
    <include refid="whereCondition" />
  </delete>
  <!--根据主键删除记录-->
  <delete id="deleteByPrimaryKey">
    DELETE FROM `author`
    <include refid="pkWhere" />
  </delete>
  <!--插入一条记录-->
  <insert id="insert" keyColumn="author_id" keyProperty="authorId" parameterType="com.slodon.b2b2c.video.pojo.Author" useGeneratedKeys="true">
    INSERT INTO `author`(
    <include refid="columns" />
    )
    VALUES(
    <trim suffixOverrides=",">
      <if test="memberId != null">
        #{memberId},
      </if>
      <if test="memberName != null">
        #{memberName},
      </if>
      <if test="memberNickname != null">
        #{memberNickname},
      </if>
      <if test="memberAvatar != null">
        #{memberAvatar},
      </if>
      <if test="backgroundImage != null">
        #{backgroundImage},
      </if>
      <if test="introduction != null">
        #{introduction},
      </if>
      <if test="roleType != null">
        #{roleType},
      </if>
      <if test="permissionState != null">
        #{permissionState},
      </if>
      <if test="remark != null">
        #{remark},
      </if>
      <if test="liveState != null">
        #{liveState},
      </if>
      <if test="forbidReason != null">
        #{forbidReason},
      </if>
      <if test="followNum != null">
        #{followNum},
      </if>
      <if test="fansNum != null">
        #{fansNum},
      </if>
      <if test="likeNum != null">
        #{likeNum},
      </if>
      <if test="videoNum != null">
        #{videoNum},
      </if>
      <if test="goodsNum != null">
        #{goodsNum},
      </if>
      <if test="likeVideoNum != null">
        #{likeVideoNum},
      </if>
      <if test="liveNum != null">
        #{liveNum},
      </if>
      <if test="grade != null">
        #{grade},
      </if>
      <if test="integral != null">
        #{integral},
      </if>
      <if test="storeId != null">
        #{storeId},
      </if>
      <if test="storeName != null">
        #{storeName},
      </if>
      <if test="vendorId != null">
        #{vendorId},
      </if>
      <if test="vendorName != null">
        #{vendorName},
      </if>
      <if test="createTime != null">
        #{createTime},
      </if>
      <if test="updateTime != null">
        #{updateTime},
      </if>
    </trim>
    )
  </insert>
  <!--按条件更新记录中不为空的字段-->
  <update id="updateByExampleSelective">
    UPDATE `author`
    <trim prefix="SET" suffixOverrides=",">
      <if test="record.memberId != null">
        `member_id` = #{record.memberId},
      </if>
      <if test="record.memberName != null">
        `member_name` = #{record.memberName},
      </if>
      <if test="record.memberNickname != null">
        `member_nickname` = #{record.memberNickname},
      </if>
      <if test="record.memberAvatar != null">
        `member_avatar` = #{record.memberAvatar},
      </if>
      <if test="record.backgroundImage != null">
        `background_image` = #{record.backgroundImage},
      </if>
      <if test="record.introduction != null">
        `introduction` = #{record.introduction},
      </if>
      <if test="record.roleType != null">
        `role_type` = #{record.roleType},
      </if>
      <if test="record.permissionState != null">
        `permission_state` = #{record.permissionState},
      </if>
      <if test="record.remark != null">
        `remark` = #{record.remark},
      </if>
      <if test="record.liveState != null">
        `live_state` = #{record.liveState},
      </if>
      <if test="record.forbidReason != null">
        `forbid_reason` = #{record.forbidReason},
      </if>
      <if test="record.followNum != null">
        `follow_num` = #{record.followNum},
      </if>
      <if test="record.fansNum != null">
        `fans_num` = #{record.fansNum},
      </if>
      <if test="record.likeNum != null">
        `like_num` = #{record.likeNum},
      </if>
      <if test="record.videoNum != null">
        `video_num` = #{record.videoNum},
      </if>
      <if test="record.goodsNum != null">
        `goods_num` = #{record.goodsNum},
      </if>
      <if test="record.likeVideoNum != null">
        `like_video_num` = #{record.likeVideoNum},
      </if>
      <if test="record.liveNum != null">
        `live_num` = #{record.liveNum},
      </if>
      <if test="record.grade != null">
        `grade` = #{record.grade},
      </if>
      <if test="record.integral != null">
        `integral` = #{record.integral},
      </if>
      <if test="record.storeId != null">
        `store_id` = #{record.storeId},
      </if>
      <if test="record.storeName != null">
        `store_name` = #{record.storeName},
      </if>
      <if test="record.vendorId != null">
        `vendor_id` = #{record.vendorId},
      </if>
      <if test="record.vendorName != null">
        `vendor_name` = #{record.vendorName},
      </if>
      <if test="record.createTime != null">
        `create_time` = #{record.createTime},
      </if>
      <if test="record.updateTime != null">
        `update_time` = #{record.updateTime},
      </if>
    </trim>
    <include refid="whereCondition" />
  </update>
  <!--按照主键更新记录中不为空的字段-->
  <update id="updateByPrimaryKeySelective">
    UPDATE `author`
    <trim prefix="SET" suffixOverrides=",">
      <if test="memberId != null">
        `member_id` = #{memberId},
      </if>
      <if test="memberName != null">
        `member_name` = #{memberName},
      </if>
      <if test="memberNickname != null">
        `member_nickname` = #{memberNickname},
      </if>
      <if test="memberAvatar != null">
        `member_avatar` = #{memberAvatar},
      </if>
      <if test="backgroundImage != null">
        `background_image` = #{backgroundImage},
      </if>
      <if test="introduction != null">
        `introduction` = #{introduction},
      </if>
      <if test="roleType != null">
        `role_type` = #{roleType},
      </if>
      <if test="permissionState != null">
        `permission_state` = #{permissionState},
      </if>
      <if test="remark != null">
        `remark` = #{remark},
      </if>
      <if test="liveState != null">
        `live_state` = #{liveState},
      </if>
      <if test="forbidReason != null">
        `forbid_reason` = #{forbidReason},
      </if>
      <if test="followNum != null">
        `follow_num` = #{followNum},
      </if>
      <if test="fansNum != null">
        `fans_num` = #{fansNum},
      </if>
      <if test="likeNum != null">
        `like_num` = #{likeNum},
      </if>
      <if test="videoNum != null">
        `video_num` = #{videoNum},
      </if>
      <if test="goodsNum != null">
        `goods_num` = #{goodsNum},
      </if>
      <if test="likeVideoNum != null">
        `like_video_num` = #{likeVideoNum},
      </if>
      <if test="liveNum != null">
        `live_num` = #{liveNum},
      </if>
      <if test="grade != null">
        `grade` = #{grade},
      </if>
      <if test="integral != null">
        `integral` = #{integral},
      </if>
      <if test="storeId != null">
        `store_id` = #{storeId},
      </if>
      <if test="storeName != null">
        `store_name` = #{storeName},
      </if>
      <if test="vendorId != null">
        `vendor_id` = #{vendorId},
      </if>
      <if test="vendorName != null">
        `vendor_name` = #{vendorName},
      </if>
      <if test="createTime != null">
        `create_time` = #{createTime},
      </if>
      <if test="updateTime != null">
        `update_time` = #{updateTime},
      </if>
    </trim>
    WHERE `author_id` = #{authorId}
  </update>
</mapper>