Sql update = Sqls.createf("update merge_purchase_order set status = 10 where id=(select merge_purchase_id from merge_purchase where oid=%s and status <> 100 limit 0,1)", 86242);
dao.update(update);
错误信息
[ERROR] 2020-11-30 20:47:27.651 org.nutz.boot.NbApp.execute(NbApp.java:224) - something happen!!
org.nutz.ioc.IocException: IocBean[cloudLauncher] throw Exception when creating
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:153)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
at org.nutz.boot.NbApp.execute(NbApp.java:214)
at org.nutz.boot.NbApp.run(NbApp.java:182)
at com.kunnit.cloud.search.CloudLauncher.main(CloudLauncher.java:1161)
Caused by: java.lang.RuntimeException: Don't know how to make fetch key org.nutz.dao.impl.sql.NutSql:'update merge_purchase_order set status = 10 where id=(select merge_purchase_id from merge_purchase where oid=86242 and status <> 100 limit 0,1)', need any of @Id/@Name/@Pk
at org.nutz.lang.Lang.makeThrow(Lang.java:138)
at org.nutz.dao.util.Pojos$Items.cndAuto(Pojos.java:155)
at org.nutz.dao.impl.EntityOperator.addUpdate(EntityOperator.java:94)
at org.nutz.dao.impl.EntityOperator.addUpdate(EntityOperator.java:73)
at org.nutz.dao.impl.NutDao.update(NutDao.java:317)
at com.kunnit.cloud.search.CloudLauncher.init(CloudLauncher.java:146)
at com.kunnit.cloud.search.CloudLauncher$FM$init$3dafadcc9264e53064cdbeb3797dd929.invoke(CloudLauncher.java)
at org.nutz.ioc.impl.ObjectMakerImpl$2.trigger(ObjectMakerImpl.java:181)
at org.nutz.ioc.weaver.DefaultWeaver.onCreate(DefaultWeaver.java:89)
at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:141)
... 6 more
merge_purchase_order 结构
merge_purchase_order | CREATE TABLE `merge_purchase_order` (
`id` bigint NOT NULL AUTO_INCREMENT,
`pid` bigint DEFAULT NULL,
`time` datetime DEFAULT NULL,
`status` int DEFAULT NULL,
`uid` bigint DEFAULT NULL,
`delivery_type` int DEFAULT '-1' COMMENT '配送机构 ',
`modify_time` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=381 DEFAULT CHARSET=utf8
merge_purchase结构
merge_purchase | CREATE TABLE `merge_purchase` (
`id` bigint NOT NULL AUTO_INCREMENT,
`oid` bigint DEFAULT NULL,
`status` int DEFAULT NULL,
`merge_purchase_id` bigint DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=975 DEFAULT CHARSET=utf8