NutzCN Logo
问答 多表关联查询,查询的结果是空呢?sql放数据库查结果是正常的
发布于 2418天前 作者 西风微凉 2452 次浏览 复制 上一个帖子 下一个帖子
标签:

多表关联查询,怎么获取的res 是空的呢?

StringBuffer baseSql = new StringBuffer();
				baseSql.append(" select ")
				.append("	 t1.id, ")
				.append("	 t1.term_id, ")
				.append("	 t6.name as placeName,	 ")
				.append("	 CONCAT_WS('',	t3.pname,	t4.pname,	t5.pname) AS area, ")
				.append("	 t1.comAddr, ")
				.append("	 t1.trade_no as order_id, ")
				.append("	 t1.refund_id, ")
				.append("	 t7.name as refund_way, ")
				.append("	 t1.refund_fee, ")
				.append("	 t1.rf_time  ")
				.append("	 from tm_refund t1 ")
				.append("	 left join tm_term t2 on t1.term_id = t2.id ")
				.append("	 LEFT JOIN sys_area t3 ON t2.province = t3.id ")
				.append("	 LEFT JOIN sys_area t4 ON t2.city = t4.id ")
				.append("	 LEFT JOIN sys_area t5 ON t2.county = t5.id ")
				.append("	 left join tm_place t6 on t2.placeId = t6.id ")
				.append("	 left join sys_dict t7 on t7.id = t1.refund_way and t7.typeId=19 ")
				.append("   $condition ");
				Sql sql = Sqls.queryRecord(baseSql.toString());
				sql.setCondition(cri);
				sql.setPager(pager);
				dao().execute(sql);
		        List<Record> res = sql.getList(Record.class);
		        long totalCount = Daos.queryCount(dao(), sql);
2 回复

最前面的空格去掉试试

@wendal 可以了,和空格没关系,连错库了,有点乌龙。。
谢谢兽哥。

添加回复
请先登陆
回到顶部