<?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.springblade.modules.xlfk.mapper.XlfkMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="xlfkResultMap" type="org.springblade.modules.xlfk.pojo.entity.XlfkEntity">
        <result column="xllx" property="xllx"/>
        <result column="xllcs" property="xllcs"/>
        <result column="start_time" property="startTime"/>
        <result column="end_time" property="endTime"/>
        <result column="zp" property="zp"/>
    </resultMap>

    <select id="selectXlfkPage" resultMap="xlfkResultMap">
        SELECT
            *
        FROM
            jdrh.xlfk xl
        LEFT JOIN jdrh.blade_dept bd ON bd.id = xl.create_dept
        WHERE
            xl.is_deleted = 0
          AND (bd.parent_id = #{params.pcsId} :: int8 OR bd.ancestors LIKE '%' || #{params.deptId} || '%')
    </select>

    <select id="exportXlfk" resultType="org.springblade.modules.xlfk.excel.XlfkExcel">
        SELECT * FROM xlfk ${ew.customSqlSegment}
    </select>

</mapper>
