RenovationPartsDetailServiceImpl.java 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. package com.example.demo.service.impl;
  2. import com.example.demo.entity.RenovationPartsDetailEntity;
  3. import com.example.demo.mapper.IBaseMapper;
  4. import com.example.demo.mapper.IRenovationPartsAttachingMapper;
  5. import com.example.demo.mapper.IRenovationPartsDetailMapper;
  6. import com.example.demo.mapper.IRenovationPartsSizeMapper;
  7. import com.example.demo.service.IRenovationPartsDetailService;
  8. import com.example.demo.vo.response.ResponseRenovationPartsDetail;
  9. import com.github.pagehelper.PageHelper;
  10. import com.github.pagehelper.PageInfo;
  11. import org.springframework.beans.factory.annotation.Autowired;
  12. import org.springframework.stereotype.Service;
  13. import org.springframework.transaction.annotation.Transactional;
  14. import java.util.List;
  15. /**
  16. * Created by Hb_zzZ on 2020/8/11.
  17. */
  18. @Service
  19. @Transactional
  20. public class RenovationPartsDetailServiceImpl extends BaseServiceImpl<RenovationPartsDetailEntity, Long> implements IRenovationPartsDetailService {
  21. @Autowired
  22. private IRenovationPartsDetailMapper mapper;
  23. @Autowired
  24. private IRenovationPartsAttachingMapper renovationPartsAttachingMapper;
  25. @Autowired
  26. private IRenovationPartsSizeMapper renovationPartsSizeMapper;
  27. @Override
  28. public IBaseMapper<RenovationPartsDetailEntity, Long> getBaseMapper() {
  29. return this.mapper;
  30. }
  31. @Override
  32. public List<ResponseRenovationPartsDetail> findDetailByTypeId(Long id, Long colorId, Long classifyId) {
  33. if(colorId != null && colorId.longValue() == 0){
  34. colorId = null;
  35. }
  36. if(classifyId != null && classifyId.longValue() == 0){
  37. classifyId = null;
  38. }
  39. List<ResponseRenovationPartsDetail> detailList = mapper.findDetailByTypeId(id, colorId, classifyId);
  40. for (ResponseRenovationPartsDetail responseRenovationPartsDetail : detailList) {
  41. responseRenovationPartsDetail.setEditing(renovationPartsAttachingMapper.findAttachinByDetailId(responseRenovationPartsDetail.getId()));
  42. responseRenovationPartsDetail.setSize(renovationPartsSizeMapper.findSizeByDetailId(responseRenovationPartsDetail.getId()));
  43. }
  44. return detailList;
  45. }
  46. @Override
  47. public ResponseRenovationPartsDetail findByName(String name) {
  48. return mapper.findByName(name);
  49. }
  50. @Override
  51. public List<ResponseRenovationPartsDetail> findByKeyWord(String keyWord) {
  52. return mapper.findByKeyWord(keyWord);
  53. }
  54. @Override
  55. public PageInfo<RenovationPartsDetailEntity> findAllByUserId(Long userId, String name, Integer pageNum, Integer pageSize) {
  56. PageHelper.startPage(pageNum, pageSize);
  57. List<RenovationPartsDetailEntity> list = mapper.findAllByUserId(userId, name);
  58. PageInfo<RenovationPartsDetailEntity> pageInfo = new PageInfo<>(list);
  59. return pageInfo;
  60. }
  61. }