📄 develop.java
字号:
package ntsky.news;
import java.sql.*;
import ntsky.database.*;
public class Develop{
private int sum;
private int classid;
private int id;
private ResultSet rs = null;
private int counter;
//文章的总值(开发)(判断有无记录,如没有的话就要求先添加记录)
public int sum() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//文章的总值(jsp)(判断有无记录,如没有的话就要求先添加记录)
public int sum_jsp() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3 and id=4;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//文章的总值(java)(判断有无记录,如没有的话就要求先添加记录)
public int sum_java() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3 and id=5;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//文章的总值(.net)(判断有无记录,如没有的话就要求先添加记录)
public int sum_c() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3 and id=8;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//文章的总值(xml)(判断有无记录,如没有的话就要求先添加记录)
public int sum_xml() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3 and id=6;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//文章的总值(delphi)(判断有无记录,如没有的话就要求先添加记录)
public int sum_delphi() throws Exception{
String sql = "select count(articleid) as t from article where state=1 and classid=3 and id=7;";
DBConnect dbc = new DBConnect();
rs=dbc.executeQuery(sql);
if(rs != null){
rs.next();
sum = rs.getInt("t");
return sum;
}
else{
return 0;
}
}
//时间
public ResultSet rs_time() throws Exception{
String sql = "select time,classid,id from article where classid=3 and state=1 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//jsp时间
public ResultSet rs_time_jsp() throws Exception{
String sql = "select time,classid,id from article where state=1 and classid=3 and id=4 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//java时间
public ResultSet rs_time_java() throws Exception{
String sql = "select time,classid,id from article where state=1 and classid=3 and id=5 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//c# 时间
public ResultSet rs_time_c() throws Exception{
String sql = "select time,classid,id from article where state=1 and classid=3 and id=8 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//xml时间
public ResultSet rs_time_xml() throws Exception{
String sql = "select time,classid,id from article where state=1 and classid=3 and id=6 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//delphi时间
public ResultSet rs_time_delphi() throws Exception{
String sql = "select time,classid,id from article where state=1 and classid=3 and id=7 order by time desc limit 0,1;";
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
return rs;
}
//最新的文章(jsp)
public ResultSet rs_new_jsp(){
String sql = "select articleid,title,date from article where state=1 and classid=3 and id=4 order by time desc limit 0,5;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_new" +e.getMessage());
}
return rs;
}
//最新的文章(java)
public ResultSet rs_new_java(){
String sql = "select articleid,title,date from article where state=1 and classid=3 and id=5 order by time desc limit 0,5;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_new" +e.getMessage());
}
return rs;
}
//最新的文章(java)
public ResultSet rs_new_c(){
String sql = "select articleid,title,date from article where state=1 and classid=3 and id=8 order by time desc limit 0,5;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_new" +e.getMessage());
}
return rs;
}
//最新的文章(xml)
public ResultSet rs_new_xml(){
String sql = "select articleid,title,date from article where state=1 and classid=3 and id=6 order by time desc limit 0,5;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_new" +e.getMessage());
}
return rs;
}
//最新的文章(delphi)
public ResultSet rs_new_delphi(){
String sql = "select articleid,title,date from article where state=1 and classid=3 and id=7 order by time desc limit 0,5;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_new" +e.getMessage());
}
return rs;
}
//点击次数
public ResultSet rs_hot(){
String sql = "select articleid,title from article where state=1 and classid=3 order by hits desc limit 0,10;";
try{
DBConnect dbc = new DBConnect();
rs = dbc.executeQuery(sql);
}
catch(Exception e){
System.out.print("rs_hot" +e.getMessage());
}
return rs;
}
//关闭指针
public void close() throws Exception{
if(rs != null){
rs.close();
rs = null;
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -