! Jinshang online mall 10 ~ 11-business logic analysis + logic (encoding) Design

Source: Internet
Author: User

Looking at some terms in the demand process, if it is not extended to a class, it will extend the attributes of the class (for example, there must be membership classes) (the attribute is the member variable)

  1. Member
    A: Packaging System Member
    B: There is a one-to-many relationship with the order class.
  2. Administrator
    Packaging System Administrator (permission setting required)
  3. Product
    A: Information about the packaged product
    B: The relationship between orders and orders is many-to-one.
  4. Category
    A: The type of the Packaging product // (daily necessities include laundry products, tooth-brushing products, papper, etc. The laundry products include soap, washing powder, and 84 disinfectant ))
    B: Tree Structure // they are a tree structure, increasing layers of ladders!
    C: One-to-multiple relationship with products
  5. Order class // loaded in the shopping cart, that is, order class
    A: Information about the packaging order
    B: many-to-many relationship with products
    C: The relationship with members is many-to-one. // multiple items of the user will only be in the shopping cart (order type). Other members will not have your order (Shopping Cart) items.
  6. Shopping cart type
    A: Information about the wrapped shopping cart
    B: many-to-many relationship with products

11. jinshang online mall-business logic design // There are so many houses in the world. The following classes are not absolute and the houses are of different structures.

1. User // mall Member

 A: Properties

  1.  ID
  2. Username
  3. Password
  4. Phone
  5. ADDR // address
  6. Rdate // registration time reger-date abbreviation

 B: Methods // when designing this method, do not always think about programming methods.

  1. Get () oders () // get the order
  2. Save () // Add to shopping cart
  3. Change () // modify the order
  4. Delete
    // Modify the order
  5. Staticsearch () // search for order information in members

2. Administrator // Administrator

  1. Properties

    A: Username

    B: Password

  2. Methods

    Login () // login, logout login well

3. Product)

A: proterties

  1. Id // ID of the item
  2. Name // Product Name
  3. Descr // product description
  4. Mormalprice // normal price of the product
  5. Memberprice // membership price of the product
  6. Pdate // Date on which the product is launched
  7. CATEGORY // category of the Product

B: Methods

  1. Getcategory () // obtain the product category
  2. Getsalescount () // get the number of sold items
  3. Save (), change (), search () ... And so on

PS: Not necessarily how perfect the design is. It can be updated and improved step by step.

4. Category (Category, A tree)

A: Properties

  1. ID
  2. Name
  3. Descr
  4. PID (parent: category)

B: Methods

  1. Getproductcounts ()// Calculate the number of products in counts.
  2. Save (), change ()... andso on

PS: complete edges and edges

5. salesorder& Saleltem //Product order(&
ORDER item)

A: Properties

  1. ID
  2. Userid
  3. ADDR
  4. Salesltem [] // sales volume
  5. Odate

B: Methods

  1. Gettotalprice () // total amount of money for this orderTotalTotal price
  2. Save (), change ()....
  3. Getsalesltems ()// Obtain the number of items in this Order (the same kind of meat package purchased is equal to one order) (I bought the programming idea and bought eight books, which is an order item, 8 Red Mansions are still an order item! )

6. salesorder &Saleltem
// View order items now
Saleltem

A: Properties

  1. Id // ORDER item ID
  2. Productid//
    Product ID product Product (The same product category corresponds to an order item, which is called one-to-one.)
  3. Unitperce // The price in the order item. (LU renjia asked: Isn't there a price in the product? Why do I need to set this? Teacher A: this morning
    A kilo of beef is priced at 10: 00 in seconds. I purchased this product at 10: 00, and it is 10 RMB in the order item (recorded on the member's page and the mall system ), but after 10 o'clock and 1 minute
    On the purchase page, we cannot point to this 10 yuan second kill order item .)

  4. Pcount

B: Methods

  1. Gettotalperce ()
  2. Save (), change ()... andso on

7.Shoppingcart& Cartltem

// Start with the shopping cart
Shoppingcart
Similar order items

A: peoperties

  1. Userid // user ID
  2. Cartltem [] // how many items are bought

B: Methods

  1. Gettotalprice ()
    // The total amount of the orderTotalTotal price
  2. Save (), change ()... andso on
  3. Getcartltems ()

8. shoppingcart &Cartltem

//
Shopping itemsSimilar order items

A: Properties

  1. Productid
  2. Unitprice
  3. Pcount

B: Methods

  • Gettotalprice ()
    // The total amount of the orderTotalTotal price

PS: write while doing, spiral ladder increase, step by step perfect ..........

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.