<?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.cool.store.mapper.ShopAuditInfoMapper">
  <resultMap id="BaseResultMap" type="com.cool.store.entity.ShopAuditInfoDO">
    <!--
      WARNING - @mbg.generated
    -->
    <id column="id" jdbcType="BIGINT" property="id" />
    <result column="shop_id" jdbcType="BIGINT" property="shopId" />
    <result column="audit_type" jdbcType="TINYINT" property="auditType" />
    <result column="submitted_user_id" jdbcType="VARCHAR" property="submittedUserId" />
    <result column="submitted_user_name" jdbcType="VARCHAR" property="submittedUserName" />
    <result column="result_type" jdbcType="TINYINT" property="resultType" />
    <result column="pass_reason" jdbcType="VARCHAR" property="passReason" />
    <result column="reject_reason" jdbcType="VARCHAR" property="rejectReason" />
    <result column="certify_file" jdbcType="VARCHAR" property="certifyFile" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="data_type" jdbcType="TINYINT" property="dataType" />
  </resultMap>
  <select id="selectBykeyAndType" resultType="com.cool.store.entity.ShopAuditInfoDO">
    select *
    from xfsg_shop_audit_info
    where shop_id = #{shopId}
    and audit_type = 4
    and deleted = 0
    order by create_time desc
    limit 1
  </select>

  <select id="getAuditInfoList" resultType="com.cool.store.entity.ShopAuditInfoDO">
    select *
    from xfsg_shop_audit_info
    where id in
    <foreach collection="auditIds" item="auditId" open="(" separator="," close=")">
      #{auditId}
    </foreach>
  </select>
  <sql id="Base_Column_List">
    id,shop_id,audit_type,submitted_user_id,submitted_user_name,result_type,pass_reason,reject_reason,
      certify_file,create_time,update_time,deleted,data_type
  </sql>

  <select id="getListByShopIdAndType" resultType="com.cool.store.vo.ShopAuditInfoVO">
    select <include refid="Base_Column_List"/>
    from xfsg_shop_audit_info
    where shop_id = #{shopId}
    and audit_type = #{type}
    order by create_time
  </select>
  <select id="getAuditList" resultType="com.cool.store.entity.ShopAuditInfoDO">
    select * from xfsg_shop_audit_info
    where shop_id = #{shopId} and audit_type =#{auditType}
  </select>
</mapper>