[
  {
    "path": ".gitignore",
    "content": "node_modules\ndist\ntarget\n\n# Editor directories and files\n.idea\n.vscode\n*.iml\n"
  },
  {
    "path": "LICENSE",
    "content": "                    GNU AFFERO GENERAL PUBLIC LICENSE\n                       Version 3, 19 November 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n                            Preamble\n\n  The GNU Affero General Public License is a free, copyleft license for\nsoftware and other kinds of works, specifically designed to ensure\ncooperation with the community in the case of network server software.\n\n  The licenses for most software and other practical works are designed\nto take away your freedom to share and change the works.  By contrast,\nour General Public Licenses are intended to guarantee your freedom to\nshare and change all versions of a program--to make sure it remains free\nsoftware for all its users.\n\n  When we speak of free software, we are referring to freedom, not\nprice.  Our General Public Licenses are designed to make sure that you\nhave the freedom to distribute copies of free software (and charge for\nthem if you wish), that you receive source code or can get it if you\nwant it, that you can change the software or use pieces of it in new\nfree programs, and that you know you can do these things.\n\n  Developers that use our General Public Licenses protect your rights\nwith two steps: (1) assert copyright on the software, and (2) offer\nyou this License which gives you legal permission to copy, distribute\nand/or modify the software.\n\n  A secondary benefit of defending all users' freedom is that\nimprovements made in alternate versions of the program, if they\nreceive widespread use, become available for other developers to\nincorporate.  Many developers of free software are heartened and\nencouraged by the resulting cooperation.  However, in the case of\nsoftware used on network servers, this result may fail to come about.\nThe GNU General Public License permits making a modified version and\nletting the public access it on a server without ever releasing its\nsource code to the public.\n\n  The GNU Affero General Public License is designed specifically to\nensure that, in such cases, the modified source code becomes available\nto the community.  It requires the operator of a network server to\nprovide the source code of the modified version running there to the\nusers of that server.  Therefore, public use of a modified version, on\na publicly accessible server, gives the public access to the source\ncode of the modified version.\n\n  An older license, called the Affero General Public License and\npublished by Affero, was designed to accomplish similar goals.  This is\na different license, not a version of the Affero GPL, but Affero has\nreleased a new version of the Affero GPL which permits relicensing under\nthis license.\n\n  The precise terms and conditions for copying, distribution and\nmodification follow.\n\n                       TERMS AND CONDITIONS\n\n  0. Definitions.\n\n  \"This License\" refers to version 3 of the GNU Affero General Public License.\n\n  \"Copyright\" also means copyright-like laws that apply to other kinds of\nworks, such as semiconductor masks.\n\n  \"The Program\" refers to any copyrightable work licensed under this\nLicense.  Each licensee is addressed as \"you\".  \"Licensees\" and\n\"recipients\" may be individuals or organizations.\n\n  To \"modify\" a work means to copy from or adapt all or part of the work\nin a fashion requiring copyright permission, other than the making of an\nexact copy.  The resulting work is called a \"modified version\" of the\nearlier work or a work \"based on\" the earlier work.\n\n  A \"covered work\" means either the unmodified Program or a work based\non the Program.\n\n  To \"propagate\" a work means to do anything with it that, without\npermission, would make you directly or secondarily liable for\ninfringement under applicable copyright law, except executing it on a\ncomputer or modifying a private copy.  Propagation includes copying,\ndistribution (with or without modification), making available to the\npublic, and in some countries other activities as well.\n\n  To \"convey\" a work means any kind of propagation that enables other\nparties to make or receive copies.  Mere interaction with a user through\na computer network, with no transfer of a copy, is not conveying.\n\n  An interactive user interface displays \"Appropriate Legal Notices\"\nto the extent that it includes a convenient and prominently visible\nfeature that (1) displays an appropriate copyright notice, and (2)\ntells the user that there is no warranty for the work (except to the\nextent that warranties are provided), that licensees may convey the\nwork under this License, and how to view a copy of this License.  If\nthe interface presents a list of user commands or options, such as a\nmenu, a prominent item in the list meets this criterion.\n\n  1. Source Code.\n\n  The \"source code\" for a work means the preferred form of the work\nfor making modifications to it.  \"Object code\" means any non-source\nform of a work.\n\n  A \"Standard Interface\" means an interface that either is an official\nstandard defined by a recognized standards body, or, in the case of\ninterfaces specified for a particular programming language, one that\nis widely used among developers working in that language.\n\n  The \"System Libraries\" of an executable work include anything, other\nthan the work as a whole, that (a) is included in the normal form of\npackaging a Major Component, but which is not part of that Major\nComponent, and (b) serves only to enable use of the work with that\nMajor Component, or to implement a Standard Interface for which an\nimplementation is available to the public in source code form.  A\n\"Major Component\", in this context, means a major essential component\n(kernel, window system, and so on) of the specific operating system\n(if any) on which the executable work runs, or a compiler used to\nproduce the work, or an object code interpreter used to run it.\n\n  The \"Corresponding Source\" for a work in object code form means all\nthe source code needed to generate, install, and (for an executable\nwork) run the object code and to modify the work, including scripts to\ncontrol those activities.  However, it does not include the work's\nSystem Libraries, or general-purpose tools or generally available free\nprograms which are used unmodified in performing those activities but\nwhich are not part of the work.  For example, Corresponding Source\nincludes interface definition files associated with source files for\nthe work, and the source code for shared libraries and dynamically\nlinked subprograms that the work is specifically designed to require,\nsuch as by intimate data communication or control flow between those\nsubprograms and other parts of the work.\n\n  The Corresponding Source need not include anything that users\ncan regenerate automatically from other parts of the Corresponding\nSource.\n\n  The Corresponding Source for a work in source code form is that\nsame work.\n\n  2. Basic Permissions.\n\n  All rights granted under this License are granted for the term of\ncopyright on the Program, and are irrevocable provided the stated\nconditions are met.  This License explicitly affirms your unlimited\npermission to run the unmodified Program.  The output from running a\ncovered work is covered by this License only if the output, given its\ncontent, constitutes a covered work.  This License acknowledges your\nrights of fair use or other equivalent, as provided by copyright law.\n\n  You may make, run and propagate covered works that you do not\nconvey, without conditions so long as your license otherwise remains\nin force.  You may convey covered works to others for the sole purpose\nof having them make modifications exclusively for you, or provide you\nwith facilities for running those works, provided that you comply with\nthe terms of this License in conveying all material for which you do\nnot control copyright.  Those thus making or running the covered works\nfor you must do so exclusively on your behalf, under your direction\nand control, on terms that prohibit them from making any copies of\nyour copyrighted material outside their relationship with you.\n\n  Conveying under any other circumstances is permitted solely under\nthe conditions stated below.  Sublicensing is not allowed; section 10\nmakes it unnecessary.\n\n  3. Protecting Users' Legal Rights From Anti-Circumvention Law.\n\n  No covered work shall be deemed part of an effective technological\nmeasure under any applicable law fulfilling obligations under article\n11 of the WIPO copyright treaty adopted on 20 December 1996, or\nsimilar laws prohibiting or restricting circumvention of such\nmeasures.\n\n  When you convey a covered work, you waive any legal power to forbid\ncircumvention of technological measures to the extent such circumvention\nis effected by exercising rights under this License with respect to\nthe covered work, and you disclaim any intention to limit operation or\nmodification of the work as a means of enforcing, against the work's\nusers, your or third parties' legal rights to forbid circumvention of\ntechnological measures.\n\n  4. Conveying Verbatim Copies.\n\n  You may convey verbatim copies of the Program's source code as you\nreceive it, in any medium, provided that you conspicuously and\nappropriately publish on each copy an appropriate copyright notice;\nkeep intact all notices stating that this License and any\nnon-permissive terms added in accord with section 7 apply to the code;\nkeep intact all notices of the absence of any warranty; and give all\nrecipients a copy of this License along with the Program.\n\n  You may charge any price or no price for each copy that you convey,\nand you may offer support or warranty protection for a fee.\n\n  5. Conveying Modified Source Versions.\n\n  You may convey a work based on the Program, or the modifications to\nproduce it from the Program, in the form of source code under the\nterms of section 4, provided that you also meet all of these conditions:\n\n    a) The work must carry prominent notices stating that you modified\n    it, and giving a relevant date.\n\n    b) The work must carry prominent notices stating that it is\n    released under this License and any conditions added under section\n    7.  This requirement modifies the requirement in section 4 to\n    \"keep intact all notices\".\n\n    c) You must license the entire work, as a whole, under this\n    License to anyone who comes into possession of a copy.  This\n    License will therefore apply, along with any applicable section 7\n    additional terms, to the whole of the work, and all its parts,\n    regardless of how they are packaged.  This License gives no\n    permission to license the work in any other way, but it does not\n    invalidate such permission if you have separately received it.\n\n    d) If the work has interactive user interfaces, each must display\n    Appropriate Legal Notices; however, if the Program has interactive\n    interfaces that do not display Appropriate Legal Notices, your\n    work need not make them do so.\n\n  A compilation of a covered work with other separate and independent\nworks, which are not by their nature extensions of the covered work,\nand which are not combined with it such as to form a larger program,\nin or on a volume of a storage or distribution medium, is called an\n\"aggregate\" if the compilation and its resulting copyright are not\nused to limit the access or legal rights of the compilation's users\nbeyond what the individual works permit.  Inclusion of a covered work\nin an aggregate does not cause this License to apply to the other\nparts of the aggregate.\n\n  6. Conveying Non-Source Forms.\n\n  You may convey a covered work in object code form under the terms\nof sections 4 and 5, provided that you also convey the\nmachine-readable Corresponding Source under the terms of this License,\nin one of these ways:\n\n    a) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by the\n    Corresponding Source fixed on a durable physical medium\n    customarily used for software interchange.\n\n    b) Convey the object code in, or embodied in, a physical product\n    (including a physical distribution medium), accompanied by a\n    written offer, valid for at least three years and valid for as\n    long as you offer spare parts or customer support for that product\n    model, to give anyone who possesses the object code either (1) a\n    copy of the Corresponding Source for all the software in the\n    product that is covered by this License, on a durable physical\n    medium customarily used for software interchange, for a price no\n    more than your reasonable cost of physically performing this\n    conveying of source, or (2) access to copy the\n    Corresponding Source from a network server at no charge.\n\n    c) Convey individual copies of the object code with a copy of the\n    written offer to provide the Corresponding Source.  This\n    alternative is allowed only occasionally and noncommercially, and\n    only if you received the object code with such an offer, in accord\n    with subsection 6b.\n\n    d) Convey the object code by offering access from a designated\n    place (gratis or for a charge), and offer equivalent access to the\n    Corresponding Source in the same way through the same place at no\n    further charge.  You need not require recipients to copy the\n    Corresponding Source along with the object code.  If the place to\n    copy the object code is a network server, the Corresponding Source\n    may be on a different server (operated by you or a third party)\n    that supports equivalent copying facilities, provided you maintain\n    clear directions next to the object code saying where to find the\n    Corresponding Source.  Regardless of what server hosts the\n    Corresponding Source, you remain obligated to ensure that it is\n    available for as long as needed to satisfy these requirements.\n\n    e) Convey the object code using peer-to-peer transmission, provided\n    you inform other peers where the object code and Corresponding\n    Source of the work are being offered to the general public at no\n    charge under subsection 6d.\n\n  A separable portion of the object code, whose source code is excluded\nfrom the Corresponding Source as a System Library, need not be\nincluded in conveying the object code work.\n\n  A \"User Product\" is either (1) a \"consumer product\", which means any\ntangible personal property which is normally used for personal, family,\nor household purposes, or (2) anything designed or sold for incorporation\ninto a dwelling.  In determining whether a product is a consumer product,\ndoubtful cases shall be resolved in favor of coverage.  For a particular\nproduct received by a particular user, \"normally used\" refers to a\ntypical or common use of that class of product, regardless of the status\nof the particular user or of the way in which the particular user\nactually uses, or expects or is expected to use, the product.  A product\nis a consumer product regardless of whether the product has substantial\ncommercial, industrial or non-consumer uses, unless such uses represent\nthe only significant mode of use of the product.\n\n  \"Installation Information\" for a User Product means any methods,\nprocedures, authorization keys, or other information required to install\nand execute modified versions of a covered work in that User Product from\na modified version of its Corresponding Source.  The information must\nsuffice to ensure that the continued functioning of the modified object\ncode is in no case prevented or interfered with solely because\nmodification has been made.\n\n  If you convey an object code work under this section in, or with, or\nspecifically for use in, a User Product, and the conveying occurs as\npart of a transaction in which the right of possession and use of the\nUser Product is transferred to the recipient in perpetuity or for a\nfixed term (regardless of how the transaction is characterized), the\nCorresponding Source conveyed under this section must be accompanied\nby the Installation Information.  But this requirement does not apply\nif neither you nor any third party retains the ability to install\nmodified object code on the User Product (for example, the work has\nbeen installed in ROM).\n\n  The requirement to provide Installation Information does not include a\nrequirement to continue to provide support service, warranty, or updates\nfor a work that has been modified or installed by the recipient, or for\nthe User Product in which it has been modified or installed.  Access to a\nnetwork may be denied when the modification itself materially and\nadversely affects the operation of the network or violates the rules and\nprotocols for communication across the network.\n\n  Corresponding Source conveyed, and Installation Information provided,\nin accord with this section must be in a format that is publicly\ndocumented (and with an implementation available to the public in\nsource code form), and must require no special password or key for\nunpacking, reading or copying.\n\n  7. Additional Terms.\n\n  \"Additional permissions\" are terms that supplement the terms of this\nLicense by making exceptions from one or more of its conditions.\nAdditional permissions that are applicable to the entire Program shall\nbe treated as though they were included in this License, to the extent\nthat they are valid under applicable law.  If additional permissions\napply only to part of the Program, that part may be used separately\nunder those permissions, but the entire Program remains governed by\nthis License without regard to the additional permissions.\n\n  When you convey a copy of a covered work, you may at your option\nremove any additional permissions from that copy, or from any part of\nit.  (Additional permissions may be written to require their own\nremoval in certain cases when you modify the work.)  You may place\nadditional permissions on material, added by you to a covered work,\nfor which you have or can give appropriate copyright permission.\n\n  Notwithstanding any other provision of this License, for material you\nadd to a covered work, you may (if authorized by the copyright holders of\nthat material) supplement the terms of this License with terms:\n\n    a) Disclaiming warranty or limiting liability differently from the\n    terms of sections 15 and 16 of this License; or\n\n    b) Requiring preservation of specified reasonable legal notices or\n    author attributions in that material or in the Appropriate Legal\n    Notices displayed by works containing it; or\n\n    c) Prohibiting misrepresentation of the origin of that material, or\n    requiring that modified versions of such material be marked in\n    reasonable ways as different from the original version; or\n\n    d) Limiting the use for publicity purposes of names of licensors or\n    authors of the material; or\n\n    e) Declining to grant rights under trademark law for use of some\n    trade names, trademarks, or service marks; or\n\n    f) Requiring indemnification of licensors and authors of that\n    material by anyone who conveys the material (or modified versions of\n    it) with contractual assumptions of liability to the recipient, for\n    any liability that these contractual assumptions directly impose on\n    those licensors and authors.\n\n  All other non-permissive additional terms are considered \"further\nrestrictions\" within the meaning of section 10.  If the Program as you\nreceived it, or any part of it, contains a notice stating that it is\ngoverned by this License along with a term that is a further\nrestriction, you may remove that term.  If a license document contains\na further restriction but permits relicensing or conveying under this\nLicense, you may add to a covered work material governed by the terms\nof that license document, provided that the further restriction does\nnot survive such relicensing or conveying.\n\n  If you add terms to a covered work in accord with this section, you\nmust place, in the relevant source files, a statement of the\nadditional terms that apply to those files, or a notice indicating\nwhere to find the applicable terms.\n\n  Additional terms, permissive or non-permissive, may be stated in the\nform of a separately written license, or stated as exceptions;\nthe above requirements apply either way.\n\n  8. Termination.\n\n  You may not propagate or modify a covered work except as expressly\nprovided under this License.  Any attempt otherwise to propagate or\nmodify it is void, and will automatically terminate your rights under\nthis License (including any patent licenses granted under the third\nparagraph of section 11).\n\n  However, if you cease all violation of this License, then your\nlicense from a particular copyright holder is reinstated (a)\nprovisionally, unless and until the copyright holder explicitly and\nfinally terminates your license, and (b) permanently, if the copyright\nholder fails to notify you of the violation by some reasonable means\nprior to 60 days after the cessation.\n\n  Moreover, your license from a particular copyright holder is\nreinstated permanently if the copyright holder notifies you of the\nviolation by some reasonable means, this is the first time you have\nreceived notice of violation of this License (for any work) from that\ncopyright holder, and you cure the violation prior to 30 days after\nyour receipt of the notice.\n\n  Termination of your rights under this section does not terminate the\nlicenses of parties who have received copies or rights from you under\nthis License.  If your rights have been terminated and not permanently\nreinstated, you do not qualify to receive new licenses for the same\nmaterial under section 10.\n\n  9. Acceptance Not Required for Having Copies.\n\n  You are not required to accept this License in order to receive or\nrun a copy of the Program.  Ancillary propagation of a covered work\noccurring solely as a consequence of using peer-to-peer transmission\nto receive a copy likewise does not require acceptance.  However,\nnothing other than this License grants you permission to propagate or\nmodify any covered work.  These actions infringe copyright if you do\nnot accept this License.  Therefore, by modifying or propagating a\ncovered work, you indicate your acceptance of this License to do so.\n\n  10. Automatic Licensing of Downstream Recipients.\n\n  Each time you convey a covered work, the recipient automatically\nreceives a license from the original licensors, to run, modify and\npropagate that work, subject to this License.  You are not responsible\nfor enforcing compliance by third parties with this License.\n\n  An \"entity transaction\" is a transaction transferring control of an\norganization, or substantially all assets of one, or subdividing an\norganization, or merging organizations.  If propagation of a covered\nwork results from an entity transaction, each party to that\ntransaction who receives a copy of the work also receives whatever\nlicenses to the work the party's predecessor in interest had or could\ngive under the previous paragraph, plus a right to possession of the\nCorresponding Source of the work from the predecessor in interest, if\nthe predecessor has it or can get it with reasonable efforts.\n\n  You may not impose any further restrictions on the exercise of the\nrights granted or affirmed under this License.  For example, you may\nnot impose a license fee, royalty, or other charge for exercise of\nrights granted under this License, and you may not initiate litigation\n(including a cross-claim or counterclaim in a lawsuit) alleging that\nany patent claim is infringed by making, using, selling, offering for\nsale, or importing the Program or any portion of it.\n\n  11. Patents.\n\n  A \"contributor\" is a copyright holder who authorizes use under this\nLicense of the Program or a work on which the Program is based.  The\nwork thus licensed is called the contributor's \"contributor version\".\n\n  A contributor's \"essential patent claims\" are all patent claims\nowned or controlled by the contributor, whether already acquired or\nhereafter acquired, that would be infringed by some manner, permitted\nby this License, of making, using, or selling its contributor version,\nbut do not include claims that would be infringed only as a\nconsequence of further modification of the contributor version.  For\npurposes of this definition, \"control\" includes the right to grant\npatent sublicenses in a manner consistent with the requirements of\nthis License.\n\n  Each contributor grants you a non-exclusive, worldwide, royalty-free\npatent license under the contributor's essential patent claims, to\nmake, use, sell, offer for sale, import and otherwise run, modify and\npropagate the contents of its contributor version.\n\n  In the following three paragraphs, a \"patent license\" is any express\nagreement or commitment, however denominated, not to enforce a patent\n(such as an express permission to practice a patent or covenant not to\nsue for patent infringement).  To \"grant\" such a patent license to a\nparty means to make such an agreement or commitment not to enforce a\npatent against the party.\n\n  If you convey a covered work, knowingly relying on a patent license,\nand the Corresponding Source of the work is not available for anyone\nto copy, free of charge and under the terms of this License, through a\npublicly available network server or other readily accessible means,\nthen you must either (1) cause the Corresponding Source to be so\navailable, or (2) arrange to deprive yourself of the benefit of the\npatent license for this particular work, or (3) arrange, in a manner\nconsistent with the requirements of this License, to extend the patent\nlicense to downstream recipients.  \"Knowingly relying\" means you have\nactual knowledge that, but for the patent license, your conveying the\ncovered work in a country, or your recipient's use of the covered work\nin a country, would infringe one or more identifiable patents in that\ncountry that you have reason to believe are valid.\n\n  If, pursuant to or in connection with a single transaction or\narrangement, you convey, or propagate by procuring conveyance of, a\ncovered work, and grant a patent license to some of the parties\nreceiving the covered work authorizing them to use, propagate, modify\nor convey a specific copy of the covered work, then the patent license\nyou grant is automatically extended to all recipients of the covered\nwork and works based on it.\n\n  A patent license is \"discriminatory\" if it does not include within\nthe scope of its coverage, prohibits the exercise of, or is\nconditioned on the non-exercise of one or more of the rights that are\nspecifically granted under this License.  You may not convey a covered\nwork if you are a party to an arrangement with a third party that is\nin the business of distributing software, under which you make payment\nto the third party based on the extent of your activity of conveying\nthe work, and under which the third party grants, to any of the\nparties who would receive the covered work from you, a discriminatory\npatent license (a) in connection with copies of the covered work\nconveyed by you (or copies made from those copies), or (b) primarily\nfor and in connection with specific products or compilations that\ncontain the covered work, unless you entered into that arrangement,\nor that patent license was granted, prior to 28 March 2007.\n\n  Nothing in this License shall be construed as excluding or limiting\nany implied license or other defenses to infringement that may\notherwise be available to you under applicable patent law.\n\n  12. No Surrender of Others' Freedom.\n\n  If conditions are imposed on you (whether by court order, agreement or\notherwise) that contradict the conditions of this License, they do not\nexcuse you from the conditions of this License.  If you cannot convey a\ncovered work so as to satisfy simultaneously your obligations under this\nLicense and any other pertinent obligations, then as a consequence you may\nnot convey it at all.  For example, if you agree to terms that obligate you\nto collect a royalty for further conveying from those to whom you convey\nthe Program, the only way you could satisfy both those terms and this\nLicense would be to refrain entirely from conveying the Program.\n\n  13. Remote Network Interaction; Use with the GNU General Public License.\n\n  Notwithstanding any other provision of this License, if you modify the\nProgram, your modified version must prominently offer all users\ninteracting with it remotely through a computer network (if your version\nsupports such interaction) an opportunity to receive the Corresponding\nSource of your version by providing access to the Corresponding Source\nfrom a network server at no charge, through some standard or customary\nmeans of facilitating copying of software.  This Corresponding Source\nshall include the Corresponding Source for any work covered by version 3\nof the GNU General Public License that is incorporated pursuant to the\nfollowing paragraph.\n\n  Notwithstanding any other provision of this License, you have\npermission to link or combine any covered work with a work licensed\nunder version 3 of the GNU General Public License into a single\ncombined work, and to convey the resulting work.  The terms of this\nLicense will continue to apply to the part which is the covered work,\nbut the work with which it is combined will remain governed by version\n3 of the GNU General Public License.\n\n  14. Revised Versions of this License.\n\n  The Free Software Foundation may publish revised and/or new versions of\nthe GNU Affero General Public License from time to time.  Such new versions\nwill be similar in spirit to the present version, but may differ in detail to\naddress new problems or concerns.\n\n  Each version is given a distinguishing version number.  If the\nProgram specifies that a certain numbered version of the GNU Affero General\nPublic License \"or any later version\" applies to it, you have the\noption of following the terms and conditions either of that numbered\nversion or of any later version published by the Free Software\nFoundation.  If the Program does not specify a version number of the\nGNU Affero General Public License, you may choose any version ever published\nby the Free Software Foundation.\n\n  If the Program specifies that a proxy can decide which future\nversions of the GNU Affero General Public License can be used, that proxy's\npublic statement of acceptance of a version permanently authorizes you\nto choose that version for the Program.\n\n  Later license versions may give you additional or different\npermissions.  However, no additional obligations are imposed on any\nauthor or copyright holder as a result of your choosing to follow a\nlater version.\n\n  15. Disclaimer of Warranty.\n\n  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY\nAPPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT\nHOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY\nOF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,\nTHE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR\nPURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM\nIS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF\nALL NECESSARY SERVICING, REPAIR OR CORRECTION.\n\n  16. Limitation of Liability.\n\n  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\nWILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS\nTHE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY\nGENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE\nUSE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF\nDATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD\nPARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),\nEVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF\nSUCH DAMAGES.\n\n  17. Interpretation of Sections 15 and 16.\n\n  If the disclaimer of warranty and limitation of liability provided\nabove cannot be given local legal effect according to their terms,\nreviewing courts shall apply local law that most closely approximates\nan absolute waiver of all civil liability in connection with the\nProgram, unless a warranty or assumption of liability accompanies a\ncopy of the Program in return for a fee.\n\n                     END OF TERMS AND CONDITIONS\n\n            How to Apply These Terms to Your New Programs\n\n  If you develop a new program, and you want it to be of the greatest\npossible use to the public, the best way to achieve this is to make it\nfree software which everyone can redistribute and change under these terms.\n\n  To do so, attach the following notices to the program.  It is safest\nto attach them to the start of each source file to most effectively\nstate the exclusion of warranty; and each file should have at least\nthe \"copyright\" line and a pointer to where the full notice is found.\n\n    <one line to give the program's name and a brief idea of what it does.>\n    Copyright (C) <year>  <name of author>\n\n    This program is free software: you can redistribute it and/or modify\n    it under the terms of the GNU Affero General Public License as published\n    by the Free Software Foundation, either version 3 of the License, or\n    (at your option) any later version.\n\n    This program is distributed in the hope that it will be useful,\n    but WITHOUT ANY WARRANTY; without even the implied warranty of\n    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n    GNU Affero General Public License for more details.\n\n    You should have received a copy of the GNU Affero General Public License\n    along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\nAlso add information on how to contact you by electronic and paper mail.\n\n  If your software can interact with users remotely through a computer\nnetwork, you should also make sure that it provides a way for users to\nget its source.  For example, if your program is a web application, its\ninterface could display a \"Source\" link that leads users to an archive\nof the code.  There are many ways you could offer source, and different\nsolutions will be better for different programs; see section 13 for the\nspecific requirements.\n\n  You should also get your employer (if you work as a programmer) or school,\nif any, to sign a \"copyright disclaimer\" for the program, if necessary.\nFor more information on this, and how to apply and follow the GNU AGPL, see\n<http://www.gnu.org/licenses/>.\n"
  },
  {
    "path": "README.md",
    "content": "# 从0开始做前后端分离的图书管理系统\n\n技术栈：SpringBoot2 + Vue2.0 + ElementUI + Mysql\n\n免费开源，完全手写，适合小白，求求 <b style=\"color=red\">Star</b>\n\n[课程笔记点这里](文档/笔记.md)\n\n关注B站：[程序员青戈](https://space.bilibili.com/402779077) ，学习更多干货教程\n\n关注微信公众号：Java学习指南，回复：软件，获取课程所需的所有软件下载和安装教程。\n\n## 系统登录\n\nhttp://localhost:8080/login\n\n账号：admin/admin\n\n## 系统功能\n\n<img src=\"./文档/图书管理.png\">\n\n## 系统截图\n\n<img src=\"./文档/首页.png\">\n\n<img src=\"./文档/登录.png\">\n\n<img src=\"./文档/会员.png\">\n\n<img src=\"./文档/图书.png\">\n\n<img src=\"./文档/借书.png\">\n\n## 老铁，白嫖完了，真的别忘了 Star 噢！\n\n"
  },
  {
    "path": "springboot/pom.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<project xmlns=\"http://maven.apache.org/POM/4.0.0\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd\">\n    <modelVersion>4.0.0</modelVersion>\n    <parent>\n        <groupId>org.springframework.boot</groupId>\n        <artifactId>spring-boot-starter-parent</artifactId>\n        <version>2.7.3</version>\n        <relativePath/> <!-- lookup parent from repository -->\n    </parent>\n    <groupId>com.example</groupId>\n    <artifactId>springboot</artifactId>\n    <version>0.0.1-SNAPSHOT</version>\n    <name>springboot</name>\n    <description>Demo project for Spring Boot</description>\n    <properties>\n        <java.version>1.8</java.version>\n    </properties>\n    <dependencies>\n        <dependency>\n            <groupId>org.springframework.boot</groupId>\n            <artifactId>spring-boot-starter-web</artifactId>\n        </dependency>\n        <dependency>\n            <groupId>org.mybatis.spring.boot</groupId>\n            <artifactId>mybatis-spring-boot-starter</artifactId>\n            <version>2.2.2</version>\n        </dependency>\n\n        <dependency>\n            <groupId>mysql</groupId>\n            <artifactId>mysql-connector-java</artifactId>\n            <scope>runtime</scope>\n        </dependency>\n        <dependency>\n            <groupId>org.projectlombok</groupId>\n            <artifactId>lombok</artifactId>\n            <optional>true</optional>\n        </dependency>\n        <dependency>\n            <groupId>com.github.pagehelper</groupId>\n            <artifactId>pagehelper-spring-boot-starter</artifactId>\n            <version>1.4.5</version>\n        </dependency>\n        <dependency>\n            <groupId>cn.hutool</groupId>\n            <artifactId>hutool-all</artifactId>\n            <version>5.8.0</version>\n        </dependency>\n        <dependency>\n            <groupId>com.auth0</groupId>\n            <artifactId>java-jwt</artifactId>\n            <version>3.10.3</version>\n        </dependency>\n\n\n        <dependency>\n            <groupId>org.springframework.boot</groupId>\n            <artifactId>spring-boot-starter-test</artifactId>\n            <scope>test</scope>\n        </dependency>\n    </dependencies>\n\n    <build>\n        <plugins>\n            <plugin>\n                <groupId>org.springframework.boot</groupId>\n                <artifactId>spring-boot-maven-plugin</artifactId>\n                <configuration>\n                    <excludes>\n                        <exclude>\n                            <groupId>org.projectlombok</groupId>\n                            <artifactId>lombok</artifactId>\n                        </exclude>\n                    </excludes>\n                </configuration>\n            </plugin>\n        </plugins>\n    </build>\n\n</project>\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/SpringbootApplication.java",
    "content": "package com.example.springboot;\n\nimport org.springframework.boot.SpringApplication;\nimport org.springframework.boot.autoconfigure.SpringBootApplication;\nimport org.springframework.web.bind.annotation.GetMapping;\nimport org.springframework.web.bind.annotation.RestController;\n\n@RestController\n@SpringBootApplication\npublic class SpringbootApplication {\n\n    public static void main(String[] args) {\n        SpringApplication.run(SpringbootApplication.class, args);\n    }\n\n    // 健康检查的接口\n    @GetMapping\n    public String health() {\n        return \"SUCCESS\";\n    }\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/common/CorsConfig.java",
    "content": "package com.example.springboot.common;\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.web.cors.CorsConfiguration;\nimport org.springframework.web.cors.UrlBasedCorsConfigurationSource;\nimport org.springframework.web.filter.CorsFilter;\n\n@Configuration\npublic class CorsConfig {\n\n    @Bean\n    public CorsFilter corsFilter() {\n        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n        CorsConfiguration corsConfiguration = new CorsConfiguration();\n        corsConfiguration.addAllowedOrigin(\"*\"); // 1 设置访问源地址\n        corsConfiguration.addAllowedHeader(\"*\"); // 2 设置访问源请求头\n        corsConfiguration.addAllowedMethod(\"*\"); // 3 设置访问源请求方法\n        source.registerCorsConfiguration(\"/**\", corsConfiguration); // 4 对接口配置跨域设置\n        return new CorsFilter(source);\n    }\n}\n\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/common/JwtInterceptor.java",
    "content": "package com.example.springboot.common;\n\nimport cn.hutool.core.util.StrUtil;\nimport com.auth0.jwt.JWT;\nimport com.auth0.jwt.JWTVerifier;\nimport com.auth0.jwt.algorithms.Algorithm;\nimport com.auth0.jwt.exceptions.JWTVerificationException;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.exception.ServiceException;\nimport com.example.springboot.service.IAdminService;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Component;\nimport org.springframework.web.servlet.HandlerInterceptor;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n@Component\n@Slf4j\npublic class JwtInterceptor implements HandlerInterceptor {\n\n    private static final String ERROR_CODE_401 = \"401\";\n\n    @Autowired\n    private IAdminService adminService;\n\n    @Override\n    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {\n        String token = request.getHeader(\"token\");\n        if (StrUtil.isBlank(token)) {\n            token = request.getParameter(\"token\");\n        }\n\n        // 执行认证\n        if (StrUtil.isBlank(token)) {\n            throw new ServiceException(ERROR_CODE_401, \"无token，请重新登录\");\n        }\n        // 获取 token 中的adminId\n        String adminId;\n        Admin admin;\n        try {\n            adminId = JWT.decode(token).getAudience().get(0);\n            // 根据token中的userid查询数据库\n            admin = adminService.getById(Integer.parseInt(adminId));\n        } catch (Exception e) {\n            String errMsg = \"token验证失败，请重新登录\";\n            log.error(errMsg + \", token=\" + token, e);\n            throw new ServiceException(ERROR_CODE_401, errMsg);\n        }\n        if (admin == null) {\n            throw new ServiceException(ERROR_CODE_401, \"用户不存在，请重新登录\");\n        }\n\n        try {\n            // 用户密码加签验证 token\n            JWTVerifier jwtVerifier = JWT.require(Algorithm.HMAC256(admin.getPassword())).build();\n            jwtVerifier.verify(token); // 验证token\n        } catch (JWTVerificationException e) {\n            throw new ServiceException(ERROR_CODE_401, \"token验证失败，请重新登录\");\n        }\n        return true;\n    }\n}\n\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/common/Result.java",
    "content": "package com.example.springboot.common;\n\nimport lombok.Data;\n\n@Data\npublic class Result {\n    private static final String SUCCESS_CODE = \"200\";\n    private static final String ERROR_CODE = \"-1\";\n\n    private String code;\n    private Object data;\n    private String msg;\n\n    public static Result success() {\n        Result result = new Result();\n        result.setCode(SUCCESS_CODE);\n        return result;\n    }\n\n    public static Result success(Object data) {\n        Result result = new Result();\n        result.setCode(SUCCESS_CODE);\n        result.setData(data);\n        return result;\n    }\n\n    public static Result error(String msg) {\n        Result result = new Result();\n        result.setCode(ERROR_CODE);\n        result.setMsg(msg);\n        return result;\n    }\n\n    public static Result error(String code, String msg) {\n        Result result = new Result();\n        result.setCode(code);\n        result.setMsg(msg);\n        return result;\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/common/WebConfig.java",
    "content": "package com.example.springboot.common;\n\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.web.bind.annotation.RestController;\nimport org.springframework.web.servlet.config.annotation.InterceptorRegistry;\nimport org.springframework.web.servlet.config.annotation.PathMatchConfigurer;\nimport org.springframework.web.servlet.config.annotation.WebMvcConfigurer;\n\n@Configuration\npublic class WebConfig implements  WebMvcConfigurer {\n\n    @Autowired\n    JwtInterceptor jwtInterceptor;\n\n    @Override\n    public void configurePathMatch(PathMatchConfigurer configurer) {\n        // 指定controller统一的接口前缀\n        configurer.addPathPrefix(\"/api\", clazz -> clazz.isAnnotationPresent(RestController.class));\n    }\n\n\n    // 加自定义拦截器JwtInterceptor，设置拦截规则\n    @Override\n    public void addInterceptors(InterceptorRegistry registry) {\n        registry.addInterceptor(jwtInterceptor).addPathPatterns(\"/api/**\").excludePathPatterns(\"/api/admin/login\");\n    }\n\n\n}\n\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/AdminController.java",
    "content": "package com.example.springboot.controller;\n\nimport com.example.springboot.common.Result;\nimport com.example.springboot.controller.dto.LoginDTO;\nimport com.example.springboot.controller.request.AdminPageRequest;\nimport com.example.springboot.controller.request.LoginRequest;\nimport com.example.springboot.controller.request.PasswordRequest;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.service.IAdminService;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.List;\n\n@CrossOrigin\n@RestController\n@RequestMapping(\"/admin\")\npublic class AdminController {\n\n    @Autowired\n    IAdminService adminService;\n\n    @PostMapping(\"/login\")\n    public Result login(@RequestBody LoginRequest request) {\n        LoginDTO login = adminService.login(request);\n        return Result.success(login);\n    }\n\n    @PutMapping(\"/password\")\n    public Result password(@RequestBody PasswordRequest request) {\n        adminService.changePass(request);\n        return Result.success();\n    }\n\n    @PostMapping(\"/save\")\n    public Result save(@RequestBody Admin obj) {\n        adminService.save(obj);\n        return Result.success();\n    }\n\n    @PutMapping(\"/update\")\n    public Result update(@RequestBody Admin obj) {\n        adminService.update(obj);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/delete/{id}\")\n    public Result delete(@PathVariable Integer id) {\n        adminService.deleteById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/{id}\")\n    public Result getById(@PathVariable Integer id) {\n        Admin obj = adminService.getById(id);\n        return Result.success(obj);\n    }\n\n    @GetMapping(\"/list\")\n    public Result list() {\n        List<Admin> list = adminService.list();\n        return Result.success(list);\n    }\n\n    @GetMapping(\"/page\")\n    public Result page(AdminPageRequest pageRequest) {\n        return Result.success(adminService.page(pageRequest));\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/BookController.java",
    "content": "package com.example.springboot.controller;\n\nimport cn.hutool.core.io.FileUtil;\nimport cn.hutool.core.util.StrUtil;\nimport com.example.springboot.common.Result;\nimport com.example.springboot.controller.request.BookPageRequest;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.entity.Book;\nimport com.example.springboot.service.IBookService;\nimport com.example.springboot.utils.TokenUtils;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\nimport org.springframework.web.multipart.MultipartFile;\n\nimport javax.servlet.http.HttpServletResponse;\nimport java.io.OutputStream;\nimport java.net.URLEncoder;\nimport java.util.List;\n\n@Slf4j\n@CrossOrigin\n@RestController\n@RequestMapping(\"/book\")\npublic class BookController {\n\n    @Autowired\n    IBookService bookService;\n\n    private static final String BASE_FILE_PATH = System.getProperty(\"user.dir\") + \"/files/\";\n\n    @PostMapping(\"/file/upload\")\n    public Result uploadFile(MultipartFile file) {\n        String originalFilename = file.getOriginalFilename();\n        if (StrUtil.isBlank(originalFilename)) {\n            return Result.error(\"文件上传失败\");\n        }\n        long flag = System.currentTimeMillis();\n        String filePath = BASE_FILE_PATH + flag + \"_\" + originalFilename;\n        try {\n            FileUtil.mkParentDirs(filePath);  // 创建父级目录\n            file.transferTo(FileUtil.file(filePath));\n            Admin currentAdmin = TokenUtils.getCurrentAdmin();\n            String token = TokenUtils.genToken(currentAdmin.getId().toString(), currentAdmin.getPassword(), 15);\n            String url = \"http://localhost:9090/api/book/file/download/\" + flag + \"?&token=\" + token;\n            if (originalFilename.endsWith(\"png\") || originalFilename.endsWith(\"jpg\") || originalFilename.endsWith(\"pdf\")) {\n                url += \"&play=1\";\n            }\n            return Result.success(url);\n        } catch (Exception e) {\n            log.info(\"文件上传失败\", e);\n        }\n        return Result.error(\"文件上传失败\");\n    }\n\n    @GetMapping(\"/file/download/{flag}\")\n    public void download(@PathVariable String flag, @RequestParam(required = false) String play, HttpServletResponse response) {\n        OutputStream os;\n        List<String> fileNames = FileUtil.listFileNames(BASE_FILE_PATH);\n        String fileName = fileNames.stream().filter(name -> name.contains(flag)).findAny().orElse(\"\"); //  System.currentTimeMillis() + originalFilename\n        try {\n            if (StrUtil.isNotEmpty(fileName)) {\n                String realName = fileName.substring(fileName.indexOf(\"_\") + 1);\n                if (\"1\".equals(play)) {\n                    response.addHeader(\"Content-Disposition\", \"inline;filename=\" + URLEncoder.encode(realName, \"UTF-8\"));\n                } else {\n                    response.addHeader(\"Content-Disposition\", \"attachment;filename=\" + URLEncoder.encode(realName, \"UTF-8\"));\n                }\n                byte[] bytes = FileUtil.readBytes(BASE_FILE_PATH + fileName);\n                os = response.getOutputStream();\n                os.write(bytes);\n                os.flush();\n                os.close();\n            }\n        } catch (Exception e) {\n            log.error(\"文件下载失败\", e);\n        }\n    }\n\n    @PostMapping(\"/save\")\n    public Result save(@RequestBody Book obj) {\n        bookService.save(obj);\n        return Result.success();\n    }\n\n    @PutMapping(\"/update\")\n    public Result update(@RequestBody Book obj) {\n        bookService.update(obj);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/delete/{id}\")\n    public Result delete(@PathVariable Integer id) {\n        bookService.deleteById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/{id}\")\n    public Result getById(@PathVariable Integer id) {\n        Book obj = bookService.getById(id);\n        return Result.success(obj);\n    }\n\n    @GetMapping(\"/list\")\n    public Result list() {\n        List<Book> list = bookService.list();\n        return Result.success(list);\n    }\n\n    @GetMapping(\"/page\")\n    public Result page(BookPageRequest pageRequest) {\n        return Result.success(bookService.page(pageRequest));\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/BorrowController.java",
    "content": "package com.example.springboot.controller;\n\nimport com.example.springboot.common.Result;\nimport com.example.springboot.controller.request.BorrowPageRequest;\nimport com.example.springboot.entity.Borrow;\nimport com.example.springboot.entity.Retur;\nimport com.example.springboot.service.IBorrowService;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.List;\n\n@CrossOrigin\n@RestController\n@RequestMapping(\"/borrow\")\npublic class BorrowController {\n\n    @Autowired\n    IBorrowService borrowService;\n\n    @PostMapping(\"/save\")\n    public Result save(@RequestBody Borrow obj) {\n        borrowService.save(obj);\n        return Result.success();\n    }\n\n    @PutMapping(\"/update\")\n    public Result update(@RequestBody Borrow obj) {\n        borrowService.update(obj);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/delete/{id}\")\n    public Result delete(@PathVariable Integer id) {\n        borrowService.deleteById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/{id}\")\n    public Result getById(@PathVariable Integer id) {\n        Borrow obj = borrowService.getById(id);\n        return Result.success(obj);\n    }\n\n    @GetMapping(\"/list\")\n    public Result list() {\n        List<Borrow> list = borrowService.list();\n        return Result.success(list);\n    }\n\n    @GetMapping(\"/page\")\n    public Result page(BorrowPageRequest pageRequest) {\n        return Result.success(borrowService.page(pageRequest));\n    }\n\n    @GetMapping(\"/pageRetur\")\n    public Result pageRetur(BorrowPageRequest pageRequest) {\n        return Result.success(borrowService.pageRetur(pageRequest));\n    }\n\n    @PostMapping(\"/saveRetur\")\n    public Result saveRetur(@RequestBody Retur obj) {\n        borrowService.saveRetur(obj);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/deleteRetur/{id}\")\n    public Result deleteRetur(@PathVariable Integer id) {\n        borrowService.deleteReturById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/lineCharts/{timeRange}\")\n    public Result lineCharts(@PathVariable String timeRange) {\n        return Result.success(borrowService.getCountByTimeRange(timeRange));\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/CategoryController.java",
    "content": "package com.example.springboot.controller;\n\nimport cn.hutool.core.collection.CollUtil;\nimport com.example.springboot.common.Result;\nimport com.example.springboot.controller.request.AdminPageRequest;\nimport com.example.springboot.controller.request.CategoryPageRequest;\nimport com.example.springboot.entity.Book;\nimport com.example.springboot.entity.Category;\nimport com.example.springboot.service.ICategoryService;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.stream.Collectors;\n\n@CrossOrigin\n@RestController\n@RequestMapping(\"/category\")\npublic class CategoryController {\n\n    @Autowired\n    ICategoryService categoryService;\n\n    @PostMapping(\"/save\")\n    public Result save(@RequestBody Category obj) {\n        categoryService.save(obj);\n        return Result.success();\n    }\n\n    @PutMapping(\"/update\")\n    public Result update(@RequestBody Category obj) {\n        categoryService.update(obj);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/delete/{id}\")\n    public Result delete(@PathVariable Integer id) {\n        categoryService.deleteById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/{id}\")\n    public Result getById(@PathVariable Integer id) {\n        Category obj = categoryService.getById(id);\n        return Result.success(obj);\n    }\n\n    @GetMapping(\"/list\")\n    public Result list() {\n        List<Category> list = categoryService.list();\n        return Result.success(list);\n    }\n\n    @GetMapping(\"/tree\")\n    public Result tree() {\n        List<Category> list = categoryService.list();\n\n        // 对list操作即可\n//        List<Category> treeList = list.stream().filter(v -> v.getPid() == null).collect(Collectors.toList());  // 第一层\n        // 比如 递归实现 children列表的查询\n\n        return Result.success(createTree(null, list));   //  null 表示从第一级开始递归\n    }\n\n    // 完全递归的方法来实现递归树\n    private List<Category> createTree(Integer pid, List<Category> categories) {\n        List<Category> treeList = new ArrayList<>();\n        for (Category category : categories) {\n            if (pid == null) {\n                if (category.getPid() == null) {  // 那这就是第一级节点\n                    treeList.add(category);\n                    category.setChildren(createTree(category.getId(), categories));\n                }\n            } else {\n                if (pid.equals(category.getPid())) {\n                    treeList.add(category);\n                    category.setChildren(createTree(category.getId(), categories));\n                }\n            }\n            if (CollUtil.isEmpty(category.getChildren())) {\n                category.setChildren(null);\n            }\n        }\n        return treeList;\n    }\n\n    @GetMapping(\"/page\")\n    public Result page(CategoryPageRequest pageRequest) {\n        return Result.success(categoryService.page(pageRequest));\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/UserController.java",
    "content": "package com.example.springboot.controller;\n\nimport com.example.springboot.common.Result;\nimport com.example.springboot.controller.request.UserPageRequest;\nimport com.example.springboot.entity.User;\nimport com.example.springboot.service.IUserService;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.web.bind.annotation.*;\n\nimport java.util.List;\n\n@CrossOrigin\n@RestController\n@RequestMapping(\"/user\")\npublic class UserController {\n\n    @Autowired\n    IUserService userService;\n\n    @PostMapping(\"/save\")\n    public Result save(@RequestBody User user) {\n        userService.save(user);\n        return Result.success();\n    }\n\n    @PostMapping(\"/account\")\n    public Result account(@RequestBody User user) {\n        userService.handleAccount(user);\n        return Result.success();\n    }\n\n    @PutMapping(\"/update\")\n    public Result update(@RequestBody User user) {\n        userService.update(user);\n        return Result.success();\n    }\n\n    @DeleteMapping(\"/delete/{id}\")\n    public Result delete(@PathVariable Integer id) {\n        userService.deleteById(id);\n        return Result.success();\n    }\n\n    @GetMapping(\"/{id}\")\n    public Result getById(@PathVariable Integer id) {\n        User user = userService.getById(id);\n        return Result.success(user);\n    }\n\n    @GetMapping(\"/list\")\n    public Result list() {\n        List<User> users = userService.list();\n        return Result.success(users);\n    }\n\n    @GetMapping(\"/page\")\n    public Result page(UserPageRequest userPageRequest) {\n        return Result.success(userService.page(userPageRequest));\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/dto/LoginDTO.java",
    "content": "package com.example.springboot.controller.dto;\n\nimport lombok.Data;\n\n@Data\npublic class LoginDTO {\n    private Integer id;\n    private String username;\n    private String phone;\n    private String email;\n    private String token;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/AdminPageRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class AdminPageRequest extends BaseRequest{\n    private String username;\n    private String phone;\n    private String email;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/BaseRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class BaseRequest {\n    private Integer pageNum = 1;\n    private Integer pageSize = 10;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/BookPageRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class BookPageRequest extends BaseRequest{\n    private String name;\n    private String bookNo;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/BorrowPageRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class BorrowPageRequest extends BaseRequest{\n    private String bookName;\n    private String bookNo;\n    private String userName;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/CategoryPageRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class CategoryPageRequest extends BaseRequest{\n    private String name;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/LoginRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.AllArgsConstructor;\nimport lombok.Data;\nimport lombok.NoArgsConstructor;\n\n@Data\npublic class LoginRequest {\n    private String username;\n    private String password;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/PasswordRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class PasswordRequest {\n    private String username;\n    private String password;\n    private String newPass;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/controller/request/UserPageRequest.java",
    "content": "package com.example.springboot.controller.request;\n\nimport lombok.Data;\n\n@Data\npublic class UserPageRequest extends BaseRequest{\n    private String name;\n    private String phone;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/Admin.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.util.Date;\n\n@Data\npublic class Admin {\n    private Integer id;\n    private String username;\n    private String phone;\n    private String email;\n    private String password;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private Date createtime;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private Date updatetime;\n    private boolean status;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/BaseEntity.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.io.Serializable;\nimport java.time.LocalDate;\n\n@Data\npublic class BaseEntity implements Serializable {\n    private static final long serialVersionUID = 1L;\n\n    private Integer id;\n\n    /**\n     * 创建时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate createtime;\n\n    /**\n     * 更新时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate updatetime;\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/Book.java",
    "content": "package com.example.springboot.entity;\n\nimport lombok.Data;\n\nimport java.io.Serializable;\nimport java.util.List;\n\n@Data\npublic class Book extends BaseEntity implements Serializable {\n\n    private static final long serialVersionUID = 1L;\n\n\n    /**\n     * 名称\n     */\n    private String name;\n\n    /**\n     * 描述\n     */\n    private String description;\n\n    /**\n     * 出版日期\n     */\n    private String publishDate;\n\n    /**\n     * 作者\n     */\n    private String author;\n\n    /**\n     * 出版社\n     */\n    private String publisher;\n\n    /**\n     * 分类\n     */\n    private String category;\n\n    /**\n     * 标准码\n     */\n    private String bookNo;\n\n    /**\n     * 封面\n     */\n    private String cover;\n\n    private List<String> categories;\n    private Integer score;\n    private Integer nums;\n\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/Borrow.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.time.LocalDate;\n\n@Data\npublic class Borrow {\n\n    /**\n     * id\n     */\n    private Integer id;\n\n    /**\n     * 图书名称\n     */\n    private String bookName;\n\n    /**\n     * 图书标准码\n     */\n    private String bookNo;\n\n    /**\n     * 用户id\n     */\n    private String userNo;\n\n    /**\n     * 用户名称\n     */\n    private String userName;\n\n    /**\n     * 用户联系方式\n     */\n    private String userPhone;\n\n    /**\n     * 创建时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate createtime;\n\n    /**\n     * 更新时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate updatetime;\n\n    /**\n     * 借书积分\n     */\n    private Integer score;\n    private String status;\n    private Integer days;\n    private LocalDate returnDate;\n    // 提醒状态 即将到期（-1）  已到期（当天）  已过期（超过归还日期之后）\n    private String note;\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/Category.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.time.LocalDate;\nimport java.util.List;\n\n@Data\npublic class Category {\n    private Integer id;\n    private String name;\n    private String remark;\n    private Integer pid;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate createtime;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate updatetime;\n\n    private List<Category> children;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/Retur.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.time.LocalDate;\n\n@Data\npublic class Retur {\n\n    /**\n     * id\n     */\n    private Integer id;\n\n    /**\n     * 图书名称\n     */\n    private String bookName;\n\n    /**\n     * 图书标准码\n     */\n    private String bookNo;\n\n    /**\n     * 用户id\n     */\n    private String userNo;\n\n    /**\n     * 用户名称\n     */\n    private String userName;\n\n    /**\n     * 用户联系方式\n     */\n    private String userPhone;\n\n    /**\n     * 创建时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate createtime;\n\n    /**\n     * 更新时间\n     */\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private LocalDate updatetime;\n\n    /**\n     * 借书积分\n     */\n    private Integer score;\n    private String status;\n    private Integer days;\n    private LocalDate returnDate;\n    private LocalDate realDate;\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/entity/User.java",
    "content": "package com.example.springboot.entity;\n\nimport com.fasterxml.jackson.annotation.JsonFormat;\nimport lombok.Data;\n\nimport java.beans.Transient;\nimport java.util.Date;\n\n@Data\npublic class User {\n    private Integer id;\n    private String name;\n    private String username;\n    private Integer age;\n    private Integer account;\n    private Integer score;\n    private String sex;\n    private String phone;\n    private String address;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private Date createtime;\n    @JsonFormat(pattern = \"yyyy-MM-dd\", timezone = \"GMT+8\")\n    private Date updatetime;\n    private boolean status;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/exception/ExceptionHandle.java",
    "content": "package com.example.springboot.exception;\n\nimport cn.hutool.core.util.StrUtil;\nimport com.example.springboot.common.Result;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.web.bind.annotation.ExceptionHandler;\nimport org.springframework.web.bind.annotation.RestControllerAdvice;\n\n@Slf4j\n@RestControllerAdvice\npublic class ExceptionHandle {\n\n    @ExceptionHandler(value = ServiceException.class)\n    public Result serviceExceptionError(ServiceException e) {\n        log.error(\"业务异常\", e);\n        String code = e.getCode();\n        if (StrUtil.isNotBlank(code)) {\n            return Result.error(code, e.getMessage());\n        }\n        return Result.error(e.getMessage());\n    }\n\n    @ExceptionHandler(value = Exception.class)\n    public Result exceptionError(Exception e) {\n        log.error(\"系统错误\", e);\n        return Result.error(\"系统错误\");\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/exception/ServiceException.java",
    "content": "package com.example.springboot.exception;\n\npublic class ServiceException extends RuntimeException{\n\n    private String code;\n\n    public String getCode() {\n        return code;\n    }\n\n    public ServiceException(String message, Throwable cause) {\n        super(message, cause);\n    }\n\n    public ServiceException(String message) {\n        super(message);\n    }\n\n    public ServiceException(String code, String message) {\n        super(message);\n        this.code = code;\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/AdminMapper.java",
    "content": "package com.example.springboot.mapper;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.LoginRequest;\nimport com.example.springboot.controller.request.PasswordRequest;\nimport com.example.springboot.entity.Admin;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n@Mapper\npublic interface AdminMapper {\n\n    List<Admin> list();\n\n    List<Admin> listByCondition(BaseRequest baseRequest);\n\n    void save(Admin obj);\n\n    Admin getById(Integer id);\n\n    void updateById(Admin user);\n\n    void deleteById(Integer id);\n\n    Admin getByUsernameAndPassword(@Param(\"username\") String username, @Param(\"password\") String password);\n\n    int updatePassword(PasswordRequest request);\n\n    Admin getByUsername(String username);\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/BookMapper.java",
    "content": "package com.example.springboot.mapper;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Book;\nimport org.apache.ibatis.annotations.Mapper;\n\nimport java.util.List;\n\n@Mapper\npublic interface BookMapper {\n\n    List<Book> list();\n\n    List<Book> listByCondition(BaseRequest baseRequest);\n\n    void save(Book obj);\n\n    Book getById(Integer id);\n\n    void updateById(Book user);\n\n    void deleteById(Integer id);\n\n    Book getByNo(String bookNo);\n\n    void updateNumByNo(String bookNo);\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/BorrowMapper.java",
    "content": "package com.example.springboot.mapper;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Borrow;\nimport com.example.springboot.entity.Retur;\nimport com.example.springboot.mapper.po.BorrowReturCountPO;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n@Mapper\npublic interface BorrowMapper {\n\n    List<Borrow> list();\n\n    List<Borrow> listByCondition(BaseRequest baseRequest);\n\n    List<Retur> listReturByCondition(BaseRequest baseRequest);\n\n    void save(Borrow obj);\n\n    void saveRetur(Retur obj);\n\n    Borrow getById(Integer id);\n\n    void updateById(Borrow user);\n\n    void deleteById(Integer id);\n\n    void deleteReturById(Integer id);\n\n    void updateStatus(String status, Integer id);\n\n    List<BorrowReturCountPO> getCountByTimeRange(@Param(\"timeRange\") String timeRange, @Param(\"type\") int type);  // 1 borrow  2 return\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/CategoryMapper.java",
    "content": "package com.example.springboot.mapper;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.PasswordRequest;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.entity.Category;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n@Mapper\npublic interface CategoryMapper {\n\n    List<Category> list();\n\n    List<Category> listByCondition(BaseRequest baseRequest);\n\n    void save(Category obj);\n\n    Category getById(Integer id);\n\n    void updateById(Category user);\n\n    void deleteById(Integer id);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/UserMapper.java",
    "content": "package com.example.springboot.mapper;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.User;\nimport org.apache.ibatis.annotations.Mapper;\nimport org.apache.ibatis.annotations.Param;\n\nimport java.util.List;\n\n@Mapper\npublic interface UserMapper {\n\n//    @Select(\"select * from user\")\n    List<User> list();\n\n    List<User> listByCondition(BaseRequest baseRequest);\n\n    void save(User user);\n\n    User getById(Integer id);\n\n    void updateById(User user);\n\n    void deleteById(Integer id);\n\n    User getByUsername(String username);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/mapper/po/BorrowReturCountPO.java",
    "content": "package com.example.springboot.mapper.po;\n\nimport lombok.Data;\n\n@Data\npublic class BorrowReturCountPO {\n    private String date;\n    private Integer count;\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/IAdminService.java",
    "content": "package com.example.springboot.service;\n\nimport com.example.springboot.controller.dto.LoginDTO;\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.LoginRequest;\nimport com.example.springboot.controller.request.PasswordRequest;\nimport com.example.springboot.entity.Admin;\nimport com.github.pagehelper.PageInfo;\n\nimport java.util.List;\n\npublic interface IAdminService {\n\n    List<Admin> list();\n\n    PageInfo<Admin> page(BaseRequest baseRequest);\n\n    void save(Admin obj);\n\n    Admin getById(Integer id);\n\n    void update(Admin obj);\n\n    void deleteById(Integer id);\n\n    LoginDTO login(LoginRequest request);\n\n    void changePass(PasswordRequest request);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/IBookService.java",
    "content": "package com.example.springboot.service;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Book;\nimport com.github.pagehelper.PageInfo;\n\nimport java.util.List;\n\npublic interface IBookService {\n    \n    List<Book> list();\n\n    PageInfo<Book> page(BaseRequest baseRequest);\n\n    void save(Book obj);\n\n    Book getById(Integer id);\n\n    void update(Book obj);\n\n    void deleteById(Integer id);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/IBorrowService.java",
    "content": "package com.example.springboot.service;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Borrow;\nimport com.example.springboot.entity.Retur;\nimport com.github.pagehelper.PageInfo;\n\nimport java.util.List;\nimport java.util.Map;\n\npublic interface IBorrowService {\n    \n    List<Borrow> list();\n\n    PageInfo<Borrow> page(BaseRequest baseRequest);\n\n    void save(Borrow obj);\n\n    PageInfo<Retur> pageRetur(BaseRequest baseRequest);\n\n    void saveRetur(Retur obj);\n\n    Borrow getById(Integer id);\n\n    void update(Borrow obj);\n\n    void deleteById(Integer id);\n\n    void deleteReturById(Integer id);\n\n    Map<String, Object> getCountByTimeRange(String timeRange);\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/ICategoryService.java",
    "content": "package com.example.springboot.service;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Category;\nimport com.github.pagehelper.PageInfo;\n\nimport java.util.List;\n\npublic interface ICategoryService {\n    \n    List<Category> list();\n\n    PageInfo<Category> page(BaseRequest baseRequest);\n\n    void save(Category obj);\n\n    Category getById(Integer id);\n\n    void update(Category obj);\n\n    void deleteById(Integer id);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/IUserService.java",
    "content": "package com.example.springboot.service;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.UserPageRequest;\nimport com.example.springboot.entity.User;\nimport com.github.pagehelper.PageInfo;\n\nimport java.util.List;\n\npublic interface IUserService {\n\n    List<User> list();\n\n    PageInfo<User> page(BaseRequest baseRequest);\n\n    void save(User user);\n\n    User getById(Integer id);\n\n    void update(User user);\n\n    void deleteById(Integer id);\n\n    void handleAccount(User user);\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/impl/AdminService.java",
    "content": "package com.example.springboot.service.impl;\n\nimport cn.hutool.core.util.StrUtil;\nimport cn.hutool.crypto.SecureUtil;\nimport com.example.springboot.controller.dto.LoginDTO;\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.LoginRequest;\nimport com.example.springboot.controller.request.PasswordRequest;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.exception.ServiceException;\nimport com.example.springboot.mapper.AdminMapper;\nimport com.example.springboot.service.IAdminService;\nimport com.example.springboot.utils.TokenUtils;\nimport com.github.pagehelper.PageHelper;\nimport com.github.pagehelper.PageInfo;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.beans.BeanUtils;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.dao.DuplicateKeyException;\nimport org.springframework.stereotype.Service;\n\nimport java.util.Date;\nimport java.util.List;\n\n@Slf4j\n@Service\npublic class AdminService implements IAdminService {\n\n    @Autowired\n    AdminMapper adminMapper;\n\n    private static final String DEFAULT_PASS = \"123\";\n    private static final String PASS_SALT = \"qingge\";\n\n    @Override\n    public List<Admin> list() {\n        return adminMapper.list();\n    }\n\n    @Override\n    public PageInfo<Admin> page(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        List<Admin> users = adminMapper.listByCondition(baseRequest);\n        return new PageInfo<>(users);\n    }\n\n    @Override\n    public void save(Admin obj) {\n        // 默认密码 123\n        if (StrUtil.isBlank(obj.getPassword())) {\n            obj.setPassword(DEFAULT_PASS);\n        }\n        obj.setPassword(securePass(obj.getPassword()));  // 设置md5加密，加盐\n        try {\n            adminMapper.save(obj);\n        } catch (DuplicateKeyException e) {\n            log.error(\"数据插入失败， username:{}\", obj.getUsername(), e);\n            throw new ServiceException(\"用户名重复\");\n        }\n    }\n\n\n    @Override\n    public Admin getById(Integer id) {\n        return adminMapper.getById(id);\n    }\n\n    @Override\n    public void update(Admin user) {\n        user.setUpdatetime(new Date());\n        adminMapper.updateById(user);\n    }\n\n    @Override\n    public void deleteById(Integer id) {\n        adminMapper.deleteById(id);\n    }\n\n    @Override\n    public LoginDTO login(LoginRequest request) {\n        Admin admin = null;\n        try {\n            admin = adminMapper.getByUsername(request.getUsername());\n        } catch (Exception e) {\n            log.error(\"根据用户名{} 查询出错\", request.getUsername());\n            throw new ServiceException(\"用户名错误\");\n        }\n        if (admin == null) {\n            throw new ServiceException(\"用户名或密码错误\");\n        }\n        // 判断密码是否合法\n        String securePass = securePass(request.getPassword());\n        if (!securePass.equals(admin.getPassword())) {\n            throw new ServiceException(\"用户名或密码错误\");\n        }\n        if (!admin.isStatus()) {\n            throw new ServiceException(\"当前用户处于禁用状态，请联系管理员\");\n        }\n        LoginDTO loginDTO = new LoginDTO();\n        BeanUtils.copyProperties(admin, loginDTO);\n\n        // 生成token\n        String token = TokenUtils.genToken(String.valueOf(admin.getId()), admin.getPassword());\n        loginDTO.setToken(token);\n        return loginDTO;\n    }\n\n    @Override\n    public void changePass(PasswordRequest request) {\n        // 注意 你要对新的密码进行加密\n        request.setNewPass(securePass(request.getNewPass()));\n        int count = adminMapper.updatePassword(request);\n        if (count <= 0) {\n            throw new ServiceException(\"修改密码失败\");\n        }\n    }\n\n    private String securePass(String password) {\n        return SecureUtil.md5(password + PASS_SALT);\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/impl/BookService.java",
    "content": "package com.example.springboot.service.impl;\n\nimport cn.hutool.core.collection.CollUtil;\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Book;\nimport com.example.springboot.exception.ServiceException;\nimport com.example.springboot.mapper.BookMapper;\nimport com.example.springboot.service.IBookService;\nimport com.github.pagehelper.PageHelper;\nimport com.github.pagehelper.PageInfo;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.stereotype.Service;\n\nimport javax.annotation.Resource;\nimport java.time.LocalDate;\nimport java.util.List;\n\n@Service\n@Slf4j\npublic class BookService implements IBookService {\n\n    @Resource\n    BookMapper bookMapper;\n\n\n    @Override\n    public List<Book> list() {\n        return bookMapper.list();\n    }\n\n    @Override\n    public PageInfo<Book> page(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        return new PageInfo<>(bookMapper.listByCondition(baseRequest));\n    }\n\n    @Override\n    public void save(Book obj) {\n        try {\n            obj.setCategory(category(obj.getCategories()));\n            bookMapper.save(obj);\n        } catch (Exception e) {\n            throw new ServiceException(\"数据插入错误\", e);\n        }\n    }\n\n    @Override\n    public Book getById(Integer id) {\n        return bookMapper.getById(id);\n    }\n\n    @Override\n    public void update(Book obj) {\n        try {\n            obj.setCategory(category(obj.getCategories()));\n            obj.setUpdatetime(LocalDate.now());\n            bookMapper.updateById(obj);\n        } catch (Exception e) {\n            throw new ServiceException(\"数据更新错误\", e);\n        }\n\n    }\n\n    @Override\n    public void deleteById(Integer id) {\n        bookMapper.deleteById(id);\n    }\n\n    private String category(List<String> categories) {\n        StringBuilder sb = new StringBuilder();\n        if (CollUtil.isNotEmpty(categories)) {\n            categories.forEach(v -> sb.append(v).append(\" > \"));\n            return sb.substring(0, sb.lastIndexOf(\" > \"));\n        }\n        return sb.toString();\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/impl/BorrowService.java",
    "content": "package com.example.springboot.service.impl;\n\nimport cn.hutool.core.collection.CollUtil;\nimport cn.hutool.core.date.DateField;\nimport cn.hutool.core.date.DateTime;\nimport cn.hutool.core.date.DateUtil;\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Book;\nimport com.example.springboot.entity.Borrow;\nimport com.example.springboot.entity.Retur;\nimport com.example.springboot.entity.User;\nimport com.example.springboot.exception.ServiceException;\nimport com.example.springboot.mapper.BookMapper;\nimport com.example.springboot.mapper.BorrowMapper;\nimport com.example.springboot.mapper.UserMapper;\nimport com.example.springboot.mapper.po.BorrowReturCountPO;\nimport com.example.springboot.service.IBorrowService;\nimport com.github.pagehelper.PageHelper;\nimport com.github.pagehelper.PageInfo;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\nimport org.springframework.transaction.annotation.Transactional;\n\nimport javax.annotation.Resource;\nimport java.time.LocalDate;\nimport java.time.temporal.ChronoUnit;\nimport java.util.*;\n\n@Service\n@Slf4j\npublic class BorrowService implements IBorrowService {\n\n    @Resource\n    BorrowMapper borrowMapper;\n\n    @Autowired\n    UserMapper userMapper;\n\n    @Autowired\n    BookMapper bookMapper;\n\n    @Override\n    public List<Borrow> list() {\n        return borrowMapper.list();\n    }\n\n    @Override\n    public PageInfo<Borrow> page(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        List<Borrow> borrows = borrowMapper.listByCondition(baseRequest);\n        for (Borrow borrow : borrows) {\n            LocalDate returnDate = borrow.getReturnDate();\n            LocalDate now = LocalDate.now();\n            if (now.plusDays(1).isEqual(returnDate)) {  // 当前日期比归还的日期小一天\n                borrow.setNote(\"即将到期\");\n            } else if (now.isEqual(returnDate)) {\n                borrow.setNote(\"已到期\");\n            } else if (now.isAfter(returnDate)) {\n                borrow.setNote(\"已过期\");\n            } else {\n                borrow.setNote(\"正常\");\n            }\n        }\n        return new PageInfo<>(borrows);\n    }\n\n    @Override\n    @Transactional\n    public void save(Borrow obj) {\n        // 1. 校验用户的积分是否足够\n        String userNo = obj.getUserNo();\n        User user = userMapper.getByUsername(userNo);\n        if (Objects.isNull(user)) {\n            throw new ServiceException(\"用户不存在\");\n        }\n        // 2. 校验图书的数量是否足够\n        Book book = bookMapper.getByNo(obj.getBookNo());\n        if (Objects.isNull(book)) {\n            throw new ServiceException(\"所借图书不存在\");\n        }\n        // 3. 校验图书数量\n        if (book.getNums() < 1) {\n            throw new ServiceException(\"图书数量不足\");\n        }\n        Integer account = user.getAccount();\n        Integer score = book.getScore() * obj.getDays();  // score = 借1本的积分 * 天数\n        // 4. 校验用户账户余额\n        if (score > account) {\n            throw new ServiceException(\"用户积分不足\");\n        }\n        // 5. 更新用户余额\n        user.setAccount(user.getAccount() - score);\n        userMapper.updateById(user);\n        // 6. 更新图书的数量\n        book.setNums(book.getNums() - 1);\n        bookMapper.updateById(book);\n\n        obj.setReturnDate(LocalDate.now().plus(obj.getDays(), ChronoUnit.DAYS));  // 当前的日期加 days 得到归还的日期\n        obj.setScore(score);\n        // 7. 新增借书记录\n        borrowMapper.save(obj);\n    }\n\n    @Override\n    public PageInfo<Retur> pageRetur(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        return new PageInfo<>(borrowMapper.listReturByCondition(baseRequest));\n    }\n\n    // 还书逻辑\n    @Transactional\n    @Override\n    public void saveRetur(Retur obj) {\n        // 改状态\n        obj.setStatus(\"已归还\");\n        borrowMapper.updateStatus(\"已归还\", obj.getId());  // obj.getId() 是前端传来的借书id\n//        obj.setId(null);  // 新数据\n        obj.setRealDate(LocalDate.now());\n        borrowMapper.saveRetur(obj);\n\n        // 图书数量增加\n        bookMapper.updateNumByNo(obj.getBookNo());\n\n        // 返还和扣除用户积分\n        Book book = bookMapper.getByNo(obj.getBookNo());\n        if (book != null) {\n            long until = 0;\n            if (obj.getRealDate().isBefore(obj.getReturnDate())) {\n                until = obj.getRealDate().until(obj.getReturnDate(), ChronoUnit.DAYS);\n            } else if (obj.getRealDate().isAfter(obj.getReturnDate())) {  // 逾期归还，要扣额外的积分\n                until = -obj.getReturnDate().until(obj.getRealDate(), ChronoUnit.DAYS);\n            }\n            int score = (int) until * book.getScore();  // 获取待归还的积分\n            User user = userMapper.getByUsername(obj.getUserNo());\n            int account = user.getAccount() + score;\n            user.setAccount(account);\n            if (account < 0) {\n                // 锁定账号\n                user.setStatus(false);\n            }\n            userMapper.updateById(user);\n        }\n    }\n\n    @Override\n    public Borrow getById(Integer id) {\n        return borrowMapper.getById(id);\n    }\n\n    @Override\n    public void update(Borrow obj) {\n        obj.setUpdatetime(LocalDate.now());\n        borrowMapper.updateById(obj);\n    }\n\n    @Override\n    public void deleteById(Integer id) {\n        borrowMapper.deleteById(id);\n    }\n\n    @Override\n    public void deleteReturById(Integer id) {\n        borrowMapper.deleteReturById(id);\n    }\n\n    @Override\n    public Map<String, Object> getCountByTimeRange(String timeRange) {\n        Map<String, Object> map = new HashMap<>();\n        Date today = new Date();\n        List<DateTime> dateRange;\n        switch (timeRange) {\n            case \"week\":\n                dateRange = DateUtil.rangeToList(DateUtil.offsetDay(today, -6), today, DateField.DAY_OF_WEEK);\n                break;\n            case \"month\":\n                dateRange = DateUtil.rangeToList(DateUtil.offsetDay(today, -29), today, DateField.DAY_OF_MONTH);\n                break;\n            case \"month2\":\n                dateRange = DateUtil.rangeToList(DateUtil.offsetDay(today, -59), today, DateField.DAY_OF_MONTH);\n                break;\n            case \"month3\":\n                dateRange = DateUtil.rangeToList(DateUtil.offsetDay(today, -89), today, DateField.DAY_OF_MONTH);\n                break;\n            default:\n                dateRange = new ArrayList<>();\n        }\n        List<String> dateStrRange = datetimeToDateStr(dateRange);\n        map.put(\"date\", dateStrRange);\n        List<BorrowReturCountPO> borrowCount = borrowMapper.getCountByTimeRange(timeRange, 1);\n        List<BorrowReturCountPO> returnCount = borrowMapper.getCountByTimeRange(timeRange, 2);\n        map.put(\"borrow\", countList(borrowCount, dateStrRange));\n        map.put(\"retur\", countList(returnCount, dateStrRange));\n        return map;\n    }\n\n    private List<String> datetimeToDateStr(List<DateTime> dateTimeList) {\n        List<String> list = CollUtil.newArrayList();\n        if (CollUtil.isEmpty(dateTimeList)) {\n            return list;\n        }\n        for (DateTime dateTime : dateTimeList) {\n            String date = DateUtil.formatDate(dateTime);\n            list.add(date);\n        }\n        return list;\n    }\n\n    private List<Integer> countList(List<BorrowReturCountPO> countPOList, List<String> dateRange) {\n        List<Integer> list = CollUtil.newArrayList();\n        if (CollUtil.isEmpty(countPOList)) {\n            return list;\n        }\n        for (String date : dateRange) {\n            Integer count = countPOList.stream().filter(countPO -> date.equals(countPO.getDate()))\n                    .map(BorrowReturCountPO::getCount).findFirst().orElse(0);\n            list.add(count);\n        }\n        return list;\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/impl/CategoryService.java",
    "content": "package com.example.springboot.service.impl;\n\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.entity.Category;\nimport com.example.springboot.mapper.CategoryMapper;\nimport com.example.springboot.service.ICategoryService;\nimport com.github.pagehelper.PageHelper;\nimport com.github.pagehelper.PageInfo;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.stereotype.Service;\n\nimport javax.annotation.Resource;\nimport java.time.LocalDate;\nimport java.util.List;\n\n@Service\n@Slf4j\npublic class CategoryService implements ICategoryService {\n\n    @Resource\n    CategoryMapper categoryMapper;\n\n\n    @Override\n    public List<Category> list() {\n        return categoryMapper.list();\n    }\n\n    @Override\n    public PageInfo<Category> page(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        // 自关联查询\n        List<Category> categories = categoryMapper.listByCondition(baseRequest);\n        return new PageInfo<>(categories);\n    }\n\n    @Override\n    public void save(Category obj) {\n        categoryMapper.save(obj);\n    }\n\n    @Override\n    public Category getById(Integer id) {\n        return categoryMapper.getById(id);\n    }\n\n    @Override\n    public void update(Category obj) {\n        obj.setUpdatetime(LocalDate.now());\n        categoryMapper.updateById(obj);\n    }\n\n    @Override\n    public void deleteById(Integer id) {\n        categoryMapper.deleteById(id);\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/service/impl/UserService.java",
    "content": "package com.example.springboot.service.impl;\n\nimport cn.hutool.core.date.DateUtil;\nimport cn.hutool.core.util.IdUtil;\nimport com.example.springboot.controller.request.BaseRequest;\nimport com.example.springboot.controller.request.UserPageRequest;\nimport com.example.springboot.entity.User;\nimport com.example.springboot.mapper.UserMapper;\nimport com.example.springboot.service.IUserService;\nimport com.github.pagehelper.PageHelper;\nimport com.github.pagehelper.PageInfo;\nimport org.springframework.beans.factory.annotation.Autowired;\nimport org.springframework.stereotype.Service;\n\nimport java.util.Date;\nimport java.util.List;\n\n@Service\npublic class UserService implements IUserService {\n\n    @Autowired\n    UserMapper userMapper;\n\n    @Override\n    public List<User> list() {\n        return userMapper.list();\n    }\n\n    @Override\n    public PageInfo<User> page(BaseRequest baseRequest) {\n        PageHelper.startPage(baseRequest.getPageNum(), baseRequest.getPageSize());\n        List<User> users = userMapper.listByCondition(baseRequest);\n        return new PageInfo<>(users);\n    }\n\n    @Override\n    public void save(User user) {\n        Date date = new Date();\n        // 当做卡号来处理\n        user.setUsername(DateUtil.format(date, \"yyyyMMdd\") + Math.abs(IdUtil.fastSimpleUUID().hashCode()));\n        userMapper.save(user);\n    }\n\n    @Override\n    public User getById(Integer id) {\n        return userMapper.getById(id);\n    }\n\n    @Override\n    public void update(User user) {\n        user.setUpdatetime(new Date());\n        userMapper.updateById(user);\n    }\n\n    @Override\n    public void deleteById(Integer id) {\n        userMapper.deleteById(id);\n    }\n\n    @Override\n    public void handleAccount(User user) {\n        Integer score = user.getScore();\n        if (score == null) {\n            return;\n        }\n        Integer id = user.getId();\n        User dbUser = userMapper.getById(id);\n        dbUser.setAccount(dbUser.getAccount() + score);\n        userMapper.updateById(dbUser);\n    }\n\n}\n"
  },
  {
    "path": "springboot/src/main/java/com/example/springboot/utils/TokenUtils.java",
    "content": "package com.example.springboot.utils;\n\nimport cn.hutool.core.date.DateUtil;\nimport cn.hutool.core.util.StrUtil;\nimport com.auth0.jwt.JWT;\nimport com.auth0.jwt.algorithms.Algorithm;\nimport com.example.springboot.entity.Admin;\nimport com.example.springboot.service.IAdminService;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.stereotype.Component;\nimport org.springframework.web.context.request.RequestContextHolder;\nimport org.springframework.web.context.request.ServletRequestAttributes;\n\nimport javax.annotation.PostConstruct;\nimport javax.annotation.Resource;\nimport javax.servlet.http.HttpServletRequest;\nimport java.util.Date;\n\n@Component\n@Slf4j\npublic class TokenUtils {\n\n    private static IAdminService staticAdminService;\n\n    @Resource\n    private IAdminService adminService;\n\n    @PostConstruct\n    public void setUserService() {\n        staticAdminService = adminService;\n    }\n\n    /**\n     * 生成token\n     *\n     * @return\n     */\n    public static String genToken(String adminId, String sign) {\n        return JWT.create().withAudience(adminId) // 将 user id 保存到 token 里面,作为载荷\n                .withExpiresAt(DateUtil.offsetHour(new Date(), 2)) // 2小时后token过期\n                .sign(Algorithm.HMAC256(sign)); // 以 password 作为 token 的密钥\n    }\n\n    public static String genToken(String adminId, String sign, int days) {\n        return JWT.create().withAudience(adminId) // 将 user id 保存到 token 里面,作为载荷\n                .withExpiresAt(DateUtil.offsetDay(new Date(), days)) // 2小时后token过期\n                .sign(Algorithm.HMAC256(sign)); // 以 password 作为 token 的密钥\n    }\n\n    /**\n     * 获取当前登录的用户信息\n     *\n     * @return user对象\n     *  /admin?token=xxxx\n     */\n    public static Admin getCurrentAdmin() {\n        String token = null;\n        try {\n            HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();\n            token = request.getHeader(\"token\");\n            if (StrUtil.isBlank(token)) {  // header没有  那就从参数获取\n                token = request.getParameter(\"token\");\n            }\n            if (StrUtil.isBlank(token)) {\n                log.error(\"获取当前登录的token失败， token: {}\", token);\n                return null;\n            }\n            String adminId = JWT.decode(token).getAudience().get(0);\n            return staticAdminService.getById(Integer.valueOf(adminId));\n        } catch (Exception e) {\n            log.error(\"获取当前登录的管理员信息失败, token={}\", token,  e);\n            return null;\n        }\n    }\n}\n\n"
  },
  {
    "path": "springboot/src/main/resources/application.yml",
    "content": "server:\n  port: 9090\n\nspring:\n  datasource:\n    driver-class-name: com.mysql.cj.jdbc.Driver\n    url: jdbc:mysql://localhost:3306/library-management?serverTimezone=GMT%2b8\n    username: root\n    password: 123456\n\nmybatis:\n  mapper-locations: classpath:mapper/*.xml\n  configuration:\n    log-impl: org.apache.ibatis.logging.stdout.StdOutImpl\n    map-underscore-to-camel-case: true  # 开启数据库字段下划线转驼峰"
  },
  {
    "path": "springboot/src/main/resources/mapper/Admin.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"com.example.springboot.mapper.AdminMapper\">\n\n    <insert id=\"save\">\n        insert into admin(username, password, phone, email)\n        values(#{username}, #{password}, #{phone}, #{email})\n    </insert>\n\n    <update id=\"updateById\">\n        update admin set username = #{username}, phone = #{phone}, email = #{email}, updatetime = #{updatetime}, status = #{status} where id = #{id}\n    </update>\n\n    <update id=\"updatePassword\">\n        update admin set password = #{newPass} where username = #{username} and password = #{password}\n    </update>\n\n    <delete id=\"deleteById\">\n        delete from admin where id = #{id}\n    </delete>\n\n    <select id=\"list\" resultType=\"com.example.springboot.entity.Admin\">\n        select * from admin order by id desc\n    </select>\n\n    <select id=\"listByCondition\" resultType=\"com.example.springboot.entity.Admin\">\n        select * from admin\n            <where>\n                <if test=\"username != null and username != ''\">\n                    username like concat('%', #{username}, '%')\n                </if>\n                <if test=\"phone != null and phone != ''\">\n                    and phone  like concat('%', #{ phone }, '%')\n                </if>\n                <if test=\"email != null and email != ''\">\n                    and email  like concat('%', #{email}, '%')\n                </if>\n            </where>\n        order by id desc\n    </select>\n\n    <select id=\"getById\" resultType=\"com.example.springboot.entity.Admin\">\n        select * from admin where id = #{id}\n    </select>\n\n    <select id=\"getByUsernameAndPassword\" resultType=\"com.example.springboot.entity.Admin\">\n        select * from admin where username = #{username} and password = #{password}\n    </select>\n\n    <select id=\"getByUsername\" resultType=\"com.example.springboot.entity.Admin\">\n        select * from admin where username = #{username}\n    </select>\n\n</mapper>"
  },
  {
    "path": "springboot/src/main/resources/mapper/Book.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"com.example.springboot.mapper.BookMapper\">\n\n    <select id=\"listByCondition\" resultType=\"com.example.springboot.entity.Book\">\n        select * from book\n        <where>\n            <if test=\"name != null and name != ''\">\n                name like concat('%', #{ name }, '%')\n            </if>\n            <if test=\"bookNo != null and bookNo != ''\">\n                and book_no = #{bookNo}\n            </if>\n        </where>\n        order by id desc\n    </select>\n\n    <insert id=\"save\">\n        insert into book(name, description, publish_date, author, publisher, category, book_no, cover, score, nums)\n        values(#{name}, #{description}, #{publishDate}, #{author}, #{publisher}, #{category}, #{bookNo}, #{cover}, #{score}, #{nums})\n    </insert>\n\n    <update id=\"updateById\">\n        update book set name = #{name}, description = #{description}, publish_date = #{publishDate}, author = #{author},\n                        publisher = #{publisher}, category = #{category}, book_no = #{bookNo}, cover = #{cover}, score = #{score},\n                        nums = #{nums}, updatetime = #{updatetime} where id = #{id}\n    </update>\n\n    <update id=\"updateNumByNo\">\n        update book set nums = nums + 1 where book_no = #{bookNo}\n    </update>\n\n    <delete id=\"deleteById\">\n        delete from book where id = #{id}\n    </delete>\n\n    <select id=\"list\" resultType=\"com.example.springboot.entity.Book\">\n        select * from book order by id desc\n    </select>\n\n    <select id=\"getById\" resultType=\"com.example.springboot.entity.Book\">\n        select * from book where id = #{id}\n    </select>\n    <select id=\"getByNo\" resultType=\"com.example.springboot.entity.Book\">\n        select * from book where book_no = #{bookNo}\n    </select>\n</mapper>"
  },
  {
    "path": "springboot/src/main/resources/mapper/Borrow.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"com.example.springboot.mapper.BorrowMapper\">\n\n    <select id=\"listByCondition\" resultType=\"com.example.springboot.entity.Borrow\">\n        select * from borrow\n        <where>\n            <if test=\"bookName != null and bookName != ''\">\n                book_name like concat('%', #{bookName}, '%')\n            </if>\n            <if test=\"bookNo != null and bookNo != ''\">\n                and book_no = #{bookNo}\n            </if>\n            <if test=\" userName  != null and  userName  != ''\">\n                and user_name like concat('%', #{ userName }, '%')\n            </if>\n        </where>\n        order by id desc\n    </select>\n\n    <select id=\"listReturByCondition\" resultType=\"com.example.springboot.entity.Retur\">\n        select * from retur\n        <where>\n            <if test=\"bookName != null and bookName != ''\">\n                book_name like concat('%', #{bookName}, '%')\n            </if>\n            <if test=\"bookNo != null and bookNo != ''\">\n                and book_no = #{bookNo}\n            </if>\n            <if test=\" userName  != null and  userName  != ''\">\n                and user_name like concat('%', #{ userName }, '%')\n            </if>\n        </where>\n        order by id desc\n    </select>\n\n    <insert id=\"saveRetur\">\n        insert into retur(book_name, book_no, user_no, user_name, user_phone, score, days, return_date, real_date, status)\n        values(#{bookName}, #{bookNo}, #{userNo}, #{userName}, #{userPhone}, #{score}, #{days}, #{returnDate}, #{realDate}, #{status})\n    </insert>\n\n    <insert id=\"save\">\n        insert into borrow(book_name, book_no, user_no, user_name, user_phone, score, days, return_date)\n        values(#{bookName}, #{bookNo}, #{userNo}, #{userName}, #{userPhone}, #{score}, #{days}, #{returnDate})\n    </insert>\n\n    <update id=\"updateById\">\n        update borrow set book_name = #{bookName}, book_no = #{bookNo}, user_no = #{userNo}, user_name = #{userName},\n                          user_phone = #{userPhone}, score = #{score}, status=#{status}, days=#{days}, return_date = #{returnDate},\n                        updatetime = #{updatetime} where id = #{id}\n    </update>\n\n    <update id=\"updateStatus\">\n        update borrow set status = #{status} where id = #{id}\n    </update>\n\n    <delete id=\"deleteById\">\n        delete from borrow where id = #{id}\n    </delete>\n\n    <delete id=\"deleteReturById\">\n        delete from retur where id = #{id}\n    </delete>\n\n    <select id=\"list\" resultType=\"com.example.springboot.entity.Borrow\">\n        select * from borrow order by id desc\n    </select>\n\n    <select id=\"getById\" resultType=\"com.example.springboot.entity.Borrow\">\n        select * from borrow where id = #{id}\n    </select>\n\n    <select id=\"getCountByTimeRange\" resultType=\"com.example.springboot.mapper.po.BorrowReturCountPO\">\n        select count(id) as count, DATE_FORMAT(createtime,'%Y-%m-%d') as date from\n        <if test=\"type == 1\">\n            borrow\n        </if>\n        <if test=\"type == 2\">\n            retur\n        </if>\n        where\n        <choose>\n            <when test=\"timeRange == 'week'\">\n                createtime >=  DATE_SUB(NOW(),INTERVAL 1 WEEK)\n            </when>\n            <when test=\"timeRange == 'month'\">\n                createtime >=  DATE_SUB(NOW(),INTERVAL 1 MONTH)\n            </when>\n            <when test=\"timeRange == 'month2'\">\n                createtime >=  DATE_SUB(NOW(),INTERVAL 2 MONTH)\n            </when>\n            <when test=\"timeRange == 'month3'\">\n                createtime >=  DATE_SUB(NOW(),INTERVAL 3 MONTH)\n            </when>\n            <otherwise>\n                createtime > now()\n            </otherwise>\n        </choose>\n        group by date\n    </select>\n</mapper>"
  },
  {
    "path": "springboot/src/main/resources/mapper/Category.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"com.example.springboot.mapper.CategoryMapper\">\n\n    <resultMap id=\"categoryMap\" type=\"com.example.springboot.entity.Category\">\n        <id column=\"id\" property=\"id\" />\n        <result column=\"name\" property=\"name\" />\n        <result column=\"remark\" property=\"remark\" />\n        <result column=\"pid\" property=\"pid\" />\n        <result column=\"createtime\" property=\"createtime\" />\n        <result column=\"updatetime\" property=\"updatetime\" />\n        <collection property=\"children\" ofType=\"com.example.springboot.entity.Category\" column=\"{id=id, name1=queryName}\" select=\"selectByPid\" />\n    </resultMap>\n\n<!--    { name1=queryName }  前面的name1是子集待使用的参数名称， queryName是父级传给子集的属性，queryName必须是父级的一个查询属性，\n    也就是把 queryName赋值给了name1，然后使用 -->\n\n    <select id=\"selectByPid\" resultType=\"com.example.springboot.entity.Category\">\n        select * from category where pid = #{id}\n        <if test=\"name1 != null and name1 != ''\">\n            and name like concat('%', #{name1}, '%')\n        </if>\n        order by id desc\n    </select>\n\n    <select id=\"listByCondition\" resultMap=\"categoryMap\">\n        select c1.*,'${name}' as queryName from category c1\n        left join category c2\n        on c1.id = c2.pid\n        <where>\n            isnull(c1.pid)\n            <if test=\"name != null and name != ''\">\n               and (c1.name like concat('%', #{name}, '%') or c2.name like concat('%', #{name}, '%'))\n            </if>\n        </where>\n        group by c1.id\n        order by c1.id desc\n    </select>\n\n    <insert id=\"save\">\n        insert into category(name, remark, pid) values(#{name}, #{remark}, #{pid})\n    </insert>\n\n    <update id=\"updateById\">\n        update category set name = #{name}, remark = #{remark}, updatetime = #{updatetime} where id = #{id}\n    </update>\n\n    <delete id=\"deleteById\">\n        delete from category where id = #{id}\n    </delete>\n\n    <select id=\"list\" resultType=\"com.example.springboot.entity.Category\">\n        select * from category order by id desc\n    </select>\n\n    <select id=\"getById\" resultType=\"com.example.springboot.entity.Category\">\n        select * from category where id = #{id}\n    </select>\n</mapper>"
  },
  {
    "path": "springboot/src/main/resources/mapper/User.xml",
    "content": "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n        PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n        \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"com.example.springboot.mapper.UserMapper\">\n\n    <insert id=\"save\">\n        insert into user(name, username, age, sex, phone, address, account)\n        values(#{name}, #{username}, #{age}, #{sex}, #{phone}, #{address}, #{account})\n    </insert>\n\n    <update id=\"updateById\">\n        update user set name = #{name}, age = #{age}, sex = #{sex}, phone = #{phone}, address = #{address}, account = #{account}, status = #{status},\n        updatetime = #{updatetime} where id = #{id}\n    </update>\n\n    <delete id=\"deleteById\">\n        delete from user where id = #{id}\n    </delete>\n\n    <select id=\"list\" resultType=\"com.example.springboot.entity.User\">\n        select * from user\n    </select>\n\n    <select id=\"listByCondition\" resultType=\"com.example.springboot.entity.User\">\n        select * from user\n            <where>\n                <if test=\"name != null and name != ''\">\n                    name like concat('%', #{ name }, '%')\n                </if>\n                <if test=\"phone != null and phone != ''\">\n                    and phone  like concat('%', #{ phone }, '%')\n                </if>\n            </where>\n        order by id desc\n    </select>\n\n    <select id=\"getById\" resultType=\"com.example.springboot.entity.User\">\n        select * from user where id = #{id}\n    </select>\n\n    <select id=\"getByUsername\" resultType=\"com.example.springboot.entity.User\">\n        select * from user where username = #{username}\n    </select>\n\n</mapper>"
  },
  {
    "path": "springboot/src/test/java/com/example/springboot/SpringbootApplicationTests.java",
    "content": "package com.example.springboot;\n\nimport org.junit.jupiter.api.Test;\nimport org.springframework.boot.test.context.SpringBootTest;\n\n@SpringBootTest\nclass SpringbootApplicationTests {\n\n    @Test\n    void contextLoads() {\n    }\n\n}\n"
  },
  {
    "path": "sql/library-management.sql",
    "content": "/*\n Navicat Premium Data Transfer\n\n Source Server         : localhost_3306\n Source Server Type    : MySQL\n Source Server Version : 50737\n Source Host           : localhost:3306\n Source Schema         : library-management\n\n Target Server Type    : MySQL\n Target Server Version : 50737\n File Encoding         : 65001\n\n Date: 03/11/2022 19:01:59\n*/\n\nSET NAMES utf8mb4;\nSET FOREIGN_KEY_CHECKS = 0;\n\n-- ----------------------------\n-- Table structure for admin\n-- ----------------------------\nDROP TABLE IF EXISTS `admin`;\nCREATE TABLE `admin`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户名',\n  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系方式',\n  `email` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '邮箱',\n  `createtime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),\n  `updatetime` datetime(0) NULL DEFAULT NULL,\n  `password` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '密码',\n  `status` tinyint(1) NULL DEFAULT 1 COMMENT '状态',\n  PRIMARY KEY (`id`) USING BTREE,\n  UNIQUE INDEX `username_key`(`username`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of admin\n-- ----------------------------\nINSERT INTO `admin` VALUES (1, 'admin', '13988997788', NULL, '2022-10-08 22:21:26', '2022-10-11 20:37:20', 'ead08e95e9c867a2ee833c232bf55dbc', 1);\nINSERT INTO `admin` VALUES (2, 'admin1', '13877889900', 'admin1@qq.com', '2022-10-10 21:28:42', '2022-10-11 20:39:41', 'a7dbef0f88b54fad3f91d010a30eff55', 1);\n\n-- ----------------------------\n-- Table structure for book\n-- ----------------------------\nDROP TABLE IF EXISTS `book`;\nCREATE TABLE `book`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称',\n  `description` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '描述',\n  `publish_date` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '出版日期',\n  `author` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '作者',\n  `publisher` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '出版社',\n  `category` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '分类',\n  `book_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '标准码',\n  `cover` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '封面',\n  `createtime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',\n  `updatetime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',\n  `score` int(10) NULL DEFAULT NULL COMMENT '积分',\n  `nums` int(10) NULL DEFAULT 0 COMMENT '数量',\n  PRIMARY KEY (`id`) USING BTREE,\n  UNIQUE INDEX `book_no_index`(`book_no`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 11 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of book\n-- ----------------------------\nINSERT INTO `book` VALUES (1, '西游记幼儿美绘本（全10册）', '中国四大名著之一，西游记3-8岁版，彩绘注音，有声伴读。49款夸张角色，610张精美插图， 29个西游问答，10大智力挑战，以一种超有趣的方式亲近名著经典。', '2022-10-17', '吕进1', '少年儿童出版社', '历史文化 > 唐朝文化', 'ISBN：9787558911156', 'http://img3m7.ddimg.cn/10/30/25276987-1_w_44.jpg', '2022-10-17 21:35:14', '2022-10-19 00:00:00', 10, 1);\nINSERT INTO `book` VALUES (6, 'Java学习指南', '2222', '2022-10-06', '222', '2', '历史文化 > 唐朝文化', 'JAVA_212113123', 'http://img3m7.ddimg.cn/10/30/25276987-1_w_44.jpg', '2022-10-17 22:30:01', '2022-10-25 00:00:00', 20, 100);\nINSERT INTO `book` VALUES (7, '百科全书', '3333', '2022-10-12', '33', '333', '科技 > 高新科技 > 微分子科技', 'BKQS-233131', 'http://img3m7.ddimg.cn/10/30/25276987-1_w_44.jpg', '2022-10-17 22:30:59', '2022-10-25 00:00:00', 10, 98);\nINSERT INTO `book` VALUES (8, '童话故事大全', '345', '2022-10-05', '55', '5', '科技 > 生物科技', 'THGS-10011122', 'http://localhost:9090/api/book/file/download/1666707290390?&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIiwiZXhwIjoxNjY4MDAzMjkwfQ.FtPUrLjNRTbfzauHObyGwy0LWyrqD4VSLylW9Ef7FW8&play=1', '2022-10-17 22:32:16', '2022-10-25 00:00:00', 30, 92);\nINSERT INTO `book` VALUES (10, '钢铁是怎样炼成的', NULL, NULL, NULL, NULL, '历史文化 > 现代文化', 'GT-121313213', 'http://localhost:9090/api/book/file/download/1666706911257?&token=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIxIiwiZXhwIjoxNjY4MDAyOTExfQ.DLB80S9v-eWBECESJiigVZooV7ks58D43KUQ2ByJQrI&play=1', '2022-10-25 22:09:08', NULL, 20, 100);\n\n-- ----------------------------\n-- Table structure for borrow\n-- ----------------------------\nDROP TABLE IF EXISTS `borrow`;\nCREATE TABLE `borrow`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `book_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图书名称',\n  `book_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图书标准码',\n  `user_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户会员码',\n  `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户名称',\n  `user_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户联系方式',\n  `createtime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',\n  `updatetime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',\n  `score` int(10) NULL DEFAULT NULL COMMENT '借书积分',\n  `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '已借出' COMMENT '借书状态',\n  `days` int(11) NULL DEFAULT 1 COMMENT '借书天数',\n  `return_date` datetime(0) NULL DEFAULT NULL COMMENT '归还日期',\n  PRIMARY KEY (`id`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 19 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of borrow\n-- ----------------------------\nINSERT INTO `borrow` VALUES (2, '222', '333', '20220927-2094581083', '李芸', '138999009988', '2022-10-19 22:06:32', NULL, 10, '已借出', 2, '2022-10-21 00:00:00');\nINSERT INTO `borrow` VALUES (3, '222', '22222', '20220927-2094581083', '李芸', '138999009988', '2022-10-19 22:15:28', NULL, 25, '已借出', 3, '2022-10-22 00:00:00');\nINSERT INTO `borrow` VALUES (4, '222', '22222', '20220927-2094581083', '李芸', '138999009988', '2022-10-19 22:16:00', NULL, 25, '已借出', 4, '2022-10-23 00:00:00');\nINSERT INTO `borrow` VALUES (5, '222', '22222', '20220927-2094581083', '李芸', '138999009988', '2022-10-19 22:16:26', NULL, 30, '已借出', 5, '2022-10-24 00:00:00');\nINSERT INTO `borrow` VALUES (6, '222', '22222', '202209271239528742', '王二文案', '13988990099', '2022-10-19 22:19:18', NULL, 30, '已借出', 6, '2022-10-25 00:00:00');\nINSERT INTO `borrow` VALUES (7, '222', '22222', '202209271239528742', '王二文案', '13988990099', '2022-10-19 22:19:40', NULL, 30, '已借出', 7, '2022-10-26 00:00:00');\nINSERT INTO `borrow` VALUES (8, '222', '22222', '202209271239528742', '王二文案', '13988990099', '2022-10-19 22:19:47', NULL, 30, '已归还', 8, '2022-10-27 00:00:00');\nINSERT INTO `borrow` VALUES (9, '222', '22222', '202209271018800687', '测试', NULL, '2022-10-19 22:30:22', NULL, 30, '已归还', 9, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (10, '222', '22222', '202209271018800687', '测试', NULL, '2022-10-19 22:30:47', NULL, 30, '已归还', 10, '2022-10-29 00:00:00');\nINSERT INTO `borrow` VALUES (12, 'Java学习指南', 'JAVA_212113123', '202209271239528742', '苗洋洋', '13988990099', '2022-10-25 19:34:03', NULL, 20, '已归还', 3, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (13, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:18:25', NULL, 20, '已归还', 3, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (14, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:19:58', NULL, 20, '已归还', 3, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (15, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:23:02', NULL, 20, '已归还', 3, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (16, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:24:37', NULL, 20, '已归还', 3, '2022-10-28 00:00:00');\nINSERT INTO `borrow` VALUES (17, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:25:49', NULL, 20, '已归还', 4, '2022-10-29 00:00:00');\nINSERT INTO `borrow` VALUES (18, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:27:37', NULL, 80, '已归还', 4, '2022-10-22 00:00:00');\n\n-- ----------------------------\n-- Table structure for category\n-- ----------------------------\nDROP TABLE IF EXISTS `category`;\nCREATE TABLE `category`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '名称',\n  `remark` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '备注',\n  `pid` int(11) NULL DEFAULT NULL COMMENT '父级id',\n  `createtime` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0),\n  `updatetime` timestamp(0) NULL DEFAULT NULL,\n  PRIMARY KEY (`id`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 14 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of category\n-- ----------------------------\nINSERT INTO `category` VALUES (3, '历史文化', '历史文化', NULL, '2022-10-12 20:42:53', NULL);\nINSERT INTO `category` VALUES (4, '唐朝文化', '唐朝文化', 3, '2022-10-12 20:43:21', NULL);\nINSERT INTO `category` VALUES (5, '宋朝文化', NULL, 3, '2022-10-12 20:46:29', NULL);\nINSERT INTO `category` VALUES (9, '现代文化', '现代文化', 3, '2022-10-12 21:00:41', NULL);\nINSERT INTO `category` VALUES (10, '科技', '科技', NULL, '2022-10-12 21:50:08', NULL);\nINSERT INTO `category` VALUES (11, '高新科技', NULL, 10, '2022-10-12 21:50:16', NULL);\nINSERT INTO `category` VALUES (12, '生物科技', '生物科技', 10, '2022-10-12 21:50:22', NULL);\nINSERT INTO `category` VALUES (13, '微分子科技', NULL, 11, '2022-10-17 22:11:44', NULL);\n\n-- ----------------------------\n-- Table structure for retur\n-- ----------------------------\nDROP TABLE IF EXISTS `retur`;\nCREATE TABLE `retur`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `book_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图书名称',\n  `book_no` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '图书标准码',\n  `user_no` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户会员码',\n  `user_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户名称',\n  `user_phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '用户联系方式',\n  `createtime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间',\n  `updatetime` datetime(0) NULL DEFAULT NULL COMMENT '更新时间',\n  `score` int(10) NULL DEFAULT NULL COMMENT '借书积分',\n  `status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT '已借出' COMMENT '借书状态',\n  `days` int(11) NULL DEFAULT 1 COMMENT '借书天数',\n  `return_date` datetime(0) NULL DEFAULT NULL COMMENT '归还日期',\n  `real_date` datetime(0) NULL DEFAULT NULL COMMENT '实际归还日期',\n  PRIMARY KEY (`id`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 12 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of retur\n-- ----------------------------\nINSERT INTO `retur` VALUES (2, 'Java学习指南', 'JAVA_212113123', '202209271239528742', '苗洋洋', '13988990099', '2022-10-25 20:18:59', NULL, 20, '已借出', 3, '2022-10-28 00:00:00', NULL);\nINSERT INTO `retur` VALUES (3, '222', '22222', '202209271018800687', '测试', NULL, '2022-10-25 20:21:41', NULL, 30, '已借出', 10, '2022-10-29 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (4, '222', '22222', '202209271018800687', '测试', NULL, '2022-10-25 20:21:53', NULL, 30, '已借出', 9, '2022-10-28 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (5, '222', '22222', '202209271239528742', '王二文案', '13988990099', '2022-10-25 20:21:55', NULL, 30, '已借出', 8, '2022-10-27 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (6, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:19:01', NULL, 20, '已借出', 3, '2022-10-28 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (7, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:20:04', NULL, 20, '已借出', 3, '2022-10-28 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (8, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:23:08', NULL, 20, '已借出', 3, '2022-10-28 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (9, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:24:47', NULL, 20, '已归还', 3, '2022-10-28 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (10, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:27:19', NULL, 20, '已归还', 4, '2022-10-29 00:00:00', '2022-10-25 00:00:00');\nINSERT INTO `retur` VALUES (11, 'Java学习指南', 'JAVA_212113123', '20220927688792394', '杰克', '13977889988', '2022-10-25 21:28:35', NULL, 80, '已归还', 4, '2022-10-22 00:00:00', '2022-10-25 00:00:00');\n\n-- ----------------------------\n-- Table structure for user\n-- ----------------------------\nDROP TABLE IF EXISTS `user`;\nCREATE TABLE `user`  (\n  `id` int(11) NOT NULL AUTO_INCREMENT,\n  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '姓名',\n  `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '会员码',\n  `age` int(11) NULL DEFAULT NULL COMMENT '年龄',\n  `sex` varchar(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '性别',\n  `phone` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '联系方式',\n  `address` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NULL DEFAULT NULL COMMENT '地址',\n  `createtime` datetime(0) NULL DEFAULT CURRENT_TIMESTAMP(0),\n  `updatetime` datetime(0) NULL DEFAULT NULL,\n  `account` int(10) NULL DEFAULT 0 COMMENT '账户余额',\n  `status` tinyint(1) NULL DEFAULT 1 COMMENT '禁用状态 1不禁用',\n  PRIMARY KEY (`id`) USING BTREE,\n  UNIQUE INDEX `username_index`(`username`) USING BTREE\n) ENGINE = InnoDB AUTO_INCREMENT = 24 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_unicode_ci ROW_FORMAT = Dynamic;\n\n-- ----------------------------\n-- Records of user\n-- ----------------------------\nINSERT INTO `user` VALUES (19, '苗洋洋', '202209271239528742', 18, '男', '13988990099', '合肥', '2022-09-27 22:10:36', '2022-10-25 19:32:13', 140, 1);\nINSERT INTO `user` VALUES (20, '李芸', '20220927-2094581083', 24, '女', '138999009988', '合肥', '2022-09-27 22:16:03', NULL, 20, 1);\nINSERT INTO `user` VALUES (21, '落布', '202209271018800687', 20, NULL, NULL, NULL, '2022-09-27 22:17:06', '2022-10-25 19:31:20', 140, 1);\nINSERT INTO `user` VALUES (22, '卡森', '202209271213716465', 22, '男', '13988990066', NULL, '2022-09-27 22:34:48', '2022-10-25 19:31:12', 100, 1);\nINSERT INTO `user` VALUES (23, '杰克', '20220927688792394', 33, '男', '13977889988', NULL, '2022-09-27 22:35:35', '2022-10-25 21:07:15', -40, 0);\n\nSET FOREIGN_KEY_CHECKS = 1;\n"
  },
  {
    "path": "vue/README.md",
    "content": "# vue\n\n## Project setup\n```\nnpm install\n```\n\n### Compiles and hot-reloads for development\n```\nnpm run serve\n```\n\n### Compiles and minifies for production\n```\nnpm run build\n```\n\n### Customize configuration\nSee [Configuration Reference](https://cli.vuejs.org/config/).\n"
  },
  {
    "path": "vue/babel.config.js",
    "content": "module.exports = {\n  presets: [\n    '@vue/cli-plugin-babel/preset'\n  ]\n}\n"
  },
  {
    "path": "vue/jsconfig.json",
    "content": "{\n  \"compilerOptions\": {\n    \"target\": \"es5\",\n    \"module\": \"esnext\",\n    \"baseUrl\": \"./\",\n    \"moduleResolution\": \"node\",\n    \"paths\": {\n      \"@/*\": [\n        \"src/*\"\n      ]\n    },\n    \"lib\": [\n      \"esnext\",\n      \"dom\",\n      \"dom.iterable\",\n      \"scripthost\"\n    ]\n  }\n}\n"
  },
  {
    "path": "vue/package.json",
    "content": "{\n  \"name\": \"vue\",\n  \"version\": \"0.1.0\",\n  \"private\": true,\n  \"scripts\": {\n    \"serve\": \"vue-cli-service serve\",\n    \"build\": \"vue-cli-service build\"\n  },\n  \"dependencies\": {\n    \"axios\": \"^0.27.2\",\n    \"core-js\": \"^3.8.3\",\n    \"echarts\": \"^5.4.0\",\n    \"element-ui\": \"^2.15.10\",\n    \"js-cookie\": \"^3.0.1\",\n    \"vue\": \"^2.6.14\",\n    \"vue-monoplasty-slide-verify\": \"^1.3.1\",\n    \"vue-router\": \"^3.5.1\"\n  },\n  \"devDependencies\": {\n    \"@vue/cli-plugin-babel\": \"~5.0.0\",\n    \"@vue/cli-plugin-router\": \"~5.0.0\",\n    \"@vue/cli-service\": \"~5.0.0\",\n    \"vue-template-compiler\": \"^2.6.14\"\n  },\n  \"browserslist\": [\n    \"> 1%\",\n    \"last 2 versions\",\n    \"not dead\"\n  ]\n}\n"
  },
  {
    "path": "vue/public/index.html",
    "content": "<!DOCTYPE html>\n<html lang=\"\">\n  <head>\n    <meta charset=\"utf-8\">\n    <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n    <meta name=\"viewport\" content=\"width=device-width,initial-scale=1.0\">\n    <link rel=\"icon\" href=\"<%= BASE_URL %>favicon.ico\">\n    <title><%= htmlWebpackPlugin.options.title %></title>\n  </head>\n  <body>\n    <noscript>\n      <strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>\n    </noscript>\n    <div id=\"app\"></div>\n    <!-- built files will be auto injected -->\n  </body>\n</html>\n"
  },
  {
    "path": "vue/src/App.vue",
    "content": "<template>\n  <div id=\"app\">\n    <router-view />\n  </div>\n</template>\n\n"
  },
  {
    "path": "vue/src/assets/global.css",
    "content": "body {\n    margin: 0;\n    padding: 0;\n    background-color: #eee;\n}\n* {\n    box-sizing: border-box;\n}\n\nth {\n    background-color: aliceblue !important;\n}"
  },
  {
    "path": "vue/src/main.js",
    "content": "import Vue from 'vue'\nimport App from './App.vue'\nimport router from './router'\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-chalk/index.css';\nimport '@/assets/global.css'\nimport SlideVerify from 'vue-monoplasty-slide-verify';\n\nVue.use(SlideVerify);\nVue.config.productionTip = false\nVue.use(ElementUI, { size: 'small' });  // medium  small mini\n\nnew Vue({\n  router,\n  render: h => h(App)\n}).$mount('#app')\n"
  },
  {
    "path": "vue/src/router/index.js",
    "content": "import Vue from 'vue'\nimport VueRouter from 'vue-router'\nimport Layout from '../views/Layout.vue'\nimport Cookies from \"js-cookie\";\n\nVue.use(VueRouter)\n\nconst routes = [\n  //  ====== 登录  =====\n  {\n    path: '/login',\n    name: 'Login',\n    component: () => import('@/views/login/Login.vue'),\n  },\n    //  ====== 主页  =====\n  {\n    path: '/',\n    name: 'Layout',\n    component: Layout,\n    redirect: '/home',\n    children: [  // 子路由\n      {\n        path: 'home',\n        name: 'Home',\n        component: () => import('@/views/home/HomeView.vue'),\n      },\n      //  ====  User  ====\n      {\n        path: 'userList',\n        name: 'UserList',\n        component: () => import('@/views/user/User.vue'),\n      },\n      {\n        path: 'addUser',\n        name: 'AddUser',\n        component: () => import('@/views/user/AddUser.vue'),\n      },\n      {\n        path: 'editUser',\n        name: 'EditUser',\n        component: () => import('@/views/user/EditUser.vue'),\n      },\n      //  ====  Admin  ====\n      {\n        path: 'adminList',\n        name: 'AdminList',\n        component: () => import('@/views/admin/List.vue'),\n      },\n      {\n        path: 'addAdmin',\n        name: 'AddAdmin',\n        component: () => import('@/views/admin/Add.vue'),\n      },\n      {\n        path: 'editAdmin',\n        name: 'EditAdmin',\n        component: () => import('@/views/admin/Edit.vue'),\n      },\n      //  ====  Category  ====\n      { path: 'categoryList', name: 'CategoryList', component: () => import('@/views/category/List.vue') },\n      { path: 'addCategory', name: 'AddCategory', component: () => import('@/views/category/Add.vue') },\n      { path: 'editCategory', name: 'EditCategory', component: () => import('@/views/category/Edit.vue') },\n      //  ====  Book  ====\n      { path: 'bookList', name: 'BookList', component: () => import('@/views/book/List.vue') },\n      { path: 'addBook', name: 'AddBook', component: () => import('@/views/book/Add.vue') },\n      { path: 'editBook', name: 'EditBook', component: () => import('@/views/book/Edit.vue') },\n      //  ====  Borrow  ====\n      { path: 'borrowList', name: 'BorrowList', component: () => import('@/views/borrow/List.vue') },\n      { path: 'addBorrow', name: 'AddBorrow', component: () => import('@/views/borrow/Add.vue') },\n      { path: 'editBorrow', name: 'EditBorrow', component: () => import('@/views/borrow/Edit.vue') },\n      //  ====  Return  ====\n      { path: 'returList', name: 'returList', component: () => import('@/views/retur/List.vue') },\n    ]\n  },\n  {\n    path: \"*\",\n    component:() => import('@/views/404')\n  }\n]\n\nconst router = new VueRouter({\n  mode: 'history',\n  base: process.env.BASE_URL,\n  routes\n})\n\nrouter.beforeEach((to, from, next) => {\n  if (to.path === '/login') next()\n  const admin = Cookies.get(\"admin\")\n  if (!admin && to.path !== '/login') return next(\"/login\")  // 强制退回到登录页面\n  // 访问 /home 的时候，并且cookie里面存在数据，这个时候我就直接放行\n  next()\n})\n\nexport default router\n"
  },
  {
    "path": "vue/src/utils/request.js",
    "content": "import axios from 'axios'\nimport router from \"@/router\";\nimport Cookies from 'js-cookie'\n\nconst request = axios.create({\n    baseURL: 'http://localhost:9090/api',\n    timeout: 5000\n})\n\n// request 拦截器\n// 可以自请求发送前对请求做一些处理\n// 比如统一加token，对请求参数统一加密\nrequest.interceptors.request.use(config => {\n    config.headers['Content-Type'] = 'application/json;charset=utf-8';\n\n    const adminJson = Cookies.get('admin')\n    if (adminJson) {\n        // 设置请求头\n        config.headers['token'] = JSON.parse(adminJson).token\n    }\n    return config\n}, error => {\n    return Promise.reject(error)\n});\n\n// response 拦截器\n// 可以在接口响应后统一处理结果\nrequest.interceptors.response.use(\n    response => {\n        let res = response.data;\n        // 兼容服务端返回的字符串数据\n        if (typeof res === 'string') {\n            res = res ? JSON.parse(res) : res\n        }\n        if (res.code === '401') {\n            router.push('/login')\n        }\n        return res;\n    },\n    error => {\n        console.log('err' + error) // for debug\n        return Promise.reject(error)\n    }\n)\n\n\nexport default request"
  },
  {
    "path": "vue/src/views/404.vue",
    "content": "<template>\n  <div style=\"text-align: center\">\n    <div style=\"margin-top: 150px; font-size: 100px; \">404</div>\n    <div style=\"font-size: 50px\">未找到页面</div>\n    <div><el-button type=\"text\" style=\"margin-top: 20px; font-size: 20px\" @click=\"$router.push('/')\">返回主页</el-button></div>\n  </div>\n</template>"
  },
  {
    "path": "vue/src/views/Layout.vue",
    "content": "<template>\n  <div>\n    <!-- 头部区域 -->\n    <div style=\"height: 60px; line-height: 60px; background-color: white; margin-bottom: 2px; display: flex\">\n      <div style=\"width: 300px\">\n        <img src=\"@/assets/logo.png\" alt=\"\" style=\"width: 40px; position: relative; top: 10px; left: 20px\">\n        <span style=\"margin-left: 25px; font-size: 24px\">图书管理系统</span>\n      </div>\n      <div style=\"flex: 1; text-align: right; padding-right: 20px\">\n        <el-dropdown size=\"medium\">\n          <span class=\"el-dropdown-link\" style=\"cursor: pointer\">\n            {{ admin.username }}<i class=\"el-icon-arrow-down el-icon--right\"></i>\n          </span>\n          <el-dropdown-menu slot=\"dropdown\" style=\"margin-top: -5px\">\n            <el-dropdown-item><div style=\"width: 50px; text-align: center;\" @click=\"logout\">退出</div></el-dropdown-item>\n          </el-dropdown-menu>\n        </el-dropdown>\n      </div>\n    </div>\n\n    <!-- 侧边栏和主体 -->\n    <div style=\"display: flex\">\n      <!-- 侧边栏导航 -->\n      <div style=\"width: 200px; min-height: calc(100vh - 62px); overflow: hidden; margin-right: 2px; background-color: white\">\n        <el-menu :default-active=\"$route.path\" router class=\"el-menu-demo\" style=\"margin-bottom: 10px\">\n          <el-menu-item index=\"/\">\n            <i class=\"el-icon-eleme\"></i>\n            <span>首页</span>\n          </el-menu-item>\n          <el-submenu index=\"user\">\n            <template slot=\"title\">\n              <i class=\"el-icon-question\"></i>\n              <span>会员管理</span>\n            </template>\n            <el-menu-item index=\"/addUser\">会员添加</el-menu-item>\n            <el-menu-item index=\"/userList\">会员列表</el-menu-item>\n          </el-submenu>\n          <el-submenu index=\"admin\">\n            <template slot=\"title\">\n              <i class=\"el-icon-user\"></i>\n              <span>管理员管理</span>\n            </template>\n            <el-menu-item index=\"/addAdmin\">管理员添加</el-menu-item>\n            <el-menu-item index=\"/adminList\">管理员列表</el-menu-item>\n          </el-submenu>\n          <el-submenu index=\"category\">\n            <template slot=\"title\">\n              <i class=\"el-icon-s-operation\"></i>\n              <span>图书分类管理</span>\n            </template>\n            <el-menu-item index=\"/addCategory\">图书分类添加</el-menu-item>\n            <el-menu-item index=\"/categoryList\">图书分类列表</el-menu-item>\n          </el-submenu>\n          <el-submenu index=\"book\">\n            <template slot=\"title\">\n              <i class=\"el-icon-notebook-1\"></i>\n              <span>图书管理</span>\n            </template>\n            <el-menu-item index=\"/addBook\">图书添加</el-menu-item>\n            <el-menu-item index=\"/bookList\">图书列表</el-menu-item>\n          </el-submenu>\n          <el-submenu index=\"borrow\">\n            <template slot=\"title\">\n              <i class=\"el-icon-document-copy\"></i>\n              <span>借书管理</span>\n            </template>\n            <el-menu-item index=\"/addBorrow\">借书添加</el-menu-item>\n            <el-menu-item index=\"/borrowList\">借书列表</el-menu-item>\n          </el-submenu>\n          <el-submenu index=\"retur\">\n            <template slot=\"title\">\n              <i class=\"el-icon-document\"></i>\n              <span>还书管理</span>\n            </template>\n            <el-menu-item index=\"/returList\">还书列表</el-menu-item>\n          </el-submenu>\n        </el-menu>\n      </div>\n\n      <!-- 主体数据 -->\n      <!-- width: 0; 可以限制容器的宽度，不被子元素无限撑开-->\n      <div style=\"flex: 1; width: 0; background-color: white; padding: 10px\">\n        <router-view />\n      </div>\n    </div>\n  </div>\n</template>\n\n<script>\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: \"Layout.vue\",\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {}\n    }\n  },\n  methods: {\n    logout() {\n      // 清除浏览器用户数据\n      Cookies.remove('admin')\n      this.$router.push('/login')\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/admin/Add.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">新增管理员</div>\n    <el-form :inline=\"true\" :model=\"form\" :rules=\"rules\" ref=\"ruleForm\" label-width=\"100px\">\n      <el-form-item label=\"用户名\" prop=\"username\">\n        <el-input v-model=\"form.username\" placeholder=\"请输入姓名\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"联系方式\" prop=\"phone\">\n        <el-input v-model=\"form.phone\" placeholder=\"请输入联系方式\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"邮箱\" prop=\"email\">\n        <el-input v-model=\"form.email\" placeholder=\"请输入地址\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'AddAdmin',\n  data() {\n    const checkPhone = (rule, value, callback) => {\n      if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(value)) {\n        callback(new Error('请输入合法的手机号'));\n      }\n      callback()\n    };\n    return {\n      form: {},\n      rules: {\n        username: [\n          { required: true, message: '请输入用户名', trigger: 'blur'},\n          { min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}\n        ],\n        phone: [\n          { validator: checkPhone, trigger: 'blur' }\n        ]\n      }\n    }\n  },\n  methods: {\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/admin/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增成功')\n              this.$refs['ruleForm'].resetFields()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/admin/Edit.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">编辑管理员</div>\n    <el-form :inline=\"true\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"用户名\" prop=\"username\">\n        <el-input v-model=\"form.username\" placeholder=\"请输入姓名\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"联系方式\" prop=\"phone\">\n        <el-input v-model=\"form.phone\" placeholder=\"请输入联系方式\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"邮箱\">\n        <el-input v-model=\"form.email\" placeholder=\"请输入地址\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'EditAdmin',\n  data() {\n    return {\n      form: {}\n    }\n  },\n  created() {\n    const id = this.$route.query.id\n    request.get(\"/admin/\" + id).then(res => {\n      this.form = res.data\n    })\n  },\n  methods: {\n    save() {\n      request.put('/admin/update', this.form).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('更新成功')\n          this.$router.push(\"/adminList\")\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/admin/List.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入用户名\" v-model=\"params.username\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入联系方式\" v-model=\"params.phone\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入邮箱\" v-model=\"params.email\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"username\" label=\"用户名\"></el-table-column>\n      <el-table-column prop=\"phone\" label=\"联系方式\"></el-table-column>\n      <el-table-column prop=\"email\" label=\"邮箱\"></el-table-column>\n      <el-table-column prop=\"createtime\" label=\"创建时间\"></el-table-column>\n      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>\n      <el-table-column label=\"状态\" width=\"230\">\n        <template v-slot=\"scope\">\n          <el-switch\n              v-model=\"scope.row.status\"\n              @change=\"changeStatus(scope.row)\"\n              active-color=\"#13ce66\"\n              inactive-color=\"#ff4949\">\n          </el-switch>\n        </template>\n      </el-table-column>\n      <el-table-column label=\"操作\" width=\"230\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n          <el-button type=\"primary\" @click=\"$router.push('/editAdmin?id=' + scope.row.id)\">编辑</el-button>\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n          <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"handleChangePass(scope.row)\">修改密码</el-button>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n    <el-dialog title=\"修改密码\" :visible.sync=\"dialogFormVisible\" width=\"30%\">\n      <el-form :model=\"form\" label-width=\"100px\" ref=\"formRef\" :rules=\"rules\">\n        <el-form-item label=\"新密码\" prop=\"newPass\">\n          <el-input v-model=\"form.newPass\" autocomplete=\"off\" show-password></el-input>\n        </el-form-item>\n      </el-form>\n      <div slot=\"footer\" class=\"dialog-footer\">\n        <el-button @click=\"dialogFormVisible = false\">取 消</el-button>\n        <el-button type=\"primary\" @click=\"savePass\">确 定</el-button>\n      </div>\n    </el-dialog>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'AdminList',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      tableData: [],\n      total: 0,\n      form: {},\n      dialogFormVisible: false,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        username: '',\n        phone: '',\n        email: ''\n      },\n      rules: {\n        newPass: [\n          {required: true, message: '请输入新密码', trigger: 'blur'},\n          {min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    changeStatus(row) {\n      if (this.admin.id === row.id && !row.status) {\n        row.status = true\n        this.$notify.warning('您的操作不合法')\n        return\n      }\n      request.put('/admin/update', row).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('操作成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    handleChangePass(row) {\n      this.form = JSON.parse(JSON.stringify(row))\n      this.dialogFormVisible = true\n    },\n    savePass() {\n      this.$refs['formRef'].validate((valid) => {\n        if (valid) {\n          request.put('/admin/password', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success(\"修改成功\")\n              if (this.form.id === this.admin.id) {   // 当前修改的用户id 等于当前登录的管理员id，那么修改成功之后需要重新登录\n                Cookies.remove('admin')\n                this.$router.push('/login')\n              } else {\n                this.load()\n                this.dialogFormVisible = false\n              }\n            } else {\n              this.$notify.error(\"修改失败\")\n            }\n          })\n        }\n      })\n    },\n    load() {\n      request.get('/admin/page', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        username: '',\n        phone: '',\n        email: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/admin/delete/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/book/Add.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">新增图书</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"名称\" prop=\"name\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入名称\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"描述\" prop=\"description\">\n        <el-input style=\"width: 400px\" type=\"textarea\" v-model=\"form.description\" placeholder=\"请输入描述\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"出版日期\" prop=\"publishDate\">\n        <el-date-picker\n            v-model=\"form.publishDate\"\n            type=\"date\"\n            value-format=\"yyyy-MM-dd\"\n            placeholder=\"请选择出版日期\">\n        </el-date-picker>\n      </el-form-item>\n      <el-form-item label=\"作者\" prop=\"author\">\n        <el-input v-model=\"form.author\" placeholder=\"请输入作者\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"出版社\" prop=\"publisher\">\n        <el-input v-model=\"form.publisher\" placeholder=\"请输入出版社\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"分类\" prop=\"category\">\n        <el-cascader\n            style=\"width: 220px\"\n            :props=\"{ value: 'name', label: 'name'}\"\n            v-model=\"form.categories\"\n            :options=\"categories\"></el-cascader>\n      </el-form-item>\n      <el-form-item label=\"标准码\" prop=\"bookNo\">\n        <el-input v-model=\"form.bookNo\" placeholder=\"请输入标准码\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"借书积分\" prop=\"cover\">\n        <el-input-number v-model=\"form.score\" :min=\"10\" :max=\"30\" label=\"所需积分\"></el-input-number>\n      </el-form-item>\n      <el-form-item label=\"数量\" prop=\"nums\">\n        <el-input v-model=\"form.nums\" placeholder=\"请输入数量\"></el-input>\n      </el-form-item>\n      <br>\n      <el-form-item label=\"封面\" prop=\"cover\">\n        <el-upload\n            class=\"avatar-uploader\"\n            :action=\"'http://localhost:9090/api/book/file/upload?token=' + this.admin.token\"\n            :show-file-list=\"false\"\n            :on-success=\"handleCoverSuccess\"\n        >\n          <img v-if=\"form.cover\" :src=\"form.cover\" class=\"avatar\">\n          <i v-else class=\"el-icon-plus avatar-uploader-icon\"></i>\n        </el-upload>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from \"js-cookie\";\n\nexport default {\n  name: 'AddBook',\n  data() {\n    const checkNums = (rule, value, callback) => {\n      value = parseInt(value)\n      if (value < 0 || value >= 1000) {\n        callback(new Error('请输入大于等于0小于1000的整数'));\n      }\n      callback()\n    };\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      form: {  score: 10, cover: '' },\n      categories: [],\n      rules: {\n        name: [\n          { required: true, message: '请输入图书名称', trigger: 'blur'}\n        ],\n        bookNo: [\n          { required: true, message: '请输入图书标准码', trigger: 'blur'}\n        ],\n        score: [\n          { validator: checkNums, trigger: 'blur' }\n        ],\n        nums: [\n          { required: true, message: '请输入数量', trigger: 'blur'},\n          { validator: checkNums, trigger: 'blur' }\n        ]\n      }\n    }\n  },\n  created() {\n    request.get('/category/tree').then(res => {\n      this.categories = res.data\n    })\n  },\n  methods: {\n    handleCoverSuccess(res) {\n      if (res.code === '200') {\n        console.log(res.data)\n        // this.$set(this.form, 'cover', res.data)\n        this.form.cover = res.data\n      }\n    },\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/book/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增成功')\n              this.$refs['ruleForm'].resetFields()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n<style>\n.avatar-uploader .el-upload {\n  border: 1px dashed #d9d9d9;\n  border-radius: 6px;\n  cursor: pointer;\n  position: relative;\n  overflow: hidden;\n}\n.avatar-uploader .el-upload:hover {\n  border-color: #409EFF;\n}\n.avatar-uploader-icon {\n  font-size: 28px;\n  color: #8c939d;\n  width: 178px;\n  height: 178px;\n  line-height: 178px;\n  text-align: center;\n}\n.avatar {\n  width: 178px;\n  height: 178px;\n  display: block;\n}\n</style>\n"
  },
  {
    "path": "vue/src/views/book/Edit.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">编辑图书</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"名称\" prop=\"name\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入名称\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"描述\" prop=\"description\">\n        <el-input style=\"width: 400px\" type=\"textarea\" v-model=\"form.description\" placeholder=\"请输入描述\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"出版日期\" prop=\"publishDate\">\n        <el-date-picker\n            v-model=\"form.publishDate\"\n            type=\"date\"\n            value-format=\"yyyy-MM-dd\"\n            placeholder=\"请选择出版日期\">\n        </el-date-picker>\n      </el-form-item>\n      <el-form-item label=\"作者\" prop=\"author\">\n        <el-input v-model=\"form.author\" placeholder=\"请输入作者\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"出版社\" prop=\"publisher\">\n        <el-input v-model=\"form.publisher\" placeholder=\"请输入出版社\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"分类\" prop=\"category\">\n        <el-cascader\n            style=\"width: 220px\"\n            :props=\"{ value: 'name', label: 'name'}\"\n            v-model=\"form.categories\"\n            :options=\"categories\"></el-cascader>\n      </el-form-item>\n      <el-form-item label=\"标准码\" prop=\"bookNo\">\n        <el-input v-model=\"form.bookNo\" placeholder=\"请输入标准码\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"借书积分\" prop=\"cover\">\n        <el-input-number v-model=\"form.score\" :min=\"10\" :max=\"30\" label=\"所需积分\"></el-input-number>\n      </el-form-item>\n      <br>\n      <el-form-item label=\"封面\" prop=\"cover\">\n        <el-upload\n            class=\"avatar-uploader\"\n            :action=\"'http://localhost:9090/api/book/file/upload?token=' + this.admin.token\"\n            :show-file-list=\"false\"\n            :on-success=\"handleCoverSuccess\"\n        >\n          <img v-if=\"form.cover\" :src=\"form.cover\" class=\"avatar\">\n          <i v-else class=\"el-icon-plus avatar-uploader-icon\"></i>\n        </el-upload>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from \"js-cookie\";\n\nexport default {\n  name: 'EditBook',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      form: { score: 10 },\n      categories: [],\n      rules: {\n        name: [\n          { required: true, message: '请输入图书名称', trigger: 'blur'}\n        ],\n        bookNo: [\n          { required: true, message: '请输入图书标准码', trigger: 'blur'}\n        ],\n        score: [\n          { required: true, message: '请输入借书积分', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    request.get('/category/tree').then(res => {\n      this.categories = res.data\n    })\n\n    const id = this.$route.query.id\n    request.get(\"/book/\" + id).then(res => {\n      this.form = res.data\n      if (this.form.category) {\n        this.form.categories = this.form.category.split(' > ')\n        console.log(this.form.categories)\n      }\n    })\n  },\n  methods: {\n    handleCoverSuccess(res) {\n      if (res.code === '200') {\n        this.form.cover = res.data\n      }\n    },\n    save() {\n      request.put('/book/update', this.form).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('更新成功')\n          this.$router.push(\"/bookList\")\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n<style>\n.avatar-uploader .el-upload {\n  border: 1px dashed #d9d9d9;\n  border-radius: 6px;\n  cursor: pointer;\n  position: relative;\n  overflow: hidden;\n}\n.avatar-uploader .el-upload:hover {\n  border-color: #409EFF;\n}\n.avatar-uploader-icon {\n  font-size: 28px;\n  color: #8c939d;\n  width: 178px;\n  height: 178px;\n  line-height: 178px;\n  text-align: center;\n}\n.avatar {\n  width: 178px;\n  height: 178px;\n  display: block;\n}\n</style>\n\n"
  },
  {
    "path": "vue/src/views/book/List.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入图书名称\" v-model=\"params.name\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入图书标准码\" v-model=\"params.bookNo\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe row-key=\"id\"  default-expand-all>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"name\" label=\"图书名称\"></el-table-column>\n      <el-table-column prop=\"bookNo\" label=\"标准码\"></el-table-column>\n      <el-table-column prop=\"description\" width=\"200\" label=\"描述\"></el-table-column>\n      <el-table-column prop=\"publishDate\" label=\"出版日期\"></el-table-column>\n      <el-table-column prop=\"author\" label=\"作者\"></el-table-column>\n      <el-table-column prop=\"publisher\" label=\"出版社\"></el-table-column>\n      <el-table-column prop=\"category\" label=\"分类\"></el-table-column>\n      <el-table-column prop=\"score\" label=\"借书积分\"></el-table-column>\n      <el-table-column prop=\"nums\" label=\"数量\"></el-table-column>\n      <el-table-column prop=\"cover\" label=\"封面\">\n        <template v-slot=\"scope\">\n          <el-image :src=\"scope.row.cover\" :preview-src-list=\"[scope.row.cover]\"></el-image>\n        </template>\n      </el-table-column>\n      <el-table-column prop=\"createtime\" label=\"创建时间\"></el-table-column>\n      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>\n      <el-table-column label=\"操作\" width=\"140\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n          <el-button type=\"primary\" @click=\"$router.push('/editBook?id=' + scope.row.id)\">编辑</el-button>\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'BookList',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      tableData: [],\n      total: 0,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        bookNo: ''\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    load() {\n      request.get('/book/page', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        bookNo: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/book/delete/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/borrow/Add.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">新增借书记录</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"图书标准码\" prop=\"bookNo\">\n        <el-select v-model=\"form.bookNo\" clearable filterable placeholder=\"请选择\" @change=\"selBook\">\n          <el-option\n              v-for=\"item in books\"\n              :key=\"item.id\"\n              :label=\"item.bookNo\"\n              :value=\"item.bookNo\">\n          </el-option>\n        </el-select>\n      </el-form-item>\n      <el-form-item label=\"图书名称\" prop=\"bookName\">\n        <el-input v-model=\"form.bookName\" disabled></el-input>\n      </el-form-item>\n      <el-form-item label=\"所需积分\" prop=\"score\">\n        <el-input v-model=\"form.score\" disabled></el-input>\n      </el-form-item>\n      <el-form-item label=\"图书数量\" prop=\"nums\">\n        <el-input v-model=\"form.nums\" disabled></el-input>\n      </el-form-item>\n      <br />\n      <el-form-item label=\"会员码\" prop=\"userNo\">\n        <el-select v-model=\"form.userNo\" filterable placeholder=\"请选择\" @change=\"selUser\">\n          <el-option\n              v-for=\"item in users\"\n              :key=\"item.id\"\n              :label=\"item.username\"\n              :value=\"item.username\">\n          </el-option>\n        </el-select>\n      </el-form-item>\n      <el-form-item label=\"用户名称\" prop=\"userName\">\n        <el-input disabled v-model=\"form.userName\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"用户联系方式\" prop=\"userPhone\">\n        <el-input disabled v-model=\"form.userPhone\" ></el-input>\n      </el-form-item>\n      <el-form-item label=\"用户账户积分\" prop=\"account\">\n        <el-input disabled v-model=\"form.account\" ></el-input>\n      </el-form-item>\n      <el-form-item label=\"借出的天数\" prop=\"days\">\n        <el-input-number v-model=\"form.days\" :min=\"1\" :max=\"30\" label=\"借出的天数\"></el-input-number>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'AddBook',\n  data() {\n    return {\n      form: {days: 1},\n      books: [],\n      users: [],\n      rules: {\n        bookNo: [\n          { required: true, message: '请输入图书标准码', trigger: 'blur'}\n        ],\n        userNo: [\n          { required: true, message: '请输入会员码', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    request.get('/book/list').then(res => {\n      this.books = res.data\n    })\n\n    request.get('/user/list').then(res => {\n      this.users = res.data.filter(v => v.status)\n    })\n  },\n  methods: {\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/borrow/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增成功')\n              this.$refs['ruleForm'].resetFields()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    },\n    selBook() {\n      const book = this.books.find(v => v.bookNo === this.form.bookNo)\n      request.get('/book/' + book.id).then(res => {\n        this.$set(this.form, 'bookName', res.data.name)\n        this.form.score = res.data.score\n        this.form.nums = res.data.nums\n      })\n    },\n    selUser() {\n      const user = this.users.find(v => v.username === this.form.userNo)\n      request.get('/user/' + user.id).then(res => {\n        this.$set(this.form, 'userName', res.data.name)\n        this.form.userPhone = res.data.phone\n        this.form.account = res.data.account\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/borrow/Edit.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">编辑图书</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"图书标准码\" prop=\"bookNo\">\n        <el-select v-model=\"form.bookNo\" clearable filterable placeholder=\"请选择\" @change=\"selBook\">\n          <el-option\n              v-for=\"item in books\"\n              :key=\"item.id\"\n              :label=\"item.bookNo\"\n              :value=\"item.bookNo\">\n          </el-option>\n        </el-select>\n      </el-form-item>\n      <el-form-item label=\"图书名称\" prop=\"bookName\">\n        <el-input v-model=\"form.bookName\" disabled></el-input>\n      </el-form-item>\n      <el-form-item label=\"所需积分\" prop=\"score\">\n        <el-input v-model=\"form.score\" disabled></el-input>\n      </el-form-item>\n      <el-form-item label=\"图书数量\" prop=\"nums\">\n        <el-input v-model=\"form.nums\" disabled ></el-input>\n      </el-form-item>\n\n      <br />\n      <el-form-item label=\"会员码\" prop=\"userNo\">\n        <el-select v-model=\"form.userNo\" filterable placeholder=\"请选择\" @change=\"selUser\">\n          <el-option\n              v-for=\"item in users\"\n              :key=\"item.id\"\n              :label=\"item.username\"\n              :value=\"item.username\">\n          </el-option>\n        </el-select>\n      </el-form-item>\n      <el-form-item label=\"用户名称\" prop=\"userName\">\n        <el-input disabled v-model=\"form.userName\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"用户联系方式\" prop=\"userPhone\">\n        <el-input disabled v-model=\"form.userPhone\" ></el-input>\n      </el-form-item>\n      <el-form-item label=\"用户账户积分\" prop=\"account\">\n        <el-input disabled v-model=\"form.account\" ></el-input>\n      </el-form-item>\n      <el-form-item label=\"借出的天数\" prop=\"days\">\n        <el-input-number v-model=\"form.days\" :min=\"1\" :max=\"30\" label=\"借出的天数\"></el-input-number>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'EditBook',\n  data() {\n    return {\n      form: {},\n      books: [],\n      users: [],\n      rules: {\n        bookNo: [\n          { required: true, message: '请输入图书标准码', trigger: 'blur'}\n        ],\n        userNo: [\n          { required: true, message: '请输入会员码', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    request.get('/book/list').then(res => {\n      this.books = res.data\n    })\n\n    request.get('/user/list').then(res => {\n      this.users = res.data.filter(v => v.status)\n    })\n\n    const id = this.$route.query.id\n    request.get(\"/borrow/\" + id).then(res => {\n      this.form = res.data\n    })\n  },\n  methods: {\n    save() {\n      request.put('/borrow/update', this.form).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('更新成功')\n          this.$router.push(\"/bookList\")\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    selBook() {\n      const book = this.books.find(v => v.bookNo === this.form.bookNo)\n      request.get('/book/' + book.id).then(res => {\n        this.form.bookName = res.data.name\n        this.form.score = res.data.score\n        this.form.nums = res.data.nums\n      })\n    },\n    selUser() {\n      const user = this.users.find(v => v.username === this.form.userNo)\n      request.get('/user/' + user.id).then(res => {\n        this.form.userName = res.data.name\n        this.form.userPhone = res.data.phone\n        this.form.account = res.data.account\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/borrow/List.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入图书名称\" v-model=\"params.bookName\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入图书标准码\" v-model=\"params.bookNo\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入用户名称\" v-model=\"params.userName\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe row-key=\"id\"  default-expand-all>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"bookName\" label=\"图书名称\"></el-table-column>\n      <el-table-column prop=\"bookNo\" label=\"图书标准码\"></el-table-column>\n      <el-table-column prop=\"userNo\" label=\"会员码\"></el-table-column>\n      <el-table-column prop=\"userName\" label=\"用户名称\"></el-table-column>\n      <el-table-column prop=\"userPhone\" label=\"用户联系方式\"></el-table-column>\n      <el-table-column prop=\"score\" label=\"所用积分\"></el-table-column>\n      <el-table-column prop=\"createtime\" label=\"借出日期\"></el-table-column>\n      <el-table-column prop=\"status\" label=\"借出状态\"></el-table-column>\n      <el-table-column prop=\"days\" label=\"借出天数\"></el-table-column>\n      <el-table-column prop=\"returnDate\" label=\"归还日期\"></el-table-column>\n      <el-table-column prop=\"note\" label=\"过期提醒\">\n        <template v-slot=\"scope\">\n          <el-tag type=\"success\" v-if=\"scope.row.note === '正常'\">{{ scope.row.note }}</el-tag>\n          <el-tag type=\"primary\" v-if=\"scope.row.note === '即将到期'\">{{ scope.row.note }}</el-tag>\n          <el-tag type=\"warning\" v-if=\"scope.row.note === '已到期'\">{{ scope.row.note }}</el-tag>\n          <el-tag type=\"danger\" v-if=\"scope.row.note === '已过期'\">{{ scope.row.note }}</el-tag>\n        </template>\n      </el-table-column>\n      <el-table-column label=\"管理\">\n        <template v-slot=\"scope\">\n          <el-button type=\"primary\" @click=\"returnBooks(scope.row)\" v-if=\"scope.row.status === '已借出'\">还书</el-button>\n        </template>\n      </el-table-column>\n<!--      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>-->\n      <el-table-column label=\"操作\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n<!--          <el-button type=\"primary\" @click=\"$router.push('/editBorrow?id=' + scope.row.id)\">编辑</el-button>-->\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'BorrowList',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      tableData: [],\n      total: 0,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        bookNo: ''\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    load() {\n      request.get('/borrow/page', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        bookName: '',\n        bookNo: '',\n        userName: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/borrow/delete/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    returnBooks(row) {\n      request.post(\"/borrow/saveRetur\", row).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('还书成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/category/Add.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">新增分类</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"名称\" prop=\"name\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入名称\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"备注\" prop=\"remark\">\n        <el-input v-model=\"form.remark\" placeholder=\"请输入备注\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'AddCategory',\n  data() {\n    return {\n      form: {},\n      rules: {\n        name: [\n          { required: true, message: '请输入分类名称', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  methods: {\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/category/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增成功')\n              this.$refs['ruleForm'].resetFields()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/category/Edit.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">编辑分类</div>\n    <el-form :inline=\"true\" :rules=\"rules\" ref=\"ruleForm\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"名称\" prop=\"name\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入名称\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"备注\" prop=\"remark\">\n        <el-input v-model=\"form.remark\" placeholder=\"请输入备注\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'EditCategory',\n  data() {\n    return {\n      form: {},\n      rules: {\n        name: [\n          { required: true, message: '请输入分类名称', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    const id = this.$route.query.id\n    request.get(\"/category/\" + id).then(res => {\n      this.form = res.data\n    })\n  },\n  methods: {\n    save() {\n      request.put('/category/update', this.form).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('更新成功')\n          this.$router.push(\"/categoryList\")\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/category/List.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入分类名称\" v-model=\"params.name\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe row-key=\"id\"  default-expand-all>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"name\" label=\"名称\"></el-table-column>\n      <el-table-column prop=\"remark\" label=\"备注\"></el-table-column>\n      <el-table-column prop=\"createtime\" label=\"创建时间\"></el-table-column>\n      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>\n      <el-table-column label=\"操作\" width=\"280\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n          <el-button type=\"success\" v-if=\"!scope.row.pid\" @click=\"handleAdd(scope.row)\">添加二级分类</el-button>\n          <el-button type=\"primary\" @click=\"$router.push('/editCategory?id=' + scope.row.id)\">编辑</el-button>\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n    <el-dialog title=\"添加二级分类\" :visible.sync=\"dialogFormVisible\" width=\"30%\">\n      <el-form :model=\"form\" label-width=\"100px\" ref=\"ruleForm\" :rules=\"rules\" style=\"width: 85%\">\n        <el-form-item label=\"分类名称\" prop=\"name\">\n          <el-input v-model=\"form.name\" autocomplete=\"off\"></el-input>\n        </el-form-item>\n        <el-form-item label=\"分类备注\" prop=\"remark\">\n          <el-input v-model=\"form.remark\" autocomplete=\"off\"></el-input>\n        </el-form-item>\n      </el-form>\n      <div slot=\"footer\" class=\"dialog-footer\">\n        <el-button @click=\"dialogFormVisible = false\">取 消</el-button>\n        <el-button type=\"primary\" @click=\"save\">确 定</el-button>\n      </div>\n    </el-dialog>\n    \n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'CategoryList',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      tableData: [],\n      total: 0,\n      dialogFormVisible: false,\n      form: {},\n      pid: null,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n      },\n      rules: {\n        name: [\n          {required: true, message: '请输入分类名称', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    load() {\n      request.get('/category/page', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        name: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/category/delete/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    handleAdd(row) {\n      // 将当前行的id作为二级分类的pid\n      this.pid = row.id\n      this.dialogFormVisible = true\n    },\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          // 给二级分类赋值 pid\n          this.form.pid = this.pid\n          request.post('/category/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增二级分类成功')\n              this.$refs['ruleForm'].resetFields()\n              this.dialogFormVisible = false\n              this.load()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/home/HomeView.vue",
    "content": "<template>\n  <div>\n    <div style=\"margin: 20px 0\">\n      <el-select class=\"input\" v-model=\"timeRange\" placeholder=\"请选择\" @change=\"load\">\n        <el-option\n            v-for=\"item in options\"\n            :key=\"item.value\"\n            :label=\"item.label\"\n            :value=\"item.value\">\n        </el-option>\n      </el-select>\n    </div>\n    <el-card>\n      <div id=\"line\" style=\"width: 100%; height: 400px\"></div>\n    </el-card>\n  </div>\n</template>\n\n<script>\nimport Cookies from 'js-cookie'\nimport request from \"@/utils/request\";\nimport * as echarts from 'echarts'\n\nconst option = {\n  title: {\n    text: '图书借还统计'\n  },\n  tooltip: {\n    trigger: 'axis'\n  },\n  legend: {\n    data: ['借书数量', '还书数量']\n  },\n  grid: {\n    left: '3%',\n    right: '4%',\n    bottom: '3%',\n    containLabel: true\n  },\n  toolbox: {\n    feature: {\n      saveAsImage: {}\n    }\n  },\n  xAxis: {\n    type: 'category',\n    boundaryGap: false,\n    data: []\n  },\n  yAxis: {\n    type: 'value'\n  },\n  series: [\n    {\n      name: '借书数量',\n      type: 'line',\n      stack: 'Total',\n      smooth: true,\n      data: []\n    },\n    {\n      name: '还书数量',\n      type: 'line',\n      stack: 'Total',\n      smooth: true,\n      data: []\n    }\n  ]\n}\n\n  export default {\n    data() {\n      return {\n        admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n        lineBox: null,\n        timeRange: 'week',\n        options: [\n          {label: '最近一周', value: 'week'},\n          {label: '最近一个月', value: 'month'},\n          {label: '最近两个月', value: 'month2'},\n          {label: '最近三个月', value: 'month3'},\n        ]\n      }\n    },\n    mounted() {\n      this.load()\n    },\n    methods: {\n      load() {\n        if (!this.lineBox) {\n          this.lineBox = echarts.init(document.getElementById('line'))\n        }\n        request.get('/borrow/lineCharts/' + this.timeRange).then(res => {\n          option.xAxis.data = res.data.date\n          option.series[0].data = res.data.borrow\n          option.series[1].data = res.data.retur\n          this.lineBox.setOption(option)\n        })\n      }\n    }\n  }\n</script>\n\n<style>\n.input {\n  width: 300px;\n}\n</style>\n"
  },
  {
    "path": "vue/src/views/login/Login.vue",
    "content": "<template>\n  <div style=\"height: 100vh; overflow: hidden; position: relative\">\n    <el-card class=\"cover\" v-if=\"loginAdmin.id\">\n      <slide-verify :l=\"42\"\n                    :r=\"10\"\n                    :w=\"310\"\n                    :h=\"155\"\n                    :accuracy=\"5\"\n                    slider-text=\"向右滑动\"\n                    @success=\"onSuccess\"\n                    @fail=\"onFail\"\n                    @refresh=\"onRefresh\"\n      ></slide-verify>\n    </el-card>\n\n      <div style=\"width: 500px; height: 400px; background-color: white; border-radius: 10px;\n        margin: 150px auto; padding:50px\">\n        <div style=\"margin: 30px; text-align: center; font-size: 30px; font-weight: bold; color: dodgerblue\">登 录</div>\n        <el-form :model=\"admin\" :rules=\"rules\" ref=\"loginForm\">\n          <el-form-item prop=\"username\">\n            <el-input placeholder=\"请输入账号\" prefix-icon=\"el-icon-user\" size=\"medium\" v-model=\"admin.username\"></el-input>\n          </el-form-item>\n          <el-form-item prop=\"password\">\n            <el-input placeholder=\"请输入密码\" show-password prefix-icon=\"el-icon-lock\" size=\"medium\" v-model=\"admin.password\"></el-input>\n          </el-form-item>\n          <el-form-item>\n            <el-button style=\"width: 100%\" size=\"medium\" type=\"primary\" @click=\"login\">登录</el-button>\n          </el-form-item>\n        </el-form>\n      </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'LOGIN',\n  data() {\n    return {\n      loginAdmin: {},\n      admin: {},\n      rules: {\n        username: [\n          { required: true, message: '请输入用户名', trigger: 'blur'},\n          { min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}\n        ],\n        password: [\n          { required: true, message: '请输入密码', trigger: 'blur'},\n          { min: 3, max: 10, message: '长度在3-10个字符', trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  methods: {\n    login() {\n      this.$refs['loginForm'].validate((valid) => {\n        if (valid) {\n          request.post('/admin/login', this.admin).then(res => {\n            if (res.code === '200') {\n              this.loginAdmin = res.data  // 滑块组件就出现了\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    },\n    onSuccess() { // 滑块验证通过之后触发的\n      Cookies.set('admin', JSON.stringify(this.loginAdmin))\n      this.$notify.success(\"登录成功\")\n      this.$router.push('/')\n    },\n    onFail() {\n      console.log('onFail')\n    },\n    onRefresh() {\n      console.log('refresh')\n    }\n  }\n}\n</script>\n\n<style>\n.cover {\n  width: fit-content;\n  background-color: white;\n  position: absolute;\n  top:50%;\n  left:50%;\n  transform: translate(-50%, -50%);\n  z-index: 1000;\n}\n</style>"
  },
  {
    "path": "vue/src/views/retur/List.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入图书名称\" v-model=\"params.name\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入图书标准码\" v-model=\"params.bookNo\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入用户名称\" v-model=\"params.userName\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe row-key=\"id\"  default-expand-all>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"bookName\" label=\"图书名称\"></el-table-column>\n      <el-table-column prop=\"bookNo\" label=\"图书标准码\"></el-table-column>\n      <el-table-column prop=\"userNo\" label=\"会员码\"></el-table-column>\n      <el-table-column prop=\"userName\" label=\"用户名称\"></el-table-column>\n      <el-table-column prop=\"userPhone\" label=\"用户联系方式\"></el-table-column>\n      <el-table-column prop=\"score\" label=\"所用积分\"></el-table-column>\n      <el-table-column prop=\"createtime\" label=\"借出日期\"></el-table-column>\n      <el-table-column prop=\"status\" label=\"借出状态\"></el-table-column>\n      <el-table-column prop=\"days\" label=\"借出天数\"></el-table-column>\n      <el-table-column prop=\"returnDate\" label=\"归还日期\"></el-table-column>\n      <el-table-column prop=\"realDate\" label=\"实际归还日期\"></el-table-column>\n<!--      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>-->\n      <el-table-column label=\"操作\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n<!--          <el-button type=\"primary\" @click=\"$router.push('/editBorrow?id=' + scope.row.id)\">编辑</el-button>-->\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\nimport Cookies from 'js-cookie'\n\nexport default {\n  name: 'ReturList',\n  data() {\n    return {\n      admin: Cookies.get('admin') ? JSON.parse(Cookies.get('admin')) : {},\n      tableData: [],\n      total: 0,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        bookNo: ''\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    load() {\n      request.get('/borrow/pageRetur', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        bookName: '',\n        bookNo: '',\n        userName: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/borrow/deleteRetur/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    returnBooks(row) {\n\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/src/views/user/AddUser.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">新增用户</div>\n    <el-form :inline=\"true\" :model=\"form\" :rules=\"rules\" ref=\"ruleForm\" label-width=\"100px\">\n      <el-form-item label=\"姓名\" prop=\"name\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入姓名\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"年龄\" prop=\"age\">\n        <el-input v-model=\"form.age\" placeholder=\"请输入年龄\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"性别\">\n        <el-radio v-model=\"form.sex\"  label=\"男\">男</el-radio>\n        <el-radio v-model=\"form.sex\"  label=\"女\">女</el-radio>\n      </el-form-item>\n      <el-form-item label=\"联系方式\" prop=\"phone\">\n        <el-input v-model=\"form.phone\" placeholder=\"请输入联系方式\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"地址\" prop=\"address\">\n        <el-input v-model=\"form.address\" placeholder=\"请输入地址\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'AddUser',\n  data() {\n    const checkAge = (rule, value, callback) => {\n      if (!value) {\n        return callback(new Error('年龄不能为空'));\n      }\n      if (!/^[0-9]+$/.test(value)) {\n        callback(new Error('请输入数字值'));\n      }\n      if (parseInt(value) > 120 || parseInt(value) <= 0) {\n        callback(new Error('请输入合理的年龄'));\n      }\n      callback()\n    };\n    const checkPhone = (rule, value, callback) => {\n      if (!/^[1][3,4,5,6,7,8,9][0-9]{9}$/.test(value)) {\n        callback(new Error('请输入合法的手机号'));\n      }\n      callback()\n    };\n    return {\n      form: {sex: '男'},\n      rules: {\n        name: [\n          { required: true, message: '请输入姓名', trigger: 'blur'}\n        ],\n        age: [\n          { validator: checkAge, trigger: 'blur' }\n        ],\n        phone: [\n          { validator: checkPhone, trigger: 'blur' }\n        ]\n      }\n    }\n  },\n  methods: {\n    save() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/user/save', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('新增成功')\n              this.$refs['ruleForm'].resetFields()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/user/EditUser.vue",
    "content": "<template>\n  <div style=\"width: 80%\">\n    <div style=\"margin-bottom: 30px\">编辑用户</div>\n    <el-form :inline=\"true\" :model=\"form\" label-width=\"100px\">\n      <el-form-item label=\"卡号\">\n        <el-input v-model=\"form.username\" disabled></el-input>\n      </el-form-item>\n      <el-form-item label=\"姓名\">\n        <el-input v-model=\"form.name\" placeholder=\"请输入姓名\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"年龄\">\n        <el-input v-model=\"form.age\" placeholder=\"请输入年龄\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"性别\">\n        <el-input v-model=\"form.sex\" placeholder=\"请输入性别\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"联系方式\">\n        <el-input v-model=\"form.phone\" placeholder=\"请输入联系方式\"></el-input>\n      </el-form-item>\n      <el-form-item label=\"地址\">\n        <el-input v-model=\"form.address\" placeholder=\"请输入地址\"></el-input>\n      </el-form-item>\n    </el-form>\n\n    <div style=\"text-align: center; margin-top: 30px\">\n      <el-button type=\"primary\" @click=\"save\" size=\"medium\">提交</el-button>\n    </div>\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'EditUser',\n  data() {\n    return {\n      form: {}\n    }\n  },\n  created() {\n    const id = this.$route.query.id\n    request.get(\"/user/\" + id).then(res => {\n      this.form = res.data\n    })\n  },\n  methods: {\n    save() {\n      request.put('/user/update', this.form).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('更新成功')\n          this.$router.push(\"/userList\")\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    }\n  }\n}\n\n</script>\n\n"
  },
  {
    "path": "vue/src/views/user/User.vue",
    "content": "<template>\n  <div>\n    <!--    搜索表单-->\n    <div style=\"margin-bottom: 20px\">\n      <el-input style=\"width: 240px\" placeholder=\"请输入名称\" v-model=\"params.name\"></el-input>\n      <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入联系方式\" v-model=\"params.phone\"></el-input>\n      <el-button style=\"margin-left: 5px\" type=\"primary\" @click=\"load\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n      <el-button style=\"margin-left: 5px\" type=\"warning\" @click=\"reset\"><i class=\"el-icon-refresh\"></i> 重置</el-button>\n    </div>\n\n    <el-table :data=\"tableData\" stripe>\n      <el-table-column prop=\"id\" label=\"编号\" width=\"80\"></el-table-column>\n      <el-table-column prop=\"username\" label=\"会员卡号\"></el-table-column>\n      <el-table-column prop=\"name\" label=\"名称\"></el-table-column>\n      <el-table-column prop=\"age\" label=\"年龄\"></el-table-column>\n      <el-table-column prop=\"address\" label=\"地址\"></el-table-column>\n      <el-table-column prop=\"phone\" label=\"联系方式\"></el-table-column>\n      <el-table-column prop=\"sex\" label=\"性别\"></el-table-column>\n      <el-table-column prop=\"account\" label=\"账户积分\"></el-table-column>\n      <el-table-column label=\"状态\" width=\"230\">\n        <template v-slot=\"scope\">\n          <el-switch\n              v-model=\"scope.row.status\"\n              @change=\"changeStatus(scope.row)\"\n              active-color=\"#13ce66\"\n              inactive-color=\"#ff4949\">\n          </el-switch>\n        </template>\n      </el-table-column>\n      <el-table-column prop=\"createtime\" label=\"创建时间\"></el-table-column>\n      <el-table-column prop=\"updatetime\" label=\"更新时间\"></el-table-column>\n\n      <el-table-column label=\"操作\" width=\"230\">\n        <template v-slot=\"scope\">\n<!--          scope.row 就是当前行数据-->\n          <el-button type=\"warning\" @click=\"handleAccountAdd(scope.row)\">充值</el-button>\n          <el-button type=\"primary\" @click=\"$router.push('/editUser?id=' + scope.row.id)\">编辑</el-button>\n          <el-popconfirm\n              style=\"margin-left: 5px\"\n              title=\"您确定删除这行数据吗？\"\n              @confirm=\"del(scope.row.id)\"\n          >\n            <el-button type=\"danger\" slot=\"reference\">删除</el-button>\n          </el-popconfirm>\n        </template>\n      </el-table-column>\n    </el-table>\n\n    <!--    分页-->\n    <div style=\"margin-top: 20px\">\n      <el-pagination\n          background\n          :current-page=\"params.pageNum\"\n          :page-size=\"params.pageSize\"\n          layout=\"prev, pager, next\"\n          @current-change=\"handleCurrentChange\"\n          :total=\"total\">\n      </el-pagination>\n    </div>\n\n    <el-dialog title=\"充值\" :visible.sync=\"dialogFormVisible\" width=\"30%\">\n      <el-form :model=\"form\" label-width=\"100px\" ref=\"ruleForm\" :rules=\"rules\" style=\"width: 85%\">\n        <el-form-item label=\"当前账户积分\" prop=\"account\">\n          <el-input disabled v-model=\"form.account\" autocomplete=\"off\"></el-input>\n        </el-form-item>\n        <el-form-item label=\"积分\" prop=\"score\">\n          <el-input v-model=\"form.score\" autocomplete=\"off\"></el-input>\n        </el-form-item>\n      </el-form>\n      <div slot=\"footer\" class=\"dialog-footer\">\n        <el-button @click=\"dialogFormVisible = false\">取 消</el-button>\n        <el-button type=\"primary\" @click=\"addAccount\">确 定</el-button>\n      </div>\n    </el-dialog>\n\n  </div>\n</template>\n\n<script>\nimport request from \"@/utils/request\";\n\nexport default {\n  name: 'User',\n  data() {\n    const checkNums = (rule, value, callback) => {\n      value = parseInt(value)\n      if (value < 10 || value > 200) {\n        callback(new Error('请输入大于等于10小于或等于200的整数'));\n      }\n      callback()\n    };\n    return {\n      tableData: [],\n      total: 0,\n      params: {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        phone: ''\n      },\n      dialogFormVisible: false,\n      form: {},\n      rules: {\n        score: [\n          { required: true, message: '请输入积分', trigger: 'blur'},\n          { validator: checkNums, trigger: 'blur'}\n        ]\n      }\n    }\n  },\n  created() {\n    this.load()\n  },\n  methods: {\n    changeStatus(row) {\n      request.put('/user/update', row).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('操作成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    load() {\n      // fetch('http://localhost:9090/user/list').then(res => res.json()).then(res => {\n      //   console.log(res)\n      //   this.tableData = res\n      // })\n\n      request.get('/user/page', {\n        params: this.params\n      }).then(res => {\n        if (res.code === '200') {\n          this.tableData = res.data.list\n          this.total = res.data.total\n        }\n      })\n    },\n    reset() {\n      this.params = {\n        pageNum: 1,\n        pageSize: 10,\n        name: '',\n        phone: ''\n      }\n      this.load()\n    },\n    handleCurrentChange(pageNum) {\n      // 点击分页按钮触发分页\n      this.params.pageNum = pageNum\n      this.load()\n    },\n    del(id) {\n      request.delete(\"/user/delete/\" + id).then(res => {\n        if (res.code === '200') {\n          this.$notify.success('删除成功')\n          this.load()\n        } else {\n          this.$notify.error(res.msg)\n        }\n      })\n    },\n    handleAccountAdd(row) {\n      this.form = JSON.parse(JSON.stringify(row))\n      this.dialogFormVisible = true\n    },\n    addAccount() {\n      this.$refs['ruleForm'].validate((valid) => {\n        if (valid) {\n          request.post('/user/account', this.form).then(res => {\n            if (res.code === '200') {\n              this.$notify.success('充值成功')\n              this.dialogFormVisible = false\n              this.load()\n            } else {\n              this.$notify.error(res.msg)\n            }\n          })\n        }\n      })\n    }\n  }\n}\n</script>\n\n<style scoped>\n\n</style>"
  },
  {
    "path": "vue/vue.config.js",
    "content": "const { defineConfig } = require('@vue/cli-service')\nmodule.exports = defineConfig({\n  transpileDependencies: true\n})\n"
  },
  {
    "path": "文档/笔记.md",
    "content": "# 总览\n\n![](图书管理.png)\n\n## 第一节：搭建脚手架\n\n### 准备知识\n\njavaSE、servlet、JDBC、Maven、Mybatis、SpringMVC、SSM（了解）、Springboot\n\nMysql数据库简单的SQL语法\n\nHTML、CSS、JS、vue2相关语法\n\n### 安装软件\n\n关注公众号：Java学习指南，回复：软件\n\nidea（写代码软件）、nodejs（前端开发环境）、jdk（后端开发环境）、mysql5.7\\8.0（数据库）、navicat（数据库可视化）、notepad++（文本编辑器，可选）、postman（接口调试工具，可选）\n\n### 创建vue工程\n\n`npm config set registry https://registry.npm.taobao.org`\n\n安装 vue/cli：https://cli.vuejs.org/zh/guide/installation.html\n\n@vue/cli@5.0.8\n\n### 使用elementUI\n\n官网：https://element.eleme.cn/\n\n安装 ElementUI\n```\nnpm i element-ui -S\n```\n\n```\nimport ElementUI from 'element-ui';\nimport 'element-ui/lib/theme-chalk/index.css';\n\n\nVue.use(ElementUI);\n```\n\n## 完成主页布局\n\n### 头部\n\n图标网站：https://www.iconfont.cn/\n\n```\n<!-- 头部区域 -->\n<div style=\"height: 60px; line-height: 60px; background-color: white; margin-bottom: 2px\">\n  <img src=\"@/assets/logo.png\" alt=\"\" style=\"width: 40px; position: relative; top: 10px; left: 20px\">\n  <span style=\"margin-left: 25px; font-size: 24px\">图书管理系统</span>\n</div>\n```\n\n### 左侧菜单\n\n```\n<!-- 侧边栏导航 -->\n<div style=\"width: 200px; min-height: calc(100vh - 62px); overflow: hidden; margin-right: 2px; background-color: white\">\n  <el-menu :default-active=\"$route.path\" :default-openeds=\"['/']\" router class=\"el-menu-demo\">\n    <el-menu-item index=\"/\">\n      <i class=\"el-icon-eleme\"></i>\n      <span>首页</span>\n    </el-menu-item>\n    <el-submenu index=\"/\">\n      <template slot=\"title\">\n        <i class=\"el-icon-question\"></i>\n        <span>关于页面</span>\n      </template>\n      <el-menu-item index=\"about\">关于详情</el-menu-item>\n    </el-submenu>\n  </el-menu>\n</div>\n```\n\n### 右侧主体\n\n```\n  <!-- 主体数据 -->\n<div style=\"flex: 1; background-color: white; padding: 10px\">\n  <router-view/>\n</div>\n```\n\n### 写个表格试试\n\n```\n<!--    搜索表单-->\n<div style=\"margin-bottom: 20px\">\n  <el-input style=\"width: 240px\" placeholder=\"请输入名称\"></el-input>\n  <el-input style=\"width: 240px; margin-left: 5px\" placeholder=\"请输入联系方式\"></el-input>\n  <el-button style=\"margin-left: 5px\" type=\"primary\"><i class=\"el-icon-search\"></i> 搜索</el-button>\n</div>\n\n<el-table :data=\"tableData\" stripe>\n  <el-table-column prop=\"name\" label=\"名称\"></el-table-column>\n  <el-table-column prop=\"age\" label=\"年龄\"></el-table-column>\n  <el-table-column prop=\"address\" label=\"地址\"></el-table-column>\n  <el-table-column prop=\"phone\" label=\"联系方式\"></el-table-column>\n  <el-table-column prop=\"sex\" label=\"性别\"></el-table-column>\n</el-table>\n\n<!--    分页-->\n<div style=\"margin-top: 20px\">\n  <el-pagination\n      background\n      :page-size=\"5\"\n      layout=\"prev, pager, next\"\n      :total=\"100\">\n  </el-pagination>\n</div>\n\n\n\ntableData: [\n  { name: '王二', age: 20, address: '北京市', phone: '13899008899', sex: '男' },\n  { name: '王二', age: 20, address: '北京市', phone: '13899008899', sex: '男' },\n  { name: '王二', age: 20, address: '北京市', phone: '13899008899', sex: '女' },\n]\n```\n\n## 搭建后台服务\n\n### 跨域错误\n> Access to fetch at 'http://localhost:9090/user/list' from origin 'http://localhost:8080' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.\n\n如何解决？   @CrossOrigin\n\n百度：SpringBoot如何解决跨域问题 / Vue如何解决跨域问题\n\n### Mybatis官网示例\n\nhttps://mybatis.net.cn/getting-started.html\n\n```xml\n<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<!DOCTYPE mapper\n  PUBLIC \"-//mybatis.org//DTD Mapper 3.0//EN\"\n  \"http://mybatis.org/dtd/mybatis-3-mapper.dtd\">\n<mapper namespace=\"org.mybatis.example.BlogMapper\">\n  <select id=\"selectBlog\" resultType=\"Blog\">\n    select * from Blog where id = #{id}\n  </select>\n</mapper>\n```\n\n安装MybatisX插件\n\n错误：\n> org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.springboot.mapper.UserMapper.listUsers\n\n如何解决？配置 mapper.xml\n\n## 后台增删改查\n\npageHelper\n```xml\n<dependency>\n    <groupId>com.github.pagehelper</groupId>\n    <artifactId>pagehelper-spring-boot-starter</artifactId>\n    <version>1.4.5</version>\n</dependency>\n```\n\n### axios安装和使用\n\n> npm i axios -S\n\naxios封装request.js\n\n```javascript\nimport axios from 'axios'\n\nconst request = axios.create({\n\tbaseURL: '/api',  // 注意！！ 这里是全局统一加上了 '/api' 前缀，也就是说所有接口都会加上'/api'前缀在，页面里面写接口的时候就不要加 '/api'了，否则会出现2个'/api'，类似 '/api/api/user'这样的报错，切记！！！\n    timeout: 5000\n})\n\n// request 拦截器\n// 可以自请求发送前对请求做一些处理\n// 比如统一加token，对请求参数统一加密\nrequest.interceptors.request.use(config => {\n    config.headers['Content-Type'] = 'application/json;charset=utf-8';\n  \n // config.headers['token'] = user.token;  // 设置请求头\n    return config\n}, error => {\n    return Promise.reject(error)\n});\n\n// response 拦截器\n// 可以在接口响应后统一处理结果\nrequest.interceptors.response.use(\n    response => {\n        let res = response.data;\n        // 兼容服务端返回的字符串数据\n        if (typeof res === 'string') {\n            res = res ? JSON.parse(res) : res\n        }\n        return res;\n    },\n    error => {\n        console.log('err' + error) // for debug\n        return Promise.reject(error)\n    }\n)\n\n\nexport default request\n```\n\n删除sql报错：\n\n> java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'where id = 12' at line\n\n如何解决？检查sql语法\n\n常见的错误：\n> java.lang.IllegalArgumentException: Source must not be null\n\n为什么会出现这个错误？\n因为写代码的时候未考虑异常情况，新手常犯错误！\n\n### 全局异常处理\n\n```java\nimport com.example.springboot.common.Result;\nimport lombok.extern.slf4j.Slf4j;\nimport org.springframework.web.bind.annotation.ExceptionHandler;\nimport org.springframework.web.bind.annotation.RestControllerAdvice;\n\n@Slf4j\n@RestControllerAdvice\npublic class ExceptionHandle {\n\n    @ExceptionHandler(value = ServiceException.class)\n    public Result serviceExceptionError(ServiceException e) {\n        log.error(\"业务异常\", e);\n        return Result.error(e.getMessage());\n    }\n\n    @ExceptionHandler(value = Exception.class)\n    public Result exceptionError(Exception e) {\n        log.error(\"系统错误\", e);\n        return Result.error(\"系统错误\");\n    }\n\n}\n\n```\n\n```java\npublic class ServiceException extends RuntimeException{\n\n    public ServiceException(String message) {\n        super(message);\n    }\n\n}\n```\n\n## 登录和数据安全\n\njs-cookie的使用\n\n```\nnpm i js-cookie -S\n\n// 导入使用\n\nimport Cookies from 'js-cookie'\n\nCookies.set('user', obj)  // 默认失效时间为该网站关闭时\nCookies.set('user', obj, { expires: 1 })  // 1天过期\n\nCookies.get('user')  // 获取cookie数据\n\nCookies.remove('user')  // 删除cookie数据\n```\n\n```sql\n-- 清空表数据\nTRUNCATE table admin;\n```\n\n> ### Cause: com.mysql.cj.jdbc.exceptions.MysqlDataTruncation: Data truncation: Data too long for column 'password' at row 1\n> 数据字段设置的长度不够\n> \n\n## 路由守卫\n\n```javascript\n// 404路由：\n {\n    path: '*',\n        component: () => import('@/views/404.vue'),\n}\n\nrouter.beforeEach((to, from, next) => {\n    if (to.path === '/login') next()\n    const admin = Cookies.get(\"admin\")\n    if (!admin && to.path !== '/login') return next(\"/login\")\n    next()\n})\n```\n\n> 错误：Uncaught (in promise) Error: Redirected when going from \"/login\" to \"/home\" via a navigation guard.\n> \n> 原因：cookie数据没存，就发生了跳转，我们应该先存数据，再跳转\n> \n> if (res.data !== null) {\nCookies.set('admin', JSON.stringify(res.data))\n}\nthis.$router.push('/')\n> \n\n```java\n//  设置自定义头配置\n\nimport org.springframework.context.annotation.Bean;\nimport org.springframework.context.annotation.Configuration;\nimport org.springframework.web.cors.CorsConfiguration;\nimport org.springframework.web.cors.UrlBasedCorsConfigurationSource;\nimport org.springframework.web.filter.CorsFilter;\n\n@Configuration\npublic class CorsConfig {\n\n\n    @Bean\n    public CorsFilter corsFilter() {\n        UrlBasedCorsConfigurationSource source = new UrlBasedCorsConfigurationSource();\n        CorsConfiguration corsConfiguration = new CorsConfiguration();\n        corsConfiguration.addAllowedOrigin(\"*\"); // 1 设置访问源地址\n        corsConfiguration.addAllowedHeader(\"*\"); // 2 设置访问源请求头\n        corsConfiguration.addAllowedMethod(\"*\"); // 3 设置访问源请求方法\n        source.registerCorsConfiguration(\"/**\", corsConfiguration); // 4 对接口配置跨域设置\n        return new CorsFilter(source);\n    }\n}\n```\n\n## 滑块验证\n\n开源插件地址：https://gitee.com/monoplasty/vue-monoplasty-slide-verify\n\n```javascript\nnpm i vue-monoplasty-slide-verify -S\n\nimport SlideVerify from 'vue-monoplasty-slide-verify';\nVue.use(SlideVerify);\n```\n\n```\n<el-card class=\"cover\" v-if=\"loginAdmin.id\">\n      <slide-verify :l=\"42\"\n                    :r=\"10\"\n                    :w=\"310\"\n                    :h=\"155\"\n                    slider-text=\"向右滑动\"\n                    @success=\"onSuccess\"\n                    @fail=\"onFail\"\n                    @refresh=\"onRefresh\"\n      ></slide-verify>\n    </el-card>\n    \n    \n函数：\n  onSuccess() {\n      Cookies.set('admin', JSON.stringify(this.loginAdmin))\n      this.$router.push('/')\n      this.$notify.success(\"登录成功\")\n    },\n    onFail() {\n      \n    },\n    onRefresh() {\n      console.log('refresh')\n    }\n    \n.cover {\n  width: fit-content;\n  background-color: white;\n  position: absolute;\n  top:50%;\n  left:50%;\n  transform: translate(-50%, -50%);\n  z-index: 1000;\n}\n```\n\n"
  },
  {
    "path": "文档/首页Echarts.md",
    "content": ""
  }
]