栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Java

MybatisCodeHelpPro生成持久层代码

Java 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

MybatisCodeHelpPro生成持久层代码

MybatisCodeHelpPro生成持久层代码

链接:https://pan.baidu.com/s/18-ZMVW6WjW8oUbCUlzJI9A
提取码:8ruy

1.链接数据库

2.详细配置

生成方式

文件生成目录配置

生成注解、方法配置

File-Settings设置选项中配置:接口后缀名,设置为Dao 则生成的即可名为MytestDao ;Mapper则为MyTestMapper

3.生成后的代码

提示:这里我建的表名为mytest 生成的规则是首字母大写,如果想要达到MyTest这种效果,则在建表示已下划线分割即可 my_test ——> MyTest

1.接口—Mytest
package 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`
  
  
    
    select 
    
    from mytest
    where id = #{id,jdbcType=INTEGER}
  
  
    
    delete from mytest
    where id = #{id,jdbcType=INTEGER}
  
  
    
    delete from mytest
    
      
    
  
  
    
    insert into mytest (id, `name`)
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})
  
  
    
    insert into mytest
    
      
        id,
      
      
        `name`,
      
    
    
      
        #{id,jdbcType=INTEGER},
      
      
        #{name,jdbcType=VARCHAR},
      
    
  
  
  
    
    update mytest
    
      
        id = #{record.id,jdbcType=INTEGER},
      
      
        `name` = #{record.name,jdbcType=VARCHAR},
      
    
    
      
    
  
  
    
    update mytest
    set id = #{record.id,jdbcType=INTEGER},
      `name` = #{record.name,jdbcType=VARCHAR}
    
      
    
  
  
    
    update mytest
    
      
        `name` = #{name,jdbcType=VARCHAR},
      
    
    where id = #{id,jdbcType=INTEGER}
  
  
    
    update mytest
    set `name` = #{name,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  
  
    
    update mytest
    
      
        
          when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
        
      
    
    where id in
    
      #{item.id,jdbcType=INTEGER}
    
  
  
    
    update mytest
    
      
        
          
            when id = #{item.id,jdbcType=INTEGER} then #{item.name,jdbcType=VARCHAR}
          
        
      
    
    where id in
    
      #{item.id,jdbcType=INTEGER}
    
  
  
    
    insert into mytest
    (id, `name`)
    values
    
      (#{item.id,jdbcType=INTEGER}, #{item.name,jdbcType=VARCHAR})
    
  
  
    
    insert into mytest
    (id, `name`)
    values
    (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR})
    on duplicate key update 
    id = #{id,jdbcType=INTEGER}, 
    `name` = #{name,jdbcType=VARCHAR}
  
  
    
    insert into mytest
    
      
        id,
      
      
        `name`,
      
    
    values
    
      
        #{id,jdbcType=INTEGER},
      
      
        #{name,jdbcType=VARCHAR},
      
    
    on duplicate key update 
    
      
        id = #{id,jdbcType=INTEGER},
      
      
        `name` = #{name,jdbcType=VARCHAR},
      
    
  

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/914322.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号