package com.sqx.modules.errand.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sqx.common.utils.Result;
import com.sqx.modules.errand.dao.ServiceTypeDao;
import com.sqx.modules.errand.entity.ServiceType;
import com.sqx.modules.errand.service.ServiceTypeService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ServiceTypeServiceImpl extends ServiceImpl<ServiceTypeDao, ServiceType> implements ServiceTypeService {

    @Override
    public Result selectServiceTypeList() {
        List<ServiceType> serviceTypes = baseMapper.selectList(null);
        return Result.success().put("data", serviceTypes);
    }

    @Override
    public Result insertServiceType(ServiceType serviceType) {
        baseMapper.insert(serviceType);
        return Result.success();
    }

    @Override
    public Result updateServiceType(ServiceType serviceType) {
        baseMapper.updateById(serviceType);
        return Result.success();
    }

    @Override
    public Result deleteServiceType(Long id) {
        baseMapper.deleteById(id);
        return Result.success();
    }
}
