| | |
| | | package com.gkhy.assess.system.service.impl; |
| | | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.gkhy.assess.common.api.CommonPage; |
| | | import com.gkhy.assess.common.exception.ApiException; |
| | | import com.gkhy.assess.common.utils.PageUtil; |
| | | import com.gkhy.assess.system.domain.SysAgency; |
| | | import com.gkhy.assess.system.domain.SysUser; |
| | | import com.gkhy.assess.system.mapper.SysAgencyMapper; |
| | | import com.gkhy.assess.system.service.SysAgencyService; |
| | | import com.gkhy.assess.system.utils.ShiroUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.util.List; |
| | | |
| | |
| | | } |
| | | |
| | | @Override |
| | | public Boolean checkAgencyNameUnique(SysAgency agency) { |
| | | public boolean checkAgencyNameUnique(SysAgency agency) { |
| | | Long agencyId = agency.getId()==null? -1L : agency.getId(); |
| | | SysAgency info = baseMapper.checkAgencyNameUnique(agency.getName()); |
| | | if (info!=null && info.getId().longValue() != agencyId.longValue()) |
| | |
| | | public SysAgency getAgencyById(Long agencyId) { |
| | | return baseMapper.getAgencyById(agencyId); |
| | | } |
| | | |
| | | @Override |
| | | public boolean changePublic(SysAgency agency) { |
| | | checkAgencyDataScope(agency.getId()); |
| | | SysAgency ay=new SysAgency().setId(agency.getId()).setPublication(agency.getPublication()); |
| | | ay.setUpdateBy(ShiroUtils.getSysUser().getUsername()); |
| | | return updateById(ay); |
| | | } |
| | | |
| | | public SysAgency checkAgencyDataScope(Long agencyId) { |
| | | if(agencyId==null){ |
| | | throw new ApiException("机构id为空!"); |
| | | } |
| | | SysAgency agency = baseMapper.getAgencyById(agencyId); |
| | | if (ObjectUtil.isNull(agency)) |
| | | { |
| | | throw new ApiException("机构数据不存在!"); |
| | | } |
| | | return agency; |
| | | } |
| | | } |