开始日期与结束日期(easyui的日期easyui-datebox)错误
2015-02-03 12:15
561 查看
1.前台页面使用easyui,我演示的是oracle数据库的日期字段,数据库字段:中心结算日期(SETTDATE)NUMBER(8),交易日期(TXNDATE)CHAR(8 BYTE)
中心结算开始日期和中心结算结算日期都是正常写法。
select count(1) from t_XXX t WHERE t.settdate>=? and t.settdate<=?
Parameters: 20150113(String), 20150113(String)
2.
提交到后台:路径就隐藏了,
3.mybatis的执行语句:
select count(1) from t_XXX t WHERE t.settdate>=? and t.settdate<=?
Parameters: 20150 113(String), 20150113(String)
其实应该是查不到结果才对,其实不是,原因是::中心结算日期(SETTDATE)NUMBER(8),是number类型的,参数的时候多了一个空格。
5.对比:交易日期(TXNDATE)CHAR(8 BYTE),
select count(1) from t_XXX t WHERE t.txndate>=? and t.txndate<=?
20150120(String), 20150120(String)
select count(1) from t_dtl_XXX t WHERE t.txndate>=? and t.txndate<=?
Parameters: 20150 120(String), 20150120(String) 参数有空格,依然可以查询。日期中间可以有空格,不会影响查询结果
希望大家在开发中注意,可能是设计表的人大意出的问题。
对于使用number的日期解决方法也很简单,就是用户只能从选择日期,editable="false" 不可编辑
<pre name="code" class="html"> <td> 中心结算开始日期:</td><td> <input name="settleDateStart" id="settleDateStart" class="easyui-datebox" editable="false"/> </td>
<td> 中心结算结束日期:</td><td> <input name="settleDateEnd" id="settleDateEnd" class="easyui-datebox" editable="false"
/> </td>
<tr>
<td>交易开始日期:</td><td> <input name="txnDateStart" id="txnDateStart" class="easyui-datebox" editable="false"
/></td>
<td>交易结束日期:</td><td> <input name="txnDateEnd" id="txnDateEnd" class="easyui-datebox" editable="false"
/></td>
中心结算开始日期和中心结算结算日期都是正常写法。
select count(1) from t_XXX t WHERE t.settdate>=? and t.settdate<=?
Parameters: 20150113(String), 20150113(String)
<form id="queryfm" method="post"> <div> <table > <tr> <td> 中心结算开始日期:</td><td> <input name="settleDateStart" id="settleDateStart" class="easyui-datebox" /> </td> <td> 中心结算结束日期:</td><td> <input name="settleDateEnd" id="settleDateEnd" class="easyui-datebox" /> </td> <tr> <td>交易开始日期:</td><td> <input name="txnDateStart" id="txnDateStart" class="easyui-datebox" /></td> <td>交易结束日期:</td><td> <input name="txnDateEnd" id="txnDateEnd" class="easyui-datebox" /></td> </tr> </table> </div> </form>
2.
提交到后台:路径就隐藏了,
function queryInfo(pageNumber,pageSize,sort, order) { var submitData = {}; submitData = querypage.initSubmitData(pageNumber,pageSize,sort, order); submitData = geneSubmitDataFromForm("#queryfm",submitData); $.messager.progress(COMMONPARAM_PROCESS); submitData['settleDateStart'] = submitData['settleDateStart'].replace(/-/g, '').trim(); submitData['settleDateEnd'] = submitData['settleDateEnd'].replace(/-/g, '').trim(); submitData['txnDateStart'] = submitData['txnDateStart'].replace(/-/g, '').trim(); submitData['txnDateEnd'] = submitData['txnDateEnd'].replace(/-/g, '').trim(); submitData['adtDateStart'] = submitData['adtDateStart'].replace(/-/g, '').trim(); submitData['adtDateEnd'] = submitData['adtDateEnd'].replace(/-/g, '').trim(); jQueryAjaxForJSON(basePath + '/XXX.do', submitData, function(sRet) { querypage.refreshData(sRet.field1,submitData,function(pageNumber, pageSize,sort1,order1){queryInfo(pageNumber, pageSize,sort1,order1);},querypage,tbColumns1); $.messager.progress('close'); }, function(sRet) { $.messager.progress('close'); $.messager.alert('提示',sRet.message,'',function(){}); }, function() { $.messager.progress('close'); alert('通讯异常'); }); }
3.mybatis的执行语句:
<!-- 中心结算日期 --> <if test="settleDateStart !=null and settleDateStart !='' "> <![CDATA[and t.settdate>=#{settleDateStart}]]> </if> <if test="settleDateEnd !=null and settleDateEnd !='' "> <![CDATA[and t.settdate<=#{settleDateEnd}]]> </if> <!-- 调整日期 --> <if test="adtDateStart !=null and adtDateStart !='' "> <![CDATA[ and t.adtdate>=#{adtDateStart} ]]> </if> <if test="adtDateEnd != null and adtDateEnd !='' "> <![CDATA[ and t.adtdate<=#{adtDateEnd} ]]> </if> <!-- 交易日期 --> <if test="txnDateStart !=null and txnDateStart !='' "> <![CDATA[and t.txndate>=#{txnDateStart}]]> </if> <if test="txnDateEnd !=null and txnDateEnd !='' "> <![CDATA[and t.txndate<=#{txnDateEnd}]]> </if>4.见图,
select count(1) from t_XXX t WHERE t.settdate>=? and t.settdate<=?
Parameters: 20150 113(String), 20150113(String)
其实应该是查不到结果才对,其实不是,原因是::中心结算日期(SETTDATE)NUMBER(8),是number类型的,参数的时候多了一个空格。
5.对比:交易日期(TXNDATE)CHAR(8 BYTE),
select count(1) from t_XXX t WHERE t.txndate>=? and t.txndate<=?
20150120(String), 20150120(String)
select count(1) from t_dtl_XXX t WHERE t.txndate>=? and t.txndate<=?
Parameters: 20150 120(String), 20150120(String) 参数有空格,依然可以查询。日期中间可以有空格,不会影响查询结果
希望大家在开发中注意,可能是设计表的人大意出的问题。
对于使用number的日期解决方法也很简单,就是用户只能从选择日期,editable="false" 不可编辑
<pre name="code" class="html"> <td> 中心结算开始日期:</td><td> <input name="settleDateStart" id="settleDateStart" class="easyui-datebox" editable="false"/> </td>
<td> 中心结算结束日期:</td><td> <input name="settleDateEnd" id="settleDateEnd" class="easyui-datebox" editable="false"
/> </td>
<tr>
<td>交易开始日期:</td><td> <input name="txnDateStart" id="txnDateStart" class="easyui-datebox" editable="false"
/></td>
<td>交易结束日期:</td><td> <input name="txnDateEnd" id="txnDateEnd" class="easyui-datebox" editable="false"
/></td>
相关文章推荐
- easyUI的datebox,开始/结束日期不得大于当前日期,开始日期不得大于结束日期
- easyui datebox日期控制扩展选择日期小于等于当前日期,开始日期小于等于结束日期
- easyui datebox 时间限制,datebox开始时间限制结束时间,datebox截止日期比起始日期大的实现代码
- Easyui_datebox验证-开始日期小于结束日期
- easyui datebox 时间限制,datebox开始时间限制结束时间,datebox截止日期比起始日期大
- EasyUI Datebox 日期验证之开始日期小于结束时间
- EasyUI-datebox设置开始日期小于结束日期,并且结束日期小于当前日期
- easyUI中使用datatimebox选定开始日期时间后自动带出7天之后的结束日期时间
- EasyUi 日历组件 datebox 开始时间与结束时间限制高级版
- EasyUi 日历组件 datebox 开始时间与结束时间限制
- easyui获取日期datebox中的值
- easyUI 格式化datebox 中的日期
- easyui获取日期datebox中的值
- EasyUI的DataGrid日期列(datebox)正确显示json时间格式
- HTML Jquery EasyUI 日期选择框[easyui-datebox]的使用【格式自定】
- jQuery ui 利用 datepicker插件实现开始日期(minDate)和结束日期(maxDate)
- easyui获取日期datebox中的值
- 修改easyui datebox默认日期格式
- easyui获取日期datebox中的值
- jQuery ui 利用 datepicker插件实现开始日期(minDate)和结束日期(maxDate)