String orderid = dga.getParam("orderid");
String contno = dga.getParam("contno");
String startdate =dga.getParam("startdate");
String paymode = dga.getParam("paymode");
StringBuilder sql = new StringBuilder();
sql.append("SELECT o1.* FROM order_refund_examine o1 LEFT JOIN order_new_covenant o2 ON (o1.policy_no = o2.policy_no) WHERE o2.app_status = 'SURRENDER_SUCCESS' AND (o1.operate_type = 1 OR o1.operate_type = 3) ");
ArrayList<String> arr = new ArrayList<>();
if(orderid != null && !"".equals(orderid)){
sql.append(" and o1.order_id = ?");
arr.add(orderid);
}
if(contno != null && !"".equals(contno)){
sql.append(" and o1.policy_no = ?");
arr.add(contno);
}
if(startdate != null && !"".equals(startdate)){
sql.append(" and o1.surrender_date = ?");
arr.add(startdate);
}
if(paymode != null && !"".equals(paymode)){
sql.append(" and o1.pay_method = ?");
arr.add(paymode);
}
System.out.println(sql.toString());
QueryBuilder qb = new QueryBuilder(sql.toString());
qb.setParams(arr);
DataTable paymethod = qb.executeDataTable();
}
使用 case when then 语法做处理
select pay_method when 'WECHAT' then '微信支付' when 'ALIPAY' then '支付宝支付' from order_refund_examine 这样对吗
@zzc111:
select case pay_method when 'WECHAT' then '微信支付' when 'ALIPAY' then '支付宝支付' end from order_refund_examine
@刘宏玺: 谢谢
可是jsp取的时候该怎么写呢
@zzc111: (case 。。。 end) as 名称 外面获取时,用“名称”即可