博客
关于我
Mybatis注解开发 @Select @Insert @Update @Delete
阅读量:201 次
发布时间:2019-02-28

本文共 1645 字,大约阅读时间需要 5 分钟。

Mybatis注解开发 @Select @Insert @Update @Delete

@Select用法

如果未使用mybatis的动态标签,则不需要加标签注意若数据库为在oracle,使用容易造成字段类型不匹配的问题
@Mapperpublic interface RtcCheckParamBussDao {    @Select(value = "")    int checkUserBranch(@Param(value = "branchCode" ) String branchCode, @Param(value = "subBranchCode" )String subBranchCode,@Param(value = "userId" ) String userId);    @Select(value = "")    int checkAccountContract(@Param(value = "account_no") String account_no,@Param(value = "contract_no") String contract_no);    @Select(value = "")    int checkProductSubProduct(@Param(value = "branchCode")String branchCode, @Param(value = "subBranchCode")String subBranchCode, @Param(value = "product")String product, @Param(value = "subProduct")String subProduct);    @Select(value = "")    int checkTillDepartmentCurrency(@Param(value = "branchCode")String branchCode, @Param(value = "subBranchCode")String subBranchCode, @Param(value = "department")String department, @Param(value = "tillCode")String tillCode,@Param(value = "currency") String currency);    @Select(value = "")    int checkAccountNoContractNo(@Param(value = "parm01") String parm01, @Param(value = "parm02") String parm02);    @Select(value = "")    String checkPageVerify(Map
map);}

@Update使用

@Update({ "update sys_role set role_name = #{roleName},enabled = #{enabled},create_by = #{createBy},create_time = #{createTime, jdbcType=TIMESTAMP} where id = #{id}" })    int updateSysRoleById(SysRole sysRole);

@Insert使用

// 批量插入数据@Insert("")void addBatch(@Param("Lines") List
Lines);

@Delete使用

@Delete("delete from sys_role where id = #{id}")    int deleteSysRoleById(Long id);

转载地址:http://fkji.baihongyu.com/

你可能感兴趣的文章
Mysqldump参数大全(参数来源于mysql5.5.19源码)
查看>>
mysqldump备份时忽略某些表
查看>>
mysqldump实现数据备份及灾难恢复
查看>>
mysqldump数据库备份无法进行操作只能查询 --single-transaction
查看>>
mysqldump的一些用法
查看>>
mysqli
查看>>
MySQLIntegrityConstraintViolationException异常处理
查看>>
mysqlreport分析工具详解
查看>>
MySQLSyntaxErrorException: Unknown error 1146和SQLSyntaxErrorException: Unknown error 1146
查看>>
Mysql_Postgresql中_geometry数据操作_st_astext_GeomFromEWKT函数_在java中转换geometry的16进制数据---PostgreSQL工作笔记007
查看>>
mysql_real_connect 参数注意
查看>>
mysql_secure_installation初始化数据库报Access denied
查看>>
MySQL_西安11月销售昨日未上架的产品_20161212
查看>>
Mysql——深入浅出InnoDB底层原理
查看>>
MySQL“被动”性能优化汇总
查看>>
MySQL、HBase 和 Elasticsearch:特点与区别详解
查看>>
MySQL、Redis高频面试题汇总
查看>>
MYSQL、SQL Server、Oracle数据库排序空值null问题及其解决办法
查看>>
mysql一个字段为空时使用另一个字段排序
查看>>
MySQL一个表A中多个字段关联了表B的ID,如何关联查询?
查看>>