mybatis 如何让前端实现多选的功能,

** 当然提前声明是在一个表里面的几个字段,前台选择哪个字段就出哪个字段的结果**

mybatis映射文件  这种情况t1表的所选字段都出来了 
SELECT
    t1.name,t1.content,t1.xiyichufang,t1.zhongyichufang,t1.zhongchengyao,t1.other
    from dt_ear_disease as t1
    LEFT JOIN
    dt_ear_system as t2 ON
    t2.id=t1.system_id
    where t1.system_id IN
    <foreach item="item" index="index" collection="num" open="("
        separator="," close=")">
        #{item}
    </foreach>

图片说明
我想就是红线的部分可以多选 select什么字段就出什么字段 在前段点什么字段出什么字段 比如点zhongyichufang(中医处方)就出对应的信息 其他的不出 ,点zhongyichufang(中医处方)和zhongchengyao(中成药)就出中成药的信息

用if:
t1.name,
最后一个不带逗号,放一个一定会存在的就行,如果没有固定显示的,就放个常量,反正也用不上

多选就是定义一个checkbox多选框。添加相应的事件就行了。选中、取消。
SQL,就是根据选择的类别条件去查数据就行了。

exception

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:

Error querying database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET t1.name

    t1.content 

    from dt_ear_disease as t1
    LEFT JOIN
    dt_ear_sy' at line 2

The error may exist in mybatis/EarDiseaseMapper.xml

The error may involve com.app.dao.mapper.EarDiseaseMapper.findReport-Inline

The error occurred while setting parameters

SQL: SELECT SET t1.name t1.content from dt_ear_disease as t1 LEFT JOIN dt_ear_system as t2 ON t2.id=t1.system_id where t1.system_id IN ( ? ) AND min_age<=? AND max_age >=? AND t1.id IN ( ? , ? ) GROUP BY t1.name

Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET t1.name

    t1.content 

    from dt_ear_disease as t1
    LEFT JOIN
    dt_ear_sy' at line 2

; bad SQL grammar []; nested exception is com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'SET t1.name
t1.content

    from dt_ear_disease as t1
    LEFT JOIN
    dt_ear_sy' at line 2
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:656)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
javax.servlet.http.HttpServlet.service(HttpServlet.java:624)
javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)



这个是浏览器的 接口测试地址:
http://192.168.1.100:8080/miaolangzhong/memberBusiness/PreventiveTreatmentOfDisease.do?requestType=5&num=1&ear_disease_id=399,526&age=25