2019-09-14 09:17
Db.tx(new IAtom() {
@Override
public boolean run() throws SQLException {
account.setCreateTime(new Date());
account.setType(JMAccountDao.TYPE_ADMIN);
JMResult result = accountDao.save(account, password, JMAccountDao.TYPE_ADMIN, getIp());
AccountAdmin accountAdmin = getModel(AccountAdmin.class);
accountAdmin.setAccountId(account.getId());
if (avatar != null) {
accountAdmin.setAvatar(JMUploadKit.uploadPath+"image/"+avatar.getName());
}
if (realImage != null) {
accountAdmin.setRealImage(JMUploadKit.uploadPath+"image/"+realImage.getName());
}
boolean flag = accountAdminDao.save(accountAdmin);
if(flag){
if (roleId != null) {
accountAdmin = accountAdminDao.getById(accountAdmin.getId());
flag = roleAccountDao.band(accountAdmin.getAccountId(), roleId);
}
}
return result.isOk() && flag;
}
});
我改db,保存异常,数据不回滚