StoredSellerMapper.xml 3.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.StoredSellerMapper" >
  <resultMap id="BaseResultMap" type="com.yoho.order.model.StoredSeller" >
    <id column="id" property="id" jdbcType="INTEGER" />
    <result column="uid" property="uid" jdbcType="INTEGER" />
    <result column="valid_status" property="validStatus" jdbcType="INTEGER" />
    <result column="cert_no" property="certNo" jdbcType="VARCHAR" />
    <result column="cert_name" property="certName" jdbcType="VARCHAR" />
    <result column="operator_uid" property="operatorUid" jdbcType="INTEGER" />
    <result column="operator_name" property="operatorName" jdbcType="VARCHAR" />
    <result column="enter_time" property="enterTime" jdbcType="INTEGER" />
    <result column="quit_time" property="quitTime" jdbcType="INTEGER" />
    <result column="create_time" property="createTime" jdbcType="INTEGER" />
    <result column="update_time" property="updateTime" jdbcType="INTEGER" />
    <result column="break_zhi_ma_cert" property="breakZhiMaCert" jdbcType="TINYINT" />
    <result column="entry_type" property="entryType" jdbcType="INTEGER" />
  </resultMap>

  <sql id="Base_Column_List" >
    id, uid, valid_status,cert_no,cert_name,operator_uid,operator_name,enter_time,quit_time ,create_time, update_time,break_zhi_ma_cert,entry_type
  </sql>


  <sql id="Query_Condition_Sql" >

    <if test="storedSellerReq.uid != null">
      and uid =  #{storedSellerReq.uid}
    </if>

    <if test="storedSellerReq.certName != null">
      and cert_name =  #{storedSellerReq.certName}
    </if>

    <if test="storedSellerReq.validStatus != null ">
      and valid_status =  #{storedSellerReq.validStatus}
    </if>
    <if test="storedSellerReq.entryType != null and storedSellerReq.entryType != 0">
      and entry_type =  #{storedSellerReq.entryType}
    </if>
  </sql>

  <select id="selectCountByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.StoredSellerReqVo">
    select count(id)
    from stored_seller where 1=1
    <include refid="Query_Condition_Sql" />
  </select>

  <select id="selectByConditionWithPage" resultMap="BaseResultMap" parameterType="com.yoho.order.model.StoredSellerReqVo">
    select <include refid="Base_Column_List" />
    from stored_seller where 1=1
    <include refid="Query_Condition_Sql" />
    order by id desc
    limit #{storedSellerReq.start},#{storedSellerReq.size}
  </select>
  <select id="selectNameByUids" resultType="java.util.Map">
    select uid,cert_name from stored_seller
    where uid in
    <foreach collection="uids" item="uid" open="(" separator="," close=")">
      #{uid}
    </foreach>
  </select>
  <select id="selectUidByCertName" resultType="java.lang.Integer">
    select uid from stored_seller where cert_name=#{certName}
  </select>
  <select id="selectUid" resultMap="BaseResultMap" parameterType="com.yoho.order.model.StoredSellerReqVo">
    select <include refid="Base_Column_List" />
    from stored_seller where valid_status = 1 and uid=#{uid}
  </select>
  <select id="selectUidByCertNameAndUid" resultType="java.lang.Integer">
    select uid from stored_seller where 1=1
    <if test="merchantName != null and merchantName != ''">
      and cert_name=#{merchantName}
    </if>
    <if test="uid != null and uid !=''">
      and uid = #{uid}
    </if>
  </select>
  
  <update id="updateOperateInfo">
      update stored_seller 
      set operator_uid=#{operatorUid}, operator_name=#{operatorName}, update_time=unix_timestamp()  
      where uid = #{uid}
  </update>
  
  <select id="selectByUids" resultMap="BaseResultMap">
    select <include refid="Base_Column_List" /> 
    from stored_seller 
    where uid in
    <foreach collection="uids" item="uid" open="(" separator="," close=")">
      #{uid}
    </foreach>
  </select>
  
</mapper>