首页 > 数据库 > oracle

Oracle在Mybatis中SQL语句的配置方法

admin oracle 2022-02-09 21:25:56 oracle   mybatis   sql   语句配置   mybatis   sql语句"

数据库中有下划线的字段在实体中应采用驼峰命名法,如P_NAME对应pName,实例如下:

1.XML文件中SQL语句配置(Geteway.xml文件)

<?xml version="1.0" encoding="UTF-8"?>


 
 
 
 
 
   DELETE 
   FROM 
   P_GATEWAY
   WHERE
   GATEWAY_ID = #{gatewayId}
 
 
 
   UPDATE P_GATEWAY
   SET
   GATEWAY_NAME= #{gatewayName},
   GATEWAY_NUM= #{gatewayNum},
   GATEWAY_NATURE= #{gatewayNature},
   GATEWAY_SUPPLY= #{gatewaySupply},
   REMARK= #{remark} 
   WHERE
   GATEWAY_ID = #{gatewayId}
  

2.entity实体配置(Gateway.java文件)

package com.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语句的配置 ,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的!

版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
本文地址:/shujuku/oracle/98340.html

留言与评论(共有 0 条评论)
   
验证码:

潘少俊衡

| 桂ICP备2023010378号-4

Powered By EmpireCMS

爱享小站

中德益农

谷姐神农

环亚肥料

使用手机软件扫描微信二维码

关注我们可获取更多热点资讯

感谢潘少俊衡友情技术支持