复选框问题

我想设置这个微博类型为复选框,可以多选,然后我的参数type该怎么写呢

 IF(a.`message` LIKE '%#今日心得与分享%',"心得与分享","管理建议") AS TYPE

上面是我定义的type

想定义type和


and 1=1 ${if(len(sentname) == 0,""," and b.`username` in ('" + sentname+ "')")}

这样的

FineReport 哎哟喂 发布于 2019-3-22 09:24 (编辑于 2019-3-22 09:25)
1min目标场景问卷 立即参与
回答问题
悬赏:4 F币 + 添加悬赏
提示:增加悬赏、完善问题、追问等操作,可使您的问题被置顶,并向所有关注者发送通知
共4回答
最佳回答
0
axingLv6专家互助
发布于2019-3-22 10:23(编辑于 2019-3-22 10:29)

试一下

select * from (
SELECT
   DATE(FROM_UNIXTIME(a.date)) AS create_time,
   b.id,
   a.`user_id`, 
   a.`message`, 
   a.`comments`, 
   a.`likes`, 
   b.email, 
   b.`username` AS sentname,
   case when a.`message` LIKE '%#今日心得与分享%' then '心得与分享' else '管理建议'end AS type
   FROM 
   `users` b, 
   `posts` a
   WHERE a.`user_id`=b.`id` 
	AND (a.`message` LIKE '#今日心得与分享%' OR a.`message` LIKE '#管理建议%') 
	AND date(from_unixtime(a.date))>='${starttime}' 
	and date(from_unixtime(a.date))<='${endtime}' 
	${if(len(sentname) == 0,""," and b.`username` in ('" + sentname+ "')")}
	) t
	where 1=1
	${if(len(type) == 0,""," and type in ('" + type+ "')")}


  • 哎哟喂 哎哟喂(提问者) 报错unknown column \'a.message\' in where clause
    2019-03-22 10:28 
  • axing axing 回复 哎哟喂(提问者) 改了,再试下
    2019-03-22 10:29 
最佳回答
0
KevinGaoLv2初级互助
发布于2019-3-22 09:27

选择下拉复选框控件

  • 哎哟喂 哎哟喂(提问者) 我的重点是设置type这个参数
    2019-03-22 09:29 
  • KevinGao KevinGao 回复 哎哟喂(提问者) 读不懂你想问啥,您的type参数干嘛用的?
    2019-03-22 09:33 
最佳回答
0
孤陌Lv6资深互助
发布于2019-3-22 09:34

下拉复选多值模糊查询-http://help.finereport.com/doc-view-2499.html 看这个就好

最佳回答
0
黄源Lv6中级互助
发布于2019-3-22 09:35(编辑于 2019-3-22 09:37)

内部用case when 把type处理成你复选框内容一致 外面套一层select 然后就可以用type in('${type}')了 如

select * from (

select case when a.message LIKE '%#今日心得与分享%' then '心得与分享'

  else '管理建议' end as type from 表 a)tt where 1=1 

${if(len(type) == 0,""," and tt.type in ('" + type+ "')")}

  • 哎哟喂 哎哟喂(提问者) 就是我引了两个表FROM `posts` a ,`users` b,那`users`b 该放哪里呢,我试了一下放的地方都报错了
    2019-03-22 09:57 
  • 黄源 黄源 回复 哎哟喂(提问者) 原来的都放里面不变,只是把in type 的条件放外面
    2019-03-22 09:59 
  • 哎哟喂 哎哟喂(提问者) SELECT DATE(FROM_UNIXTIME(a.date)) AS create_time, b.id, a.`user_id`, a.`message`, a.`comments`, a.`likes`, b.email, b.`username` AS \'sentname\' FROM `users` b, (select case when a.`message` LIKE \'%#今日心得与分享%\' then \'心得与分享\' else \'管理建议\' end as type from posts` a)tt where 1=1 ${if(len(type)==0,\"\",\"and tt.type in (\'\"+type+\"\')\")} WHERE a.`user_id`=b.`id` AND (a.`message` LIKE \'#今日心得与分享%\' OR a.`message` LIKE \'#管理建议%\') AND date(from_unixtime(a.date))>=\'${starttime}\' and date(from_unixtime(a.date))<=\'${endtime}\' and 1=1 ${if(len(sentname) == 0,\"\",\" and b.`username` in (\'\" + sentname+ \"\')\")} 是这样吗,报错耶
    2019-03-22 10:09 
  • 黄源 黄源 回复 哎哟喂(提问者) 开会去了...
    2019-03-22 11:03 
  • 5关注人数
  • 398浏览人数
  • 最后回答于:2019-3-22 10:29
    请选择关闭问题的原因
    确定 取消
    返回顶部