| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?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.zhentao.mapper.MatchmakerMapper">
-
- <!-- 红娘VO结果映射 -->
- <resultMap id="MatchmakerVOMap" type="com.zhentao.vo.MatchmakerVO">
- <id column="matchmaker_id" property="matchmakerId"/>
- <result column="real_name" property="realName"/>
- <result column="phone" property="phone"/>
- <result column="email" property="email"/>
- <result column="gender" property="gender"/>
- <result column="birth_date" property="birthDate"/>
- <result column="avatar_url" property="avatarUrl"/>
- <result column="matchmaker_type" property="matchmakerType"/>
- <result column="level" property="level"/>
- <result column="success_couples" property="successCouples"/>
- <result column="address_detail" property="addressDetail"/>
- <result column="profile" property="profile"/>
- <result column="status" property="status"/>
- <result column="created_at" property="createdAt"/>
- <result column="province_name" property="provinceName"/>
- <result column="city_name" property="cityName"/>
- <result column="area_name" property="areaName"/>
- </resultMap>
-
- <!-- 分页查询红娘列表 -->
- <select id="selectMatchmakerPage" resultMap="MatchmakerVOMap">
- SELECT
- m.matchmaker_id,
- m.real_name,
- m.phone,
- m.email,
- m.gender,
- m.birth_date,
- m.avatar_url,
- m.matchmaker_type,
- m.level,
- m.success_couples,
- m.address_detail,
- m.profile,
- m.status,
- m.created_at,
- p.name AS province_name,
- c.name AS city_name,
- a.name AS area_name
- FROM matchmakers m
- LEFT JOIN province p ON m.province_id = p.id
- LEFT JOIN city c ON m.city_id = c.id
- LEFT JOIN area a ON m.area_id = a.id
- WHERE 1=1
- <if test="matchmakerType != null">
- AND m.matchmaker_type = #{matchmakerType}
- </if>
- <if test="level != null">
- AND m.level = #{level}
- </if>
- <if test="provinceId != null">
- AND m.province_id = #{provinceId}
- </if>
- <if test="cityId != null">
- AND m.city_id = #{cityId}
- </if>
- <if test="keyword != null and keyword != ''">
- AND (m.real_name LIKE CONCAT('%', #{keyword}, '%')
- OR m.phone LIKE CONCAT('%', #{keyword}, '%'))
- </if>
- <choose>
- <when test="orderBy == 'level'">
- ORDER BY m.level ${orderType}, m.success_couples DESC
- </when>
- <otherwise>
- ORDER BY m.success_couples ${orderType}, m.level DESC
- </otherwise>
- </choose>
- </select>
-
- <!-- 查询红娘详情 -->
- <select id="selectMatchmakerDetail" resultMap="MatchmakerVOMap">
- SELECT
- m.matchmaker_id,
- m.real_name,
- m.phone,
- m.email,
- m.gender,
- m.birth_date,
- m.avatar_url,
- m.matchmaker_type,
- m.level,
- m.success_couples,
- m.address_detail,
- m.profile,
- m.status,
- m.created_at,
- p.name AS province_name,
- c.name AS city_name,
- a.name AS area_name
- FROM matchmakers m
- LEFT JOIN province p ON m.province_id = p.id
- LEFT JOIN city c ON m.city_id = c.id
- LEFT JOIN area a ON m.area_id = a.id
- WHERE m.matchmaker_id = #{matchmakerId}
- </select>
- </mapper>
|