1,controller如何接收来自jsp的数组值?
例如,我有一组name相同的checkbox。如何在controller接收呢?我知道如果是单值的话,可以直接用@PathVariable Classname name来接收,如果是数组就不知道怎么办了。
2,继承PagingAndSortingRepository,JpaSpecificationExecutor的DAO如何进行sql拼装呢?
[code="java"]public interface GategoryDao extends
PagingAndSortingRepository,
JpaSpecificationExecutor{
}[/code]
@Modifying @Query 只能是一条写好的sql语句
例如我想修改id为1,2,4分类gategory的visible为false。这时我想用delete(Long[] ids);实现。该怎么写呢?
[align=center]感谢您的回复[/align]
数组的话 就直接 定义 如Long[] ids 传参数时名字都是 ids即可 可以看我博客的数据绑定
[code="java"] @RequestMapping(value = "/pull", method = RequestMethod.POST)
public String featureFormList(@RequestParam(value = "ids", required = false) String[] idsArray,
@RequestParam(value = "applyIds", required = false) String[] applyIdsArray, RedirectAttributes redirectAttributes) {
//业务代码
}[/code]
PagingAndSortingRepository 你用的应该是Spring-data-jpa吧.
目前无法进行sql拼装,只有些多个方法接口.