package org.jk.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.jk.common.core.utils.DateUtils;
import org.jk.common.core.utils.SnowflakeDigitGenerator;
import org.jk.common.mybatis.core.page.PageQuery;
import org.jk.system.domain.SysClient;
import org.jk.system.domain.SysProjectStaff;
import org.jk.system.domain.vo.SysClientVo;
import org.jk.system.mapper.SysProjectStaffMapper;
import org.jk.system.service.ISysProjectStaffService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 【请填写功能名称】Service业务层处理
 *
 * @author takai
 * @date 2025-05-28
 */
@RequiredArgsConstructor
@Service
public class SysProjectStaffServiceImpl implements ISysProjectStaffService
{
    @Autowired
    private final SysProjectStaffMapper sysProjectStaffMapper;

    /**
     * 查询【请填写功能名称】
     *
     * @param id 【请填写功能名称】主键
     * @return 【请填写功能名称】
     */
    @Override
    public SysProjectStaff selectSysProjectStaffById(Long id)
    {
        return sysProjectStaffMapper.selectSysProjectStaffById(id);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param sysProjectStaff 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public List<SysProjectStaff> selectSysProjectStaffList(SysProjectStaff sysProjectStaff)
    {
        return sysProjectStaffMapper.selectSysProjectStaffList(sysProjectStaff);
    }

    /**
     * 查询【请填写功能名称】列表
     *
     * @param sysProjectStaff 【请填写功能名称】
     * @return 【请填写功能名称】
     */
    @Override
    public SysProjectStaff selectSysProjectStaff(SysProjectStaff sysProjectStaff)
    {
        return sysProjectStaffMapper.selectSysProjectStaff(sysProjectStaff);
    }


    /**
     * 新增【请填写功能名称】
     *
     * @param sysProjectStaff 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int insertSysProjectStaff(SysProjectStaff sysProjectStaff)
    {
//        List<String> approvers = sysProjectStaff.getApprovers();
//        String userids = String.join(",", approvers);
        SnowflakeDigitGenerator snowflakeDigitGenerator = new SnowflakeDigitGenerator(1, 1);
//        sysProjectStaff.setUserId(userids);
        sysProjectStaff.setCreateTime(DateUtils.getNowDate());
        sysProjectStaff.setId(String.valueOf(snowflakeDigitGenerator.nextId()));
        return sysProjectStaffMapper.insertSysProjectStaff(sysProjectStaff);
    }

    /**
     * 修改【请填写功能名称】
     *
     * @param sysProjectStaff 【请填写功能名称】
     * @return 结果
     */
    @Override
    public int updateSysProjectStaff(SysProjectStaff sysProjectStaff)
    {
//        List<String> approvers = sysProjectStaff.getApprovers();
//        String userids = String.join(",", approvers);
//        sysProjectStaff.setUserId(userids);
        sysProjectStaff.setUpdateTime(DateUtils.getNowDate());
        return sysProjectStaffMapper.updateSysProjectStaff(sysProjectStaff);
    }

    /**
     * 批量删除【请填写功能名称】
     *
     * @param ids 需要删除的【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSysProjectStaffByIds(Long[] ids)
    {
        return sysProjectStaffMapper.deleteSysProjectStaffByIds(ids);
    }

    /**
     * 删除【请填写功能名称】信息
     *
     * @param id 【请填写功能名称】主键
     * @return 结果
     */
    @Override
    public int deleteSysProjectStaffById(Long id)
    {
        return sysProjectStaffMapper.deleteSysProjectStaffById(id);
    }

    @Override
    public Page<SysProjectStaff> selectPageList(SysProjectStaff sysProjectStaff,PageQuery pageQuery)
    {
        return sysProjectStaffMapper.selectPageList(sysProjectStaff,pageQuery.build());
    }
}
