whycxzp
2021-01-07 d7fb9e92779e971954ca59b86848569592f6185b
src/main/java/com/whyc/service/MotorSystemInfService.java
@@ -1,9 +1,42 @@
package com.whyc.service;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
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);
        }
    }
}