search

Home  >  Q&A  >  body text

javascript - Category editor retains previous category name

Now there is such a demand. Due to the unreasonable design of the previous classification, it is now necessary to edit the classification when the previous classification name (called the old classification name) is not in the editing classification drop-down list, but when querying it needs to be The old category names are displayed, and the questions under these old category names are retained in the MySQL database. How to achieve this? The classification table has fields such as id, pid, name, create_time, and desc

黄舟黄舟2820 days ago1136

reply all(2)I'll reply

  • 高洛峰

    高洛峰2017-06-30 09:54:43

    Add one more field to distinguish the old classification from the new classification,
    or directly distinguish it through create_time.

    reply
    0
  • 三叔

    三叔2017-06-30 09:54:43

    You are right what you said above. In fact, there should be no problem with your data structure. I think you think there is a problem. It may be that the previous demand design conflicts with the current demand design. This is because the person who put forward the demand does not understand the development process. and details, which are caused by not taking into account the actual development situation.

    For your current design, you can add an extra field to distinguish the old and new categories, such as is_new TINYINT(1). If it is an old category, the value of is_new is 0, just fill it in manually. When adding or modifying a new category, the is_new of the new category is forced to be set to 1.

    When displaying the list and querying classified data, add the is_new = 1 condition. Just don’t add any conditions for is_new when searching.

    reply
    0
  • Cancelreply