⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 aa.txt

📁 是一个基于java开发的拍卖系统 非常适合初学者看
💻 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;
import com.wish.jhk.dao.impl.UserDaoHibernate;

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 + -