forked from gzzfw/backEnd/gz-dyh

liyj
2024-10-17 f494a94882a56079d24ee41d40aabf09018aba86
dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/service/ThirdCauseService.java
File was renamed from dyh-service/dyh-sys/src/main/java/cn/huge/module/kind/service/SyCauseThirdService.java
@@ -4,19 +4,17 @@
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;
@@ -32,10 +30,10 @@
@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;
@@ -44,7 +42,7 @@
    * 更新对象
    * @param entity 对象
    */
    public void updateSyCauseThird(SyCauseThird entity){
    public void updateSyCauseThird(ThirdCause entity){
        try{
            mapper.updateSyCauseThird(entity);
        }catch (Exception e){
@@ -58,7 +56,7 @@
    * @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){
@@ -85,7 +83,7 @@
    * @param terms 条件
    * @return List
    */
    public List<SyCauseThird> listTerms(Map<String, Object> terms){
    public List<ThirdCause> listTerms(Map<String, Object> terms){
        return mapper.listTerms(terms);
    }
@@ -104,26 +102,26 @@
    * @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);