Oracle在Mybatis中SQL语句的配置方法
网络编程 2021-07-05 16:08www.168986.cn编程入门
这篇文章主要介绍了Oracle在Mybatis中SQL语句的配置 ,非常不错,具有参考借鉴价值,需要的朋友可以参考下
数据库中有下划线的字段在实体中应采用驼峰命名法,如P_NAME对应pName,实例如下
1.XML文件中SQL语句配置(Geteway.xml文件)
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE mapper PUBLIC "-//mybatis.//DTD Mapper 3.0//EN" "http://mybatis./dtd/mybatis-3-mapper.dtd"> <mapper namespace=".soecode.hbdw.gateway.dao.GatewayDao"> <cache></cache> <!-- 目的为dao接口方法提供sql语句配置 --> <select id="queryById" resultType="Gateway" parameterType="int"> <!-- 具体的sql --> SELECT FROM P_GATEWAY WHERE GATEWAY_ID = #{gatewayId} </select> <select id="queryByName" resultType="Gateway" parameterType="java.lang.String"> <!-- 具体的sql --> SELECT FROM P_GATEWAY WHERE GATEWAY_NAME=#{gatewayName} </select> <delete id="delGateway" parameterType="java.lang.Integer"> DELETE FROM P_GATEWAY WHERE GATEWAY_ID = #{gatewayId} </delete> <update id="updateGateway" > <!-- ignore 主键冲突,报错 --> UPDATE P_GATEWAY SET GATEWAY_NAME= #{gatewayName}, GATEWAY_NUM= #{gatewayNum}, GATEWAY_NATURE= #{gatewayNature}, GATEWAY_SUPPLY= #{gatewaySupply}, REMARK= #{remark} WHERE GATEWAY_ID = #{gatewayId} </update> </mapper>
2.entity实体配置(Gateway.java文件)
package .soecode.hbdw.gateway.entity; import java.io.Serializable; import java.util.Date; public class Gateway implements Serializable{ / / private static final long serialVersionUID = 1L; private int gatewayId; private String gatewayName; private String gatewayNum; private String gatewayNature; private String gatewaySupply; private String remark; public int getGatewayId() { return gatewayId; } public void setGatewayId(int gatewayId) { this.gatewayId = gatewayId; } public String getGatewayName() { return gatewayName; } public void setGatewayName(String gatewayName) { this.gatewayName = gatewayName; } public String getGatewayNum() { return gatewayNum; } public void setGatewayNum(String gatewayNum) { this.gatewayNum = gatewayNum; } public String getGatewayNature() { return gatewayNature; } public void setGatewayNature(String gatewayNature) { this.gatewayNature = gatewayNature; } public String getGatewaySupply() { return gatewaySupply; } public void setGatewaySupply(String gatewaySupply) { this.gatewaySupply = gatewaySupply; } public String getRemark() { return remark; } public void setRemark(String remark) { this.remark = remark; } public static long getSerialversionuid() { return serialVersionUID; } @Override public String toString() { return "Gateway [gatewayId=" + gatewayId + ", gatewayName=" + gatewayName + ", gatewayNum=" + gatewayNum + ", gatewayNature=" + gatewayNature + ", gatewaySupply=" + gatewaySupply + ", remark=" + remark + "]"; } }
以上所述是长沙网络推广给大家介绍的Oracle在Mybatis中SQL语句的配置 ,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,长沙网络推广会及时回复大家的!
编程语言
- 甘肃哪有关键词排名优化购买方式有哪些
- 甘肃SEO如何做网站优化
- 河南seo关键词优化怎么做电话营销
- 北京SEO优化如何做QQ群营销
- 来宾百度关键词排名:提升您网站曝光率的关键
- 卢龙关键词优化:提升您网站排名的策略与技巧
- 山东网站优化的注意事项有哪些
- 四川整站优化怎样提升在搜索引擎中的排名
- 疏附整站优化:提升网站性能与用户体验的全新
- 海南seo主要做什么工作售后服务要做到哪些
- 荣昌百度网站优化:提升您网站的搜索引擎排名
- 河北seo网站排名关键词优化如何做SEO
- 江西优化关键词排名推广售后保障一般有哪些
- 古浪SEO优化:提升你的网站可见性
- 西藏网站排名优化怎么把网站排名在百度首页
- 如何提升阳东百度快照排名:详尽指南