<?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.lantone.daqe.mapper.RegularInfoMapper">

    <select id="getRegularPage" resultType="com.lantone.daqe.dto.GetRegularPageDTO">
        SELECT DISTINCT
            dri.id,
            dri.`name`,
            dri.val,
            dri.description,
        CASE WHEN drm.id is NULL THEN 0
            ELSE 1 END AS relation
        FROM
            `dc_regular_info` dri
        LEFT JOIN dc_regular_mapping drm ON dri.id = drm.regular_id
        WHERE dri.is_deleted = 'N'
        <if test="getRegularPageVO.name != null and getRegularPageVO.name != ''">
            AND dri.`name` LIKE CONCAT('%',#{getRegularPageVO.name},'%')
        </if>
    </select>
</mapper>