|
|
@@ -2,22 +2,32 @@ package com.xjrsoft.module.textbook.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.github.yulichang.base.MPJBaseServiceImpl;
|
|
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
|
|
import com.xjrsoft.common.enums.WarehouseModeEnum;
|
|
|
import com.xjrsoft.common.exception.MyException;
|
|
|
+import com.xjrsoft.common.page.ConventPage;
|
|
|
+import com.xjrsoft.common.utils.VoToColumnUtil;
|
|
|
+import com.xjrsoft.module.base.entity.BaseCourseSubject;
|
|
|
+import com.xjrsoft.module.base.entity.BaseSemester;
|
|
|
+import com.xjrsoft.module.base.entity.CourseSubjectDetail;
|
|
|
+import com.xjrsoft.module.system.entity.DictionaryDetail;
|
|
|
+import com.xjrsoft.module.teacher.entity.XjrUser;
|
|
|
import com.xjrsoft.module.textbook.dto.AddTextbookWarehouseRecordDto;
|
|
|
import com.xjrsoft.module.textbook.dto.TextbookWarehouseRecordExportDto;
|
|
|
import com.xjrsoft.module.textbook.dto.TextbookWarehouseRecordPageDto;
|
|
|
-import com.xjrsoft.module.textbook.entity.Textbook;
|
|
|
-import com.xjrsoft.module.textbook.entity.TextbookWarehouseRecord;
|
|
|
+import com.xjrsoft.module.textbook.entity.*;
|
|
|
import com.xjrsoft.module.textbook.mapper.TextbookMapper;
|
|
|
import com.xjrsoft.module.textbook.mapper.TextbookWarehouseRecordMapper;
|
|
|
import com.xjrsoft.module.textbook.service.ITextbookWarehouseRecordService;
|
|
|
+import com.xjrsoft.module.textbook.vo.SubscriptionItemListDistributeVo;
|
|
|
+import com.xjrsoft.module.textbook.vo.TextbookSubscriptionPageVo;
|
|
|
import com.xjrsoft.module.textbook.vo.TextbookWarehouseRecordPageVo;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import org.apache.commons.lang3.ObjectUtils;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
@@ -37,17 +47,46 @@ public class TextbookWarehouseRecordServiceImpl extends MPJBaseServiceImpl<Textb
|
|
|
private final TextbookWarehouseRecordMapper textbookWarehouseRecordMapper;
|
|
|
|
|
|
@Override
|
|
|
- public Page<TextbookWarehouseRecordPageVo> getPage(TextbookWarehouseRecordPageDto dto) {
|
|
|
-// MPJLambdaWrapper<TextbookWarehouseRecord>;-
|
|
|
-
|
|
|
-// MPJLambdaWrapper<TextbookWarehouseRecord> textbookWarehouseRecordMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
-// textbookWarehouseRecordMPJLambdaWrapper
|
|
|
-// .leftJoin()
|
|
|
-// ;
|
|
|
-
|
|
|
-
|
|
|
+ public IPage<TextbookWarehouseRecordPageVo> getPage(TextbookWarehouseRecordPageDto dto) {
|
|
|
+ MPJLambdaWrapper<TextbookWarehouseRecord> textbookWarehouseRecordMPJLambdaWrapper = new MPJLambdaWrapper<>();
|
|
|
+ textbookWarehouseRecordMPJLambdaWrapper
|
|
|
+ .disableSubLogicDel()
|
|
|
+ .select(TextbookWarehouseRecord::getId)
|
|
|
+ .select(Textbook.class,x -> VoToColumnUtil.fieldsToColumns(TextbookWarehouseRecordPageVo.class).contains(x.getProperty()))
|
|
|
+ .select(TextbookWarehouseRecord.class,x -> VoToColumnUtil.fieldsToColumns(TextbookWarehouseRecordPageVo.class).contains(x.getProperty()))
|
|
|
+ .innerJoin(Textbook.class, Textbook::getId, TextbookWarehouseRecord::getTextbookId)
|
|
|
+ .leftJoin(TextbookSubscription.class, TextbookSubscription::getId, TextbookWarehouseRecord::getDataId,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(BaseSemester::getName, TextbookWarehouseRecordPageVo::getBaseSemesterIdCn)
|
|
|
+ .leftJoin(BaseSemester.class, BaseSemester::getId, TextbookSubscription::getBaseSemesterId)
|
|
|
+ )
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, TextbookWarehouseRecord::getWarehouseMode,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(DictionaryDetail::getName, TextbookWarehouseRecordPageVo::getWarehouseModeCn)
|
|
|
+ )
|
|
|
+ .leftJoin(DictionaryDetail.class, DictionaryDetail::getCode, Textbook::getTextbookType,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(DictionaryDetail::getName, TextbookWarehouseRecordPageVo::getTextbookTypeCn)
|
|
|
+ )
|
|
|
+ .leftJoin(SubjectGroup.class, SubjectGroup::getId, Textbook::getSubjectGroupId,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(SubjectGroup::getGroupName, TextbookWarehouseRecordPageVo::getGroupName)
|
|
|
+ )
|
|
|
+ .leftJoin(BaseCourseSubject.class, BaseCourseSubject::getId, Textbook::getCourseSubjectId,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(BaseCourseSubject::getName, TextbookWarehouseRecordPageVo::getGroupName)
|
|
|
+ )
|
|
|
+ .leftJoin(XjrUser.class, XjrUser::getId, TextbookWarehouseRecord::getCreateUserId,
|
|
|
+ wrapper -> wrapper
|
|
|
+ .selectAs(XjrUser::getName, TextbookWarehouseRecordPageVo::getWarehouseUser)
|
|
|
+ )
|
|
|
+ .eq(ObjectUtils.isNotEmpty(dto.getBaseSemesterId()), TextbookSubscription::getBaseSemesterId, dto.getBaseSemesterId())
|
|
|
+ .eq(ObjectUtils.isNotEmpty(dto.getSubjectGroupId()), Textbook::getSubjectGroupId, dto.getSubjectGroupId())
|
|
|
+ .eq(ObjectUtils.isNotEmpty(dto.getCourseSubjectId()), Textbook::getCourseSubjectId, dto.getCourseSubjectId())
|
|
|
+ .like(StringUtils.isNotEmpty(dto.getBookName()), Textbook::getBookName, dto.getBookName())
|
|
|
+ ;
|
|
|
+ return this.selectJoinListPage(ConventPage.getPage(dto), TextbookWarehouseRecordPageVo.class, textbookWarehouseRecordMPJLambdaWrapper);
|
|
|
// return textbookWarehouseRecordMapper.getPage(page, dto);
|
|
|
- return null;
|
|
|
}
|
|
|
|
|
|
@Override
|