java
public class TxQueryDto{
...
private int[] txType;
...
java
IPage<TxClearing> selectRecordByCondition(Page page, @Param("tableName") String tableName, @Param("condition") TxQueryDto condition);
java
public List<TxClearing> queryRecordByCondition(TxQueryDto txQueryDto) {
Page page = new Page(txQueryDto.getPidx(), DEFAULT_PAGE_SIZE);
IPage<TxClearing> txClearings = managementMapper.selectRecordByCondition(
page, DbTableNameUtils.retTableNameByMonth(txQueryDto.getMonth()) + "_002", txQueryDto);
return txClearings.getRecords();
}
xml
<select id="selectRecordByCondition" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from ${tableName}
where cid=#{condition.cid,jdbcType=BIGINT}
<if test="condition.txType != null">
AND tx_type IN
<foreach collection="condition.txType" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select>