whycxzp
2021-07-26 8c189b243bfbbacb2ab1ce79f4e1ff22708f125a
src/main/java/com/whyc/service/MotorSystemInfService.java
@@ -1,9 +1,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);
        }
    }
}