<?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.yeejoin.equipmanage.mapper.RiskSourceMapper">
    <select id="findByIsRegion" resultType="com.yeejoin.equipmanage.common.dto.FireRiskSourceDto">
        SELECT
            a.id,
            a.`name`,
            a.parent_id,
            a.`code` AS mrid
        FROM
            `f_risk_source` a
        <where>
            <choose>
                <when test="isRegion">
                    a.is_region = 'TRUE'
                </when>
                <otherwise>
                    a.is_region = 'FALSE'
                </otherwise>
            </choose>
        </where>
    </select>
    <select id="findAll" resultType="com.yeejoin.equipmanage.common.dto.FireRiskSourceDto">
        SELECT
            a.id,
            a.`name`,
            a.parent_id,
            a.`code` AS mrid
        FROM
            `f_risk_source` a
    </select>
</mapper>