<?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.kxs.system.biz.mapper.KxsCampReportMapper">

    <resultMap type="com.kxs.system.api.model.KxsCampReport" id="KxsCampReportMap">
        <result column="id" property="id" />
        <result column="create_time" property="createTime" />
        <result column="update_time" property="updateTime" />
        <result column="del_flag" property="delFlag" />
        <result column="version" property="version" />
        <result column="report_type" property="reportType" />
        <result column="title" property="title" />
        <result column="imgs" property="imgs" />
        <result column="status" property="status" />
        <result column="user_id" property="userId" />
        <result column="camp_id" property="campId" />
        <result column="username" property="username" />
        <result column="user_code" property="userCode" />
        <result column="remark" property="remark" />
        <result column="create_by" property="createBy" />

    </resultMap>
    <select id="selectReportPage" resultType="com.kxs.system.api.vo.admin.camp.ReportCampPageVO">
        select cr.* , c.title as camp_title
        from kxs_camp_report cr
        left join kxs_camp c on cr.camp_id = c.id
        <where>
            <if test="param.reportType != null">
                and cr.report_type = #{param.reportType}
            </if>
            <if test="param.status != null">
                and cr.status = #{param.status}
            </if>
            <if test="param.userCode != null">
                and cr.user_code = #{param.userCode}
            </if>
        </where>
        order by 
        cr.create_time desc
    </select>

</mapper>
