12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- package com.example.demo.service.impl;
- import com.example.demo.entity.RenovationPartsDetailEntity;
- import com.example.demo.mapper.IBaseMapper;
- import com.example.demo.mapper.IRenovationPartsAttachingMapper;
- import com.example.demo.mapper.IRenovationPartsDetailMapper;
- import com.example.demo.mapper.IRenovationPartsSizeMapper;
- import com.example.demo.service.IRenovationPartsDetailService;
- import com.example.demo.vo.response.ResponseRenovationPartsDetail;
- import com.github.pagehelper.PageHelper;
- import com.github.pagehelper.PageInfo;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- import org.springframework.transaction.annotation.Transactional;
- import java.util.List;
- /**
- * Created by Hb_zzZ on 2020/8/11.
- */
- @Service
- @Transactional
- public class RenovationPartsDetailServiceImpl extends BaseServiceImpl<RenovationPartsDetailEntity, Long> implements IRenovationPartsDetailService {
- @Autowired
- private IRenovationPartsDetailMapper mapper;
- @Autowired
- private IRenovationPartsAttachingMapper renovationPartsAttachingMapper;
- @Autowired
- private IRenovationPartsSizeMapper renovationPartsSizeMapper;
- @Override
- public IBaseMapper<RenovationPartsDetailEntity, Long> getBaseMapper() {
- return this.mapper;
- }
- @Override
- public List<ResponseRenovationPartsDetail> findDetailByTypeId(Long id, Long colorId, Long classifyId) {
- if(colorId != null && colorId.longValue() == 0){
- colorId = null;
- }
- if(classifyId != null && classifyId.longValue() == 0){
- classifyId = null;
- }
- List<ResponseRenovationPartsDetail> detailList = mapper.findDetailByTypeId(id, colorId, classifyId);
- for (ResponseRenovationPartsDetail responseRenovationPartsDetail : detailList) {
- responseRenovationPartsDetail.setEditing(renovationPartsAttachingMapper.findAttachinByDetailId(responseRenovationPartsDetail.getId()));
- responseRenovationPartsDetail.setSize(renovationPartsSizeMapper.findSizeByDetailId(responseRenovationPartsDetail.getId()));
- }
- return detailList;
- }
- @Override
- public ResponseRenovationPartsDetail findByName(String name) {
- return mapper.findByName(name);
- }
- @Override
- public List<ResponseRenovationPartsDetail> findByKeyWord(String keyWord) {
- return mapper.findByKeyWord(keyWord);
- }
- @Override
- public PageInfo<RenovationPartsDetailEntity> findAllByUserId(Long userId, String name, Integer pageNum, Integer pageSize) {
- PageHelper.startPage(pageNum, pageSize);
- List<RenovationPartsDetailEntity> list = mapper.findAllByUserId(userId, name);
- PageInfo<RenovationPartsDetailEntity> pageInfo = new PageInfo<>(list);
- return pageInfo;
- }
- }
|