@Test
public void sm2() {
Ooxx ooxx = new Ooxx();
StringBuilder insString = new StringBuilder();
Field[] declaredFields = ooxx.getClass().getDeclaredFields();
for (Field field : declaredFields) {
insString.append("#{one.").append(field.getName()).append("}, ");
}
System.out.println(insString);
}
<insert id="insertBatch">
insert into ooxx (
<include refid="Insert_Column_List"/>
) values
<foreach collection="list" item="one" separator=",">
(#{one.id}, #{one.loginName}, #{one.userName}, #{one.authKey})
</foreach>
</insert>
<update id="updateBatch">
<foreach collection="list" item="one" index="index" open="" close="" separator=";">
UPDATE ooxx
SET APP_ID = '6101657204559872',
LOGIN_NAME = 'ooxx',
USER_NAME = 'songsong',
AUTH_KEY = 'f579dabc28bca0be262665a35b614fb62d',
DEL_FLAG = 1
WHERE ID = '5c27d0dd-143e-11eb-883c-f875a40986ed';
</foreach>
</update>
const rowDefault = {
id : null,
appId : null,
loginName : null,
ooxxId : null,
ooxxName : null,
userName : null
...
}
@Test
public void rowDefault() {
Ooxx ooxx = new Ooxx();
JSONConfig jsonConfig = JSONConfig.create();
jsonConfig.setIgnoreNullValue(false);
String jsonStr = JSONUtil.toJsonStr(ooxx, jsonConfig);
System.out.println("jsonStr = " + jsonStr);
}
jsonStr = {"name":null,"id":null}