File was renamed from dyh-service/dyh-cust/src/main/java/cn/huge/module/ctrole/service/CRoleService.java |
| | |
| | | import cn.huge.base.common.utils.DateUtils; |
| | | import cn.huge.base.common.utils.IdUtils; |
| | | import cn.huge.module.client.api.impl.UtilsClientImpl; |
| | | import cn.huge.module.ctrole.dao.mapper.CRoleMapper; |
| | | import cn.huge.module.ctrole.domain.po.CRole; |
| | | import cn.huge.module.ctrole.dao.mapper.CtRoleMapper; |
| | | import cn.huge.module.ctrole.domain.po.CtRole; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.data.domain.Page; |
| | | import org.springframework.data.domain.PageImpl; |
| | | import org.springframework.data.domain.PageRequest; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.annotation.PostConstruct; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | @Slf4j |
| | | @Service |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public class CRoleService extends ServiceImpl<CRoleMapper, CRole>{ |
| | | public class CtRoleService extends ServiceImpl<CtRoleMapper, CtRole>{ |
| | | |
| | | @Autowired |
| | | private CRoleMapper mapper; |
| | | private CtRoleMapper mapper; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateCRole(CRole entity){ |
| | | public void updateCRole(CtRole entity){ |
| | | try{ |
| | | mapper.updateCRole(entity); |
| | | }catch (Exception e){ |
| | |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateCRoleTerms(CRole entity, Map<String, Object> terms){ |
| | | public void updateCRoleTerms(CtRole entity, Map<String, Object> terms){ |
| | | try{ |
| | | mapper.updateCRoleTerms(entity, terms); |
| | | }catch (Exception e){ |
| | |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<CRole> listTerms(Map<String, Object> terms){ |
| | | public List<CtRole> listTerms(Map<String, Object> terms){ |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<CRole> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | public Page<CtRole> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | long total = mapper.countTerms(terms); |
| | | List<CRole> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<CRole>(content, page, total); |
| | | List<CtRole> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<CtRole>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param cRole 实体对象 |
| | | * @param ctRole 实体对象 |
| | | */ |
| | | public void saveCRole(CRole cRole){ |
| | | public void saveCRole(CtRole ctRole){ |
| | | try{ |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(cRole.getId())){ |
| | | cRole.setId(utilsClient.getNewTimeId()); |
| | | cRole.setCreateTime(nowDate); |
| | | if (IdUtils.checkNewId(ctRole.getId())){ |
| | | ctRole.setId(utilsClient.getNewTimeId()); |
| | | ctRole.setCreateTime(nowDate); |
| | | } |
| | | cRole.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(cRole); |
| | | ctRole.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(ctRole); |
| | | }catch (Exception e){ |
| | | log.error("[CRoleService.saveCRole]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("CRoleService.saveCRole", e); |