主题 : 3.0.2 如何自己写一个多条件查询的标签~ |
级别: 白丁
![]() |
1# 发表于:2011-04-11 12:34:00 IP:124.225.*.*
|
||||
---|---|---|---|---|---|
级别: 白丁
![]() |
3# 发表于:2011-04-11 14:36:37 IP:124.225.*.*
谢谢你~!我的意思我已经我在自己写标签的时候 那个条件该如何传进去,我仿照cms_content_list 写了个标签 这是从MyproductDirective 类中最终调用getList() 的DAO 的实现类..
@Repository public class MyProductDaoImpl extends HibernateBaseDao<MyProduct,Integer>implements MyProductDao { @SuppressWarnings("unchecked") public List<MyProduct> getList() { return find(byNothing()); } private Finder byNothing(){ Finder f = Finder.create(); f.append("from MyProduct");//可以在此处添加查询条件或者添加各种方法进行动态查询 f.setCacheable(true); return f; } @Override protected Class<MyProduct> getEntityClass() { return MyProduct.class; } 下面是MyProductDirective 类 public void execute(Environment env, Map params, TemplateModel[] loopVars, TemplateDirectiveBody body) throws TemplateException, IOException { //获取站点 CmsSite site = FrontUtils.getSite(env); //获取内容列表 List<MyProduct> list = getList(params, env); Map<String, TemplateModel> paramWrap = new HashMap<String, TemplateModel>(params); //OUT_LIST值为tag_list,将内容列表放入其中 paramWrap.put(DirectiveUtils.MY_PRODUCT_OUT_LIST, DEFAULT_WRAPPER.wrap(list)); //将params的值复制到variable中 Map<String, TemplateModel> origMap = DirectiveUtils.addParamsToVariable(env, paramWrap); //没有采用默认的模板,直接采用自己写的简单的模板(mycontent_list.html) FrontUtils.includeTpl(TPL_NAME, site, params, env); //将variable中的params值移除 DirectiveUtils.removeParamsFromVariable(env, paramWrap, origMap); } 在这个方法里怎么获取到传入的多种查询的条件???谢谢了。。 |
||
---|---|---|---|
级别: 总版主
![]() |
4# 发表于:2011-04-11 14:44:40 IP:59.152.*.*
详细的代码编写不在版主的回复范围之内哦,版主只负责系统使用方面问题的回复
|
||
---|---|---|---|
1
共1页