Reverse engineering dao MyBatis generating layer CRUD explaining a method used (reproduced)

int countByExample (BUserExample Example); // The condition number of queries 
 
    / ** 
     * Example 
     * countByExample public int () { 
     * BUserExample UserExample new new BUserExample = (); 
     * = userExample.createCriteria BUserExample.Criteria Criteria (); 
     * criteria.andUsernameEqualTo ( "Fan"); 
     * int COUNT = userMapper.countByExample (UserExample); 
     * return COUNT; 
     *} 
     * equivalent to: SELECT COUNT (*) from User WHERE username = 'Fan' 
     * / 
 
    int deleteByExample (BUserExample Example); / / delete data (one or more) according to the conditions 
 
    / ** 
     * example 
     * public int deleteByExample () { 
     * BUserExample userExample = new BUserExample () ;
     Criteria = userExample.createCriteria BUserExample.Criteria * (); 
     * criteria.andUsernameEqualTo ( "Fan"); 
     * int COUNT = userMapper.deleteByExample (UserExample); 
     * return COUNT; 
     *} 
     * equivalent to: delete from user where username = ' Fan ' 
     * / 
 
    int deleteByPrimaryKey (ID Integer); // The primary key to delete data 
 
    int iNSERT (Buser Record); // inserting data (a data insertion) 
 
    int insertSelective (Buser Record); // inserting data (a data insertion, only inserted field is not null, there will not affect the field default values) 
 
    List <Buser> selectByExample (BUserExample example); // the conditions of the query data
 
     
     * example:/**
     * public List<BUser> getList() {
     * BUserExample userExample = new BUserExample();
     * BUserExample.Criteria criteria = userExample.createCriteria();
     * criteria.andUsernameEqualTo("fan");
     * userExample.setOrderByClause("username desc");
     * List<BUser> users = userMapper.selectByExample(userExample);
     * return users;
     * }
     * 相当于:select * from user where username = 'fan' order by username desc
     */
 
    BUser selectByPrimaryKey(Integer id);  //根据主键查询
 
    int updateByExampleSelective(@Param("record") BUser record, @Param("example") BUserExample example);/ **conditionally updated value is not null fields//
 
    
     * 示例:
     * public int updateByParam(String username) {
     * BUserExample userExample = new BUserExample();
     * BUserExample.Criteria criteria = userExample.createCriteria();
     * criteria.andUsernameEqualTo(username);
     * BUser user = new BUser();
     * user.setNickname("jdk");
     * int update = userMapper.updateByExampleSelective(user, userExample);
     * return update;
     * }
     * 相当于:update user set nickname = 'jdk' where username = #{username}
     */
 
    int updateByExample(@Param("record") BUser record, @Param("example") BUserExample example);updateByPrimaryKeySelective (Buser the Record);intconditionally updating//
 
    // The condition updating primary key 
    / ** 
     * Example: 
     * public int updateByIdAndParam (String username) { 
     * = new new Buser Buser User (); 
     * user.setId (101); 
     * user.setUsername (username); 
     * int Update userMapper.updateByPrimaryKeySelective = (User); 
     * update return; 
     *} 
     * equivalent to: SET update User username = username} # {WHERE ID = 101 
     * / 
 
    int updateByPrimaryKey (Buser Record); // primary key update

Original link: https://blog.csdn.net/feidao0/article/details/80731824

Guess you like

Origin www.cnblogs.com/qfdy123/p/11565207.html