<?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="vip.xiaonuo.disk.mapper.ExamineMapper">
  <select id="queryList" resultType="vip.xiaonuo.disk.vo.examine.ExamineVo">
      SELECT
          a.user_file_id userFileId,
          a.file_id fileId,
          a.file_name fileName,
          su.name createUser,
          a.examine_status examineStatus,
          a.examine_reason examineReason,
          a.create_time createTime,
          b.file_size fileSizeNum,
          o.name orgName
      FROM
          userfile a
      LEFT JOIN FILE b ON
      a.file_id = b.file_id
      LEFT JOIN sys_user su ON a.CREATE_USER_ID=su.id
      LEFT JOIN sys_org o ON su.ORG_ID =o.id
      <where>
          <if test="examineReq.examineStatus!=null">
              a.examine_status = #{examineReq.examineStatus}
          </if>
          <if test="examineReq.fileName!=null">
              and a.file_name like concat('%',#{examineReq.fileName},'%')
          </if>
          <if test="examineReq.orgName!=null">
             and o.name like concat('%',#{examineReq.orgName},'%')
          </if>
      </where>
  </select>

    <update id="pass" parameterType="vip.xiaonuo.disk.domain.Examine">
        update examine
        set examine_status = #{examineStatus},
            examine_time = #{examineTime},
            examine_user = #{examineUser},
            examine_reason = #{examineReason}
        where target_id = #{targetId}
    </update>

    <select id="detail" resultType="map">
        SELECT
            a.user_file_id userFileId,
            a.file_id fileId,
            a.file_name fileName,
            su.name createUser,
            a.examine_status examineStatus,
            a.examine_reason examineReason,
            a.create_time createTime,
            b.file_size fileSizeNum,
            o.name orgName
        FROM
            userfile a
        LEFT JOIN FILE b ON
        a.file_id = b.file_id
        LEFT JOIN sys_user su ON a.CREATE_USER_ID=su.id
        LEFT JOIN sys_org o ON su.ORG_ID =o.id
        where a.user_file_id=#{userFileId}
    </select>
</mapper>
