保存进度!

This commit is contained in:
2023-04-26 20:20:43 +08:00
parent f31d9e9812
commit c207de7b25
3 changed files with 138 additions and 82 deletions

View File

@@ -12,9 +12,9 @@ package com.cpic.xim.utils.account;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
@SuppressWarnings( "unused" )
public final class TeleSalerInfo
@@ -39,7 +39,7 @@ public final class TeleSalerInfo
this.departmentName = departmentName;
}
public static TeleSalerInfo queryTeleSalerInfo( String code )
public static TeleSalerInfo queryTeleSalerInfo( String telsaler_code )
throws ClassNotFoundException, SQLException
{
TeleSalerInfo info = null;
@@ -49,29 +49,85 @@ public final class TeleSalerInfo
String password = "Cpic123456";
String jdbcURL = "jdbc:oracle:thin:@10.39.0.86:1521:xmcx1";
Connection conection = null;
Statement statement = null;
Connection connection = null;
PreparedStatement statement = null;
ResultSet result = null;
String sql = """
SELECT DISTINCT s.saler_code,
s.saler_name,
t.team_code,
t.team,
bm.department_code,
bm.department_name
FROM tele_saler s,
tele_saler_team t,
idst0.bm_t bm
WHERE s.team_code = t.team_code
AND t.department_code = bm.department_code
AND s.saler_code = ?
""";
SELECT s.saler_code,
s.saler_name,
t.team_code,
t.team,
bm.department_code,
bm.department_name
FROM tele_saler s,
tele_saler_team t,
idst0.bm_t bm
WHERE s.team_code = t.team_code
AND t.department_code = bm.department_code
AND s.saler_code = ? """;
Class.forName( "oracle.jdbc.driver.OracleDriver" );
conection = DriverManager.getConnection( jdbcURL, userName, password );
try
{
Class.forName( "oracle.jdbc.driver.OracleDriver" );
connection = DriverManager.getConnection( jdbcURL, userName, password );
statement = connection.prepareStatement( sql );
statement.setString( 1, telsaler_code );
result = statement.executeQuery();
if ( result.next() )
{
String code = result.getString( 1 );
String name = result.getString( 2 );
String teamCode = result.getString( 3 );
String teamName = result.getString( 4 );
String departmentCode = result.getString( 5 );
String departmentName = result.getString( 6 );
info = new TeleSalerInfo( code, name, teamCode, teamName, departmentCode,
departmentName );
}
}
finally
{
try
{
if ( result != null )
{
result.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try
{
if ( statement != null )
{
statement.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
try
{
if ( connection != null )
{
connection.close();
}
}
catch ( Exception exception )
{
exception.printStackTrace();
}
}
return info;
}