<?xml version="1.0" encoding="UTF-8" ?>
<sqlGroup name="test">
    <sql id="selectByPrimaryKey">
        select
        a.id,a.username,a.name,a.sex,a.status,a.created,a.time,a.test_id,a.love_name,b.girl_name,b.status as girlStatus
        from t_test a left join t_girl b on a.id = b.id and b.age > :age
        where a.id = :id
    </sql>
    <sql id="selectByExample">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        id = :id
        <!--and username = :username-->
        <!--and name = :name-->
        <!--and sex = :sex-->
        <!--and -->
        and status = :status
        <!--and created = :created-->
        <!--and time = :time-->
        and test_id = :test_id
        <!--and love_name = :love_name-->
    </sql>

    <!--<sql id="selectById">-->
    <!--select-->
    <!--id-->
    <!--,username,name,sex,status,created,time,test_id,love_name-->
    <!--from t_test-->
    <!--where-->
    <!--id = :id-->
    <!--</sql>-->
    <sql id="selectByName">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        id = :id
        and username = :username
        <!--and name = :name-->
        <!--and sex = :sex-->
        <!--and -->
        <!--id = :id-->
        <!--and created = :created-->
        <!--and time = :time-->
        <!--and test_id = :test_id-->
        <!--and love_name = :love_name-->
    </sql>


    <sql id="deleteByKey">
        delete from t_test
        where id = :id
    </sql>
    <sql id="batchInsert">
        insert into t_test (username, name, sex, status, created, time, test_id, love_name)
        values (:username, :name, :sex, :status, :created, :time, :test_id, :love_name)
    </sql>
    <sql id="updateByPrimaryKey">
        update t_test
        set
        username = :username,name = :name,sex = :sex,status = :status,created = :created,time = :time,test_id =
        :test_id,love_name = :love_name
        where
        id = :id
    </sql>

    <sql id="getTestObject">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        id = :id
    </sql>

    <sql id="getTestList">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        status = :status
    </sql>

    <sql id="testListString">
        select
        username
        from t_test
        where
        status = :status
    </sql>

    <sql id="getTestList2">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        status = :status
    </sql>

    <sql id="getTestPageListMap">
        select
        id
        ,username,name,sex,status,created,time,test_id,love_name
        from t_test
        where
        status = :status
    </sql>

    <sql id="selectOrganizeMembsersByPage">
        select distinct a.id,a.name,a.mobile,a.sex,a.head,a.online_status,a.video_online_status,
        a.wxno,a.im_adviser,a.video_adviser,a.agent,a.honor,d.id organize_id,
        d.name organize_name,b.user_id worker_id,b.follow_service,b.toker_service,
        b.writer,b.write_time,b.write_type,b.status,b.recommend,a.photo,a.email from worker_account a
        left join organize_user_rlat b on b.user_id = a.id
        left join organize d on d.id = b.organize_id
        left join t_dm_organize_house_rlat f on f.organize_id = d.id and f.house_id = b.house_id
        where d.status = 1 and f.status = 1 and b.house_id = :houseId and b.write_type = :writeType
        and b.organize_id = :organizeId and (a.name like :keyword1 or a.mobile like :keyword2)
        order by ifnull(b.updated,b.created) desc
    </sql>

    <sql id="updateByExample">
        update t_test set love_name=:loveName  where status = :status and name = :name
    </sql>

    <sql id="updateByExample">
        update t_test set love_name=:loveName  where status = :status and name = :name
    </sql>

    <sql id="updateUserInfo">
        update c_user_info set updated = :updated, real_name = :realName,
        report_name = :reportName, visit_name = :visitName, validate_name = :validateName,
        mobile_time = :mobileTime, other_name = :otherName, source = :source
        where house_id = :houseId and brand_id = :brandId and  user_id = :userId
    </sql>
</sqlGroup>