kings186

2019-03-14 10:57

请问如果我要写动态sql,可以用#if判断是否存在,并判断她的值嘛,比如说#if(num && num =1),这样的用法可以嘛

kings186

2019-03-14 10:47

@天朝子民 请问如果我要写动态sql,可以用#if判断是否存在,并判断她的值嘛,比如说#if(num && num =1),这样的用法可以嘛

kings186

2019-01-21 14:16

@JFinal 好的,谢谢波总

kings186

2019-01-19 14:11

@JFinal
波总您好,谢谢您的回答,上面已经改了sql语句,但是还是会报下面的错误

sql语句是这样的:
select *
FROM
(select *,
(select count(1) from organize_course oc where o.uid =oc.organize_uid) AS course_num,
(SELECT count(1) FROM organize_course oc WHERE o.uid =oc.organize_uid AND oc.status=1)as onsale_num,
(SELECT COUNT(1) FROM organize_member om WHERE o.uid =om.organize_uid AND member_role =2) AS stu_num,
(SELECT COUNT(1) FROM social_like sc WHERE o.uid =sc.target_uid ) AS fans_num
from organize o
ORDER BY #para(orderType) #para(orderMode)) as temp

下面的是报错信息:

com.jfinal.core.ActionHandler.error /organize/listOrganize?page=1&order_type=course_num&order_mode=DESC
com.jfinal.plugin.activerecord.ActiveRecordException: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'nize o
?) as temp
',expect RPAREN, actual QUES o : select count(*) from
(select *,
(select count(1) from organize_course oc where o.uid =oc.organize_uid) AS course_num,
(SELECT count(1) FROM organize_course oc WHERE o.uid =oc.organize_uid AND oc.status=1)as onsale_num,
(SELECT COUNT(1) FROM organize_member om WHERE o.uid =om.organize_uid AND member_role =2) AS stu_num,
(SELECT COUNT(1) FROM social_like sc WHERE o.uid =sc.target_uid ) AS fans_num
from organize o
?) as temp

kings186

2019-01-05 17:40

@JFinal generator.setGenerateDaoInModel(true);
generator.setGenerateDataDictionary(false);
generator.addExcludedTable(excludeTableName);我是有这三个的,是封装了吗