minidao代码如下:
@Arguments({"id","upleveno1"})
@Sql("UPDATE test SET areano ="
+ "(SELECT "
+ "CASE WHEN areano IS NULL THEN "
+ "CASE WHEN 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 "
+ "ELSE areano 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);
----------------------分割线---------------------------------
运行结果:
求大神帮忙找一下原因:
----------------------分割线------本人做了尝试------------------------------------------------------
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
求大神指点。。。在线等。。。。
|