1.链接数据库 2.详细配置链接:https://pan.baidu.com/s/18-ZMVW6WjW8oUbCUlzJI9A
提取码:8ruy
生成方式
文件生成目录配置
生成注解、方法配置
3.生成后的代码File-Settings设置选项中配置:接口后缀名,设置为Dao 则生成的即可名为MytestDao ;Mapper则为MyTestMapper
提示:这里我建的表名为mytest 生成的规则是首字母大写,如果想要达到MyTest这种效果,则在建表示已下划线分割即可 my_test ——> MyTest
1.接口—Mytestpackage com.zds.tbl.dao;
import com.zds.tbl.po.Mytest;
import com.zds.tbl.po.MytestExample;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import java.util.List;
@Repository
public interface MytestDao {
long countByExample(MytestExample example);
int deleteByExample(MytestExample example);
int deleteByPrimaryKey(Integer id);
int insert(Mytest record);
int insertOrUpdate(Mytest record);
int insertOrUpdateSelective(Mytest record);
int insertSelective(Mytest record);
List selectByExample(MytestExample example);
Mytest selectByPrimaryKey(Integer id);
int updateByExampleSelective(@Param("record") Mytest record, @Param("example") MytestExample example);
int updateByExample(@Param("record") Mytest record, @Param("example") MytestExample example);
int updateByPrimaryKeySelective(Mytest record);
int updateByPrimaryKey(Mytest record);
int updateBatch(List list);
int updateBatchSelective(List list);
int batchInsert(@Param("list") List list);
}
2.实体—Mytest
package com.zds.tbl.po;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
@ApiModel(value="com-zds-tbl-po-Mytest")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Mytest {
@ApiModelProperty(value="id")
private Integer id;
@ApiModelProperty(value="名称")
private String name;
}
3.xml—MytestDao.xml
and ${criterion.condition} and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{listItem} and ${criterion.condition} and ${criterion.condition} #{criterion.value} and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} and ${criterion.condition} #{listItem} id, `name`



