AcademyDictMapper.xml 2.91 KB
<?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.subsidy.mapper.AcademyDictMapper">

    <select id="academies" resultType="com.subsidy.vo.academy.AcademiesVO">
        SELECT distinct
        t2.id AS academy_id,
        t2.academy_name,
        t2.short_name,
        t2.location,
        t2.academy_type,
        t4.account_name,
        t4.PASSWORD,
        t4.user_name,
        t4.telephone
        FROM
        academy_dict t2
        LEFT JOIN administer_academy_mapping t5 ON t2.id = t5.academy_id
        LEFT JOIN administer t4 ON t4.id = t5.administer_id
        WHERE
        t2.delete_date IS NULL
        AND t5.delete_date IS NULL
        AND t4.delete_date IS NULL
        AND role =4
        <if test="academyName != null and academyName != ''">
            and t2.academy_name like concat('%',#{academyName} ,'%')
        </if>
    </select>

    <select id="academyAccount" resultType="com.subsidy.vo.academy.AcademyAccountVO">
        SELECT distinct
        t2.id,
        t2.user_name,
        t2.`password`,
        t2.telephone,
        t2.remark,
        t2.role,
        t2.account_name
        FROM
        administer t2
        LEFT JOIN administer_academy_mapping t1 ON t2.id = t1.administer_id
        LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
        WHERE
        t2.delete_date IS NULL
        AND t1.delete_date IS NULL
        AND t3.delete_date IS NULL
        AND t2.role = 5
        <if test="academyName != null and academyName != ''">
            and (t3.academy_name like concat('%',#{academyName} ,'%') or t2.account_name like concat('%',#{academyName}
            ,'%') )
        </if>
    </select>

    <select id="accountAcademies" parameterType="long" resultType="com.subsidy.model.AcademyDictDO">
        SELECT
            t3.*
        FROM
            administer_academy_mapping t1
            LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
        WHERE
            t1.delete_date IS NULL
            AND t3.delete_date IS NULL
            and t1.administer_id = #{administerId}
    </select>

    <select id="accountAcademyIds" parameterType="long" resultType="long">
        SELECT
            t3.id
        FROM
            administer_academy_mapping t1
            LEFT JOIN academy_dict t3 ON t1.academy_id = t3.id
        WHERE
            t1.delete_date IS NULL
            AND t3.delete_date IS NULL
            and t1.administer_id = #{administerId}
    </select>

    <select id="mainAccount" parameterType="long" resultType="com.subsidy.model.AdministerDO">
        SELECT
            t2.*
        FROM
            administer_academy_mapping t
            LEFT JOIN administer t2 ON t.administer_id = t2.id
            AND t2.role = 4
            where t.delete_date is null
            and t2.delete_date is null
            and t.academy_id = #{academyId}
    </select>

</mapper>