PartLogServiceImpl.java 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. package com.fdkankan.sale.service.impl;
  2. import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
  3. import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
  4. import com.fdkankan.sale.common.PageInfo;
  5. import com.fdkankan.sale.common.RequestBase;
  6. import com.fdkankan.sale.common.ResultCode;
  7. import com.fdkankan.sale.entity.Part;
  8. import com.fdkankan.sale.entity.PartLog;
  9. import com.fdkankan.sale.exception.BusinessException;
  10. import com.fdkankan.sale.mapper.IPartLogMapper;
  11. import com.fdkankan.sale.service.IPartLogService;
  12. import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  13. import com.fdkankan.sale.service.IPartService;
  14. import com.fdkankan.sale.vo.response.PartLogVo;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.stereotype.Service;
  17. /**
  18. * <p>
  19. * 服务实现类
  20. * </p>
  21. *
  22. * @author
  23. * @since 2022-12-07
  24. */
  25. @Service
  26. public class PartLogServiceImpl extends ServiceImpl<IPartLogMapper, PartLog> implements IPartLogService {
  27. @Autowired
  28. IPartService partService;
  29. @Override
  30. public void saveLog(Integer partId,Integer count, Long userId,Integer status,String repairId ) {
  31. Part part = partService.getById(partId);
  32. if(part == null){
  33. throw new BusinessException(ResultCode.PART_NOT_EXITS);
  34. }
  35. PartLog partLog = new PartLog();
  36. partLog.setPartId(part.getPartId());
  37. partLog.setPartName(part.getPartName());
  38. partLog.setStatus(status);
  39. partLog.setCount(count);
  40. partLog.setSysUserId(userId);
  41. partLog.setRepairId(repairId);
  42. this.save(partLog);
  43. }
  44. @Override
  45. public PageInfo pageList(RequestBase param) {
  46. Page<PartLogVo> page = this.getBaseMapper().pageList(new Page<>(param.getPageNum(), param.getPageSize()),0);
  47. return PageInfo.PageInfo(page);
  48. }
  49. }