<?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.fjs.scenic.mapper.order.PlayManMapper">
  <resultMap id="BaseResultMap" type="com.fjs.scenic.entity.order.PlayMan">
    <constructor>
      <idArg column="id" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="name" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="phone" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="id_card" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="face_url" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="is_delete" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="id_default" javaType="java.lang.String" jdbcType="VARCHAR" />
      <arg column="order_id" javaType="java.lang.Integer" jdbcType="INTEGER" />
      <arg column="type" javaType="java.lang.String" jdbcType="VARCHAR" />
    </constructor>
  </resultMap>
  <sql id="Base_Column_List">
    id, name, phone, id_card, face_url, is_delete, id_default, order_id, type
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from play_man
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from play_man
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.fjs.scenic.entity.order.PlayMan">
    insert into play_man (id, name, phone, 
      id_card, face_url, is_delete, 
      id_default, order_id, type
      )
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR}, 
      #{idCard,jdbcType=VARCHAR}, #{faceUrl,jdbcType=VARCHAR}, #{isDelete,jdbcType=VARCHAR}, 
      #{idDefault,jdbcType=VARCHAR}, #{orderId,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.fjs.scenic.entity.order.PlayMan">
    insert into play_man
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="idCard != null">
        id_card,
      </if>
      <if test="faceUrl != null">
        face_url,
      </if>
      <if test="isDelete != null">
        is_delete,
      </if>
      <if test="idDefault != null">
        id_default,
      </if>
      <if test="orderId != null">
        order_id,
      </if>
      <if test="type != null">
        type,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="idCard != null">
        #{idCard,jdbcType=VARCHAR},
      </if>
      <if test="faceUrl != null">
        #{faceUrl,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        #{isDelete,jdbcType=VARCHAR},
      </if>
      <if test="idDefault != null">
        #{idDefault,jdbcType=VARCHAR},
      </if>
      <if test="orderId != null">
        #{orderId,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        #{type,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.fjs.scenic.entity.order.PlayMan">
    update play_man
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="idCard != null">
        id_card = #{idCard,jdbcType=VARCHAR},
      </if>
      <if test="faceUrl != null">
        face_url = #{faceUrl,jdbcType=VARCHAR},
      </if>
      <if test="isDelete != null">
        is_delete = #{isDelete,jdbcType=VARCHAR},
      </if>
      <if test="idDefault != null">
        id_default = #{idDefault,jdbcType=VARCHAR},
      </if>
      <if test="orderId != null">
        order_id = #{orderId,jdbcType=INTEGER},
      </if>
      <if test="type != null">
        type = #{type,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.fjs.scenic.entity.order.PlayMan">
    update play_man
    set name = #{name,jdbcType=VARCHAR},
      phone = #{phone,jdbcType=VARCHAR},
      id_card = #{idCard,jdbcType=VARCHAR},
      face_url = #{faceUrl,jdbcType=VARCHAR},
      is_delete = #{isDelete,jdbcType=VARCHAR},
      id_default = #{idDefault,jdbcType=VARCHAR},
      order_id = #{orderId,jdbcType=INTEGER},
      type = #{type,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
  <delete id="deleteByParam" parameterType="java.util.Map">
		delete from play_man
		<if test="param != null and param != ''">where ${param}</if>
	</delete>
	
	<select id="getPlayMansByOrderId" resultMap="BaseResultMap">
    select 
    <include refid="Base_Column_List" />
    from play_man
    where order_id = #{orderId,jdbcType=INTEGER}
  </select>
  
   <delete id="deleteByOrderId">
		delete from play_man where order_id = #{orderId}
	</delete>
</mapper>