<?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="org.jeecg.modules.hanHaiMember.mapper.HanHaiMemberMapper">

    <select id="getMyUser" resultType="org.jeecg.modules.hanHaiMember.resp.MyUserResp">
        SELECT a.id,a.nick_name name,(SELECT count(1) FROM hotel_lease_log WHERE user_id = a.id AND del_flag = 0 AND `status` = 0) num FROM han_hai_member a
        WHERE  a.shop_id = #{shopId}
    </select>

    <select id="getShopIndex" resultType="org.jeecg.modules.hanHaiMember.resp.ShopIndexResp">
        select (select count(1) from han_hai_member where shop_id = #{shopId}) user,
    (select count(1) from hotel_order where shop_id = #{userId} and del_flag = 0 and status in (1,2,15) and type = 0) lease,
           (select count(1) from hotel_order where shop_id = #{userId} and del_flag = 0 and status in (4,5,6,15,16) and type = 1) wash,
           (select count(1) from hotel_order where shop_id = #{userId} and del_flag = 0 and status in (7,8,9,10,15) and type = 2) worn,
           (select count(1) from hotel_order where shop_id = #{userId} and del_flag = 0 and status in (11,12,13,14,15) and type = 3) refund
    </select>

    <update id="updateUserId">
        UPDATE han_hai_member SET id = #{newId} WHERE id = #{oldId}
    </update>

</mapper>