<?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.system.app.mapper.ShopMoneyMapper">

    <select id="findByOrgCode" resultType="org.jeecg.modules.system.app.entity.ShopMoney">
        select  a.id,
                a.org_code ,
                a.dept_id ,
                a.pend_settlement_money ,
                a.can_balance ,
                a.received_amount ,
                a.create_time ,
                a.update_time ,
                a.receip_payment_details_id ,
                b.account_status
        from nm_shop_money a
        left join  nm_separate_accounts  b on a.dept_id =b.dept_id
        where a.org_code =#{orgCode} limit 1
    </select>
    <select id="findPage" resultType="org.jeecg.modules.system.app.entity.ShopMoney">
        SELECT a.id,
        a.org_code ,
        a.dept_id ,
        a.pend_settlement_money ,
        a.can_balance ,
        a.received_amount ,
        a.create_time ,
        a.update_time ,
        a.receip_payment_details_id ,
        b.account_status,b.name as siteName,b.cover as siteCover FROM nm_shop_money a
        inner join nm_site b on a.org_code = b.org_code
        where 1=1
        <if test="shopMoney != null and shopMoney != ''">
            <if test="shopMoney.siteName != null and shopMoney.siteName  != ''">
                AND b.name = #{shopMoney.siteName}
            </if>
        </if>
    </select>
</mapper>