<?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.ssj.service.mapper.LibManagerAuditMapper">
    <select id="findPageByType" resultType="com.ssj.service.sys.curator.dto.CuratorAuditDTO">
        select tb_lib_manager_audit.id, tb_lib_manager_audit.name      curator_name,
               tb_lib_manager_audit.telephone,
               tb_lib_join.league_name        lib_name,
               tb_lib_manager_audit.last_update_time applyTime
        from tb_lib_manager_audit,
             tb_lib_join
        where tb_lib_manager_audit.lib_id = tb_lib_join.id
          and tb_lib_manager_audit.type = #{type}
          and tb_lib_manager_audit.status = 3
          <if test="name neq ''">
              and tb_lib_manager_audit.name like '%${name}%'
          </if>
    </select>

    <select id="findPageByName" resultType="com.ssj.bean.weixin.libmy.domain.TbLibManagerAudit">
            select  t.*
            from tb_lib_manager_audit t
            where t.type = 17
        <if test="name !=null and name!=''">
                and t.name regexp #{name}
            </if>
        <if test="subject !=null and subject!=''">
            union  select  t.*
            from tb_lib_manager_audit t
            where t.type = 17
             and t.subject regexp #{subject}
        </if>
        <if test="authority !=null and authority!=''">
            union  select  t.*
            from tb_lib_manager_audit t
            where t.type = 17
            and t.authority regexp concat('[',#{authority},']')
        </if>
        and t.status = 3
        </select>

</mapper>