直接再自定义一个mapper.xml文件
mapper.xml文件
<?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.example.demo.dao.JournalMapper">
<resultMap id="BaseResultMap" type="com.example.demo.entity.Journal">
<result column="cdflag" jdbcType="VARCHAR" property="cd" />
<result column="subjectname" jdbcType="VARCHAR" property="journalName" />
<result column="subjectcode" jdbcType="VARCHAR" property="journalCode" />
<result column="transamount" jdbcType="REAL" property="transAmount" />
</resultMap>
<sql id="Base_Column_List">
cdflag, subjectname, subjectcode, transamount
</sql>
<select id="realResult" parameterType="String" resultMap="BaseResultMap">
select a.cdflag,b.subjectname,a.subjectcode,a.transamount
from chkdb.cash_chk_accountinginfo a join pub.sys_subjectinfo b on(a.subjectcode=b.subjectcode)
where accountserial in(select accountserial from tserial.pub_accountingserial_s where channelserial in(select ACCT_SERIAL_ID from tserial.account_loan_serial where loan_invoice_id = #{loanInvoiceId,jdbcType=VARCHAR}));
</select>
</mapper>
JournalMapper.java
package com.example.demo.dao;
import com.example.demo.entity.Journal;
import org.springframework.stereotype.Repository;
import java.util.List;
/**
* @Author: lxx
* @Date: 2021/8/2 4:37 下午
*/
@Repository
public interface JournalMapper {
List<Journal> realResult(String LoanInvoiceId);
}