<?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.SeparateAccountsMapper">

    <select id="findPage" resultType="org.jeecg.modules.system.app.dto.separateAccounts.FindAccountResponseDTO">
        select nsa.id, sd.depart_name as merchantName,nsa.pt_separate_accounts,
               nsa.sh_separate_accounts,nsa.md_separate_accounts,nsa.account_status,nsa.update_time
        from nm_separate_accounts nsa
        left join  sys_depart sd on nsa.dept_id =sd.id
        where nsa.del_flag=0
        <if test="findAccountRequestDTO!=null and findAccountRequestDTO!=''">
        <if test="findAccountRequestDTO.merchantName!=null and findAccountRequestDTO.merchantName!=''">
            AND sd.depart_name = #{findAccountRequestDTO.merchantName}
        </if>
        <if test="findAccountRequestDTO.accountStatus!=null">
            AND nsa.account_status = #{findAccountRequestDTO.accountStatus}
        </if>
        </if>
    </select>
</mapper>