1.使用动态拼接SQL查询
/**
* 查询 数据
* @return
* @throws ParseException
*/
@RequestMapping("/getTableAList")
@ResponseBody
public JsonResult getTableAList(@RequestBody String json, HttpSession session){
JSONObject jsonObject = JSON.parseObject(json);//解析json
String voucherDate = jsonObject.getString("voucherDate");
String sortTag = jsonObject.getString("sortTag");
StringBuilder sb = new StringBuilder(" select distinct t.* " +
"from table_a a " +
"right join table_b b" +
"on a.id = b.a_id" +
"where a.name = " +
GetUserUtils.GetUserUnitId(session));
String[] strArr = voucherDate.split(",");
//拼接字符串
if (strArr[0] != null && !strArr[0].equals(