九月 发表于 2018-4-20 15:09:12

minidao通过查询结果更新对应字段,查询结果总是固定值

minidao代码如下:
@Arguments({"id","upleveno1"})
    @Sql("UPDATE test SET areano ="
            + "(SELECT"
                + "CASE WHEN areano IS NULL THEN"
                  + "CASEWHEN upleveno=1 THEN '11' "
                           + "WHEN LENGTH(upleveno)=2 THEN CONCAT(upleveno,'01') "
                           + "WHEN LENGTH(upleveno)=4 THEN CONCAT(upleveno,'01') "
                           + "WHEN LENGTH(upleveno)=6 THEN CONCAT(upleveno,'001') "
                           + "WHEN LENGTH(upleveno)=9 THEN CONCAT(upleveno,'001') "
                  + "ELSE 'test' END "
                + "ELSEareano END AS areano"
            + "FROM (SELECT MAX(areano)+1 areano, :upleveno1 upleveno FROM test WHERE upleveno=:upleveno) AS tableq )"
    + " WHERE id=:id")
    Integer updatetestNum(int id,String upleveno1);

----------------------分割线---------------------------------
运行结果:
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQoAAACdCAIAAADDvaHRAAAMcklEQVR4nO2dvW8cxxnG50+glM4GeEnlBP4HUhsI4i5wylQpXARIunSOG9uNKlVJ58JwZ6eQIRwcR/6C4diEKJIiaRLUB2DLEOzkjMiipBWIyDA2xYqj9+bj3Zm5u515d54fXgjL2dnb0bPz7Oze7eyrjgEAHtSLAAAP6g0AgAcVOMp0tVc6kC0XcQ1eKVAjDXX58/d645joe/nz95orfyk8jAZXHlAjOdTmxqXeoPpublx6sP1K4WE0uPKAGsmhrlz+oDeovlcuf/Dg6rkHV88ppboFGkopZ/nAYTS48oAayaG2Nz/qDarv9uZH9/fP398/r5TqFozwlQ8ZRoMrD6iRHGpn65PeoPrubH1y/+BvTCil+AoDhNHgygNqJIfa3f60N6i+u9uf3jt6nQmlFF9hgDAaXHlAjeRQe1c/6w2q797Vz+5df7O7x7h3/U0a6hSjfPgwGtxF1zZjmRbafzq34usUGBnVEKrYk3bu7270BtV3f3fj+OZbxzffUkp1C8afRnmemG/w/u6GUspe0MtMnYSF0iKjGva/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zh6v0fVV3e8O1QjOLWg/VEKrUXvYBzXjYc5rj2axN9JXZ4+o2YJL3rf/jKUCUqXZ/cxpD2MvzpIhKcQevn8b1gOwBzdbcPm7X549jCOH0YOi7z2agJe0wx4awbkFYY9wfGOpcxn20AjOLUj7mb0V7EHBxVUagnMLwh7h8GoY5bCHRnBuQdgjHN/X3IEXtyGrRong3IKB9jA2d5YMSQn3Hj66yrCHRnBuQfwsGA795qqDGbdhD43g3IKwRzjGpabzapMfPfIOubkQnFuwXV/rchg41xZtD3+zV0SxahSO4NyC+jT88PqRvbbQDnHnTvbRA4QjOLdg+7OfnHY1QRkGnzR1SK1gjzQE5xb84c9/zN3X0+PH3z4/pFawRxqCH2hvmuaHP/xe4gDy429+NbBQsEcagmcLArBq6pr8BUAUsAcAXmAPALzAHgB4gT0A8AJ7AOAF9gDAC+wBgBfYAwAvsAcAXmAPALz8H6CjarQnGuQBAAAAAElFTkSuQmCCAA==

求大神帮忙找一下原因:
----------------------分割线------本人做了尝试------------------------------------------------------
minidao 如下:
@Arguments({"upleveno1"})
    @Sql("SELECT MAX(areano)+1 areano FROM test WHERE upleveno=:upleveno")
    Integer updateAreaNum1(String upleveno1);

调用如下:
logger.info("aaaa "+test.getId()+"   uplevelno:"+test.getUpleveno());
logger.info("ssssss:"+updateAreaNum1(test.getUpleveno()));

运行结果如下:
aaaa 12207   uplevelno:1
ssssss:null

求大神指点。。。在线等。。。。




admin 发表于 2018-4-20 15:21:23

参数传进去了吗?
写的问题吧,参数名不一样
页: [1]
查看完整版本: minidao通过查询结果更新对应字段,查询结果总是固定值