ibatIS中的parameterClass,一般分类两种,1种为传model,另一种为传map
一、parameterClass传model参数
- <select id=“queryModel” parameterClass=“com.hanpeng.base.phone.model.TDictionary” resultClass=“com.hanpeng.base.phone.model.TDictionary”>
- SELECT
- D_CODE as dCode ,
- D_NAME as dName ,
- D_INFO as dInfo ,
- D_SERVER_NAME as dServerName ,
- D_CLIENT_NAME as dClientName ,
- REMARK as remark ,
- D_SHORT as dShort ,
- D_SERVER_COLOR as dServerColor ,
- D_CLIENT_COLOR as dClientColor
- FROM T_DICTIONARY
- <dynamic prepend=“WHERE”>
- <isNotEmpty prepend=” AND “ property=“dCode”>
- D_CODE = #dCode# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dName”>
- D_NAME = #dName# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dInfo”>
- D_INFO = #dInfo# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dServerName”>
- D_SERVER_NAME = #dServerName# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dClientName”>
- D_CLIENT_NAME = #dClientName# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“remark”>
- REMARK = #remark# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dShort”>
- D_SHORT = #dShort# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dServerColor”>
- D_SERVER_COLOR = #dServerColor# </isNotEmpty>
- <isNotEmpty prepend=” AND “ property=“dClientColor”>
- D_CLIENT_COLOR = #dClientColor# </isNotEmpty>
- </dynamic>
- </select>
二、parameterClass传map参数
1.
- /**
- * 快速备注
- * @param request
- * @return
- * @author sgdjava
- * @date 2011-9-8 下午05:00:14
- */
- public static List getKuaiSuBeiZhu(HttpServletRequest request) {
- List result = null;
- try {
- String sendtype=“”;
- if(request.getAttribute(“sendType”) != null)
- sendtype = (String)request.getAttribute(“sendType”);
- Map search = new HashMap();
- search.put(“wbType”, sendtype);
- result = selectUtilSerivce.queryKuaiSuBeiZhu(search);
- } catch (Exception e) {
- log.error(“SelectUtilReq getKuaiSuBeiZhu Err”,e);
- }
- return result;
- }
2.daoImpl
- public List<Map<String, Object>> queryKuaiSuBeiZhu(Map searchMap) {
- return getSqlMapClientTemplate().queryForList(“TDictionary.queryKuaiSuBeiZhu”, searchMap);
- }
3.sqlMap
- <select id=“queryKuaiSuBeiZhu” parameterClass=“java.util.HashMap” resultClass=“java.util.HashMap”>
- SELECT T.WB_INFO AS “val” , T.WB_INFO AS “key” FROM T_WRITE_BACK T
- <dynamic prepend=“WHERE”>
- <isNotEmpty prepend=” AND “ property=“wbType”>
- T.WB_TYPE=#wbType# </isNotEmpty>
- </dynamic>
- ORDER BY T.WB_NUM ASC
- </select>
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/38011.html