File was renamed from dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/service/SyCauseThirdService.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.kind.dao.mapper.SyCauseThirdMapper; |
| | | import cn.huge.module.kind.domain.po.SyCauseThird; |
| | | import cn.huge.module.kind.dao.mapper.ThirdCauseMapper; |
| | | import cn.huge.module.kind.domain.po.ThirdCause; |
| | | 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 SyCauseThirdService extends ServiceImpl<SyCauseThirdMapper, SyCauseThird>{ |
| | | public class ThirdCauseService extends ServiceImpl<ThirdCauseMapper, ThirdCause>{ |
| | | |
| | | @Autowired |
| | | private SyCauseThirdMapper mapper; |
| | | private ThirdCauseMapper mapper; |
| | | |
| | | @Autowired |
| | | private UtilsClientImpl utilsClient; |
| | |
| | | * 更新对象 |
| | | * @param entity 对象 |
| | | */ |
| | | public void updateSyCauseThird(SyCauseThird entity){ |
| | | public void updateSyCauseThird(ThirdCause entity){ |
| | | try{ |
| | | mapper.updateSyCauseThird(entity); |
| | | }catch (Exception e){ |
| | |
| | | * @param entity 对象 |
| | | * @param terms 条件 |
| | | */ |
| | | public void updateSyCauseThirdTerms(SyCauseThird entity, Map<String, Object> terms){ |
| | | public void updateSyCauseThirdTerms(ThirdCause entity, Map<String, Object> terms){ |
| | | try{ |
| | | mapper.updateSyCauseThirdTerms(entity, terms); |
| | | }catch (Exception e){ |
| | |
| | | * @param terms 条件 |
| | | * @return List |
| | | */ |
| | | public List<SyCauseThird> listTerms(Map<String, Object> terms){ |
| | | public List<ThirdCause> listTerms(Map<String, Object> terms){ |
| | | return mapper.listTerms(terms); |
| | | } |
| | | |
| | |
| | | * @param terms 条件 |
| | | * @return Page |
| | | */ |
| | | public Page<SyCauseThird> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | public Page<ThirdCause> pageQuery(PageRequest page, Map<String, Object> terms){ |
| | | long total = mapper.countTerms(terms); |
| | | List<SyCauseThird> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<SyCauseThird>(content, page, total); |
| | | List<ThirdCause> content = mapper.pageTerms(page, terms); |
| | | return new PageImpl<ThirdCause>(content, page, total); |
| | | } |
| | | |
| | | /** |
| | | * 新增或更新对象 |
| | | * @param syCauseThird 实体对象 |
| | | * @param thirdCause 实体对象 |
| | | */ |
| | | public void saveSyCauseThird(SyCauseThird syCauseThird){ |
| | | public void saveSyCauseThird(ThirdCause thirdCause){ |
| | | try{ |
| | | Date nowDate = DateUtils.getNowDate(); |
| | | // 判断是否新增 |
| | | if (IdUtils.checkNewId(syCauseThird.getId())){ |
| | | syCauseThird.setId(utilsClient.getNewTimeId()); |
| | | syCauseThird.setCreateTime(nowDate); |
| | | if (IdUtils.checkNewId(thirdCause.getId())){ |
| | | thirdCause.setId(utilsClient.getNewTimeId()); |
| | | thirdCause.setCreateTime(nowDate); |
| | | } |
| | | syCauseThird.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(syCauseThird); |
| | | thirdCause.setUpdateTime(nowDate); |
| | | this.saveOrUpdate(thirdCause); |
| | | }catch (Exception e){ |
| | | log.error("[SyCauseThirdService.saveSyCauseThird]调用失败,异常信息:"+e, e); |
| | | throw new ServiceException("SyCauseThirdService.saveSyCauseThird", e); |