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
package com.whyc.service;
 
import com.whyc.dto.Response;
import com.whyc.mapper.DeviceTypeMapper;
import com.whyc.pojo.DeviceType;
import org.springframework.stereotype.Service;
 
import javax.annotation.Resource;
import java.util.List;
 
@Service
public class DeviceTypeService {
 
    @Resource
    private DeviceTypeMapper mapper;
 
    public Response<List<DeviceType>> getAll() {
        List<DeviceType> deviceTypes = mapper.selectList(null);
        return new Response<List<DeviceType>>().set(1,deviceTypes);
    }
 
    public Response update(DeviceType deviceType) {
        mapper.updateById(deviceType);
        return new Response().setMsg(1,"修改成功");
    }
 
    public Response<DeviceType> get(Integer deviceTypeId) {
        DeviceType deviceType = mapper.selectById(deviceTypeId);
        return new Response<DeviceType>().set(1,deviceType);
    }
 
    public DeviceType getOneByDeviceTypeId(Integer deviceTypeId){
        DeviceType deviceType = mapper.selectById(deviceTypeId);
        return deviceType;
    }
}