package com.ruoyi.system.mapper;

import java.util.Date;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import com.ruoyi.system.domain.SysCodeRule;

/**
 * 编码规则Mapper接口
 * 
 * @author Yangk
 * @date 2026-06-08
 */
public interface SysCodeRuleMapper 
{
    /**
     * 查询编码规则
     * 
     * @param ruleId 编码规则主键
     * @return 编码规则
     */
    public SysCodeRule selectSysCodeRuleByRuleId(Long ruleId);

    /**
     * 查询编码规则列表
     * 
     * @param sysCodeRule 编码规则
     * @return 编码规则集合
     */
    public List<SysCodeRule> selectSysCodeRuleList(SysCodeRule sysCodeRule);

    /**
     * 根据规则编码查询编码规则
     *
     * @param ruleCode 规则编码
     * @return 编码规则
     */
    public SysCodeRule selectSysCodeRuleByRuleCode(String ruleCode);

    /**
     * 锁定并查询编码规则
     *
     * @param ruleCode 规则编码
     * @return 编码规则
     */
    public SysCodeRule selectSysCodeRuleByRuleCodeForUpdate(String ruleCode);

    /**
     * 锁定并查询编码规则
     *
     * @param ruleId 编码规则主键
     * @return 编码规则
     */
    public SysCodeRule selectSysCodeRuleByRuleIdForUpdate(Long ruleId);

    /**
     * 新增编码规则
     * 
     * @param sysCodeRule 编码规则
     * @return 结果
     */
    public int insertSysCodeRule(SysCodeRule sysCodeRule);

    /**
     * 修改编码规则
     * 
     * @param sysCodeRule 编码规则
     * @return 结果
     */
    public int updateSysCodeRule(SysCodeRule sysCodeRule);

    /**
     * 更新编码规则流水状态
     *
     * @param ruleId 规则ID
     * @param currentSerial 当前流水号
     * @param lastSerialKey 上次流水键
     * @param updateTime 更新时间
     * @return 结果
     */
    public int updateSerialState(@Param("ruleId") Long ruleId,
                                 @Param("currentSerial") Long currentSerial,
                                 @Param("lastSerialKey") String lastSerialKey,
                                 @Param("updateTime") Date updateTime);

    /**
     * 删除编码规则
     * 
     * @param ruleId 编码规则主键
     * @return 结果
     */
    public int deleteSysCodeRuleByRuleId(Long ruleId);

    /**
     * 批量删除编码规则
     * 
     * @param ruleIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteSysCodeRuleByRuleIds(String[] ruleIds);
}
