<?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.qmth.sop.business.mapper.SysCustomMapper">

    <select id="query" resultType="com.qmth.sop.business.bean.result.SysCustomResult">
        select a.*,su.real_name as createName,l.level from sys_custom a
        left join sys_user su on su.id = a.create_id
        left join sys_level l on l.id = a.level_id
        <where>
            <if test="type != null and type != ''">
                and a.type = #{type}
            </if>
            <if test="name != null and name != ''">
                and a.name like concat('%', #{name} , '%')
            </if>
            <if test="levelId != null and levelId != ''">
                and a.level_id = #{levelId}
            </if>
        </where>
        order by a.create_time desc
    </select>
</mapper>