|
@@ -1,12 +1,23 @@
|
|
package com.om.service.impl;
|
|
package com.om.service.impl;
|
|
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
|
+import cn.hutool.core.util.PageUtil;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
|
+import com.om.entity.dto.AppWxscQueryPageDTO;
|
|
import com.om.entity.po.Wxsc;
|
|
import com.om.entity.po.Wxsc;
|
|
|
|
+import com.om.entity.vo.AppWxscQueryPageVO;
|
|
|
|
+import com.om.entity.vo.AppWxscVO;
|
|
|
|
+import com.om.exception.BadReqException;
|
|
import com.om.mapper.WxscMapper;
|
|
import com.om.mapper.WxscMapper;
|
|
import com.om.service.IWxscService;
|
|
import com.om.service.IWxscService;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
+import com.om.utils.Result;
|
|
|
|
+import org.springframework.context.annotation.Bean;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* <p>
|
|
* <p>
|
|
* 服务实现类
|
|
* 服务实现类
|
|
@@ -27,4 +38,53 @@ public class WxscServiceImpl extends ServiceImpl<WxscMapper, Wxsc> implements IW
|
|
public Page<Wxsc> findManual(Page<Wxsc> page, String code, String title) {
|
|
public Page<Wxsc> findManual(Page<Wxsc> page, String code, String title) {
|
|
return wxscMapper.findManual(page, code, title);
|
|
return wxscMapper.findManual(page, code, title);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result<AppWxscQueryPageVO> appGetPageList(AppWxscQueryPageDTO dto) {
|
|
|
|
+ if (BeanUtil.isEmpty(dto)){
|
|
|
|
+ throw new BadReqException("数据为空");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Integer pageIndex = dto.getPageIndex();
|
|
|
|
+ Integer pageSize = dto.getPageSize();
|
|
|
|
+
|
|
|
|
+ Page<Wxsc> page = this.lambdaQuery()
|
|
|
|
+ .page(new Page<>(pageIndex, pageSize));
|
|
|
|
+
|
|
|
|
+ if (BeanUtil.isEmpty(page)){
|
|
|
|
+ return Result.ok();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ AppWxscQueryPageVO vo = new AppWxscQueryPageVO();
|
|
|
|
+ vo.setCurrent((int) page.getCurrent());
|
|
|
|
+ vo.setTotal((int) page.getTotal());
|
|
|
|
+ vo.setPages((int) page.getPages());
|
|
|
|
+ vo.setSize((int) page.getSize());
|
|
|
|
+
|
|
|
|
+ List<AppWxscVO> appWxscVOS = new ArrayList<>();
|
|
|
|
+
|
|
|
|
+ List<Wxsc> records = page.getRecords();
|
|
|
|
+ for (Wxsc record : records) {
|
|
|
|
+ AppWxscVO appWxscVO = new AppWxscVO();
|
|
|
|
+ appWxscVO.setMaintenanceManualId(record.getId());
|
|
|
|
+ appWxscVO.setMaintenanceManualName(record.getScName());
|
|
|
|
+ appWxscVO.setCreateTime(record.getCreateTime());
|
|
|
|
+ appWxscVOS.add(appWxscVO);
|
|
|
|
+ }
|
|
|
|
+ vo.setRecords(appWxscVOS);
|
|
|
|
+ return Result.ok(vo);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public Result<Wxsc> appGetById(Integer id, String language) {
|
|
|
|
+ //todo 先不考虑语言
|
|
|
|
+ //根据id查询
|
|
|
|
+ Wxsc wxsc = this.getById(id);
|
|
|
|
+
|
|
|
|
+ if (BeanUtil.isEmpty(wxsc)){
|
|
|
|
+ throw new BadReqException("该维修资料不存在!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.ok(wxsc);
|
|
|
|
+ }
|
|
}
|
|
}
|