package com.yuchen.saas.park.service.service.work.impl;

import com.yuchen.saas.park.api.dto.work.SaasWorkOrderHandleTimeLimitDto;
import com.yuchen.saas.park.api.entity.work.SaasWorkOrderHandleTimeLimit;
import com.yuchen.saas.park.api.vo.work.SaasWorkOrderHandleTimeLimitVo;
import com.yuchen.saas.park.service.mapper.work.SaasWorkOrderHandleTimeLimitMapper;
import com.yuchen.saas.park.service.service.work.ISaasWorkOrderHandleTimeLimitService;
import org.nest.springwrap.core.mp.base.BaseServiceImpl;
import org.nest.springwrap.core.tool.utils.BeanUtil;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 工单处理时限设置表 服务实现类
 * </p>
 *
 * @author caiwq
 * @since 2024-04-01
 */
@Service
public class SaasWorkOrderHandleTimeLimitServiceImpl extends BaseServiceImpl<SaasWorkOrderHandleTimeLimitMapper, SaasWorkOrderHandleTimeLimit> implements ISaasWorkOrderHandleTimeLimitService {

    @Override
    public Boolean add(SaasWorkOrderHandleTimeLimitDto workOrderHandleTimeLimitDto) {
        SaasWorkOrderHandleTimeLimit workOrderHandleTimeLimit = BeanUtil.copyProperties(workOrderHandleTimeLimitDto, SaasWorkOrderHandleTimeLimit.class);
        return saveOrUpdate(workOrderHandleTimeLimit);
    }

    @Override
    public SaasWorkOrderHandleTimeLimitVo getDetail() {
        SaasWorkOrderHandleTimeLimit workOrderHandleTimeLimit = this.lambdaQuery().last("LIMIT 1").one();
        return BeanUtil.copyProperties(workOrderHandleTimeLimit, SaasWorkOrderHandleTimeLimitVo.class);
    }

}
