class UserManagementImpl implements UserManagementService {

    @Override
    public CommonResult insertUser(User user) {
        // sha加密后密码
        String pwd = SHAUtils.encodeData(user.getPassword());
        user.setPassword(pwd);
        int count = userMapper.insert(user);
        if (count == 0) {
            return CommonResult.fail();
        }
        return CommonResult.success(count);
    }

}