Search in sources :

Example 6 with XmallException

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;
}
Also used : TbThanksExample(cn.exrick.manager.pojo.TbThanksExample) XmallException(cn.exrick.common.exception.XmallException)

Example 7 with XmallException

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;
}
Also used : TbThanks(cn.exrick.manager.pojo.TbThanks) DataTablesResult(cn.exrick.common.pojo.DataTablesResult) TbThanksExample(cn.exrick.manager.pojo.TbThanksExample) XmallException(cn.exrick.common.exception.XmallException)

Example 8 with XmallException

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;
}
Also used : DataTablesResult(cn.exrick.common.pojo.DataTablesResult) XmallException(cn.exrick.common.exception.XmallException)

Example 9 with XmallException

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;
}
Also used : XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Example 10 with XmallException

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;
}
Also used : XmallException(cn.exrick.common.exception.XmallException) XmallException(cn.exrick.common.exception.XmallException)

Aggregations

XmallException (cn.exrick.common.exception.XmallException)47 Date (java.util.Date)22 TbMember (cn.exrick.manager.pojo.TbMember)12 DataTablesResult (cn.exrick.common.pojo.DataTablesResult)11 TbMemberExample (cn.exrick.manager.pojo.TbMemberExample)5 SimpleDateFormat (java.text.SimpleDateFormat)5 Gson (com.google.gson.Gson)4 TbItem (cn.exrick.manager.pojo.TbItem)3 TbThanksExample (cn.exrick.manager.pojo.TbThanksExample)3 PageInfo (com.github.pagehelper.PageInfo)3 ParseException (java.text.ParseException)3 ArrayList (java.util.ArrayList)3 CartProduct (cn.exrick.manager.dto.front.CartProduct)2 SearchItem (cn.exrick.manager.dto.front.SearchItem)2 TbContentCategory (cn.exrick.manager.pojo.TbContentCategory)2 TbItemCat (cn.exrick.manager.pojo.TbItemCat)2 TbItemDesc (cn.exrick.manager.pojo.TbItemDesc)2 TbThanks (cn.exrick.manager.pojo.TbThanks)2 TransportClient (org.elasticsearch.client.transport.TransportClient)2 Settings (org.elasticsearch.common.settings.Settings)2