<?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.cyksj.mapper.HomeGroupMapper">

    <select id="getAccountIdsByUserIdOrNickNameOrSubmitAccount" resultType="java.lang.Long">
            select hp.account_id from home_group hp ,`user` u , groups_relation gr
            where  hp.relation_id = gr.id and u.id = gr.user_id
            <if test="nickName != null and nickName != ''">
                and u.nickname like '%${nickName}%'
            </if>
            <if test="userId != null ">
                and u.id = #{userId,jdbcType=BIGINT}
            </if>
            <if test="submitAccount != null and submitAccount != ''">
                and gr.account =  #{submitAccount,jdbcType=VARCHAR}
            </if>
    </select>
</mapper>