<?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="org.sky.scientific.mapper.FeedBackMapper">



    <resultMap id="ResultMap" type="org.sky.scientific.pojo.entity.FeedBackEntity">
        <result column="id" property="id"/>
        <result column="tenant_id" property="tenantId"/>
        <result column="type" property="type"/>
        <result column="remark" property="remark"/>
        <result column="attachment" property="attachment"/>
        <result column="userName" property="userName"/>
        <result column="tenantName" property="tenantName"/>
        <result column="create_user" property="createUser"/>
        <result column="create_dept" property="createDept"/>
        <result column="create_time" property="createTime"/>
        <result column="update_user" property="updateUser"/>
        <result column="update_time" property="updateTime"/>
        <result column="status" property="status"/>
        <result column="is_deleted" property="isDeleted"/>
    </resultMap>

    <select id="selectFeedBackPage" resultMap="ResultMap">
        SELECT
        f.id, f.tenant_id, f.type,f.remark,f.attachment,f.create_user,f.create_time,
        u.real_name as userName,
        t.tenant_name as tenantName
        FROM kd_feedback f
        LEFT JOIN kd_user u on u.id = f.create_user
        LEFT JOIN kd_tenant t on t.tenant_id = f.tenant_id
        <where>
            <if test="ew.tenantId!='000000'">and f.tenant_id = #{ew.tenantId}</if>
        </where>
    </select>

</mapper>
