FinalMatchMemberMapper.xml 4.13 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.zhongzhi.dao.FinalMatchMemberDAO">

    <select id="registerMembers" parameterType="long" resultType="com.zhongzhi.vo.college.RegisterMembersVO">
        SELECT
            t.id,
            t.project_id,
            t3.college,
            t2.`name` as userName,
            t2.type,
            t2.telephone,
            t.id_card,
            t3.project_name,
            t.member_type
        FROM
            final_match_member t
            LEFT JOIN project_member t2 ON t.member_id = t2.id
            LEFT JOIN project t3 ON t.project_id = t3.id
        WHERE
            t.delete_time IS NULL
            AND t2.delete_time IS NULL
            AND t3.delete_time IS NULL
            and t.project_id is not null
            AND t.college_id =#{collegeId}
            and t3.match_id = #{matchId}
    </select>

    <select id="otherMembers" resultType="com.zhongzhi.vo.college.RegisterMembersVO">
        SELECT
            t.id,
            t4.`name` as college,
            t.user_name,
            t.member_type,
            t.telephone,
            t.id_card,
            t3.project_name
        FROM
            final_match_member t
            LEFT JOIN project t3 ON t.project_id = t3.id
			left join colleges_dict t4 on t.college_id = t4.id
        WHERE
            t.delete_time IS NULL
            AND t3.delete_time IS NULL
            and t.project_id is null
            AND t.college_id =#{collegeId}
            and t.match_id = #{matchId}
            and t.member_type != '车'
    </select>

    <select id="cars" resultType="com.zhongzhi.vo.college.RegisterMembersVO">
        SELECT
            t.id,
            t4.`name` as college,
            t.user_name,
            t.member_type,
            t.telephone,
            t.id_card,
            t3.project_name
        FROM
            final_match_member t
            LEFT JOIN project t3 ON t.project_id = t3.id
			left join colleges_dict t4 on t.college_id = t4.id
        WHERE
            t.delete_time IS NULL
            AND t3.delete_time IS NULL
            and t.project_id is null
            AND t.college_id =#{collegeId}
            and t.match_id = #{matchId}
            and t.member_type = '车'
    </select>

    <select id="latestUpdateTime" parameterType="long" resultType="string">
       SELECT
	max( ddd )
FROM
	(
	SELECT
		max( t.update_time ) ddd
	FROM
		final_match_member t
	WHERE
		t.college_id = #{collegeId} UNION
	SELECT
		max( t1.create_time ) ddd
	FROM
		final_match_member t1
	WHERE
		t1.college_id = #{collegeId}  UNION
	SELECT
		max( t2.delete_time ) ddd
	FROM
		final_match_member t2
	WHERE
	t2.college_id = #{collegeId}
	) t4
    </select>


    <select id="schools" resultType="com.zhongzhi.vo.college.SchoolsVO">
            SELECT
            t.college_id,
            t3.NAME,
            count( 1 ) AS cnt
            FROM
            final_match_member t
            LEFT JOIN colleges_dict t3 ON t.college_id = t3.id
            WHERE
            t.delete_time IS NULL
            AND t.match_id = #{matchId}
            <if test="name != null and name != ''">
                and t3.`name` like concat('%', #{name}, '%')
            </if>
            and t.member_type != '车'
        GROUP BY
            t.college_id
    </select>

    <select id="exportList"  resultType="com.zhongzhi.vo.college.ExportListVO">
       SELECT
        t2.`name` collegeName,
        t.user_name,
        t.member_type,
        t.telephone,
        t.id_card,
        t4.project_name
        FROM
        final_match_member t
        LEFT JOIN colleges_dict t2 ON t.college_id = t2.id
        LEFT JOIN project t4 ON t.project_id = t4.id
        WHERE
            t.delete_time IS NULL
            AND t2.delete_time IS NULL
            AND t4.delete_time IS NULL
            AND t.match_id =#{matchId}
            <if test="collegeId != null and collegeId != ''">
                and t.college_id = #{collegeId}
            </if>
        ORDER BY
        t2.`name`,
        t4.project_name DESC,
        t.order_no
    </select>

</mapper>