代码如下:
先创建一个Provider类:

public class RptEbankFsymtTranflowingProvider {
	
	public String select(String orgId, String startDate, String endDate, String merId) {
		String sql = "select * from RPT_EBANK_FSYMT_TRANFLOWING where 1=1";
		if (orgId != null) {
			sql += " and ORG_ID=#{orgId}";
		}
		if (startDate != null) {
			sql += " and DATA_DT>=#{startDate}";
		}
		if (endDate != null) {
			sql += " and DATA_DT<=#{endDate}";
		}
		if (merId != null) {
			sql += " and MER_ID=#{merId}";
		}
		return sql;
	}
}

然后在代码中类似如下使用它:

@Mapper
public interface RptEbankMerchantDetailMapper {
	// 查询所有数据
    @Select("select * from RPT_EBANK_MERCHANT_DETAIL")
    List<RptEbankMerchantDetail> getAllRptEbankMerchantDetail();
    
    @SelectProvider(method = "select", type = RptEbankMerchantDetailProvider.class)
    List<RptEbankMerchantDetail> getRptEbankMerchantDetail(@Param("orgId") String orgId, 
    															@Param("startDate") String startDate, 
    															@Param("endDate") String endDate, 
    															@Param("merId") String merId);
}

相关文章:

  • 2021-07-26
  • 2022-01-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-09-10
  • 2021-08-20
猜你喜欢
  • 2021-10-09
  • 2022-12-23
  • 2021-08-11
  • 2021-12-16
  • 2021-10-08
  • 2021-10-21
  • 2022-12-23
相关资源
相似解决方案