package com.cpxt.biz.service.impl;

import java.util.Arrays;
import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.cpxt.biz.domain.BizCustomer;
import com.cpxt.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.cpxt.biz.mapper.BizCustomerRouteMapper;
import com.cpxt.biz.domain.BizCustomerRoute;
import com.cpxt.biz.service.IBizCustomerRouteService;

/**
 * 路线Service业务层处理
 * 
 * @author YIN
 * @date 2024-12-16
 */
@Service
public class BizCustomerRouteServiceImpl implements IBizCustomerRouteService 
{
    @Autowired
    private BizCustomerRouteMapper bizCustomerRouteMapper;

    /**
     * 查询路线
     * 
     * @param id 路线主键
     * @return 路线
     */
    @Override
    public BizCustomerRoute selectBizCustomerRouteById(Long id)
    {
        return bizCustomerRouteMapper.selectById(id);
    }

    /**
     * 查询路线列表
     * 
     * @param bizCustomerRoute 路线
     * @return 路线
     */
    @Override
    public List<BizCustomerRoute> selectBizCustomerRouteList(BizCustomerRoute bizCustomerRoute)
    {
        LambdaQueryWrapper<BizCustomerRoute> queryWrapper = new LambdaQueryWrapper<>();

        return bizCustomerRouteMapper.selectList(queryWrapper);
    }

    /**
     * 新增路线
     * 
     * @param bizCustomerRoute 路线
     * @return 结果
     */
    @Override
    public int insertBizCustomerRoute(BizCustomerRoute bizCustomerRoute)
    {
        return bizCustomerRouteMapper.insert(bizCustomerRoute);
    }

    /**
     * 修改路线
     * 
     * @param bizCustomerRoute 路线
     * @return 结果
     */
    @Override
    public int updateBizCustomerRoute(BizCustomerRoute bizCustomerRoute)
    {
        return bizCustomerRouteMapper.updateById(bizCustomerRoute);
    }

    /**
     * 批量删除路线
     * 
     * @param ids 需要删除的路线主键
     * @return 结果
     */
    @Override
    public int deleteBizCustomerRouteByIds(Long[] ids)
    {
        UpdateWrapper<BizCustomerRoute> updateWrapper = new UpdateWrapper<>();
        updateWrapper.in("id", (Object) ids);
        updateWrapper.set("status","2"); //状态改为删除
        return bizCustomerRouteMapper.update(null,updateWrapper);
    }

    /**
     * 删除路线信息
     * 
     * @param id 路线主键
     * @return 结果
     */
    @Override
    public int deleteBizCustomerRouteById(Long id)
    {
        UpdateWrapper<BizCustomerRoute> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", id);
        updateWrapper.set("status","2"); //状态改为删除
        return bizCustomerRouteMapper.update(null,updateWrapper);
    }
}
