<?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.rule.mapper.RuleMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="ruleResultMap" type="org.springblade.modules.rule.entity.RuleEntity">
        <result column="id" property="id"/>
        <result column="sbsj" property="sbsj"/>
        <result column="xbsj" property="xbsj"/>
        <result column="dkfw" property="dkfw"/>
        <result column="create_time" property="createTime"/>
        <result column="update_time" property="updateTime"/>
    </resultMap>


    <select id="selectRulePage" resultType="org.springblade.modules.rule.vo.RuleVO">
        SELECT
            sr.sbsj,
            sr.xbsj,
            sr.dkfw,
            bu.phone,
            jj.jwsmc,
            jj.jwzjd,
            jj.jwzwd
        FROM
            sign_rule sr
        LEFT JOIN blade_user bu ON bu.ID = #{userId}
        LEFT JOIN user_jws uj ON uj.user_id = #{userId}
        LEFT JOIN jlrh_jws jj ON jj.ID = uj.jws_id
    </select>

    <select id="exportRule" resultType="org.springblade.modules.rule.excel.RuleExcel">
        SELECT * FROM sign_rule ${ew.customSqlSegment}
    </select>

</mapper>
