package pwc.taxtech.atms.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.TaxRuleSettingDto;
import pwc.taxtech.atms.entity.TaxRuleSetting;
import pwc.taxtech.atms.entity.TaxRuleSettingExample;

import java.util.List;

@Mapper
public interface TaxRuleSettingMapper extends MyMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    long countByExample(TaxRuleSettingExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int deleteByExample(TaxRuleSettingExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int deleteByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int insert(TaxRuleSetting record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int insertSelective(TaxRuleSetting record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    List<TaxRuleSetting> selectByExampleWithRowbounds(TaxRuleSettingExample example, RowBounds rowBounds);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    List<TaxRuleSetting> selectByExample(TaxRuleSettingExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    TaxRuleSetting selectByPrimaryKey(Long id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int updateByExampleSelective(@Param("record") TaxRuleSetting record, @Param("example") TaxRuleSettingExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int updateByExample(@Param("record") TaxRuleSetting record, @Param("example") TaxRuleSettingExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int updateByPrimaryKeySelective(TaxRuleSetting record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.TAX_RULE_SETTING
     *
     * @mbg.generated
     */
    int updateByPrimaryKey(TaxRuleSetting record);

    @Select("SELECT TRS.GROUP_NAME,TRS.ID,TRS.IS_DEFAULT,TRS.NAME,TRS.TAX_BASE,TRS.TAX_RATE*100 AS TAX_RATE,TRSO.ORGANIZATION_ID"
            + " FROM TAX_RULE_SETTING TRS "
            + "LEFT JOIN TAX_RULE_SETTING_ORGANIZATION TRSO ON TRS.ID=TRSO.TAX_SETTING_ID")
    List<TaxRuleSettingDto> GetTaxRuleSetting();
}