/*
 *    Copyright (c) 2018-2025, lengleng All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright
 * notice, this list of conditions and the following disclaimer in the
 * documentation and/or other materials provided with the distribution.
 * Neither the name of the yifu4cloud.com developer nor the names of its
 * contributors may be used to endorse or promote products derived from
 * this software without specific prior written permission.
 * Author: lengleng (wangiegie@gmail.com)
 */

package com.yifu.cloud.plus.v1.yifu.salary.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yifu.cloud.plus.v1.yifu.salary.entity.TSalaryZero;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroExportVo;
import com.yifu.cloud.plus.v1.yifu.salary.vo.TSalaryZeroSearchVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 0申报
 *
 * @author hgw
 * @date 2026-03-18 14:47:00
 */
@Mapper
public interface TSalaryZeroMapper extends BaseMapper<TSalaryZero> {
    // 单个查询
    TSalaryZero getTSalaryZeroById(@Param("tableName") String tableName, @Param("id") String id);
	// 单个删除
    int deleteTSalaryZeroById(@Param("tableName") String tableName, @Param("id") String id);
	// 批量删除
    int deleteTSalaryZeroByIdList(@Param("tableName") String tableName, @Param("idList") String idList);
	// 分页查询
    IPage<TSalaryZero> getTSalaryZeroPage(Page<TSalaryZero> page, @Param("tableName") String tableName, @Param("tSalaryZero") TSalaryZeroSearchVo searchVo);

	// 批量更新状态(deleteFlag0,1,2：0：正常；1：已删除；2存在报账假删除)
    int updateDeleteFlagByIdList(@Param("tableName") String tableName, @Param("deleteFlag") Integer deleteFlag, @Param("idList") List<String> idList);

	// 导出获取数据总数
    long getTSalaryZeroCount(@Param("tableName") String tableName, @Param("tSalaryZero") TSalaryZeroSearchVo searchVo);
	// 导出获取数据
	List<TSalaryZeroExportVo> getTSalaryZeroExport(@Param("tableName") String tableName, @Param("tSalaryZero") TSalaryZeroSearchVo searchVo);

	// 获取已存在的身份证去重
	List<String> getIdListByCardAndTitleAndMonth(@Param("tableName") String tableName
			, @Param("invoiceTitle") String invoiceTitle, @Param("settleMonth") String settleMonth, @Param("cardList") List<String> cardList);

	/**
	 * @Description: 自动创建年度0申报表
	 * @Author: hgw
	 * @Date: 2026/3/18 16:32
	 **/
	void createSalaryZeroYear(@Param("tableName") String tableName);

	// 自动创建每月的0申报视图（1月创建含去年12月的计税月份）（2月更新成当年的上月的计税月份）
	void createOrUpdateViewSalaryZeroYear(@Param("viewYearName") String viewYearName, @Param("tableNameOrLastTable") String tableNameOrLastTable);
	// 自动创建每日的0申报视图（1月创建含去年12月的计税月份）（2月更新成当年的上月的计税月份）
	void createOrUpdateViewSalaryZeroDay(@Param("viewDayName") String viewDayName, @Param("tableName") String tableName, @Param("tableNameOrLastTable") String tableNameOrLastTable);

	// 每月1号生成当月0申报表
	void insertIntoSalaryZeroYear(@Param("tableName") String tableName, @Param("viewYearName") String viewYearName);
	// 每天23点生成当天0申报表
	void insertIntoSalaryZeroNowDay(@Param("tableName") String tableName, @Param("viewDayName") String viewDayName);

	// 判断表是否存在
	int getTableExists(@Param("tableName") String tableName);

}
