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

import java.util.List;

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;

import net.wicp.tams.app.duckula.controller.bean.models.SysUser;
import net.wicp.tams.app.duckula.controller.bean.models.SysUserExample;

public interface SysUserMapper extends BaseMapper<SysUser> {

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

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_user
	 * @mbg.generated
	 */
	//***** 删除掉它，重试mybatis plus的insert方法，这次有主键返回了
//	@Insert({ "insert into sys_user (id, user_name, ", "password, gender, ", "email, mobile, status, ",
//			"org_id, remark, create_time, ", "update_time, minus_role, ", "duties, tenant_id)",
//			"values (#{id,jdbcType=BIGINT}, #{userName,jdbcType=VARCHAR}, ",
//			"#{password,jdbcType=VARCHAR}, #{gender,jdbcType=VARCHAR}, ",
//			"#{email,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, ",
//			"#{orgId,jdbcType=BIGINT}, #{remark,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
//			"#{updateTime,jdbcType=TIMESTAMP}, #{minusRole,jdbcType=VARCHAR}, ",
//			"#{duties,jdbcType=VARCHAR}, #{tenantId,jdbcType=BIGINT})" })
//	int insert(SysUser record);

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_user
	 * @mbg.generated
	 */
	@Select({ "select", "id, user_name, password, gender, email, mobile, status, org_id, remark, create_time, ",
			"update_time, minus_role, duties, tenant_id", "from sys_user", "where id = #{id,jdbcType=BIGINT}" })
	@ResultMap("net.wicp.tams.app.duckula.controller.dao.SysUserMapper.BaseResultMap")
	SysUser selectByPrimaryKey(Long id);

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

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

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

	/**
	 * This method was generated by MyBatis Generator. This method corresponds to the database table sys_user
	 * @mbg.generated
	 */
	@Update({ "update sys_user", "set user_name = #{userName,jdbcType=VARCHAR},",
			"password = #{password,jdbcType=VARCHAR},", "gender = #{gender,jdbcType=VARCHAR},",
			"email = #{email,jdbcType=VARCHAR},", "mobile = #{mobile,jdbcType=VARCHAR},",
			"status = #{status,jdbcType=VARCHAR},", "org_id = #{orgId,jdbcType=BIGINT},",
			"remark = #{remark,jdbcType=VARCHAR},", "create_time = #{createTime,jdbcType=TIMESTAMP},",
			"update_time = #{updateTime,jdbcType=TIMESTAMP},", "minus_role = #{minusRole,jdbcType=VARCHAR},",
			"duties = #{duties,jdbcType=VARCHAR},", "tenant_id = #{tenantId,jdbcType=BIGINT}",
			"where id = #{id,jdbcType=BIGINT}" })
	int updateByPrimaryKey(SysUser record);
}