Exemple #1
0
 public Integer create(Role role) throws DataIntegrityViolationException {
   String CREATE = "INSERT cucgp.`role` (role_name) VALUES (?);";
   Integer ret = jdbcTemplate.update(CREATE, role.getRoleName());
   String LAST_INSERT_ID = "SELECT LAST_INSERT_ID()";
   Integer id = jdbcTemplate.queryForObject(LAST_INSERT_ID, Integer.class);
   role.setRoleId(id);
   relation(role, true);
   return ret;
 }
Exemple #2
0
 public Integer write(Role role) {
   String UPDATE = "UPDATE cucgp.`role` SET role_name = (?) WHERE role_id = (?);";
   Integer ret = jdbcTemplate.update(UPDATE, role.getRoleName(), role.getRoleId());
   if (ret == 1) {
     relation(role, true);
     return ret;
   } else {
     return 0;
   }
 }