把一张表中的数据即一个List作为查询另一张表的条件参数
来源:互联网 发布:java中布尔 编辑:程序博客网 时间:2024/05/16 10:58
XML查询语句:
<select id="getMatterFunForeach" parameterType="Map" resultType="hashmap"> select * from(select m.mattertitle as mattertitle,<foreach collection="list" index="index" item="item" separator="," > count(decode(f.funcode, '${item.funcode}', 1)) as ${item.funcode}isnot </foreach>from os_fun f join os_matter_fun mf on f.funcode = mf.funcode and f.funname = mf.funname join os_matter m on m.matterid = mf.matteridgroup by m.matterid,m.mattertitle)<where><if test="funcode!=null and funcode!=''">and ${funcode}ISNOT >0</if></where> </select>SpringMVC控制层:
@RequestMapping(value = "")public ModelAndView LoadMatteropen(@RequestParam(required = false,defaultValue="1") String pageNum,@RequestParam(required = false,defaultValue="20") String pageSize,@RequestParam(required = false,defaultValue="")String funcode,HttpServletRequest request, HttpServletResponse response) throws Exception {ModelAndView result = null;Map<String, Object> map = new HashMap<String, Object>();String userid = getLoginUserId(request);SysUserOrg suo = sysUserOrgService.findOrgByUserId2(userid);WorkOrg wo = null;if(suo!=null){wo= workOrgService.getWorkOrgByOrgcode(suo.getOrgCode());}int orgtype =getLoginUserInfo(request, response).getUser().getOrgtype();//获取user对象中的orgtypeif(orgtype==1){result = new ModelAndView("");result.addObject("funcode", funcode);List<OsFun> funList = osFunService.getOsFunList();if(funList.size()>0){result.addObject("funList", funList);}map.put("funcode", funcode);map.put("list", funList);Page<Map<String,Object>> mapList = osMatterService.getMatterFunForeach(map, new PageUtil(pageNum,pageSize)); result.addObject("mapList", mapList);setPageInfo(result,mapList,"",map);}result.addObject("orgtype", orgtype);load(result, request, response);return result;}freemarker页面代码:
<table class="listtable" align="center" cellpadding="0" cellspacing="1" border="0"><tr class="header"><td width="30" class="center">No</td><td class="center">局委名称</td><td width="60" class="center">办事项总数</td><#list funList as fun><td width="53" class="center">${(fun.funname)!}</td></#list></tr><!-- loop begin --><#assign i=1/><#if mapList??><#assign totalcount=0/><#list mapList as map><tr <#if map_has_next>class="trow"<#else>class="header"</#if>><#if map_has_next><td <#if map_has_next>class="center tno" <#else>class="right ttext" colspan="2"</#if>>${i}</td><#else></#if><td <#if map_has_next>class="left ttext"<#else>class="right ttext" colspan="2"</#if>>${(map['ORGNAME'])!}</td> <td class="center tlink"><#if map_has_next><a href="${RootPath}x.html?orgid=${(map['ORGID'])!}"><#if (map['COUNT'])>0>${(map['COUNT'])!}个</#if></a><#assign totalcount=totalcount+map['COUNT']/><#else><a href="${RootPath}x.html"><#if totalcount>0>${totalcount}个</#if></a></#if></td> <!-- <#list map?keys as itemKey><td class="center tlink"><a href="${RootPath}x.html?orgid=${(map['ORGID'])!}">${map[itemKey]}</a></td></#list>--> <#list funList as fun><td class="center tlink"><a href="${RootPath}x.html?<#if map_has_next>orgid=${(map['ORGID'])!}&</#if>funcode=${fun.funcode?upper_case}"><#if (map['${fun.funcode?upper_case}COUNT'])>0>${(map['${fun.funcode?upper_case}COUNT'])!}个</#if></a></td></#list></tr><#assign i++/></#list></#if><!-- loop end --></table>
0 0
- 把一张表中的数据即一个List作为查询另一张表的条件参数
- oracle 把一张表的数据放入另一张表
- mysql触发器把一张表插入的一个数据添加到另一张表
- 查询一张表的一个字段数据,修改另一张表的字段数据
- 查询一张表的数据去更新另一张表
- .net 把sql2005中一张表中的数据复制到另一张表
- .net 把sql2005中一张表中的数据复制到另一张表
- 查询一张表不在另一张表中的记录
- 根据某一条件,从一张表更新数据到另一张表的相应列
- Mysql把一个表的数据导入另一张表中的语句
- 如何用一条语句把一张表的数据插入到另一张数据库表中
- 如何用一条语句把一张表的数据插入到另一张数据库表中
- 如何把一张表里的数据update到另一张表
- mysql 查询一张表没有存在在另一张表的数据
- mysql查询数据,根据条件更新到另一张表
- mysql 一张表的数据存入另一张表
- 根据一张表去更新另一张表的数据
- SQL使用一张表的数据更新另一张表
- spring中 LobHandler 的配置
- SQL SELECT DISTINCT 语句
- MyEclipse2014新建Web Project并配置SSH
- 如何阅读一本书笔记4之主动的阅读
- 快速部署有身份验证和授权的MongoDB Replica SET复制集
- 把一张表中的数据即一个List作为查询另一张表的条件参数
- [033]八大排序算法详解——插入排序
- 665D Simple Subset
- 字符串切割componetsSeparatedByString注意
- SpringMVC Controller 介绍
- 继承
- leetcode——343——Integer Break
- 图片轮播
- c++第4次上机实验