
package org.sky.scientific.mapper;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.sky.scientific.pojo.dto.TechnicianDTO;
import org.sky.scientific.pojo.entity.XmTechnicianHours;
import org.sky.scientific.pojo.vo.DailyAttendance;
import org.sky.scientific.pojo.vo.DailyHours;
import org.sky.scientific.pojo.vo.TechnicianHoursMonthlyVO;
import org.sky.scientific.pojo.vo.XmTechnicianHoursVO;

import java.util.List;

/**
 * 研发人员研发工时 Mapper 接口
 *
 * @author Kd
 * @since 2025-06-29
 */
public interface XmTechnicianHoursMapper extends BaseMapper<XmTechnicianHours> {

 	int batchUpdate(List<XmTechnicianHours> list);

 	List<DailyAttendance> selectByXmIdAndUnicode(@Param("xmId") Long xmId, @Param("unicode") String unicode, @Param("yearAndMonth") String yearAndMonth);

 	List<XmTechnicianHoursVO> selectHoursPage(IPage<XmTechnicianHoursVO> page, @Param("ew") XmTechnicianHoursVO dto);

	List<XmTechnicianHours> selectByYearAndMonth(String yearAndMonth, @Param("xmId") Long xmId, @Param("unicode") String unicode);

	List<JSONObject> countByUnicodeAndWorkDate(String yearAndMonth);
	/**
	 * 清除工时数据
	 */
	int clear(@Param("yearAndMonth") String yearAndMonth, @Param("xmId") Long xmId, @Param("unicode") String unicode);

    List<JSONObject> selectListForPrint(XmTechnicianHoursVO dto);

	/**
	 * 按月查询人员的年度工时
	 * @param unicode
	 * @param year
	 * @return
	 */
	List<DailyAttendance> selectHoursListByUnicodeAndYear(@Param("unicode") String unicode, @Param("year") String year);

	/**
	 * 每月研发工时分配表
	 * @param page
	 * @param dto
	 * @return
	 */
    List<TechnicianHoursMonthlyVO> meiyueyanfagongshifenpeibiao(@Param("page") IPage<TechnicianHoursMonthlyVO> page, @Param("ew") TechnicianDTO dto);

	/**
	 * 查询考勤、研发工时
	 * @param yearAndMonth 月份
	 * @param unicode 人员
	 * @return
	 */
	List<DailyHours> selectDailyHoursByUnicodeAndMonth(@Param("yearAndMonth") String yearAndMonth, @Param("unicode") String unicode);

}
