Mybatis中数据库的增删改查和动态Sql

2.数据库的增删改查:

马 克-to-win:以下例子的配置文件中出现了一些mybatis特有的动态Sql的标签,比如trim,foreach或set标签。动态Sql是为了 应对更多的情况。trim标签的功能是可以在自己包含的内容前加上某些前缀(prefix属性),也可以在自己包含的内容后加上某些后缀(suffix属 性), 可以把包含内容的首部某些内容删掉(prefixOverrides属性),也可以把包含内容的尾部的某些内容删掉(suffixOverrides属 性)。



例 1.2

package com.mapper;
import com.Register;
import java.util.List;
import java.util.Map;
public interface RegisterMapper {
    public int insertBatch(List list);
    public List<Register> selectAll();
    int deleteByPrimaryKey(Integer id);
    int insert(Register record);
    int insertSelective(Register record);
    Register selectByPrimaryKey(Integer id);
    int updateByPrimaryKeySelective(Register record);
    int updateByPrimaryKey(Register record);
    List<Register> selectPageList(Map map);
    List<Register> selectList(Map map);
    int selectCount(Map map);
}


RegisterMapper.xml

版权保护,原文出处:http://www.mark-to-win.com/index.html?content=Frame/frameUrl.html&chapter=Frame/Mybatis_web.html#CRUD

猜你喜欢

转载自blog.csdn.net/mark_to_win/article/details/88708817