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

import java.util.List;

import net.wicp.tams.app.duckula.controller.bean.models.SysGroup;
import net.wicp.tams.app.duckula.controller.bean.models.SysOrg;
import net.wicp.tams.app.duckula.controller.bean.models.SysOrgExample;
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 SysOrgMapper extends BaseMapper<SysOrg>{

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
	 * @mbg.generated
	 */
	@Delete({ "delete from sys_org", "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
	 * @mbg.generated
	 */
	@Insert({ "insert into sys_org (id, parent_id, ", "org_id_path, org_name, ", "org_code, unit_type, ",
			"address, tenant_id)", "values (#{id,jdbcType=BIGINT}, #{parentId,jdbcType=BIGINT}, ",
			"#{orgIdPath,jdbcType=VARCHAR}, #{orgName,jdbcType=VARCHAR}, ",
			"#{orgCode,jdbcType=VARCHAR}, #{unitType,jdbcType=VARCHAR}, ",
			"#{address,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})" })
	int insert(SysOrg record);

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
	 * @mbg.generated
	 */
	@Select({ "select", "id, parent_id, org_id_path, org_name, org_code, unit_type, address, tenant_id", "from sys_org",
			"where id = #{id,jdbcType=BIGINT}" })
	@ResultMap("net.wicp.tams.app.duckula.controller.dao.SysOrgMapper.BaseResultMap")
	SysOrg selectByPrimaryKey(Long id);

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

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_org
	 * @mbg.generated
	 */
	@Update({ "update sys_org", "set parent_id = #{parentId,jdbcType=BIGINT},",
			"org_id_path = #{orgIdPath,jdbcType=VARCHAR},", "org_name = #{orgName,jdbcType=VARCHAR},",
			"org_code = #{orgCode,jdbcType=VARCHAR},", "unit_type = #{unitType,jdbcType=VARCHAR},",
			"address = #{address,jdbcType=VARCHAR},", "tenant_id = #{tenantId,jdbcType=BIGINT}",
			"where id = #{id,jdbcType=BIGINT}" })
	int updateByPrimaryKey(SysOrg record);
}