Blame view

FinalMatchMemberMapper.xml 4.13 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
<?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>