A good algorithm for generating an order number

前端 未结 10 1456
青春惊慌失措
青春惊慌失措 2021-01-31 06:27

As much as I like using GUIDs as the unique identifiers in my system, it is not very user-friendly for fields like an order number where a customer may have to repeat that to a

10条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 07:10

    You could base64-encode a guid. This will meet all your criteria except the "numeric values only" requirement.

    Really, though, the correct thing to do here is let the database generate the order number. That may mean creating an order template record that doesn't actually have an order number until the user saves it, or it might be adding the ability to create empty (but perhaps uncommitted) orders.

提交回复
热议问题