|
@@ -16,28 +16,30 @@ import org.apache.ibatis.annotations.Select;
|
|
|
public interface UserMapper extends BaseMapper<User> {
|
|
public interface UserMapper extends BaseMapper<User> {
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 按手机号模糊 / 用户ID精确搜索用户,LEFT JOIN 入驻信息,返回聚合结果。
|
|
|
|
|
- * 未提交入驻信息的用户,入驻相关字段为 null。
|
|
|
|
|
- * phone 和 userId 至少传一个,同时传时 phone 优先。
|
|
|
|
|
- *
|
|
|
|
|
- * @param page 分页参数
|
|
|
|
|
- * @param phone 手机号关键词(LIKE 模糊匹配,可选)
|
|
|
|
|
- * @param userId 用户ID(精确匹配,可选)
|
|
|
|
|
- * @return 分页聚合结果
|
|
|
|
|
|
|
+ * 以用户表为主,LEFT JOIN 入驻信息搜索。
|
|
|
|
|
+ * 未入驻用户的入驻字段为 null。
|
|
|
|
|
+ * noLicense=true 只返回没有入驻信息的用户。
|
|
|
|
|
+ * phone 和 userId 必须至少传一个,同时传时 phone 优先。
|
|
|
*/
|
|
*/
|
|
|
@Select("<script>" +
|
|
@Select("<script>" +
|
|
|
"SELECT u.id AS userId, u.phone, u.nickname, u.wechat_nickname, u.status AS userStatus, " +
|
|
"SELECT u.id AS userId, u.phone, u.nickname, u.wechat_nickname, u.status AS userStatus, " +
|
|
|
"u.create_time, u.membership_level, u.membership_expire_at, " +
|
|
"u.create_time, u.membership_level, u.membership_expire_at, " +
|
|
|
"bl.id AS licenseId, bl.store_name, bl.terminal_type, " +
|
|
"bl.id AS licenseId, bl.store_name, bl.terminal_type, " +
|
|
|
- "bl.contact_person, bl.contact_phone, bl.review_status, bl.status AS syncStatus, bl.external_id " +
|
|
|
|
|
|
|
+ "bl.province, bl.city, bl.district, bl.store_address, " +
|
|
|
|
|
+ "bl.contact_person, bl.contact_phone, bl.credit_code, " +
|
|
|
|
|
+ "bl.license_image_url, bl.drug_license_url, " +
|
|
|
|
|
+ "bl.medical_device_class2_url, bl.medical_device_class3_url, " +
|
|
|
|
|
+ "bl.review_status, bl.reject_reason, bl.remark, bl.status AS syncStatus, bl.external_id " +
|
|
|
"FROM t_user u LEFT JOIN t_business_license bl ON u.id = bl.user_id " +
|
|
"FROM t_user u LEFT JOIN t_business_license bl ON u.id = bl.user_id " +
|
|
|
"<where>" +
|
|
"<where>" +
|
|
|
- "<if test='phone != null and phone != \"\"'>u.phone LIKE CONCAT('%', #{phone}, '%')</if>" +
|
|
|
|
|
- "<if test='userId != null'>u.id = #{userId}</if>" +
|
|
|
|
|
|
|
+ "<if test='noLicense != null and noLicense == true'>bl.id IS NULL</if>" +
|
|
|
|
|
+ "<if test='phone != null and phone != \"\"'>AND u.phone LIKE CONCAT('%', #{phone}, '%')</if>" +
|
|
|
|
|
+ "<if test='userId != null'>AND u.id = #{userId}</if>" +
|
|
|
"</where>" +
|
|
"</where>" +
|
|
|
"ORDER BY u.create_time DESC" +
|
|
"ORDER BY u.create_time DESC" +
|
|
|
"</script>")
|
|
"</script>")
|
|
|
IPage<AdminUserDetailResponse> selectUsersWithLicense(Page<?> page,
|
|
IPage<AdminUserDetailResponse> selectUsersWithLicense(Page<?> page,
|
|
|
@Param("phone") String phone,
|
|
@Param("phone") String phone,
|
|
|
- @Param("userId") Long userId);
|
|
|
|
|
|
|
+ @Param("userId") Long userId,
|
|
|
|
|
+ @Param("noLicense") Boolean noLicense);
|
|
|
}
|
|
}
|