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

import com.yuchen.saas.park.api.dto.work.SaasWorkOrderCategorySettingDto;
import com.yuchen.saas.park.api.dto.work.SaasWorkOrderDispatchUserDto;
import com.yuchen.saas.park.api.entity.work.SaasWorkOrderCategorySetting;
import com.yuchen.saas.park.api.entity.work.SaasWorkOrderDispatchUser;
import com.yuchen.saas.park.api.vo.work.SaasWorkOrderCategorySettingVo;
import com.yuchen.saas.park.api.vo.work.SaasWorkOrderDispatchUserVo;
import com.yuchen.saas.park.service.mapper.work.SaasWorkOrderDispatchUserMapper;
import com.yuchen.saas.park.service.service.work.ISaasWorkOrderDispatchUserService;
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-10-15
 */
@Service
public class SaasWorkOrderDispatchUserServiceImpl extends BaseServiceImpl<SaasWorkOrderDispatchUserMapper, SaasWorkOrderDispatchUser> implements ISaasWorkOrderDispatchUserService {

    @Override
    public Boolean add(SaasWorkOrderDispatchUserDto dto) {
        SaasWorkOrderDispatchUser dispatchUser = BeanUtil.copyProperties(dto, SaasWorkOrderDispatchUser.class);
        return saveOrUpdate(dispatchUser);
    }

    @Override
    public SaasWorkOrderDispatchUserVo getDetail(Long customerId) {
        SaasWorkOrderDispatchUser dispatchUser = this.lambdaQuery().eq(SaasWorkOrderDispatchUser::getCustomerId, customerId).last("LIMIT 1").one();
        return BeanUtil.copyProperties(dispatchUser, SaasWorkOrderDispatchUserVo.class);
    }
}
