public int update(Person person) { logger.info("update person"); PersonExample example = new PersonExample(); PersonExample.Criteria criteria = example.createCriteria(); criteria.andIdEqualTo(person.getId()); return personMapper.updateByExample(person, example); }
public int insert(Person person) { logger.info("add person"); personMapper.insertSelective(person); // 为了测试事务回滚 // throw new IllegalArgumentException("roll back"); return 1; }
public int delete(int id) { logger.info("delete person, id is " + id); return personMapper.deleteByPrimaryKey(id); }