<?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.fjhx.account.mapper.account.AccountRunningWaterMapper">
    <select id="getPage" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
        select
            arw.*,
            am.alias accountManagementName
        from account_running_water arw
                 left join  account_management am on arw.account_management_id = am.id
            ${ew.customSqlSegment}
    </select>
    <select id="getDetail" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
        select
            arw.id,
            arw.account_management_id,
            arw.status,
            arw.business_id,
            arw.amount,
            arw.currency,
            arw.name,
            arw.received,
            arw.opening_bank,
            arw.account_opening,
            arw.transaction_time,
            arw.remarks,
            arw.create_user,
            arw.create_time,
            arw.update_user,
            arw.update_time,
            am.name accountManagementName
        from account_running_water arw
                 left join  account_management am on arw.account_management_id = am.id
            where arw.id = #{id}
    </select>
    <select id="getList" resultType="com.fjhx.account.entity.account.vo.AccountRunningWaterVo">
        select
            arw.id,
            arw.account_management_id,
            arw.status,
            arw.business_id,
            IF(arw.status =20,CONCAT("-",arw.amount),arw.amount) amount,
            arw.currency,
            arw.name,
            arw.received,
            arw.opening_bank,
            arw.account_opening,
            arw.transaction_time,
            arw.remarks,
            arw.create_user,
            arw.create_time,
            arw.update_user,
            arw.update_time,
            am.alias accountManagementName
        from account_running_water arw
                 left join  account_management am on arw.account_management_id = am.id
            ${ew.customSqlSegment}
    </select>

</mapper>
