工作中ibatis中的连表查询及in()的使用案例
作者:互联网
public class CbExchangeOrderArr extends BaseBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = -1213585508833130943L;
/**
* 订单号
*/
private Long id;
/**
* 创建时间
*/
private Date createTime;
/**
* 修改时间
*/
private Date modifyTime;
/**
* 有效期截止时间
*/
private Date expirationTime;
/**
* 商户端系统的订单号/流水号
*/
private String orderIdIn3rdSys;
/**
* 批次号
*/
private String batchNumber;
/**
* 子批次号
*/
private String subBatchNumber;
/**
* 付款人ID
*/
private String payerId;
/**
* 是否商户
*/
private String isMerchant;
/**
* 付款人信息
*/
private Long payerInfoId;
/**
* 源币种
*/
private String sourceCurrency;
/**
* 源金额
*/
private BigDecimal sourceAmount;
/**
* 源实付金额
*/
private BigDecimal sourceActualAmount;
/**
* 汇率
*/
private String exchangeRate;
/**
* 收款人ID
*/
private Long payeeId;
/**
* 是否商户
*/
private String isMerchantPayee;
/**
* 收款人信息
*/
private Long payeeInfoId;
/**
* 目的币种
*/
private String targetCurrency;
/**
* 目的金额
*/
private BigDecimal targetAmount;
/**
* MCC code
*/
private String mccCode;
/**
* 状态, invalid:无效 valid:有效
*/
private String status;
/**
* 汇兑状态
*/
private String exchangeStatus;
/**
* 付款状态
*/
private String paymentStatus;
/**
* 是否被处理,Y:是 ,N:否
*/
private String isProcessed;
/**
* 是否手工退款 红冲单标识 Y:是 N:否
*/
private String isManualRefund;
/**
* 付款人类型
*/
private String payerType;
/**
* 收款人类型
*/
private String payeeType;
/**
* 冗余收款人表中的姓名
*/
private String name;
/**
* 冗余收款人表中的银行账号
*/
private String bankAccount;
/**
* 国家代码
*/
private String countryCode;
/**
* 证件类型
*/
private String idType;
/**
* 证件号
*/
private String idNumber;
/**
* 收款人地址
*/
private String address;
/**
* 收款公司名称
*/
private String companyName;
/**
* 收款银行名称
*/
private String bankName;
/**
* 收款行国别
*/
private String bankCountryCode;
/**
* 收款行地址
*/
private String bankAddress;
/**
* swift code
*/
private String swiftCode;
/**
* 大额行号
*/
private String cnapsCode;
/**
* bic
*/
private String bic;
/**
* iban
*/
private String iban;
/**
* 用户在商户下的账户
*/
private String account;
/**
* 所属商户号下的用户账号
*/
private String userIdIn3rdSys;
/**
* 账户类型(c:个人、b企业)
*/
private String bankAccountType;
private String[] orderArray;
private List<String> idList;
下面是get set方法就不贴出来了,
<typeAlias type="com.lianpay.lcpay.cb.exchangeorderserver.share.domain.CbExchangeOrderArr"
alias="CbExchangeOrderArr" />
<resultMap id="CbExchangeOrderArr" class="CbExchangeOrderArr">
<result column="ID" property="id" jdbcType="DECIMAL" />
<result column="ORDER_ID_IN3RD_SYS" property="orderIdIn3rdSys"
jdbcType="VARCHAR" />
<result column="PAYEE_INFO_ID" property="payerInfoId" jdbcType="DECIMAL" />
<result column="SOURCE_CURRENCY" property="sourceCurrency"
jdbcType="VARCHAR" />
<result column="SOURCE_AMOUNT" property="sourceAmount"
jdbcType="DECIMAL" />
<result column="EXCHANGE_RATE" property="exchangeRate"
jdbcType="VARCHAR" />
<result column="PAYER_ID" property="payeeId" jdbcType="DECIMAL" />
<result column="TARGET_CURRENCY" property="targetCurrency"
jdbcType="VARCHAR" />
<result column="TARGET_AMOUNT" property="targetAmount"
jdbcType="DECIMAL" />
<result column="MCC_CODE" property="mccCode" jdbcType="VARCHAR" />
<result column="NAME" property="name" jdbcType="VARCHAR" />
<result column="COUNTRY_CODE" property="countryCode" jdbcType="VARCHAR" />
<result column="BANK_ACCOUNT_TYPE" property="bankAccountType" jdbcType="VARCHAR" />
<result column="id_type" property="idType" jdbcType="VARCHAR" />
<result column="id_number" property="idNumber" jdbcType="VARCHAR" />
<result column="address" property="address" jdbcType="VARCHAR" />
<result column="company_name" property="companyName" jdbcType="VARCHAR" />
<result column="bank_name" property="bankName" jdbcType="VARCHAR" />
<result column="bank_account" property="bankAccount" jdbcType="VARCHAR" />
<result column="bank_country_code" property="bankCountryCode" jdbcType="VARCHAR" />
<result column="swift_code" property="swiftCode" jdbcType="VARCHAR" />
<result column="cnaps_code" property="cnapsCode" jdbcType="VARCHAR" />
<result column="bic" property="bic" jdbcType="VARCHAR" />
<result column="iban" property="iban" jdbcType="VARCHAR" />
</resultMap>
<select id="listByPrimary3rdOrderId" resultMap="CbExchangeOrderArr"
parameterClass="CbExchangeOrderArr">
select
EX.ID as ID,EX.ORDER_ID_IN3RD_SYS as ORDER_ID_IN3RD_SYS,EX.PAYER_ID as PAYER_ID ,
EX.SOURCE_CURRENCY as SOURCE_CURRENCY,EX.SOURCE_AMOUNT as SOURCE_AMOUNT,EX.EXCHANGE_RATE as EXCHANGE_RATE,
EX.PAYEE_INFO_ID as PAYEE_INFO_ID,EX.TARGET_CURRENCY as TARGET_CURRENCY ,EX.TARGET_AMOUNT as TARGET_AMOUNT,
EX.MCC_CODE as MCC_CODE
,PEE.NAME as NAME,PEE.COUNTRY_CODE as COUNTRY_CODE,PEE.BANK_ACCOUNT_TYPE as BANK_ACCOUNT_TYPE,
PEE.id_type as id_type,PEE.id_number as id_number,PEE.address as address,PEE.company_name as company_name,
PEE.bank_name as bank_name,PEE.bank_account as bank_account,PEE.bank_country_code as bank_country_code,
PEE.swift_code as swift_code,PEE.cnaps_code as cnaps_code,PEE.bic as bic, PEE.iban as iban
from
cb_exchange_order EX left join cb_payee_info PEE on (EX.payee_info_id=PEE.id)
where
EX.PAYER_ID=#payerId:DECIMAL#
and EX.STATUS=#status:VARCHAR#
and EX.ORDER_ID_IN3RD_SYS in
<iterate property="idList" open="(" close=")" conjunction=",">
<![CDATA[#idList[]#]]>
</iterate>
</select>
本人感觉还是挺笨的方法,还在改进中,上面的实体类原本为两个实体类,把他们合并成一个实体类来处理的
标签:ibatis,code,String,private,查询,连表,EX,PEE,ID 来源: https://blog.51cto.com/10983206/2564151