?? aa.txt
字號:
package com.wish.jhk.service.impl;
import java.util.List;
import com.wish.jhk.service.AuctionManager;
import com.wish.jhk.Exception.AuctionException;
import com.wish.jhk.bean.ItemBean;
import com.wish.jhk.entity.Bid;
import com.wish.jhk.entity.Item;
import com.wish.jhk.entity.Kind;
import com.wish.jhk.entity.State;
import com.wish.jhk.dao.impl.BidDaoHibernate;
import com.wish.jhk.dao.impl.ItemDaoHibernate;
import com.wish.jhk.dao.impl.KindDaoHibernate;
import com.wish.jhk.dao.impl.StateDaoHibernate;
public class AuctionManagerImpl implements AuctionManager {
public void addBid(int userId, int itemId, double bidPrice)
throws AuctionException {
// TODO Auto-generated method stub
}
// 添加物品
// param name 物品名稱
// param desc 物品描述
// param remark 物品備注
// param avail 有效天數
// param kind 物品種類
public void addItem(String name, String desc, String remark,
double initPrice, int avail, int kind, int userId)
throws AuctionException {
// TODO Auto-generated method stub
}
// 添加種類
// param name 種類名稱
// param desc 種類描述
public void addKind(String name, String desc) throws AuctionException {
Kind kind = new Kind();
kind.setKindName(name);
kind.setKindDesc(desc);
KindDaoHibernate k = new KindDaoHibernate();
k.save(kind);
}
// 查詢全部狀態
// return 獲得全部種類
public List<State> getAllKind() throws AuctionException {
StateDaoHibernate s = new StateDaoHibernate();
return s.findAll();
}
// 查詢用戶的全部出價
// userId 需查詢的用戶id
// return 用戶的全部出價
public List<Bid> getBidByUser(int userId) throws AuctionException {
BidDaoHibernate b = new BidDaoHibernate();
return b.findByUser(userId);
}
// 查詢全部流拍的物品
// return 全部流拍物品
public List<Item> getFailItems() throws AuctionException {
ItemDaoHibernate i = new ItemDaoHibernate();
return i.findItemByState(3);
}
public ItemBean getItem(int itemId) throws AuctionException {
// TODO Auto-generated method stub
return null;
}
// 根據贏取者查詢物品
// winerId 贏取者id
// return 贏取者獲得的全部物品
public List<Item> getItemByWiner(int winerId) throws AuctionException {
ItemDaoHibernate i = new ItemDaoHibernate();
return i.findItemByWiner(winerId);
}
public List<Item> getItemsByKind(int kindId) throws AuctionException {
// TODO Auto-generated method stub
return null;
}
// 根據用戶id查找目前仍在拍賣中的物品
// userId 用戶id
// return 當前用戶所有的全部物品。
public List<Item> getItemsByOwner(int userId) throws AuctionException {
ItemDaoHibernate i = new ItemDaoHibernate();
return i.findItemByOwner(userId);
}
public String getKind(int kindId) throws AuctionException {
// TODO Auto-generated method stub
return null;
}
public void updateWiner() throws AuctionException {
// TODO Auto-generated method stub
}
// 根據用戶名,密碼驗證登陸是否成功
// username 登陸所輸入的用戶名
// pass 登陸的密碼
// return userId
public Integer validLogin(String username, String pass)
throws AuctionException {
UserDaoHibernate u = new UserDaoHibernate();
return u.findUserByNameAndPass(username, pass).getUserId();
}
public static void main(String args[]) throws AuctionException {
AuctionManagerImpl a = new AuctionManagerImpl();
// System.out.println(a.validLogin("tomcat", "tomcat"));有問題
// List<Item> items = a.getItemsByOwner(3);
// for (Item its : items) {
// System.out.println(its.getItemId());
// }
// List<Bid> bids = a.getBidByUser(3);
// for(Bid bs : bids){
// System.out.println(bs.getBidPrice());
// }
// List<State> states = a.getAllKind();
// for (State ss : states) {
// System.out.println(ss.getStateName());
// }
// a.addKind("手表1", "全進口卡通手表1"); 亂碼問題
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -