package com.hw.dms.service.impl;

import java.util.List;
import com.hw.common.core.utils.DateUtils;
import com.hw.common.log.annotation.Log;
import com.hw.system.api.model.LoginUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.dms.mapper.DmsBaseInspectRouteMapper;
import com.hw.dms.domain.DmsBaseInspectRoute;
import com.hw.dms.service.IDmsBaseInspectRouteService;

/**
 * 巡检线路信息Service业务层处理
 *
 * @author Open Platform
 * @date 2024-01-16
 */
@Service
public class DmsBaseInspectRouteServiceImpl implements IDmsBaseInspectRouteService
{
    @Autowired
    private DmsBaseInspectRouteMapper dmsBaseInspectRouteMapper;

    /**
     * 查询巡检线路信息
     *
     * @param inspectRouteId 巡检线路信息主键
     * @return 巡检线路信息
     */
    @Override
    public DmsBaseInspectRoute selectDmsBaseInspectRouteByInspectRouteId(Long inspectRouteId)
    {
        return dmsBaseInspectRouteMapper.selectDmsBaseInspectRouteByInspectRouteId(inspectRouteId);
    }

    /**
     * 查询巡检线路信息列表
     *
     * @param dmsBaseInspectRoute 巡检线路信息
     * @return 巡检线路信息
     */
    @Override
    public List<DmsBaseInspectRoute> selectDmsBaseInspectRouteList(DmsBaseInspectRoute dmsBaseInspectRoute)
    {
        return dmsBaseInspectRouteMapper.selectDmsBaseInspectRouteList(dmsBaseInspectRoute);
    }

    /**
     * 新增巡检线路信息
     *
     * @param dmsBaseInspectRoute 巡检线路信息
     * @return 结果
     */
    @Override
    public int insertDmsBaseInspectRoute(DmsBaseInspectRoute dmsBaseInspectRoute)
    {
        LoginUser user = new LoginUser();
        dmsBaseInspectRoute.setCreateBy(user.getUsername());
        dmsBaseInspectRoute.setIsFlag("1");
        dmsBaseInspectRoute.setCreateTime(DateUtils.getNowDate());
        return dmsBaseInspectRouteMapper.insertDmsBaseInspectRoute(dmsBaseInspectRoute);
    }

    /**
     * 修改巡检线路信息
     *
     * @param dmsBaseInspectRoute 巡检线路信息
     * @return 结果
     */
    @Override
    public int updateDmsBaseInspectRoute(DmsBaseInspectRoute dmsBaseInspectRoute)
    {
        LoginUser user = new LoginUser();
        dmsBaseInspectRoute.setUpdateBy(user.getUsername());
        dmsBaseInspectRoute.setUpdateTime(DateUtils.getNowDate());
        return dmsBaseInspectRouteMapper.updateDmsBaseInspectRoute(dmsBaseInspectRoute);
    }

    /**
     * 批量删除巡检线路信息
     *
     * @param inspectRouteIds 需要删除的巡检线路信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseInspectRouteByInspectRouteIds(Long[] inspectRouteIds)
    {
        return dmsBaseInspectRouteMapper.deleteDmsBaseInspectRouteByInspectRouteIds(inspectRouteIds);
    }

    /**
     * 删除巡检线路信息信息
     *
     * @param inspectRouteId 巡检线路信息主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseInspectRouteByInspectRouteId(Long inspectRouteId)
    {
        return dmsBaseInspectRouteMapper.deleteDmsBaseInspectRouteByInspectRouteId(inspectRouteId);
    }
}
