| | |
| | | import com.ruoyi.basic.entity.CoalInfo; |
| | | import com.ruoyi.basic.mapper.CoalInfoMapper; |
| | | import com.ruoyi.basic.service.CoalInfoService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.SecurityUtils; |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.util.StringUtils; |
| | | |
| | | import java.util.Objects; |
| | | |
| | |
| | | @Override |
| | | public IPage<CoalInfo> selectCoalInfoList(Page page, CoalInfoDto coalInfoDto) { |
| | | LambdaQueryWrapper<CoalInfo> queryWrapper = new LambdaQueryWrapper<>(); |
| | | if (StringUtils.hasText(coalInfoDto.getCoal())) { |
| | | queryWrapper.like(CoalInfo::getCoal,coalInfoDto.getCoal()); |
| | | } |
| | | queryWrapper.orderByDesc(CoalInfo::getCreateTime); |
| | | return coalInfoMapper.selectPage(page, queryWrapper); |
| | | } |
| | |
| | | public int addOrEditCoalInfo(CoalInfoDto coalInfoDto) { |
| | | CoalInfo coalInfo = new CoalInfo(); |
| | | BeanUtils.copyProperties(coalInfoDto, coalInfo); |
| | | coalInfo.setMaintainerId(SecurityUtils.getUserId()); |
| | | coalInfo.setMaintenanceDate(DateUtils.getNowDate()); |
| | | if (Objects.isNull(coalInfo.getId())) { |
| | | return coalInfoMapper.insert(coalInfo); |
| | | } else { |