@Override public Integer update(ModelUser t) { if (t == null || t.getUsername() == null || t.getPassword() == null) { throw new ServException("username 或 password 不能为空"); } t.setPassword(MD5Utils.encodeHex(t.getPassword())); return mapperUser.update(t); }
@Override public Integer delete(ModelUser t) { if (t == null || t.getId() == null) return null; Integer r = mapperUser.delete(t); if (r > 0) { servUserRole.deleteByUserId(t.getId()); } return r; }
@Override public Long countByCondition(Condition<ModelUser> condition) { if (condition == null) { condition = new Condition<ModelUser>(); } ModelUser t = condition.getT(); if (t != null && t.getPassword() != null) { t.setPassword(MD5Utils.encodeHex(t.getPassword())); } return mapperUser.countByCondition(condition); }
@Override public List<ModelUser> findByCondition(Condition<ModelUser> condition, boolean injected) { if (condition == null) { condition = new Condition<ModelUser>(); } ModelUser t = condition.getT(); if (t != null && t.getPassword() != null) { t.setPassword(MD5Utils.encodeHex(t.getPassword())); } return mapperUser.findByCondition(condition); }