BlackUserMapper.xml 1.85 KB
<?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.yoho.order.dal.BlackUserMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.order.model.BlackUser" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="black_type" property="blackType" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="reason" property="reason" jdbcType="VARCHAR" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="status" property="status" jdbcType="INTEGER" />
  </resultMap>

  <sql id="Base_Column_List" >
    id, uid, black_type, create_time, reason, update_time, status
  </sql>

  <select id="selectByUid" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from black_user
    where uid = #{uid,jdbcType=INTEGER}
  </select>

  <delete id="deleteByUid">
    delete from black_user
    where uid = #{uid,jdbcType=INTEGER}
  </delete>

  <delete id="deleteByUidsAndBlackType">
    delete from black_user
    where uid in
    <foreach collection="uids" item="uid" open="(" close=")" separator=",">
      #{uid,jdbcType=INTEGER}
    </foreach>
    and black_type = #{blackType,jdbcType=INTEGER}
  </delete>

  <insert id="insert">
    insert into black_user (uid, black_type, create_time, reason, update_time, status)
    values
    <foreach collection="records" item="record" separator=",">
      (#{record.uid,jdbcType=INTEGER}, #{record.blackType,jdbcType=INTEGER}, #{record.createTime,jdbcType=INTEGER},
      #{record.reason,jdbcType=VARCHAR}, #{record.updateTime,jdbcType=INTEGER},  #{record.status,jdbcType=INTEGER})
    </foreach>
  </insert>

</mapper>