Liferay对union的处理

Liferay
Liferay
荒--

Liferay中在Finder里面不支持unio的查询,建议采用原生SQL方式查询

如下

//获取待办流程--优化后的方法(只需要id字符串集合)
	public static String getFlow2(ActionRequest request, long userId){
		String flowIds = "";//获取所有流程id拼接的字符串
		String[] arr = getConfig(request);		
		String url = "jdbc:mysql://"+ arr[1] +":"+arr[2]+ "/" + arr[3] + "?user="+arr[4]+"&password="+arr[5]+"&useUnicode=true&characterEncoding=UTF8";
		Connection conn = null;
		PreparedStatement ps = null;
		ResultSet rs = null;
		String sql = null;
		Map<String,Object> rowData = null;
		try {
			conn = DriverManager.getConnection(url);
			sql = "SELECT GROUP_CONCAT(t.flowId)  AS flowId FROM " + 
			     "(SELECT * FROM wf_Flow flow WHERE flow.status = 0 AND flow.startUserId = ? " +  
					 "UNION " + 
				  "SELECT * FROM wf_Flow flow WHERE flow.status = 1 AND flow.startUserId = ? AND flow.curPostId = '' " +
					"UNION " +
				  "SELECT flow.* FROM wf_Flow flow, (" +
						"select DISTINCT p.* from " +
						  "Post p, MyUser
©️2020 CSDN 皮肤主题: 1024 设计师: 上身试试 返回首页
实付9.90元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值