package net.wicp.tams.app.duckula.controller.dao;

import java.util.List;

import net.wicp.tams.app.duckula.controller.bean.models.SysOrg;
import net.wicp.tams.app.duckula.controller.bean.models.SysOrgRela;
import net.wicp.tams.app.duckula.controller.bean.models.SysOrgRelaExample;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;

public interface SysOrgRelaMapper extends BaseMapper<SysOrgRela>{

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	long countByExample(SysOrgRelaExample example);

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	@Delete({ "delete from sys_org_rela", "where id = #{id,jdbcType=BIGINT}" })
	int deleteByPrimaryKey(Long id);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	@Insert({ "insert into sys_org_rela (id, org_id_main, ", "org_id_rela, rela_type, ", "tenant_id)",
			"values (#{id,jdbcType=BIGINT}, #{orgIdMain,jdbcType=BIGINT}, ",
			"#{orgIdRela,jdbcType=BIGINT}, #{relaType,jdbcType=VARCHAR}, ", "#{tenantId,jdbcType=BIGINT})" })
	int insert(SysOrgRela record);

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	List<SysOrgRela> selectByExample(SysOrgRelaExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	@Select({ "select", "id, org_id_main, org_id_rela, rela_type, tenant_id", "from sys_org_rela",
			"where id = #{id,jdbcType=BIGINT}" })
	@ResultMap("net.wicp.tams.app.duckula.controller.dao.SysOrgRelaMapper.BaseResultMap")
	SysOrgRela selectByPrimaryKey(Long id);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	int updateByExampleSelective(@Param("record") SysOrgRela record, @Param("example") SysOrgRelaExample example);

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	int updateByExample(@Param("record") SysOrgRela record, @Param("example") SysOrgRelaExample example);

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org_rela
	 * @mbg.generated
	 */
	@Update({ "update sys_org_rela", "set org_id_main = #{orgIdMain,jdbcType=BIGINT},",
			"org_id_rela = #{orgIdRela,jdbcType=BIGINT},", "rela_type = #{relaType,jdbcType=VARCHAR},",
			"tenant_id = #{tenantId,jdbcType=BIGINT}", "where id = #{id,jdbcType=BIGINT}" })
	int updateByPrimaryKey(SysOrgRela record);
}