package pwc.taxtech.atms.dao;

import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.session.RowBounds;
import pwc.taxtech.atms.MyMapper;
import pwc.taxtech.atms.dpo.UserOrgRoleDto;
import pwc.taxtech.atms.entity.UserDimensionValueRole;
import pwc.taxtech.atms.entity.UserDimensionValueRoleExample;

import java.util.List;

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

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

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

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

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

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

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

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table TAX_ADMIN.USER_DIMENSION_VALUE_ROLE
     *
     * @mbg.generated
     */
    UserDimensionValueRole selectByPrimaryKey(String id);

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

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

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

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

    List<UserOrgRoleDto> getUserDimensionValueRoleList();

    @Select("SELECT USER_DIMENSION_VALUE.USER_ID FROM USER_DIMENSION_VALUE_ROLE "
            + "JOIN USER_DIMENSION_VALUE ON USER_DIMENSION_VALUE_ROLE.USER_DIMENSION_VALUE_ID = USER_DIMENSION_VALUE.ID "
            + "WHERE USER_DIMENSION_VALUE_ROLE.ROLE_ID=#{roleId}")
    List<String> getUserIdByUserDimensionValueRole(@Param("roleId") String roleId);
}