vue springboot mybatis实现自定义条件检索功能
文章目录概要整体流程技术细节概要部门需求要求检索可以实现自选检索字段、检索条件、参数。并且在页面不要冗余显示。整体流程1.前端效果前端部分通过组件实现下拉选项 由字典提供。2.后端这一部分由mybatis拼接后进行sql查询技术细节2.1检索条件的映射!--字段映射片段--sql idsearchConditionchoosewhen test${searchKey} code//此处就是对应的字段include refidbuildConditionproperty namecolumnvaluecode/property namesearchTypevalue${searchType}///选择的参数property nameinputAvalue${inputA}///检索的数值property nameinputBvalue${inputB}///检索的数值多选/include/when/choose/sql2.2 可复用的条件构建片段!--可复用的条件构建片段--sql idbuildConditionchoosewhen test${searchType} dayuand ${column}gt;#{${inputA}}/whenwhen test${searchType} dayudengyuand ${column}gt;#{${inputA}}/whenwhen test${searchType} isnulland ${column}isnull/whenwhen test${searchType} isnotnulland ${column}is notnull/when/choose/sql2.3检索语句的使用select idselectListparameterTypelistParameterresultMaplistParameterResultselect*fromwhereinclude refidsearchCondition//有多个就对应创建多个property namesearchKeyvalueparams.searchKey1///我是用数字区分property namesearchTypevalueparams.searchType1/property nameinputAvalueparams.searchInputA1/property nameinputBvalueparams.searchInputB1//include/where/select
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2426149.html
如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!