📄 licencedaoimpl.java
字号:
package com.gs.pageBuilder.dao;
/**
* <p>Title: </p>
* <p>Description: </p>
* <p>Copyright: Copyright (c) 2003</p>
* <p>Company: </p>
* @author not attributable
* @version 1.0
*/
import java.util.*;
import java.sql.*;
import java.text.DateFormat;
import com.gs.util.*;
import com.gs.util.PubFunc;
import com.gs.pageBuilder.util.*;
import com.gs.pageBuilder.model.*;
public class LicenceDAOImpl
implements LicenceDAO {
private Connection conn;
private Statement stmt;
private ResultSet resu, rs;
private PreparedStatement pstmt;
public LicenceDAOImpl() {
super();
}
/**
* 修改执照偏移量
* 应用: 执照打印
*/
public boolean updateLessincePrintSet(LicencePrintSetupModel licencePrintSetupModel) throws
AppException {
boolean flag = false;
String sql = null;
long codeNum;
try {
conn = Common.getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//是否正常数据
if (licencePrintSetupModel == null) {
Debug.println(
"[LicenceDAOImpl]updateLessincePrintSet----->licencePrintSetupModel is null!");
return flag;
}
sql = "update "
+ TableNameUtil.UNIVERSAL_PRINTSET
+ " set EXPLAIN='"
+ licencePrintSetupModel.getEXPLAIN()
+ "',CONTENT='"
+ licencePrintSetupModel.getCONTENT()
+ "',UNIT='"
+ licencePrintSetupModel.getUNIT()
+ "',POSITION_LEFT='"
+ licencePrintSetupModel.getPOSITION_LEFT()
+ "',POSITION_TOP='"
+ licencePrintSetupModel.getPOSITION_TOP()
+ "' where code='"
+ licencePrintSetupModel.getCODE()
+ "'"
;
stmt.executeQuery(sql);
Debug.println("[LicenceDAOImpl]updateLessincePrintSet--->>>sql:" + sql);
}
catch (SQLException sqle) {
Debug.println("[LicenceDAOImpl]updateLessincePrintSet--->>>Exception:" +
sqle.getMessage());
}
finally {
try {
this.closePreparedStatement();
}
catch (Exception e) {
}
try {
this.closeResultSet();
}
catch (Exception e) {
}
try {
this.closeStatement();
}
catch (Exception e) {
}
try {
this.closeConnection();
}
catch (Exception e) {
}
}
return flag;
}
/**
* 删除执照偏移量
* 应用: 执照打印
*/
public boolean dellLessincePrintSet(String code) throws
AppException {
boolean flag = false;
String sql = null;
long codeNum;
try {
conn = Common.getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//是否正常数据
if (code == null) {
Debug.println(
"[LicenceDAOImpl]dellLessincePrintSet----->code is null!");
return flag;
}
sql = "delete from "
+ TableNameUtil.UNIVERSAL_PRINTSET
+ " where code='"
+ code
+ "'"
;
stmt.executeQuery(sql);
Debug.println("[LicenceDAOImpl]dellLessincePrintSet--->>>sql:" + sql);
}
catch (SQLException sqle) {
Debug.println("[LicenceDAOImpl]dellLessincePrintSet--->>>Exception:" +
sqle.getMessage());
}
finally {
try {
this.closePreparedStatement();
}
catch (Exception e) {
}
try {
this.closeResultSet();
}
catch (Exception e) {
}
try {
this.closeStatement();
}
catch (Exception e) {
}
try {
this.closeConnection();
}
catch (Exception e) {
}
}
return flag;
}
/**
* 增加执照偏移量
* 应用: 执照打印
*/
public boolean addLessincePrintSet(LicencePrintSetupModel licencePrintSetupModel) throws
AppException {
boolean flag = false;
String sql = null;
long codeNum;
try {
conn = Common.getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//是否正常数据
if (licencePrintSetupModel == null) {
Debug.println(
"[LicenceDAOImpl]addLessincePrintSet----->licencePrintSetupModel is null!");
return flag;
}
//获得数据的最大code
sql = "select code from "
+ TableNameUtil.UNIVERSAL_PRINTSET
+ " where rownum <2 order by code desc"
;
Debug.println("[LicenceDAOImpl]addLessincePrintSet--->>>sql:" + sql);
rs = stmt.executeQuery(sql);
if(rs.next()){
try{
codeNum = rs.getLong("code")+1;
}catch(Exception e){
Debug.println(
"[LicenceDAOImpl]addLessincePrintSet----->codeNum is exception:"+e.getMessage());
return flag;
};
}else{
codeNum=10000000;
}
rs.close();
sql = "insert into "
+ TableNameUtil.UNIVERSAL_PRINTSET
+ "(CODE,EXPLAIN,CONTENT,UNIT,POSITION_LEFT,POSITION_TOP)values('"+
+ codeNum
+ "','"
+ licencePrintSetupModel.getEXPLAIN()
+ "','"
+ licencePrintSetupModel.getCONTENT()
+ "','"
+ licencePrintSetupModel.getUNIT()
+ "','"
+ licencePrintSetupModel.getPOSITION_LEFT()
+ "','"
+ licencePrintSetupModel.getPOSITION_TOP()
+ "')"
;
Debug.println("[LicenceDAOImpl]addLessincePrintSet--->>>sql:" + sql);
stmt.executeQuery(sql);
}
catch (SQLException sqle) {
Debug.println("[LicenceDAOImpl]addLessincePrintSet--->>>Exception:" +
sqle.getMessage());
}
finally {
try {
this.closePreparedStatement();
}
catch (Exception e) {
}
try {
this.closeResultSet();
}
catch (Exception e) {
}
try {
this.closeStatement();
}
catch (Exception e) {
}
try {
this.closeConnection();
}
catch (Exception e) {
}
}
return flag;
}
/**
* 获得执照偏移量信息列表,按单位编码
* 应用: 执照打印
*/
public ArrayList getLessincePrintSetList(String unit) throws
AppException {
boolean flag = false;
String sql = null;
ArrayList lessincePrintSetList =new ArrayList();
try {
conn = Common.getConnection();
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_READ_ONLY);
//是否正常数据
if (unit == null) {
Debug.println(
"[LicenceDAOImpl]getLessincePrintSetList----->unit is null!");
return lessincePrintSetList;
}
sql = "select * from "
+ TableNameUtil.UNIVERSAL_PRINTSET
+ " where unit like '"
+ unit
+ "%'"
;
Debug.println("[LicenceDAOImpl]getLessincePrintSetList--->>>count sql:" + sql);
rs = stmt.executeQuery(sql);
while(rs.next()){
LicencePrintSetupModel licencePrintSetupModel=new LicencePrintSetupModel();
licencePrintSetupModel.setCODE(PubFunc.decodeGB(rs.getString("CODE")));
licencePrintSetupModel.setEXPLAIN(PubFunc.decodeGB(rs.getString("EXPLAIN")));
licencePrintSetupModel.setCONTENT(PubFunc.decodeGB(rs.getString("CONTENT")));
licencePrintSetupModel.setUNIT(PubFunc.decodeGB(rs.getString("UNIT")));
licencePrintSetupModel.setPOSITION_LEFT(PubFunc.decodeGB(rs.getString("POSITION_LEFT")));
licencePrintSetupModel.setPOSITION_TOP(PubFunc.decodeGB(rs.getString("POSITION_TOP")));
lessincePrintSetList.add(licencePrintSetupModel);
}
Debug.println("[LicenceDAOImpl]getLessincePrintSetList--->>>lessincePrintSetList.size():"+lessincePrintSetList.size());
}
catch (SQLException sqle) {
Debug.println("[LicenceDAOImpl]getLessincePrintSetList--->>>Exception:" +
sqle.getMessage());
}
finally {
try {
this.closePreparedStatement();
}
catch (Exception e) {
}
try {
this.closeResultSet();
}
catch (Exception e) {
}
try {
this.closeStatement();
}
catch (Exception e) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -