whyclxw
6 天以前 9b85345450e2e194a84679bb6612f58a3124aee8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package com.whyc.service;
 
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.whyc.dto.Response;
import com.whyc.mapper.DeviceSpareLogMapper;
import com.whyc.pojo.web_site.DeviceSpareLog;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class DeviceSpareLogService {
 
    @Resource
    private DeviceSpareLogMapper mapper;
 
 
    public void add(DeviceSpareLog deviceSpareLog) {
        mapper.insert(deviceSpareLog);
    }
 
    public Response<List<DeviceSpareLog>> getList(int deviceSpareId) {
        QueryWrapper<DeviceSpareLog> query = Wrappers.query();
        query.eq("device_spare_id",deviceSpareId);
        query.orderByDesc("id");
        List<DeviceSpareLog> deviceSpareLogs = mapper.selectList(query);
        return new Response<List<DeviceSpareLog>>().set(1, deviceSpareLogs);
 
    }
}