mirror of
https://gitee.com/mybatis-flex/mybatis-flex.git
synced 2025-12-07 00:58:24 +08:00
fix: insertSelectiveWithPk 方法 给主键赋值后会拼接两次id, close #I7L6DF
This commit is contained in:
parent
082b574bd0
commit
7c30bb217d
@ -479,7 +479,7 @@ public class TableInfo {
|
|||||||
retColumns.add(insertColumn);
|
retColumns.add(insertColumn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return ArrayUtil.concat(insertPrimaryKeys, retColumns.toArray(new String[0]));
|
return retColumns.toArray(new String[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,6 +32,7 @@ public class Account extends BaseEntity implements Serializable, AgeAware {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
// @Id(keyType = KeyType.Generator,value = "uuid")
|
||||||
@Id(keyType = KeyType.Auto)
|
@Id(keyType = KeyType.Auto)
|
||||||
@ColumnAlias("account_id")
|
@ColumnAlias("account_id")
|
||||||
private Long id;
|
private Long id;
|
||||||
|
|||||||
@ -107,5 +107,24 @@ public class AccountTester {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* https://gitee.com/mybatis-flex/mybatis-flex/issues/I7L6DF
|
||||||
|
*/
|
||||||
|
@Test
|
||||||
|
public void testInsertSelectiveWithPk() {
|
||||||
|
List<Account> accounts = accountMapper.selectAll();
|
||||||
|
System.out.println(accounts);
|
||||||
|
|
||||||
|
|
||||||
|
Account account = new Account();
|
||||||
|
account.setId(4L);
|
||||||
|
account.setUserName("test04");
|
||||||
|
accountMapper.insertSelectiveWithPk(account);
|
||||||
|
|
||||||
|
accounts = accountMapper.selectAll();
|
||||||
|
System.out.println(accounts);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user