主题 : 为什么子站的会读取到主站的数据,帖子勾选推荐后,居然主站也会读取到子站的推荐数据。。 |
级别: 白丁
|
1# 发表于:2014-06-24 17:05:46 IP:218.9.*.*
|
||||
---|---|---|---|---|---|
级别: 白丁
|
3# 发表于:2014-06-24 17:17:29 IP:218.9.*.*
模版没有任何问题,我发现似乎是因为我改造了一个地方导致的 :
private Finder byChannelIds(Integer[] channelIds, Integer[] typeIds, Boolean titleImg, Boolean recommend, String title, int orderBy, int option) { Finder f = Finder.create(); int len = channelIds.length; // 如果多个栏目 if (option == 0 || len > 1) { f.append("select bean from Content bean"); f.append(" join bean.contentExt as ext"); if (len == 1) { f.append(" where bean.channel.id=:channelId"); f.setParam("channelId", channelIds[0]); } else { f.append(" where bean.channel.id in (:channelIds)"); f.setParamList("channelIds", channelIds); } } else if (option == 1) { // 包含子栏目 f.append("select bean from Content bean"); f.append(" join bean.contentExt as ext"); f.append(" join bean.channel node,Channel parent"); f.append(" where node.lft between parent.lft and parent.rgt"); f.append(" and bean.site.id=parent.site.id"); f.append(" and parent.id=:channelId"); f.setParam("channelId", channelIds[0]); } else if (option == 2) { // 包含副栏目 f.append("select bean from Content bean"); f.append(" join bean.contentExt as ext"); f.append(" join bean.channels as channel"); f.append(" where channel.id=:channelId"); f.setParam("channelId", channelIds[0]); } else if(option==3) { //包含子栏目和副栏目 f.append("select bean from Content bean"); f.append(" join bean.contentExt as ext"); f.append(" join bean.channels as channel"); f.append(" where channel.id in(select ch.id from Channel as ch,"); f.append(" Channel ch2 where ch.lft between ch2.lft and"); f.append(" ch2.rgt and ch2.id=:channelId )"); f.setParam("channelId", channelIds[0]); } else { throw new RuntimeException("option value must be 0 or 1 or 2 OR 3."); } if (titleImg != null) { f.append(" and bean.hasTitleImg=:titleImg"); f.setParam("titleImg", titleImg); } if (recommend != null) { f.append(" and bean.recommend=:recommend"); f.setParam("recommend", recommend); } appendReleaseDate(f); appendTypeIds(f, typeIds); f.append(" and bean.status=" + ContentCheck.CHECKED); if (!StringUtils.isBlank(title)) { f.append(" and bean.contentExt.title like :title"); f.setParam("title", "%" + title + "%"); } appendOrder(f, orderBy); return f; } 在else if(option==3) { //包含子栏目和副栏目 时候里面的语句似乎过滤的有问题 您可以指导下该如何改么,因为有特别需求才需要这么展现的。 |
||
---|---|---|---|
级别: 白丁
|
5# 发表于:2014-06-24 17:23:59 IP:218.9.*.*
<div>
<h3 class="hot_1"><a href="/MoreSolutions/index.jhtml"></a></h3> [@cms_content_list count='3' titLen='18' orderBy='4' channelOption='1' channelId='192'] [#list tag_list as a] [#if a.recommend] <h2><a href="${a.url}" title="${a.title}" target="_blank">[@text_cut s=a.title len=titLen append="..."/]</a></h2> [/#if] [/#list] [/@cms_content_list] <span><a href="/MoreSolutions/index.jhtml">More</a></span> </div> 不是标签,就是把channelOption=“1”的,改成3,增加了3的值,让可以同时读取出副栏目和子栏目 |
||
---|---|---|---|
级别: 白丁
|
7# 发表于:2014-06-24 17:31:31 IP:218.9.*.*
可以的,我估计是漏了这句sql
f.append(" and bean.site.id=parent.site.id"); 模仿option=1的语句 |
||
---|---|---|---|
级别: 状元
|
8# 发表于:2014-06-24 17:35:09 IP:182.215.*.*
f.append(" and bean.site.id=parent.site.id"); 把这个加上去试试
|
||
---|---|---|---|
级别: 白丁
|
9# 发表于:2014-06-24 17:44:45 IP:218.9.*.*
已经可以了,我自己搞定了,就是少了我发的那句也就是你回复的
也很郁闷啊,你们功能不完善,研究了半天,尤其是副栏目 |
||
---|---|---|---|
1
共1页