📄 auctionshopcache.java
字号:
package com.redmoon.forum.plugin.auction;
import cn.js.fan.base.ObjectCache;
import cn.js.fan.db.Conn;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
public class AuctionShopCache extends ObjectCache {
String prefix = "AuctionShopId_";
public AuctionShopCache() {
super();
}
public AuctionShopCache(AuctionShopDb auctionShopDb) {
super(auctionShopDb);
}
public String getShopUserNameById(int id) {
String userName = (String) rmCache.get(prefix + id);
if (userName == null) {
ResultSet rs = null;
Conn conn = new Conn(connname);
try {
String sql = "select userName from " + objectDb.getTableName() +
" where id=?";
PreparedStatement ps = conn.prepareStatement(sql);
ps.setInt(1, id);
rs = conn.executePreQuery();
if (rs.next()) {
// shopName,address,tel,desciprtion,isValid,reason
userName = rs.getString(1);
try {
rmCache.put(prefix + id, userName);
} catch (Exception e) {
logger.error("getShopUserNameById1:" + e.getMessage());
}
}
} catch (SQLException e) {
logger.error("getShopUserNameById2:" + e.getMessage());
} finally {
if (conn != null) {
conn.close();
conn = null;
}
}
}
return userName;
}
public void setGroup() {
group = "AUCTIONSHOP";
}
public void setGroupCount() {
COUNT_GROUP_NAME = "AUCTIONSHOPCOUNT";
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -