lxw
2023-10-19 c3521c889382efcdcc12e206f62023075518859e
根据物料id查询pic历史和dwg历史
1个文件已添加
1个文件已修改
60 ■■■■■ 已修改文件
src/main/java/com/whyc/controller/MaterialHistoryController.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/service/MaterialHistoryService.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/whyc/controller/MaterialHistoryController.java
New file
@@ -0,0 +1,30 @@
package com.whyc.controller;
import com.whyc.dto.Response;
import com.whyc.service.MaterialHistoryService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@Api(tags = "物料历史管理")
@RestController
@RequestMapping("materialHistory")
public class MaterialHistoryController {
    @Autowired
    private MaterialHistoryService service;
    @ApiOperation(value = "根据物料id查询dwg历史")
    @GetMapping("getDwgHisById")
    public Response getDwgHisById(@RequestParam int materialId,@RequestParam int pageCurr,@RequestParam int pageSize){
        return service.getDwgHisById(materialId,pageCurr,pageSize);
    }
    @ApiOperation(value = "根据物料id查询pic历史")
    @GetMapping("getPicHisById")
    public Response getPicHisById(@RequestParam int materialId,@RequestParam int pageCurr,@RequestParam int pageSize){
        return service.getPicHisById(materialId,pageCurr,pageSize);
    }
}
src/main/java/com/whyc/service/MaterialHistoryService.java
@@ -1,10 +1,16 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.whyc.dto.Response;
import com.whyc.mapper.MaterialHistoryMapper;
import com.whyc.pojo.MaterialHistory;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;
import javax.annotation.Resource;
import java.util.List;
@Service
public class MaterialHistoryService {
@@ -15,4 +21,28 @@
    public void insert(MaterialHistory mh) {
        mapper.insert(mh);
    }
    //根据物料id查询dwg历史
    public Response getDwgHisById(int materialId,  int pageCurr,  int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("material_id",materialId);
        wrapper.isNotNull("dwg_url");
        wrapper.orderByDesc("create_time");
        List list=mapper.selectList(wrapper);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0,pageInfo,"根据物料id查询dwg历史");
    }
    //根据物料id查询pic历史
    public Response getPicHisById(int materialId,  int pageCurr,  int pageSize) {
        PageHelper.startPage(pageCurr,pageSize);
        QueryWrapper wrapper=new QueryWrapper();
        wrapper.eq("material_id",materialId);
        wrapper.isNotNull("picture_url");
        wrapper.orderByDesc("create_time");
        List list=mapper.selectList(wrapper);
        PageInfo pageInfo=new PageInfo(list);
        return new Response().setII(1,list.size()>0,pageInfo,"根据物料id查询pic历史");
    }
}