Mapper 一对多查询xml

Mapper 一对多查询


    <resultMap id="EmployeeAccountMap"
               type="cn.com.fsg.ihrm.web.vo.employeeAccount.EmployeeAccountRespVO">
        <result property="id" column="id"/>
        <result property="employeeId" column="employee_id"/>
        <result property="bankAccountName" column="bank_account_name"/>
        <result property="bankAccountCode" column="bank_account_code"/>
        <result property="bankCode" column="bank_code"/>
        <result property="bankAreaCode" column="bank_area_code"/>
        <result property="isDefault" column="is_default"/>
        <result property="tenantId" column="tenant_id"/>
        <result property="deleted" column="deleted"/>

        <collection property="list"
                    ofType="cn.com.fsg.ihrm.web.vo.employeeAccount.EmployeeAccountAttributeRespVO"
                    column="id"
                    select="queryAccountAttributeList"/>
    </resultMap>

    <!--分页查询指定行数据-->
    <select id="queryPageList" resultMap="EmployeeAccountMap">
        select
        id,employee_id,bank_account_name,bank_account_code,bank_code,bank_area_code,is_default,tenant_id,deleted
        from t_employee_account
        where
        deleted = 0
        <if test="reqVO.employeeId != null and reqVO.employeeId != ''">
            and employee_id = #{employeeId}
        </if>
        <if test="reqVO.isDefault != null and reqVO.isDefault != ''">
            and is_default = #{reqVO.isDefault}
        </if>
        <if test="reqVO.tenantId != null and reqVO.tenantId != ''">
            and tenant_id = #{reqVO.tenantId}
        </if>
    </select>


    <resultMap id="EmployeeAccountAttributeMap"
               type="cn.com.fsg.ihrm.web.vo.employeeAccount.EmployeeAccountAttributeRespVO">
        <result property="id" column="id"/>
        <result property="employeeAccountId" column="employee_account_id"/>
        <result property="employeeId" column="employee_id"/>
        <result property="attributeType" column="attribute_type"/>
        <result property="attributeValue" column="attribute_value"/>
        <result property="tenantId" column="tenant_id"/>
    </resultMap>

    <!-- 查询所有子表数据 -->
    <select id="queryAccountAttributeList" resultMap="EmployeeAccountAttributeMap">
        select
        id,employee_account_id,employee_id,attribute_type,attribute_value,tenant_id
        from t_employee_account_attribute
        where
        deleted = 0
        and employee_account_id = #{id}
    </select>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Java知识技术分享

感谢支持!

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值