package com.vctgo.system.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.vctgo.common.core.domain.R;
import com.vctgo.common.core.text.Convert;
import com.vctgo.common.core.utils.ServletUtils;
import com.vctgo.common.mybatisplus.constant.MybatisPageConstants;
import com.vctgo.common.security.utils.SecurityUtils;
import com.vctgo.system.api.domain.SysUser;
import com.vctgo.system.domain.SysTagManagement;
import com.vctgo.system.mapper.SysTagManagementMapper;
import com.vctgo.system.mapper.SysUserMapper;
import com.vctgo.system.service.ISysTagManagementService;
import com.vctgo.system.util.ConstantUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 标签管理Service业务层处理
 *
 * @author wanglonghua
 * @date 2023-08-14
 */
@Slf4j
@Service
public class SysTagManagementServiceImpl implements ISysTagManagementService
{
    @Autowired
    private SysTagManagementMapper sysTagManagementMapper;

    @Autowired
    private SysUserMapper sysUserMapper;


    /**
     * 查询标签管理
     *
     * @param id 标签管理主键
     * @return 标签管理
     */
    @Override
    public SysTagManagement selectSysTagManagementById(Long id)
    {
        return sysTagManagementMapper.selectById(id);
    }

    /**
     * 查询标签管理列表-分页
     *
     * @param sysTagManagement 标签管理
     * @return 标签管理
     */
    @Override
    public IPage<SysTagManagement> selectSysTagManagementPage(SysTagManagement sysTagManagement)
    {
       return null;
    }
    /**
     * 查询标签管理列表
     *
     * @param sysTagManagement 标签管理
     * @return 标签管理
     */
    @Override
    public List<SysTagManagement> selectSysTagManagementList(SysTagManagement sysTagManagement)
    {
        return null;

    }

    @Override
    public List<SysTagManagement> selectTagListByParams(Map<String, Object> params) {
        return sysTagManagementMapper.selectTagListByParams(params);
    }

    /**
     * 新增标签管理
     *
     * @param sysTagManagement 标签管理
     * @return 结果
     */

    @Override
    public int insertSysTagManagement(SysTagManagement sysTagManagement)
    {
        return sysTagManagementMapper.insert(sysTagManagement);
    }

    /**
     * 修改标签管理
     *
     * @param sysTagManagement 标签管理
     * @return 结果
     */
    @Override
    public int updateSysTagManagement(SysTagManagement sysTagManagement)
    {
        return sysTagManagementMapper.updateById(sysTagManagement);
    }

    /**
     * 逻辑删除标签管理
     *
     * @param ids 需要删除的标签管理主键
     * @return 结果
     */
    @Override
    public int logicalDeleteSysTagManagementByIds(Long[] ids)
    {
        SysTagManagement sysTagManagement = new SysTagManagement();
        sysTagManagement.setUpdateById(SecurityUtils.getUserId());
        sysTagManagement.setUpdateBy(SecurityUtils.getUsername());
        sysTagManagement.setUpdateTime(new Date());
        sysTagManagement.setIsDeleted(ConstantUtils.IS_DELETED_1);
        return sysTagManagementMapper.logicalDeleteSysTagManagementByIds(ids, sysTagManagement);
    }

    /**
     * 批量删除标签管理
     *
     * @param ids 需要删除的标签管理主键
     * @return 结果
     */
    @Override
    public int deleteSysTagManagementByIds(Long[] ids)
    {
        return sysTagManagementMapper.deleteSysTagManagementByIds(ids);
    }

    /**
     * 删除标签管理信息
     *
     * @param id 标签管理主键
     * @return 结果
     */
    @Override
    public int deleteSysTagManagementById(Long id)
    {
        return sysTagManagementMapper.deleteById(id);
    }

    @Override
    public List<SysTagManagement> getAllTag(SysTagManagement sysTagManagement) {
        return sysTagManagementMapper.getAllTag(sysTagManagement);
    }
}
