use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class ThanksServiceImpl method countThanks.
@Override
public Long countThanks() {
TbThanksExample example = new TbThanksExample();
Long result = tbThanksMapper.countByExample(example);
if (result == null) {
throw new XmallException("统计捐赠数目失败");
}
return result;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class ThanksServiceImpl method getThanksList.
@Override
public DataTablesResult getThanksList() {
DataTablesResult result = new DataTablesResult();
TbThanksExample example = new TbThanksExample();
List<TbThanks> list = tbThanksMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取捐赠列表失败");
}
result.setSuccess(true);
result.setData(list);
return result;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class UserServiceImpl method getUserList.
@Override
public DataTablesResult getUserList() {
DataTablesResult result = new DataTablesResult();
TbUserExample example = new TbUserExample();
List<TbUser> list = tbUserMapper.selectByExample(example);
if (list == null) {
throw new XmallException("获取用户列表失败");
}
for (TbUser tbUser : list) {
String names = "";
Iterator it = getRoles(tbUser.getUsername()).iterator();
while (it.hasNext()) {
names += it.next() + " ";
}
tbUser.setPassword("");
tbUser.setRoleNames(names);
}
result.setData(list);
return result;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class UserServiceImpl method getUserByUsername.
@Override
public TbUser getUserByUsername(String username) {
List<TbUser> list;
TbUserExample example = new TbUserExample();
TbUserExample.Criteria criteria = example.createCriteria();
criteria.andUsernameEqualTo(username);
criteria.andStateEqualTo(1);
try {
list = tbUserMapper.selectByExample(example);
} catch (Exception e) {
throw new XmallException("通过ID获取用户信息失败");
}
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
use of cn.exrick.common.exception.XmallException in project xmall by Exrick.
the class UserServiceImpl method getRoleByRoleName.
@Override
public TbRole getRoleByRoleName(String roleName) {
TbRoleExample example = new TbRoleExample();
TbRoleExample.Criteria criteria = example.createCriteria();
criteria.andNameEqualTo(roleName);
List<TbRole> list = new ArrayList<>();
try {
list = tbRoleMapper.selectByExample(example);
} catch (Exception e) {
throw new XmallException("通过角色名获取角色失败");
}
if (!list.isEmpty()) {
return list.get(0);
}
return null;
}
Aggregations