Flask接口签名sign原理与实例代码浅析
708
2022-08-30
MyBatis如何进行双重foreach循环
目录进行双重foreach循环使用场景mybatis foreach循环,传入多个参数上代码
进行双重foreach循环
mapname是一个Map
#{key1},
#{key2},
#{value2}
使用场景
比如说一个付款人下面对应的运单的金额,那么key1就是付款人编号,key2是运单编号,value2是分摊的金额
mybatis foreach循环,传入多个参数
上代码
controller:
@RequestMapping(value = "/findPage", method = RequestMethod.POST)
@ResponseBody
public Object findPage(@RequestParam(required=false) String jobCategory,@RequestParam(required=false) String ids,@RequestParam(required=false) String cities) {
try {
List
List
List
//按照城市名称和工种查询
if(StringUtils.isNotBlank(jobCategory) && StringUtils.isNotBlank(cities)){
String[] temp = jobCategory.split(",");
String[] cityTemp = cities.split(",");
for(int i=0;i listJob.add(Integer.valueOf(temp[i])); } for(int i=0;i listCities.add(cityTemp[i]); } List return new ExtGridReturn(list.size(), list); } //按照工种查询 if(StringUtils.isNotBlank(jobCategory)){ String[] temp = jobCategory.split(","); for(int i=0;i listJob.add(Integer.valueOf(temp[i])); } } //按照职位名称查询 if(StringUtils.isNotBlank(ids)){ String[] temp = ids.split(","); for(int i=0;i listIds.add(Integer.valueOf(temp[i])); } } //按照城市查询 if(StringUtils.isNotBlank(cities)){ String[] temp = cities.split(","); for(int i=0;i listCities.add(temp[i]); } } List JJMdkjNsafreturn new ExtGridReturn(list.size(), list); } catch (Exception e) { LOGGER.error("分页获取信息出错", e); return new ExceptionReturn(e); } } mapper /** * 描述:根据工种查询列表 * @param jobCategorys * @return */ List xml JJMdkjNsaf select n.ID id, n.NAME name, n.WORKPLACE workPlace, n.JOBCATEGORY jobCategory, n.SALARY salary, n.RESPONSIBILITIES responsibilities, n.REQUIREMENTS requirements, n.ISHOT isHot, n.UPDATEDATE updateDate, n.UPDATEUSER updateUser, u.real_name updateName from websites_job n left join base_users u on n.updateUser = u.account or n.jobCategory in #{itJJMdkjNsafem} or n.id in #{item} or n.WORKPLACE in #{item} order by n.ISHOT,n.ID desc
listJob.add(Integer.valueOf(temp[i]));
}
for(int i=0;i listCities.add(cityTemp[i]); } List return new ExtGridReturn(list.size(), list); } //按照工种查询 if(StringUtils.isNotBlank(jobCategory)){ String[] temp = jobCategory.split(","); for(int i=0;i listJob.add(Integer.valueOf(temp[i])); } } //按照职位名称查询 if(StringUtils.isNotBlank(ids)){ String[] temp = ids.split(","); for(int i=0;i listIds.add(Integer.valueOf(temp[i])); } } //按照城市查询 if(StringUtils.isNotBlank(cities)){ String[] temp = cities.split(","); for(int i=0;i listCities.add(temp[i]); } } List JJMdkjNsafreturn new ExtGridReturn(list.size(), list); } catch (Exception e) { LOGGER.error("分页获取信息出错", e); return new ExceptionReturn(e); } } mapper /** * 描述:根据工种查询列表 * @param jobCategorys * @return */ List xml JJMdkjNsaf select n.ID id, n.NAME name, n.WORKPLACE workPlace, n.JOBCATEGORY jobCategory, n.SALARY salary, n.RESPONSIBILITIES responsibilities, n.REQUIREMENTS requirements, n.ISHOT isHot, n.UPDATEDATE updateDate, n.UPDATEUSER updateUser, u.real_name updateName from websites_job n left join base_users u on n.updateUser = u.account or n.jobCategory in #{itJJMdkjNsafem} or n.id in #{item} or n.WORKPLACE in #{item} order by n.ISHOT,n.ID desc
listCities.add(cityTemp[i]);
}
List
return new ExtGridReturn(list.size(), list);
}
//按照工种查询
if(StringUtils.isNotBlank(jobCategory)){
String[] temp = jobCategory.split(",");
for(int i=0;i listJob.add(Integer.valueOf(temp[i])); } } //按照职位名称查询 if(StringUtils.isNotBlank(ids)){ String[] temp = ids.split(","); for(int i=0;i listIds.add(Integer.valueOf(temp[i])); } } //按照城市查询 if(StringUtils.isNotBlank(cities)){ String[] temp = cities.split(","); for(int i=0;i listCities.add(temp[i]); } } List JJMdkjNsafreturn new ExtGridReturn(list.size(), list); } catch (Exception e) { LOGGER.error("分页获取信息出错", e); return new ExceptionReturn(e); } } mapper /** * 描述:根据工种查询列表 * @param jobCategorys * @return */ List xml JJMdkjNsaf select n.ID id, n.NAME name, n.WORKPLACE workPlace, n.JOBCATEGORY jobCategory, n.SALARY salary, n.RESPONSIBILITIES responsibilities, n.REQUIREMENTS requirements, n.ISHOT isHot, n.UPDATEDATE updateDate, n.UPDATEUSER updateUser, u.real_name updateName from websites_job n left join base_users u on n.updateUser = u.account or n.jobCategory in #{itJJMdkjNsafem} or n.id in #{item} or n.WORKPLACE in #{item} order by n.ISHOT,n.ID desc
listJob.add(Integer.valueOf(temp[i]));
}
}
//按照职位名称查询
if(StringUtils.isNotBlank(ids)){
String[] temp = ids.split(",");
for(int i=0;i listIds.add(Integer.valueOf(temp[i])); } } //按照城市查询 if(StringUtils.isNotBlank(cities)){ String[] temp = cities.split(","); for(int i=0;i listCities.add(temp[i]); } } List JJMdkjNsafreturn new ExtGridReturn(list.size(), list); } catch (Exception e) { LOGGER.error("分页获取信息出错", e); return new ExceptionReturn(e); } } mapper /** * 描述:根据工种查询列表 * @param jobCategorys * @return */ List xml JJMdkjNsaf select n.ID id, n.NAME name, n.WORKPLACE workPlace, n.JOBCATEGORY jobCategory, n.SALARY salary, n.RESPONSIBILITIES responsibilities, n.REQUIREMENTS requirements, n.ISHOT isHot, n.UPDATEDATE updateDate, n.UPDATEUSER updateUser, u.real_name updateName from websites_job n left join base_users u on n.updateUser = u.account or n.jobCategory in #{itJJMdkjNsafem} or n.id in #{item} or n.WORKPLACE in #{item} order by n.ISHOT,n.ID desc
listIds.add(Integer.valueOf(temp[i]));
}
}
//按照城市查询
if(StringUtils.isNotBlank(cities)){
String[] temp = cities.split(",");
for(int i=0;i listCities.add(temp[i]); } } List JJMdkjNsafreturn new ExtGridReturn(list.size(), list); } catch (Exception e) { LOGGER.error("分页获取信息出错", e); return new ExceptionReturn(e); } } mapper /** * 描述:根据工种查询列表 * @param jobCategorys * @return */ List xml JJMdkjNsaf select n.ID id, n.NAME name, n.WORKPLACE workPlace, n.JOBCATEGORY jobCategory, n.SALARY salary, n.RESPONSIBILITIES responsibilities, n.REQUIREMENTS requirements, n.ISHOT isHot, n.UPDATEDATE updateDate, n.UPDATEUSER updateUser, u.real_name updateName from websites_job n left join base_users u on n.updateUser = u.account or n.jobCategory in #{itJJMdkjNsafem} or n.id in #{item} or n.WORKPLACE in #{item} order by n.ISHOT,n.ID desc
listCities.add(temp[i]);
}
}
List
JJMdkjNsafreturn new ExtGridReturn(list.size(), list);
} catch (Exception e) {
LOGGER.error("分页获取信息出错", e);
return new ExceptionReturn(e);
}
}
mapper
/**
* 描述:根据工种查询列表
* @param jobCategorys
* @return
*/
List
xml
JJMdkjNsaf
select n.ID id,
n.NAME name,
n.WORKPLACE workPlace,
n.JOBCATEGORY jobCategory,
n.SALARY salary,
n.RESPONSIBILITIES responsibilities,
n.REQUIREMENTS requirements,
n.ISHOT isHot,
n.UPDATEDATE updateDate,
n.UPDATEUSER updateUser,
u.real_name updateName
from websites_job n
left join base_users u on n.updateUser = u.account
or n.jobCategory in
#{itJJMdkjNsafem}
or n.id in
#{item}
or n.WORKPLACE in
#{item}
order by n.ISHOT,n.ID desc
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~