|
|
@@ -30,8 +30,8 @@ public class UserDaoImpl implements UserDao {
|
|
|
}
|
|
|
|
|
|
public int insert(Users users){
|
|
|
- String sql = "insert into `users`(card_number,user_name,user_phone,user_zz,openid,create_time,remark,identity_type,contact_id,contact_name,data_type,head_photo,collect_hotel,live_hotel)" +
|
|
|
- " values(:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_type,:contact_id,:contact_name,:data_type,:head_photo,:collect_hotel,:live_hotel) ";
|
|
|
+ String sql = "insert into `users`(id,card_number,user_name,user_phone,user_zz,openid,create_time,remark,identity_type,contact_id,contact_name,data_type,head_photo,collect_hotel,live_hotel)" +
|
|
|
+ " values(:id,:card_number,:user_name,:user_phone,:user_zz,:openid,:create_time,:remark,:identity_type,:contact_id,:contact_name,:data_type,:head_photo,:collect_hotel,:live_hotel) ";
|
|
|
MapSqlParameterSource sps = new MapSqlParameterSource();
|
|
|
sps.addValue("card_number", users.getCard_number());
|
|
|
sps.addValue("user_name", users.getUser_name());
|
|
|
@@ -47,6 +47,9 @@ public class UserDaoImpl implements UserDao {
|
|
|
sps.addValue("head_photo", users.getHeadPhoto());
|
|
|
sps.addValue("collect_hotel", users.getCollect_hotel());
|
|
|
sps.addValue("live_hotel", users.getLive_hotel());
|
|
|
+ if(users.getId()==0){
|
|
|
+ sps.addValue("id", UUIDUtil.generateID());
|
|
|
+ }
|
|
|
int num = 0;
|
|
|
try{
|
|
|
num = namedParameterJdbcTemplate.update(sql, sps);
|