BusinessLicenseMapper.xml 4.45 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.BusinessLicenseMapper">
    <resultMap id="BaseResultMap" type="com.yoho.order.model.BusinessLicense">
      <result column="id" property="id" jdbcType="INTEGER" />
      <result column="uid" property="uid" jdbcType="INTEGER" />
      <result column="business_type" property="businessType" jdbcType="INTEGER" />
      <result column="business_name" property="businessName" jdbcType="VARCHAR" />
      <result column="social_credit_code" property="socialCreditCode" jdbcType="VARCHAR" />
      <result column="cert_name" property="certName" jdbcType="VARCHAR" />
      <result column="cert_no" property="certNo" jdbcType="VARCHAR" />
      <result column="start_time" property="startTime" jdbcType="INTEGER" />
      <result column="expire_time" property="expireTime" jdbcType="INTEGER" />
      <result column="license_original_image" property="licenseOriginalImage" jdbcType="VARCHAR" />
      <result column="license_copy_image" property="licenseCopyImage" jdbcType="VARCHAR" />
      <result column="cert_face_image" property="certFaceImage" jdbcType="VARCHAR" />
      <result column="cert_reverse_image" property="certReverseImage" jdbcType="VARCHAR" />
      <result column="commit_time" property="commitTime" jdbcType="INTEGER" />
      <result column="audit_status" property="auditStatus" jdbcType="INTEGER" />
      <result column="audit_time" property="auditTime" jdbcType="INTEGER" />
      <result column="audit_uid" property="auditUid" jdbcType="INTEGER" />
      <result column="reject_reason" property="rejectReason" jdbcType="VARCHAR" />
    </resultMap>

    <sql id="Base_Column_List">
        id, uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time, license_original_image, 
        license_copy_image, cert_face_image, cert_reverse_image, commit_time, audit_status, audit_time, audit_uid, reject_reason
    </sql>
    
    <insert id="insert" parameterType="com.yoho.order.model.BusinessLicense">
        insert into business_license (uid, business_type, business_name, social_credit_code, cert_name, cert_no, start_time, expire_time,
        license_original_image, license_copy_image, cert_face_image, cert_reverse_image, commit_time) values (#{uid}, #{businessType}, #{businessName}, 
        #{socialCreditCode}, #{certName}, #{certNo}, #{startTime}, #{expireTime}, #{licenseOriginalImage}, #{licenseCopyImage}, 
        #{certFaceImage}, #{certReverseImage}, #{commitTime})
    </insert>
    
    <select id="selectByUid" resultMap="BaseResultMap">
        select <include refid="Base_Column_List"></include> 
        from business_license 
        where uid=#{uid} 
        order by commit_time desc
    </select>
    
    <sql id="Query_Sql" >
        <if test="businessLicenseReq.uid != null">
           and a.uid=#{businessLicenseReq.uid}
        </if>
        <if test="businessLicenseReq.businessName!= null">
        <bind name="pattern" value="'%' + businessLicenseReq.businessName + '%'" />
           and a.business_name like #{pattern}
        </if>
        <if test="businessLicenseReq.validStatus != null">
           and b.valid_status=#{businessLicenseReq.validStatus}
        </if>
    </sql>

    <select id="selectTotalByCondition" resultType="java.lang.Integer" parameterType="com.yoho.order.model.BusinessLicenseReq">
        select count(1)   
        from business_license a 
        <if test="businessLicenseReq.validStatus != null">
        LEFT JOIN stored_seller b
        ON( b.uid=a.uid) 
        </if>
        where 1=1  
        <include refid="Query_Sql"></include>
    </select>
    
    <select id="selectByCondition" resultMap="BaseResultMap" parameterType="com.yoho.order.model.BusinessLicenseReq">
      select a.*
      from business_license a 
      <if test="businessLicenseReq.validStatus != null">
        LEFT JOIN stored_seller b
        ON( b.uid=a.uid) 
        </if>
      where 1=1 
       <include refid="Query_Sql"></include>
      order by a.commit_time desc 
      <if test="businessLicenseReq.start!=null and businessLicenseReq.size != null">
        limit #{businessLicenseReq.start},#{businessLicenseReq.size}
      </if>
    </select>
    
    <select id="selectById" resultMap="BaseResultMap">
      select <include refid="Base_Column_List"></include> 
      from business_license 
      where id=#{id}
    </select>
    
    
</mapper>