-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
93 changed files
with
4,236 additions
and
11,122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.star.estore.dao; | ||
|
||
import com.star.estore.domain.Purchase; | ||
import com.star.estore.utils.DataSourceUtils; | ||
import org.apache.commons.dbutils.QueryRunner; | ||
|
||
import java.sql.SQLException; | ||
|
||
/** | ||
* Created by hp on 2016/12/16. | ||
*/ | ||
public class PurchaseDao { | ||
|
||
public void add(Purchase p) throws SQLException { | ||
QueryRunner runner=new QueryRunner(DataSourceUtils.getDataSource()); | ||
String sql="insert into purchase values(null,?,?,?,?,?,?,?,?)"; | ||
runner.update(sql,p.getName(),p.getDescription(),p.getDealps(),p.getPrice(), | ||
p.getCategory(),p.getOwner(),p.getQQ(),p.getPhone()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package com.star.estore.domain; | ||
|
||
/** | ||
* Created by hp on 2016/12/16. | ||
*/ | ||
public class Purchase { | ||
private int id;//求购物品的编号 | ||
private String name;//求购物品名称 | ||
private String description;//求购物品描述 | ||
private String dealps;//交易地点 | ||
private int price;//期望价格 | ||
private String category;//求购物品的类别,方便查询 | ||
private int owner;//求购信息发布者 | ||
private String QQ;//联系方式 | ||
private String phone; | ||
|
||
public String getQQ() { | ||
return QQ; | ||
} | ||
|
||
public void setQQ(String QQ) { | ||
this.QQ = QQ; | ||
} | ||
|
||
public String getPhone() { | ||
return phone; | ||
} | ||
|
||
public void setPhone(String phone) { | ||
this.phone = phone; | ||
} | ||
|
||
public int getId() { | ||
return id; | ||
} | ||
|
||
public void setId(int id) { | ||
this.id = id; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
public String getDescription() { | ||
return description; | ||
} | ||
|
||
public void setDescription(String description) { | ||
this.description = description; | ||
} | ||
|
||
public String getDealps() { | ||
return dealps; | ||
} | ||
|
||
public void setDealps(String dealps) { | ||
this.dealps = dealps; | ||
} | ||
|
||
public int getPrice() { | ||
return price; | ||
} | ||
|
||
public void setPrice(int price) { | ||
this.price = price; | ||
} | ||
|
||
public String getCategory() { | ||
return category; | ||
} | ||
|
||
public void setCategory(String category) { | ||
this.category = category; | ||
} | ||
|
||
public int getOwner() { | ||
return owner; | ||
} | ||
|
||
public void setOwner(int owner) { | ||
this.owner = owner; | ||
} | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/java/com/star/estore/service/PurchaseService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package com.star.estore.service; | ||
|
||
import com.star.estore.annotation.PrivilegeInfo; | ||
import com.star.estore.domain.Product; | ||
import com.star.estore.domain.Purchase; | ||
import com.star.estore.domain.User; | ||
import com.star.estore.exception.PrivilegeException; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by hp on 2016/12/4. | ||
*/ | ||
public interface PurchaseService { | ||
//添加求购 | ||
public void add(User user, Purchase purchase) throws Exception; | ||
|
||
//查找求购信息 | ||
public List<Product> findAll() throws Exception; | ||
|
||
//根据关键字查找求购信息 | ||
public Product findByInfo(String keyword) throws Exception; | ||
|
||
} |
33 changes: 33 additions & 0 deletions
33
src/main/java/com/star/estore/service/PurchaseServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package com.star.estore.service; | ||
|
||
import com.star.estore.dao.ProductDao; | ||
import com.star.estore.dao.PurchaseDao; | ||
import com.star.estore.domain.Product; | ||
import com.star.estore.domain.Purchase; | ||
import com.star.estore.domain.User; | ||
import com.star.estore.exception.PrivilegeException; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Created by hp on 2016/12/4. | ||
*/ | ||
public class PurchaseServiceImpl implements PurchaseService{ | ||
|
||
@Override | ||
public void add(User user, Purchase purchase) throws Exception { | ||
PurchaseDao dao = new PurchaseDao(); | ||
purchase.setOwner(user.getId()); | ||
dao.add(purchase); | ||
} | ||
|
||
@Override | ||
public List<Product> findAll() throws Exception { | ||
return null; | ||
} | ||
|
||
@Override | ||
public Product findByInfo(String keyword) throws Exception { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.