whycrzg
2021-05-24 085772848a19d61dbcea955ff784fda8bb73aa35
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
33
34
35
36
37
38
39
40
41
42
43
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.MotorSystemInfMapper;
import com.whyc.pojo.MotorSystemInf;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
/**
 *
 */
@Service
public class MotorSystemInfService {
 
    @Resource
    private MotorSystemInfMapper mapper;
 
    public Response getAll() {
        try {
            List<MotorSystemInf> motorSystemInfs = mapper.selectList(null);
            return new Response<>().set(1,motorSystemInfs);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<>().setCode(0);
        }
    }
 
    public Response<List<MotorSystemInf>> getDevBySysId(int sysId) {
        try{
            QueryWrapper<MotorSystemInf> queryWrapper = new QueryWrapper<>();
            queryWrapper.eq("sys_id",sysId);
            List<MotorSystemInf> motorSystemInfs = mapper.selectList(queryWrapper);
            return new Response<List<MotorSystemInf>>().set(1,motorSystemInfs);
        }catch (Exception e){
            e.printStackTrace();
            return new Response<List<MotorSystemInf>>().setCode(0);
        }
    }
}