Mark 7 tahun lalu
induk
melakukan
5cd22466bd
100 mengubah file dengan 2302 tambahan dan 1777 penghapusan
  1. 191 674
      LICENSE
  2. 16 9
      pom-war.xml
  3. 21 9
      pom.xml
  4. 1 1
      src/main/java/io/renren/common/aspect/SysLogAspect.java
  5. 147 1
      src/main/java/io/renren/common/utils/DateUtils.java
  6. 35 0
      src/main/java/io/renren/common/utils/MapUtils.java
  7. 29 0
      src/main/java/io/renren/common/utils/PageUtils.java
  8. 56 27
      src/main/java/io/renren/common/utils/Query.java
  9. 18 0
      src/main/java/io/renren/config/CorsConfig.java
  10. 39 0
      src/main/java/io/renren/config/MybatisPlusConfig.java
  11. 0 7
      src/main/java/io/renren/config/ShiroConfig.java
  12. 1 1
      src/main/java/io/renren/config/SwaggerConfig.java
  13. 0 28
      src/main/java/io/renren/datasources/DataSourceTestService.java
  14. 7 5
      src/main/java/io/renren/modules/app/controller/ApiLoginController.java
  15. 16 5
      src/main/java/io/renren/modules/app/controller/ApiRegisterController.java
  16. 18 3
      src/main/java/io/renren/modules/app/dao/UserDao.java
  17. 38 8
      src/main/java/io/renren/modules/app/entity/UserEntity.java
  18. 17 16
      src/main/java/io/renren/modules/sys/form/LoginForm.java
  19. 54 0
      src/main/java/io/renren/modules/app/form/RegisterForm.java
  20. 1 1
      src/main/java/io/renren/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java
  21. 6 22
      src/main/java/io/renren/modules/app/service/UserService.java
  22. 9 53
      src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java
  23. 18 3
      src/main/java/io/renren/modules/job/config/ScheduleConfig.java
  24. 34 26
      src/main/java/io/renren/modules/job/controller/ScheduleJobController.java
  25. 27 22
      src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java
  26. 21 6
      src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java
  27. 21 6
      src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java
  28. 26 7
      src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java
  29. 26 6
      src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java
  30. 23 25
      src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java
  31. 24 21
      src/main/java/io/renren/modules/job/service/ScheduleJobService.java
  32. 31 22
      src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java
  33. 51 38
      src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java
  34. 22 9
      src/main/java/io/renren/modules/job/task/TestTask.java
  35. 26 12
      src/main/java/io/renren/modules/job/utils/ScheduleJob.java
  36. 19 4
      src/main/java/io/renren/modules/job/utils/ScheduleRunnable.java
  37. 33 20
      src/main/java/io/renren/modules/job/utils/ScheduleUtils.java
  38. 16 0
      src/main/java/io/renren/modules/oss/cloud/AliyunCloudStorageService.java
  39. 17 0
      src/main/java/io/renren/modules/oss/cloud/CloudStorageConfig.java
  40. 16 0
      src/main/java/io/renren/modules/oss/cloud/CloudStorageService.java
  41. 18 1
      src/main/java/io/renren/modules/oss/cloud/OSSFactory.java
  42. 16 0
      src/main/java/io/renren/modules/oss/cloud/QcloudCloudStorageService.java
  43. 16 0
      src/main/java/io/renren/modules/oss/cloud/QiniuCloudStorageService.java
  44. 32 23
      src/main/java/io/renren/modules/oss/controller/SysOssController.java
  45. 19 2
      src/main/java/io/renren/modules/oss/dao/SysOssDao.java
  46. 21 2
      src/main/java/io/renren/modules/oss/entity/SysOssEntity.java
  47. 21 16
      src/main/java/io/renren/modules/oss/service/SysOssService.java
  48. 30 42
      src/main/java/io/renren/modules/oss/service/impl/SysOssServiceImpl.java
  49. 29 19
      src/main/java/io/renren/modules/sys/controller/SysConfigController.java
  50. 22 12
      src/main/java/io/renren/modules/sys/controller/SysLogController.java
  51. 17 25
      src/main/java/io/renren/modules/sys/controller/SysLoginController.java
  52. 49 27
      src/main/java/io/renren/modules/sys/controller/SysMenuController.java
  53. 16 22
      src/main/java/io/renren/modules/sys/controller/SysRoleController.java
  54. 16 22
      src/main/java/io/renren/modules/sys/controller/SysUserController.java
  55. 0 41
      src/main/java/io/renren/modules/sys/dao/BaseDao.java
  56. 32 0
      src/main/java/io/renren/modules/sys/dao/SysCaptchaDao.java
  57. 21 3
      src/main/java/io/renren/modules/sys/dao/SysConfigDao.java
  58. 19 1
      src/main/java/io/renren/modules/sys/dao/SysLogDao.java
  59. 19 6
      src/main/java/io/renren/modules/sys/dao/SysMenuDao.java
  60. 2 1
      src/main/java/io/renren/modules/sys/dao/SysRoleDao.java
  61. 7 1
      src/main/java/io/renren/modules/sys/dao/SysRoleMenuDao.java
  62. 3 7
      src/main/java/io/renren/modules/sys/dao/SysUserDao.java
  63. 8 1
      src/main/java/io/renren/modules/sys/dao/SysUserRoleDao.java
  64. 2 3
      src/main/java/io/renren/modules/sys/dao/SysUserTokenDao.java
  65. 66 0
      src/main/java/io/renren/modules/sys/entity/SysCaptchaEntity.java
  66. 20 1
      src/main/java/io/renren/modules/sys/entity/SysConfigEntity.java
  67. 21 1
      src/main/java/io/renren/modules/sys/entity/SysLogEntity.java
  68. 26 1
      src/main/java/io/renren/modules/sys/entity/SysMenuEntity.java
  69. 7 1
      src/main/java/io/renren/modules/sys/entity/SysRoleEntity.java
  70. 6 1
      src/main/java/io/renren/modules/sys/entity/SysRoleMenuEntity.java
  71. 6 0
      src/main/java/io/renren/modules/sys/entity/SysUserEntity.java
  72. 5 1
      src/main/java/io/renren/modules/sys/entity/SysUserRoleEntity.java
  73. 5 0
      src/main/java/io/renren/modules/sys/entity/SysUserTokenEntity.java
  74. 5 0
      src/main/java/io/renren/modules/sys/oauth2/OAuth2Filter.java
  75. 44 0
      src/main/java/io/renren/modules/sys/service/SysCaptchaService.java
  76. 22 13
      src/main/java/io/renren/modules/sys/service/SysConfigService.java
  77. 24 14
      src/main/java/io/renren/modules/sys/service/SysLogService.java
  78. 22 35
      src/main/java/io/renren/modules/sys/service/SysMenuService.java
  79. 9 1
      src/main/java/io/renren/modules/sys/service/SysRoleMenuService.java
  80. 9 10
      src/main/java/io/renren/modules/sys/service/SysRoleService.java
  81. 9 3
      src/main/java/io/renren/modules/sys/service/SysUserRoleService.java
  82. 8 21
      src/main/java/io/renren/modules/sys/service/SysUserService.java
  83. 3 8
      src/main/java/io/renren/modules/sys/service/SysUserTokenService.java
  84. 2 2
      src/main/java/io/renren/modules/sys/service/impl/ShiroServiceImpl.java
  85. 79 0
      src/main/java/io/renren/modules/sys/service/impl/SysCaptchaServiceImpl.java
  86. 46 29
      src/main/java/io/renren/modules/sys/service/impl/SysConfigServiceImpl.java
  87. 35 37
      src/main/java/io/renren/modules/sys/service/impl/SysLogServiceImpl.java
  88. 34 42
      src/main/java/io/renren/modules/sys/service/impl/SysMenuServiceImpl.java
  89. 23 16
      src/main/java/io/renren/modules/sys/service/impl/SysRoleMenuServiceImpl.java
  90. 64 54
      src/main/java/io/renren/modules/sys/service/impl/SysRoleServiceImpl.java
  91. 20 17
      src/main/java/io/renren/modules/sys/service/impl/SysUserRoleServiceImpl.java
  92. 33 36
      src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java
  93. 8 24
      src/main/java/io/renren/modules/sys/service/impl/SysUserTokenServiceImpl.java
  94. 1 0
      src/main/resources/application-dev.yml
  95. 0 0
      src/main/resources/application-prod.yml
  96. 32 9
      src/main/resources/application.yml
  97. 1 1
      src/main/resources/banner.txt
  98. 1 1
      src/main/resources/logback-spring.xml
  99. 0 24
      src/main/resources/mapper/app/UserDao.xml
  100. 0 0
      src/main/resources/mapper/job/ScheduleJobDao.xml

+ 191 - 674
LICENSE

@@ -1,674 +1,191 @@
-GNU GENERAL PUBLIC LICENSE
-                       Version 3, 29 June 2007
-
- Copyright (C) 2007 Free Software Foundation, Inc. [http://fsf.org/]
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-                            Preamble
-
-  The GNU General Public License is a free, copyleft license for
-software and other kinds of works.
-
-  The licenses for most software and other practical works are designed
-to take away your freedom to share and change the works.  By contrast,
-the GNU General Public License is intended to guarantee your freedom to
-share and change all versions of a program--to make sure it remains free
-software for all its users.  We, the Free Software Foundation, use the
-GNU General Public License for most of our software; it applies also to
-any other work released this way by its authors.  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-them if you wish), that you receive source code or can get it if you
-want it, that you can change the software or use pieces of it in new
-free programs, and that you know you can do these things.
-
-  To protect your rights, we need to prevent others from denying you
-these rights or asking you to surrender the rights.  Therefore, you have
-certain responsibilities if you distribute copies of the software, or if
-you modify it: responsibilities to respect the freedom of others.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must pass on to the recipients the same
-freedoms that you received.  You must make sure that they, too, receive
-or can get the source code.  And you must show them these terms so they
-know their rights.
-
-  Developers that use the GNU GPL protect your rights with two steps:
-(1) assert copyright on the software, and (2) offer you this License
-giving you legal permission to copy, distribute and/or modify it.
-
-  For the developers' and authors' protection, the GPL clearly explains
-that there is no warranty for this free software.  For both users' and
-authors' sake, the GPL requires that modified versions be marked as
-changed, so that their problems will not be attributed erroneously to
-authors of previous versions.
-
-  Some devices are designed to deny users access to install or run
-modified versions of the software inside them, although the manufacturer
-can do so.  This is fundamentally incompatible with the aim of
-protecting users' freedom to change the software.  The systematic
-pattern of such abuse occurs in the area of products for individuals to
-use, which is precisely where it is most unacceptable.  Therefore, we
-have designed this version of the GPL to prohibit the practice for those
-products.  If such problems arise substantially in other domains, we
-stand ready to extend this provision to those domains in future versions
-of the GPL, as needed to protect the freedom of users.
-
-  Finally, every program is threatened constantly by software patents.
-States should not allow patents to restrict development and use of
-software on general-purpose computers, but in those that do, we wish to
-avoid the special danger that patents applied to a free program could
-make it effectively proprietary.  To prevent this, the GPL assures that
-patents cannot be used to render the program non-free.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-                       TERMS AND CONDITIONS
-
-  0. Definitions.
-
-  "This License" refers to version 3 of the GNU General Public License.
-
-  "Copyright" also means copyright-like laws that apply to other kinds of
-works, such as semiconductor masks.
-
-  "The Program" refers to any copyrightable work licensed under this
-License.  Each licensee is addressed as "you".  "Licensees" and
-"recipients" may be individuals or organizations.
-
-  To "modify" a work means to copy from or adapt all or part of the work
-in a fashion requiring copyright permission, other than the making of an
-exact copy.  The resulting work is called a "modified version" of the
-earlier work or a work "based on" the earlier work.
-
-  A "covered work" means either the unmodified Program or a work based
-on the Program.
-
-  To "propagate" a work means to do anything with it that, without
-permission, would make you directly or secondarily liable for
-infringement under applicable copyright law, except executing it on a
-computer or modifying a private copy.  Propagation includes copying,
-distribution (with or without modification), making available to the
-public, and in some countries other activities as well.
-
-  To "convey" a work means any kind of propagation that enables other
-parties to make or receive copies.  Mere interaction with a user through
-a computer network, with no transfer of a copy, is not conveying.
-
-  An interactive user interface displays "Appropriate Legal Notices"
-to the extent that it includes a convenient and prominently visible
-feature that (1) displays an appropriate copyright notice, and (2)
-tells the user that there is no warranty for the work (except to the
-extent that warranties are provided), that licensees may convey the
-work under this License, and how to view a copy of this License.  If
-the interface presents a list of user commands or options, such as a
-menu, a prominent item in the list meets this criterion.
-
-  1. Source Code.
-
-  The "source code" for a work means the preferred form of the work
-for making modifications to it.  "Object code" means any non-source
-form of a work.
-
-  A "Standard Interface" means an interface that either is an official
-standard defined by a recognized standards body, or, in the case of
-interfaces specified for a particular programming language, one that
-is widely used among developers working in that language.
-
-  The "System Libraries" of an executable work include anything, other
-than the work as a whole, that (a) is included in the normal form of
-packaging a Major Component, but which is not part of that Major
-Component, and (b) serves only to enable use of the work with that
-Major Component, or to implement a Standard Interface for which an
-implementation is available to the public in source code form.  A
-"Major Component", in this context, means a major essential component
-(kernel, window system, and so on) of the specific operating system
-(if any) on which the executable work runs, or a compiler used to
-produce the work, or an object code interpreter used to run it.
-
-  The "Corresponding Source" for a work in object code form means all
-the source code needed to generate, install, and (for an executable
-work) run the object code and to modify the work, including scripts to
-control those activities.  However, it does not include the work's
-System Libraries, or general-purpose tools or generally available free
-programs which are used unmodified in performing those activities but
-which are not part of the work.  For example, Corresponding Source
-includes interface definition files associated with source files for
-the work, and the source code for shared libraries and dynamically
-linked subprograms that the work is specifically designed to require,
-such as by intimate data communication or control flow between those
-subprograms and other parts of the work.
-
-  The Corresponding Source need not include anything that users
-can regenerate automatically from other parts of the Corresponding
-Source.
-
-  The Corresponding Source for a work in source code form is that
-same work.
-
-  2. Basic Permissions.
-
-  All rights granted under this License are granted for the term of
-copyright on the Program, and are irrevocable provided the stated
-conditions are met.  This License explicitly affirms your unlimited
-permission to run the unmodified Program.  The output from running a
-covered work is covered by this License only if the output, given its
-content, constitutes a covered work.  This License acknowledges your
-rights of fair use or other equivalent, as provided by copyright law.
-
-  You may make, run and propagate covered works that you do not
-convey, without conditions so long as your license otherwise remains
-in force.  You may convey covered works to others for the sole purpose
-of having them make modifications exclusively for you, or provide you
-with facilities for running those works, provided that you comply with
-the terms of this License in conveying all material for which you do
-not control copyright.  Those thus making or running the covered works
-for you must do so exclusively on your behalf, under your direction
-and control, on terms that prohibit them from making any copies of
-your copyrighted material outside their relationship with you.
-
-  Conveying under any other circumstances is permitted solely under
-the conditions stated below.  Sublicensing is not allowed; section 10
-makes it unnecessary.
-
-  3. Protecting Users' Legal Rights From Anti-Circumvention Law.
-
-  No covered work shall be deemed part of an effective technological
-measure under any applicable law fulfilling obligations under article
-11 of the WIPO copyright treaty adopted on 20 December 1996, or
-similar laws prohibiting or restricting circumvention of such
-measures.
-
-  When you convey a covered work, you waive any legal power to forbid
-circumvention of technological measures to the extent such circumvention
-is effected by exercising rights under this License with respect to
-the covered work, and you disclaim any intention to limit operation or
-modification of the work as a means of enforcing, against the work's
-users, your or third parties' legal rights to forbid circumvention of
-technological measures.
-
-  4. Conveying Verbatim Copies.
-
-  You may convey verbatim copies of the Program's source code as you
-receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice;
-keep intact all notices stating that this License and any
-non-permissive terms added in accord with section 7 apply to the code;
-keep intact all notices of the absence of any warranty; and give all
-recipients a copy of this License along with the Program.
-
-  You may charge any price or no price for each copy that you convey,
-and you may offer support or warranty protection for a fee.
-
-  5. Conveying Modified Source Versions.
-
-  You may convey a work based on the Program, or the modifications to
-produce it from the Program, in the form of source code under the
-terms of section 4, provided that you also meet all of these conditions:
-
-    a) The work must carry prominent notices stating that you modified
-    it, and giving a relevant date.
-
-    b) The work must carry prominent notices stating that it is
-    released under this License and any conditions added under section
-    7.  This requirement modifies the requirement in section 4 to
-    "keep intact all notices".
-
-    c) You must license the entire work, as a whole, under this
-    License to anyone who comes into possession of a copy.  This
-    License will therefore apply, along with any applicable section 7
-    additional terms, to the whole of the work, and all its parts,
-    regardless of how they are packaged.  This License gives no
-    permission to license the work in any other way, but it does not
-    invalidate such permission if you have separately received it.
-
-    d) If the work has interactive user interfaces, each must display
-    Appropriate Legal Notices; however, if the Program has interactive
-    interfaces that do not display Appropriate Legal Notices, your
-    work need not make them do so.
-
-  A compilation of a covered work with other separate and independent
-works, which are not by their nature extensions of the covered work,
-and which are not combined with it such as to form a larger program,
-in or on a volume of a storage or distribution medium, is called an
-"aggregate" if the compilation and its resulting copyright are not
-used to limit the access or legal rights of the compilation's users
-beyond what the individual works permit.  Inclusion of a covered work
-in an aggregate does not cause this License to apply to the other
-parts of the aggregate.
-
-  6. Conveying Non-Source Forms.
-
-  You may convey a covered work in object code form under the terms
-of sections 4 and 5, provided that you also convey the
-machine-readable Corresponding Source under the terms of this License,
-in one of these ways:
-
-    a) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by the
-    Corresponding Source fixed on a durable physical medium
-    customarily used for software interchange.
-
-    b) Convey the object code in, or embodied in, a physical product
-    (including a physical distribution medium), accompanied by a
-    written offer, valid for at least three years and valid for as
-    long as you offer spare parts or customer support for that product
-    model, to give anyone who possesses the object code either (1) a
-    copy of the Corresponding Source for all the software in the
-    product that is covered by this License, on a durable physical
-    medium customarily used for software interchange, for a price no
-    more than your reasonable cost of physically performing this
-    conveying of source, or (2) access to copy the
-    Corresponding Source from a network server at no charge.
-
-    c) Convey individual copies of the object code with a copy of the
-    written offer to provide the Corresponding Source.  This
-    alternative is allowed only occasionally and noncommercially, and
-    only if you received the object code with such an offer, in accord
-    with subsection 6b.
-
-    d) Convey the object code by offering access from a designated
-    place (gratis or for a charge), and offer equivalent access to the
-    Corresponding Source in the same way through the same place at no
-    further charge.  You need not require recipients to copy the
-    Corresponding Source along with the object code.  If the place to
-    copy the object code is a network server, the Corresponding Source
-    may be on a different server (operated by you or a third party)
-    that supports equivalent copying facilities, provided you maintain
-    clear directions next to the object code saying where to find the
-    Corresponding Source.  Regardless of what server hosts the
-    Corresponding Source, you remain obligated to ensure that it is
-    available for as long as needed to satisfy these requirements.
-
-    e) Convey the object code using peer-to-peer transmission, provided
-    you inform other peers where the object code and Corresponding
-    Source of the work are being offered to the general public at no
-    charge under subsection 6d.
-
-  A separable portion of the object code, whose source code is excluded
-from the Corresponding Source as a System Library, need not be
-included in conveying the object code work.
-
-  A "User Product" is either (1) a "consumer product", which means any
-tangible personal property which is normally used for personal, family,
-or household purposes, or (2) anything designed or sold for incorporation
-into a dwelling.  In determining whether a product is a consumer product,
-doubtful cases shall be resolved in favor of coverage.  For a particular
-product received by a particular user, "normally used" refers to a
-typical or common use of that class of product, regardless of the status
-of the particular user or of the way in which the particular user
-actually uses, or expects or is expected to use, the product.  A product
-is a consumer product regardless of whether the product has substantial
-commercial, industrial or non-consumer uses, unless such uses represent
-the only significant mode of use of the product.
-
-  "Installation Information" for a User Product means any methods,
-procedures, authorization keys, or other information required to install
-and execute modified versions of a covered work in that User Product from
-a modified version of its Corresponding Source.  The information must
-suffice to ensure that the continued functioning of the modified object
-code is in no case prevented or interfered with solely because
-modification has been made.
-
-  If you convey an object code work under this section in, or with, or
-specifically for use in, a User Product, and the conveying occurs as
-part of a transaction in which the right of possession and use of the
-User Product is transferred to the recipient in perpetuity or for a
-fixed term (regardless of how the transaction is characterized), the
-Corresponding Source conveyed under this section must be accompanied
-by the Installation Information.  But this requirement does not apply
-if neither you nor any third party retains the ability to install
-modified object code on the User Product (for example, the work has
-been installed in ROM).
-
-  The requirement to provide Installation Information does not include a
-requirement to continue to provide support service, warranty, or updates
-for a work that has been modified or installed by the recipient, or for
-the User Product in which it has been modified or installed.  Access to a
-network may be denied when the modification itself materially and
-adversely affects the operation of the network or violates the rules and
-protocols for communication across the network.
-
-  Corresponding Source conveyed, and Installation Information provided,
-in accord with this section must be in a format that is publicly
-documented (and with an implementation available to the public in
-source code form), and must require no special password or key for
-unpacking, reading or copying.
-
-  7. Additional Terms.
-
-  "Additional permissions" are terms that supplement the terms of this
-License by making exceptions from one or more of its conditions.
-Additional permissions that are applicable to the entire Program shall
-be treated as though they were included in this License, to the extent
-that they are valid under applicable law.  If additional permissions
-apply only to part of the Program, that part may be used separately
-under those permissions, but the entire Program remains governed by
-this License without regard to the additional permissions.
-
-  When you convey a copy of a covered work, you may at your option
-remove any additional permissions from that copy, or from any part of
-it.  (Additional permissions may be written to require their own
-removal in certain cases when you modify the work.)  You may place
-additional permissions on material, added by you to a covered work,
-for which you have or can give appropriate copyright permission.
-
-  Notwithstanding any other provision of this License, for material you
-add to a covered work, you may (if authorized by the copyright holders of
-that material) supplement the terms of this License with terms:
-
-    a) Disclaiming warranty or limiting liability differently from the
-    terms of sections 15 and 16 of this License; or
-
-    b) Requiring preservation of specified reasonable legal notices or
-    author attributions in that material or in the Appropriate Legal
-    Notices displayed by works containing it; or
-
-    c) Prohibiting misrepresentation of the origin of that material, or
-    requiring that modified versions of such material be marked in
-    reasonable ways as different from the original version; or
-
-    d) Limiting the use for publicity purposes of names of licensors or
-    authors of the material; or
-
-    e) Declining to grant rights under trademark law for use of some
-    trade names, trademarks, or service marks; or
-
-    f) Requiring indemnification of licensors and authors of that
-    material by anyone who conveys the material (or modified versions of
-    it) with contractual assumptions of liability to the recipient, for
-    any liability that these contractual assumptions directly impose on
-    those licensors and authors.
-
-  All other non-permissive additional terms are considered "further
-restrictions" within the meaning of section 10.  If the Program as you
-received it, or any part of it, contains a notice stating that it is
-governed by this License along with a term that is a further
-restriction, you may remove that term.  If a license document contains
-a further restriction but permits relicensing or conveying under this
-License, you may add to a covered work material governed by the terms
-of that license document, provided that the further restriction does
-not survive such relicensing or conveying.
-
-  If you add terms to a covered work in accord with this section, you
-must place, in the relevant source files, a statement of the
-additional terms that apply to those files, or a notice indicating
-where to find the applicable terms.
-
-  Additional terms, permissive or non-permissive, may be stated in the
-form of a separately written license, or stated as exceptions;
-the above requirements apply either way.
-
-  8. Termination.
-
-  You may not propagate or modify a covered work except as expressly
-provided under this License.  Any attempt otherwise to propagate or
-modify it is void, and will automatically terminate your rights under
-this License (including any patent licenses granted under the third
-paragraph of section 11).
-
-  However, if you cease all violation of this License, then your
-license from a particular copyright holder is reinstated (a)
-provisionally, unless and until the copyright holder explicitly and
-finally terminates your license, and (b) permanently, if the copyright
-holder fails to notify you of the violation by some reasonable means
-prior to 60 days after the cessation.
-
-  Moreover, your license from a particular copyright holder is
-reinstated permanently if the copyright holder notifies you of the
-violation by some reasonable means, this is the first time you have
-received notice of violation of this License (for any work) from that
-copyright holder, and you cure the violation prior to 30 days after
-your receipt of the notice.
-
-  Termination of your rights under this section does not terminate the
-licenses of parties who have received copies or rights from you under
-this License.  If your rights have been terminated and not permanently
-reinstated, you do not qualify to receive new licenses for the same
-material under section 10.
-
-  9. Acceptance Not Required for Having Copies.
-
-  You are not required to accept this License in order to receive or
-run a copy of the Program.  Ancillary propagation of a covered work
-occurring solely as a consequence of using peer-to-peer transmission
-to receive a copy likewise does not require acceptance.  However,
-nothing other than this License grants you permission to propagate or
-modify any covered work.  These actions infringe copyright if you do
-not accept this License.  Therefore, by modifying or propagating a
-covered work, you indicate your acceptance of this License to do so.
-
-  10. Automatic Licensing of Downstream Recipients.
-
-  Each time you convey a covered work, the recipient automatically
-receives a license from the original licensors, to run, modify and
-propagate that work, subject to this License.  You are not responsible
-for enforcing compliance by third parties with this License.
-
-  An "entity transaction" is a transaction transferring control of an
-organization, or substantially all assets of one, or subdividing an
-organization, or merging organizations.  If propagation of a covered
-work results from an entity transaction, each party to that
-transaction who receives a copy of the work also receives whatever
-licenses to the work the party's predecessor in interest had or could
-give under the previous paragraph, plus a right to possession of the
-Corresponding Source of the work from the predecessor in interest, if
-the predecessor has it or can get it with reasonable efforts.
-
-  You may not impose any further restrictions on the exercise of the
-rights granted or affirmed under this License.  For example, you may
-not impose a license fee, royalty, or other charge for exercise of
-rights granted under this License, and you may not initiate litigation
-(including a cross-claim or counterclaim in a lawsuit) alleging that
-any patent claim is infringed by making, using, selling, offering for
-sale, or importing the Program or any portion of it.
-
-  11. Patents.
-
-  A "contributor" is a copyright holder who authorizes use under this
-License of the Program or a work on which the Program is based.  The
-work thus licensed is called the contributor's "contributor version".
-
-  A contributor's "essential patent claims" are all patent claims
-owned or controlled by the contributor, whether already acquired or
-hereafter acquired, that would be infringed by some manner, permitted
-by this License, of making, using, or selling its contributor version,
-but do not include claims that would be infringed only as a
-consequence of further modification of the contributor version.  For
-purposes of this definition, "control" includes the right to grant
-patent sublicenses in a manner consistent with the requirements of
-this License.
-
-  Each contributor grants you a non-exclusive, worldwide, royalty-free
-patent license under the contributor's essential patent claims, to
-make, use, sell, offer for sale, import and otherwise run, modify and
-propagate the contents of its contributor version.
-
-  In the following three paragraphs, a "patent license" is any express
-agreement or commitment, however denominated, not to enforce a patent
-(such as an express permission to practice a patent or covenant not to
-sue for patent infringement).  To "grant" such a patent license to a
-party means to make such an agreement or commitment not to enforce a
-patent against the party.
-
-  If you convey a covered work, knowingly relying on a patent license,
-and the Corresponding Source of the work is not available for anyone
-to copy, free of charge and under the terms of this License, through a
-publicly available network server or other readily accessible means,
-then you must either (1) cause the Corresponding Source to be so
-available, or (2) arrange to deprive yourself of the benefit of the
-patent license for this particular work, or (3) arrange, in a manner
-consistent with the requirements of this License, to extend the patent
-license to downstream recipients.  "Knowingly relying" means you have
-actual knowledge that, but for the patent license, your conveying the
-covered work in a country, or your recipient's use of the covered work
-in a country, would infringe one or more identifiable patents in that
-country that you have reason to believe are valid.
-
-  If, pursuant to or in connection with a single transaction or
-arrangement, you convey, or propagate by procuring conveyance of, a
-covered work, and grant a patent license to some of the parties
-receiving the covered work authorizing them to use, propagate, modify
-or convey a specific copy of the covered work, then the patent license
-you grant is automatically extended to all recipients of the covered
-work and works based on it.
-
-  A patent license is "discriminatory" if it does not include within
-the scope of its coverage, prohibits the exercise of, or is
-conditioned on the non-exercise of one or more of the rights that are
-specifically granted under this License.  You may not convey a covered
-work if you are a party to an arrangement with a third party that is
-in the business of distributing software, under which you make payment
-to the third party based on the extent of your activity of conveying
-the work, and under which the third party grants, to any of the
-parties who would receive the covered work from you, a discriminatory
-patent license (a) in connection with copies of the covered work
-conveyed by you (or copies made from those copies), or (b) primarily
-for and in connection with specific products or compilations that
-contain the covered work, unless you entered into that arrangement,
-or that patent license was granted, prior to 28 March 2007.
-
-  Nothing in this License shall be construed as excluding or limiting
-any implied license or other defenses to infringement that may
-otherwise be available to you under applicable patent law.
-
-  12. No Surrender of Others' Freedom.
-
-  If conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot convey a
-covered work so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you may
-not convey it at all.  For example, if you agree to terms that obligate you
-to collect a royalty for further conveying from those to whom you convey
-the Program, the only way you could satisfy both those terms and this
-License would be to refrain entirely from conveying the Program.
-
-  13. Use with the GNU Affero General Public License.
-
-  Notwithstanding any other provision of this License, you have
-permission to link or combine any covered work with a work licensed
-under version 3 of the GNU Affero General Public License into a single
-combined work, and to convey the resulting work.  The terms of this
-License will continue to apply to the part which is the covered work,
-but the special requirements of the GNU Affero General Public License,
-section 13, concerning interaction through a network will apply to the
-combination as such.
-
-  14. Revised Versions of this License.
-
-  The Free Software Foundation may publish revised and/or new versions of
-the GNU General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the
-Program specifies that a certain numbered version of the GNU General
-Public License "or any later version" applies to it, you have the
-option of following the terms and conditions either of that numbered
-version or of any later version published by the Free Software
-Foundation.  If the Program does not specify a version number of the
-GNU General Public License, you may choose any version ever published
-by the Free Software Foundation.
-
-  If the Program specifies that a proxy can decide which future
-versions of the GNU General Public License can be used, that proxy's
-public statement of acceptance of a version permanently authorizes you
-to choose that version for the Program.
-
-  Later license versions may give you additional or different
-permissions.  However, no additional obligations are imposed on any
-author or copyright holder as a result of your choosing to follow a
-later version.
-
-  15. Disclaimer of Warranty.
-
-  THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
-APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
-HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
-OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
-IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
-ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. Limitation of Liability.
-
-  IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
-THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
-USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
-DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
-PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
-EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGES.
-
-  17. Interpretation of Sections 15 and 16.
-
-  If the disclaimer of warranty and limitation of liability provided
-above cannot be given local legal effect according to their terms,
-reviewing courts shall apply local law that most closely approximates
-an absolute waiver of all civil liability in connection with the
-Program, unless a warranty or assumption of liability accompanies a
-copy of the Program in return for a fee.
-
-                     END OF TERMS AND CONDITIONS
-
-            How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-state the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    {one line to give the program's name and a brief idea of what it does.}
-    Copyright (C) {year}  {fullname}
-
-    This program is free software: you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation, either version 3 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program.  If not, see [http://www.gnu.org/licenses/].
-
-Also add information on how to contact you by electronic and paper mail.
-
-  If the program does terminal interaction, make it output a short
-notice like this when it starts in an interactive mode:
-
-    renren-fast  Copyright (C) 2017  人人开源
-    This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, your program's commands
-might be different; for a GUI interface, you would use an "about box".
-
-  You should also get your employer (if you work as a programmer) or school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.
-For more information on this, and how to apply and follow the GNU GPL, see
-[http://www.gnu.org/licenses/].
-
-  The GNU General Public License does not permit incorporating your program
-into proprietary programs.  If your program is a subroutine library, you
-may consider it more useful to permit linking proprietary applications with
-the library.  If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.  But first, please read
-[http://www.gnu.org/philosophy/why-not-lgpl.html].
+Apache License
+Version 2.0, January 2004
+http://www.apache.org/licenses/
+
+TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+1. Definitions.
+
+"License" shall mean the terms and conditions for use, reproduction, and
+distribution as defined by Sections 1 through 9 of this document.
+
+"Licensor" shall mean the copyright owner or entity authorized by the copyright
+owner that is granting the License.
+
+"Legal Entity" shall mean the union of the acting entity and all other entities
+that control, are controlled by, or are under common control with that entity.
+For the purposes of this definition, "control" means (i) the power, direct or
+indirect, to cause the direction or management of such entity, whether by
+contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the
+outstanding shares, or (iii) beneficial ownership of such entity.
+
+"You" (or "Your") shall mean an individual or Legal Entity exercising
+permissions granted by this License.
+
+"Source" form shall mean the preferred form for making modifications, including
+but not limited to software source code, documentation source, and configuration
+files.
+
+"Object" form shall mean any form resulting from mechanical transformation or
+translation of a Source form, including but not limited to compiled object code,
+generated documentation, and conversions to other media types.
+
+"Work" shall mean the work of authorship, whether in Source or Object form, made
+available under the License, as indicated by a copyright notice that is included
+in or attached to the work (an example is provided in the Appendix below).
+
+"Derivative Works" shall mean any work, whether in Source or Object form, that
+is based on (or derived from) the Work and for which the editorial revisions,
+annotations, elaborations, or other modifications represent, as a whole, an
+original work of authorship. For the purposes of this License, Derivative Works
+shall not include works that remain separable from, or merely link (or bind by
+name) to the interfaces of, the Work and Derivative Works thereof.
+
+"Contribution" shall mean any work of authorship, including the original version
+of the Work and any modifications or additions to that Work or Derivative Works
+thereof, that is intentionally submitted to Licensor for inclusion in the Work
+by the copyright owner or by an individual or Legal Entity authorized to submit
+on behalf of the copyright owner. For the purposes of this definition,
+"submitted" means any form of electronic, verbal, or written communication sent
+to the Licensor or its representatives, including but not limited to
+communication on electronic mailing lists, source code control systems, and
+issue tracking systems that are managed by, or on behalf of, the Licensor for
+the purpose of discussing and improving the Work, but excluding communication
+that is conspicuously marked or otherwise designated in writing by the copyright
+owner as "Not a Contribution."
+
+"Contributor" shall mean Licensor and any individual or Legal Entity on behalf
+of whom a Contribution has been received by Licensor and subsequently
+incorporated within the Work.
+
+2. Grant of Copyright License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable copyright license to reproduce, prepare Derivative Works of,
+publicly display, publicly perform, sublicense, and distribute the Work and such
+Derivative Works in Source or Object form.
+
+3. Grant of Patent License.
+
+Subject to the terms and conditions of this License, each Contributor hereby
+grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free,
+irrevocable (except as stated in this section) patent license to make, have
+made, use, offer to sell, sell, import, and otherwise transfer the Work, where
+such license applies only to those patent claims licensable by such Contributor
+that are necessarily infringed by their Contribution(s) alone or by combination
+of their Contribution(s) with the Work to which such Contribution(s) was
+submitted. If You institute patent litigation against any entity (including a
+cross-claim or counterclaim in a lawsuit) alleging that the Work or a
+Contribution incorporated within the Work constitutes direct or contributory
+patent infringement, then any patent licenses granted to You under this License
+for that Work shall terminate as of the date such litigation is filed.
+
+4. Redistribution.
+
+You may reproduce and distribute copies of the Work or Derivative Works thereof
+in any medium, with or without modifications, and in Source or Object form,
+provided that You meet the following conditions:
+
+You must give any other recipients of the Work or Derivative Works a copy of
+this License; and
+You must cause any modified files to carry prominent notices stating that You
+changed the files; and
+You must retain, in the Source form of any Derivative Works that You distribute,
+all copyright, patent, trademark, and attribution notices from the Source form
+of the Work, excluding those notices that do not pertain to any part of the
+Derivative Works; and
+If the Work includes a "NOTICE" text file as part of its distribution, then any
+Derivative Works that You distribute must include a readable copy of the
+attribution notices contained within such NOTICE file, excluding those notices
+that do not pertain to any part of the Derivative Works, in at least one of the
+following places: within a NOTICE text file distributed as part of the
+Derivative Works; within the Source form or documentation, if provided along
+with the Derivative Works; or, within a display generated by the Derivative
+Works, if and wherever such third-party notices normally appear. The contents of
+the NOTICE file are for informational purposes only and do not modify the
+License. You may add Your own attribution notices within Derivative Works that
+You distribute, alongside or as an addendum to the NOTICE text from the Work,
+provided that such additional attribution notices cannot be construed as
+modifying the License.
+You may add Your own copyright statement to Your modifications and may provide
+additional or different license terms and conditions for use, reproduction, or
+distribution of Your modifications, or for any such Derivative Works as a whole,
+provided Your use, reproduction, and distribution of the Work otherwise complies
+with the conditions stated in this License.
+
+5. Submission of Contributions.
+
+Unless You explicitly state otherwise, any Contribution intentionally submitted
+for inclusion in the Work by You to the Licensor shall be under the terms and
+conditions of this License, without any additional terms or conditions.
+Notwithstanding the above, nothing herein shall supersede or modify the terms of
+any separate license agreement you may have executed with Licensor regarding
+such Contributions.
+
+6. Trademarks.
+
+This License does not grant permission to use the trade names, trademarks,
+service marks, or product names of the Licensor, except as required for
+reasonable and customary use in describing the origin of the Work and
+reproducing the content of the NOTICE file.
+
+7. Disclaimer of Warranty.
+
+Unless required by applicable law or agreed to in writing, Licensor provides the
+Work (and each Contributor provides its Contributions) on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied,
+including, without limitation, any warranties or conditions of TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are
+solely responsible for determining the appropriateness of using or
+redistributing the Work and assume any risks associated with Your exercise of
+permissions under this License.
+
+8. Limitation of Liability.
+
+In no event and under no legal theory, whether in tort (including negligence),
+contract, or otherwise, unless required by applicable law (such as deliberate
+and grossly negligent acts) or agreed to in writing, shall any Contributor be
+liable to You for damages, including any direct, indirect, special, incidental,
+or consequential damages of any character arising as a result of this License or
+out of the use or inability to use the Work (including but not limited to
+damages for loss of goodwill, work stoppage, computer failure or malfunction, or
+any and all other commercial damages or losses), even if such Contributor has
+been advised of the possibility of such damages.
+
+9. Accepting Warranty or Additional Liability.
+
+While redistributing the Work or Derivative Works thereof, You may choose to
+offer, and charge a fee for, acceptance of support, warranty, indemnity, or
+other liability obligations and/or rights consistent with this License. However,
+in accepting such obligations, You may act only on Your own behalf and on Your
+sole responsibility, not on behalf of any other Contributor, and only if You
+agree to indemnify, defend, and hold each Contributor harmless for any liability
+incurred by, or claims asserted against, such Contributor by reason of your
+accepting any such warranty or additional liability.
+
+END OF TERMS AND CONDITIONS
+
+APPENDIX: How to apply the Apache License to your work
+
+To apply the Apache License to your work, attach the following boilerplate
+notice, with the fields enclosed by brackets "{}" replaced with your own
+identifying information. (Don't include the brackets!) The text should be
+enclosed in the appropriate comment syntax for the file format. We also
+recommend that a file or class name and description of purpose be included on
+the same "printed page" as the copyright notice for easier identification within
+third-party archives.
+
+   Copyright 2018 人人开源
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+     http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.

+ 16 - 9
pom-war.xml

@@ -4,21 +4,22 @@
     <modelVersion>4.0.0</modelVersion>
     <groupId>io.renren</groupId>
     <artifactId>renren-fast</artifactId>
-    <version>1.0.0</version>
+    <version>2.0.0</version>
     <packaging>war</packaging>
     <description>war包对应的pom,打war包,执行【mvn clean package -f pom-war.xml】</description>
 
     <parent>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-parent</artifactId>
-        <version>1.5.4.RELEASE</version>
+        <version>1.5.10.RELEASE</version>
     </parent>
 
     <properties>
         <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
         <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
         <java.version>1.8</java.version>
-        <mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version>
+        <mybatisplus.spring.boot.version>1.0.5</mybatisplus.spring.boot.version>
+        <mybatisplus.version>2.1.9</mybatisplus.version>
         <mysql.version>5.1.38</mysql.version>
         <druid.version>1.1.3</druid.version>
         <quartz.version>2.3.0</quartz.version>
@@ -33,6 +34,7 @@
         <qiniu.version>[7.2.0, 7.2.99]</qiniu.version>
         <aliyun.oss.version>2.5.0</aliyun.oss.version>
         <qcloud.cos.version>4.4</qcloud.cos.version>
+        <joda.time.version>2.9.9</joda.time.version>
     </properties>
 
     <dependencies>
@@ -68,14 +70,14 @@
             <optional>true</optional>
         </dependency>
         <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-devtools</artifactId>
-            <optional>true</optional>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatisplus-spring-boot-starter</artifactId>
+            <version>${mybatisplus.spring.boot.version}</version>
         </dependency>
         <dependency>
-            <groupId>org.mybatis.spring.boot</groupId>
-            <artifactId>mybatis-spring-boot-starter</artifactId>
-            <version>${mybatis.spring.boot.version}</version>
+            <groupId>com.baomidou</groupId>
+            <artifactId>mybatis-plus</artifactId>
+            <version>${mybatisplus.version}</version>
         </dependency>
         <dependency>
             <groupId>mysql</groupId>
@@ -164,6 +166,11 @@
                 </exclusion>
             </exclusions>
         </dependency>
+        <dependency>
+            <groupId>joda-time</groupId>
+            <artifactId>joda-time</artifactId>
+            <version>${joda.time.version}</version>
+        </dependency>
     </dependencies>
 
     <build>

+ 21 - 9
pom.xml

@@ -4,21 +4,22 @@
 	<modelVersion>4.0.0</modelVersion>
 	<groupId>io.renren</groupId>
 	<artifactId>renren-fast</artifactId>
-	<version>1.3.0</version>
+	<version>2.0.0</version>
 	<packaging>jar</packaging>
 	<description>renren-fast</description>
 
 	<parent>
 		<groupId>org.springframework.boot</groupId>
 		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>1.5.6.RELEASE</version>
+		<version>1.5.10.RELEASE</version>
 	</parent>
 
 	<properties>
 		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
 		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 		<java.version>1.8</java.version>
-		<mybatis.spring.boot.version>1.3.0</mybatis.spring.boot.version>
+		<mybatisplus.spring.boot.version>1.0.5</mybatisplus.spring.boot.version>
+		<mybatisplus.version>2.1.9</mybatisplus.version>
 		<mysql.version>5.1.38</mysql.version>
 		<druid.version>1.1.3</druid.version>
 		<quartz.version>2.3.0</quartz.version>
@@ -34,6 +35,7 @@
 		<aliyun.oss.version>2.5.0</aliyun.oss.version>
 		<qcloud.cos.version>4.4</qcloud.cos.version>
 		<swagger.version>2.2.2</swagger.version>
+		<joda.time.version>2.9.9</joda.time.version>
 
 		<!--wagon plugin 配置-->
 		<service-path>/work/renren</service-path>
@@ -70,15 +72,20 @@
 			<artifactId>spring-boot-configuration-processor</artifactId>
 			<optional>true</optional>
 		</dependency>
+		<!--<dependency>-->
+			<!--<groupId>org.springframework.boot</groupId>-->
+			<!--<artifactId>spring-boot-devtools</artifactId>-->
+			<!--<optional>true</optional>-->
+		<!--</dependency>-->
 		<dependency>
-			<groupId>org.springframework.boot</groupId>
-			<artifactId>spring-boot-devtools</artifactId>
-			<optional>true</optional>
+			<groupId>com.baomidou</groupId>
+			<artifactId>mybatisplus-spring-boot-starter</artifactId>
+			<version>${mybatisplus.spring.boot.version}</version>
 		</dependency>
 		<dependency>
-			<groupId>org.mybatis.spring.boot</groupId>
-			<artifactId>mybatis-spring-boot-starter</artifactId>
-			<version>${mybatis.spring.boot.version}</version>
+			<groupId>com.baomidou</groupId>
+			<artifactId>mybatis-plus</artifactId>
+			<version>${mybatisplus.version}</version>
 		</dependency>
 		<dependency>
 			<groupId>mysql</groupId>
@@ -177,6 +184,11 @@
 				</exclusion>
 			</exclusions>
 		</dependency>
+		<dependency>
+			<groupId>joda-time</groupId>
+			<artifactId>joda-time</artifactId>
+			<version>${joda.time.version}</version>
+		</dependency>
 	</dependencies>
 
 	<build>

+ 1 - 1
src/main/java/io/renren/common/aspect/SysLogAspect.java

@@ -90,6 +90,6 @@ public class SysLogAspect {
 		sysLog.setTime(time);
 		sysLog.setCreateDate(new Date());
 		//保存系统日志
-		sysLogService.save(sysLog);
+		sysLogService.insert(sysLog);
 	}
 }

+ 147 - 1
src/main/java/io/renren/common/utils/DateUtils.java

@@ -1,5 +1,27 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.common.utils;
 
+import org.apache.commons.lang.StringUtils;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+import org.joda.time.format.DateTimeFormat;
+import org.joda.time.format.DateTimeFormatter;
+
 import java.text.SimpleDateFormat;
 import java.util.Date;
 
@@ -15,11 +37,22 @@ public class DateUtils {
 	public final static String DATE_PATTERN = "yyyy-MM-dd";
 	/** 时间格式(yyyy-MM-dd HH:mm:ss) */
 	public final static String DATE_TIME_PATTERN = "yyyy-MM-dd HH:mm:ss";
-	
+
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd
+     * @param date  日期
+     * @return  返回yyyy-MM-dd格式日期
+     */
 	public static String format(Date date) {
         return format(date, DATE_PATTERN);
     }
 
+    /**
+     * 日期格式化 日期格式为:yyyy-MM-dd
+     * @param date  日期
+     * @param pattern  格式,如:DateUtils.DATE_TIME_PATTERN
+     * @return  返回yyyy-MM-dd格式日期
+     */
     public static String format(Date date, String pattern) {
         if(date != null){
             SimpleDateFormat df = new SimpleDateFormat(pattern);
@@ -27,4 +60,117 @@ public class DateUtils {
         }
         return null;
     }
+
+    /**
+     * 字符串转换成日期
+     * @param strDate 日期字符串
+     * @param pattern 日期的格式,如:DateUtils.DATE_TIME_PATTERN
+     */
+    public static Date stringToDate(String strDate, String pattern) {
+        if (StringUtils.isBlank(strDate)){
+            return null;
+        }
+
+        DateTimeFormatter fmt = DateTimeFormat.forPattern(pattern);
+        return fmt.parseLocalDateTime(strDate).toDate();
+    }
+
+    /**
+     * 根据周数,获取开始日期、结束日期
+     * @param week  周期  0本周,-1上周,-2上上周,1下周,2下下周
+     * @return  返回date[0]开始日期、date[1]结束日期
+     */
+    public static Date[] getWeekStartAndEnd(int week) {
+        DateTime dateTime = new DateTime();
+        LocalDate date = new LocalDate(dateTime.plusWeeks(week));
+
+        date = date.dayOfWeek().withMinimumValue();
+        Date beginDate = date.toDate();
+        Date endDate = date.plusDays(6).toDate();
+        return new Date[]{beginDate, endDate};
+    }
+
+    /**
+     * 对日期的【秒】进行加/减
+     *
+     * @param date 日期
+     * @param seconds 秒数,负数为减
+     * @return 加/减几秒后的日期
+     */
+    public static Date addDateSeconds(Date date, int seconds) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusSeconds(seconds).toDate();
+    }
+
+    /**
+     * 对日期的【分钟】进行加/减
+     *
+     * @param date 日期
+     * @param minutes 分钟数,负数为减
+     * @return 加/减几分钟后的日期
+     */
+    public static Date addDateMinutes(Date date, int minutes) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusMinutes(minutes).toDate();
+    }
+
+    /**
+     * 对日期的【小时】进行加/减
+     *
+     * @param date 日期
+     * @param hours 小时数,负数为减
+     * @return 加/减几小时后的日期
+     */
+    public static Date addDateHours(Date date, int hours) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusHours(hours).toDate();
+    }
+
+    /**
+     * 对日期的【天】进行加/减
+     *
+     * @param date 日期
+     * @param days 天数,负数为减
+     * @return 加/减几天后的日期
+     */
+    public static Date addDateDays(Date date, int days) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusDays(days).toDate();
+    }
+
+    /**
+     * 对日期的【周】进行加/减
+     *
+     * @param date 日期
+     * @param weeks 周数,负数为减
+     * @return 加/减几周后的日期
+     */
+    public static Date addDateWeeks(Date date, int weeks) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusWeeks(weeks).toDate();
+    }
+
+    /**
+     * 对日期的【月】进行加/减
+     *
+     * @param date 日期
+     * @param months 月数,负数为减
+     * @return 加/减几月后的日期
+     */
+    public static Date addDateMonths(Date date, int months) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusMonths(months).toDate();
+    }
+
+    /**
+     * 对日期的【年】进行加/减
+     *
+     * @param date 日期
+     * @param years 年数,负数为减
+     * @return 加/减几年后的日期
+     */
+    public static Date addDateYears(Date date, int years) {
+        DateTime dateTime = new DateTime(date);
+        return dateTime.plusYears(years).toDate();
+    }
 }

+ 35 - 0
src/main/java/io/renren/common/utils/MapUtils.java

@@ -0,0 +1,35 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.common.utils;
+
+import java.util.HashMap;
+
+
+/**
+ * Map工具类
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0
+ */
+public class MapUtils extends HashMap<String, Object> {
+
+    @Override
+    public MapUtils put(String key, Object value) {
+        super.put(key, value);
+        return this;
+    }
+}

+ 29 - 0
src/main/java/io/renren/common/utils/PageUtils.java

@@ -1,5 +1,23 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.common.utils;
 
+import com.baomidou.mybatisplus.plugins.Page;
+
 import java.io.Serializable;
 import java.util.List;
 
@@ -38,6 +56,17 @@ public class PageUtils implements Serializable {
 		this.totalPage = (int)Math.ceil((double)totalCount/pageSize);
 	}
 
+	/**
+	 * 分页
+	 */
+	public PageUtils(Page<?> page) {
+		this.list = page.getRecords();
+		this.totalCount = page.getTotal();
+		this.pageSize = page.getSize();
+		this.currPage = page.getCurrent();
+		this.totalPage = page.getPages();
+	}
+
 	public int getTotalCount() {
 		return totalCount;
 	}

+ 56 - 27
src/main/java/io/renren/common/utils/Query.java

@@ -1,5 +1,22 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.common.utils;
 
+import com.baomidou.mybatisplus.plugins.Page;
 import io.renren.common.xss.SQLFilter;
 import org.apache.commons.lang.StringUtils;
 
@@ -9,53 +26,65 @@ import java.util.Map;
 /**
  * 查询参数
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-03-14 23:15
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2017-03-14
  */
-public class Query extends LinkedHashMap<String, Object> {
+public class Query<T> extends LinkedHashMap<String, Object> {
 	private static final long serialVersionUID = 1L;
-	//当前页码
-    private int page;
-    //每页条数
-    private int limit;
+    /**
+     * mybatis-plus分页参数
+     */
+    private Page<T> page;
+    /**
+     * 当前页码
+     */
+    private int currPage = 1;
+    /**
+     * 每页条数
+     */
+    private int limit = 10;
 
     public Query(Map<String, Object> params){
         this.putAll(params);
 
         //分页参数
-        this.page = Integer.parseInt(params.get("page").toString());
-        this.limit = Integer.parseInt(params.get("limit").toString());
-        this.put("offset", (page - 1) * limit);
-        this.put("page", page);
+        if(params.get("page") != null){
+            currPage = Integer.parseInt((String)params.get("page"));
+        }
+        if(params.get("limit") != null){
+            limit = Integer.parseInt((String)params.get("limit"));
+        }
+
+        this.put("offset", (currPage - 1) * limit);
+        this.put("page", currPage);
         this.put("limit", limit);
 
         //防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险)
-        String sidx = (String)params.get("sidx");
-        String order = (String)params.get("order");
-        if(StringUtils.isNotBlank(sidx)){
-            this.put("sidx", SQLFilter.sqlInject(sidx));
-        }
-        if(StringUtils.isNotBlank(order)){
-            this.put("order", SQLFilter.sqlInject(order));
+        String sidx = SQLFilter.sqlInject((String)params.get("sidx"));
+        String order = SQLFilter.sqlInject((String)params.get("order"));
+        this.put("sidx", sidx);
+        this.put("order", order);
+
+        //mybatis-plus分页
+        this.page = new Page<>(currPage, limit);
+
+        //排序
+        if(StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)){
+            this.page.setOrderByField(sidx);
+            this.page.setAsc("ASC".equalsIgnoreCase(order));
         }
 
     }
 
-
-    public int getPage() {
+    public Page<T> getPage() {
         return page;
     }
 
-    public void setPage(int page) {
-        this.page = page;
+    public int getCurrPage() {
+        return currPage;
     }
 
     public int getLimit() {
         return limit;
     }
-
-    public void setLimit(int limit) {
-        this.limit = limit;
-    }
 }

+ 18 - 0
src/main/java/io/renren/config/CorsConfig.java

@@ -0,0 +1,18 @@
+package io.renren.config;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.web.servlet.config.annotation.CorsRegistry;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
+
+@Configuration
+public class CorsConfig extends WebMvcConfigurerAdapter {
+
+    @Override
+    public void addCorsMappings(CorsRegistry registry) {
+        registry.addMapping("/**")
+            .allowedOrigins("*")
+            .allowCredentials(true)
+            .allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS")
+            .maxAge(3600);
+    }
+}

+ 39 - 0
src/main/java/io/renren/config/MybatisPlusConfig.java

@@ -0,0 +1,39 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.config;
+
+import com.baomidou.mybatisplus.plugins.PaginationInterceptor;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * mybatis-plus配置
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2018-02-05
+ */
+@Configuration
+public class MybatisPlusConfig {
+
+    /**
+     * 分页插件
+     */
+    @Bean
+    public PaginationInterceptor paginationInterceptor() {
+        return new PaginationInterceptor();
+    }
+}

+ 0 - 7
src/main/java/io/renren/config/ShiroConfig.java

@@ -60,18 +60,11 @@ public class ShiroConfig {
         filterMap.put("/druid/**", "anon");
         filterMap.put("/app/**", "anon");
         filterMap.put("/sys/login", "anon");
-        filterMap.put("/**/*.css", "anon");
-        filterMap.put("/**/*.js", "anon");
-        filterMap.put("/**/*.html", "anon");
-        filterMap.put("/fonts/**", "anon");
-        filterMap.put("/plugins/**", "anon");
         filterMap.put("/swagger/**", "anon");
         filterMap.put("/v2/api-docs", "anon");
         filterMap.put("/swagger-ui.html", "anon");
         filterMap.put("/swagger-resources/**", "anon");
-        filterMap.put("/favicon.ico", "anon");
         filterMap.put("/captcha.jpg", "anon");
-        filterMap.put("/", "anon");
         filterMap.put("/**", "oauth2");
         shiroFilter.setFilterChainDefinitionMap(filterMap);
 

+ 1 - 1
src/main/java/io/renren/config/SwaggerConfig.java

@@ -39,7 +39,7 @@ public class SwaggerConfig extends WebMvcConfigurerAdapter {
             .title("人人开源")
             .description("renren-fast文档")
             .termsOfServiceUrl("http://www.renren.io")
-            .version("1.3")
+            .version("2.0")
             .build();
     }
 

+ 0 - 28
src/main/java/io/renren/datasources/DataSourceTestService.java

@@ -1,28 +0,0 @@
-package io.renren.datasources;
-
-import io.renren.datasources.annotation.DataSource;
-import io.renren.modules.app.entity.UserEntity;
-import io.renren.modules.app.service.UserService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-/**
- * 测试
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017/9/16 23:10
- */
-@Service
-public class DataSourceTestService {
-    @Autowired
-    private UserService userService;
-
-    public UserEntity queryObject(Long userId){
-        return userService.queryObject(userId);
-    }
-
-    @DataSource(name = DataSourceNames.SECOND)
-    public UserEntity queryObject2(Long userId){
-        return userService.queryObject(userId);
-    }
-}

+ 7 - 5
src/main/java/io/renren/modules/app/controller/ApiLoginController.java

@@ -2,13 +2,15 @@ package io.renren.modules.app.controller;
 
 
 import io.renren.common.utils.R;
-import io.renren.common.validator.Assert;
+import io.renren.common.validator.ValidatorUtils;
+import io.renren.modules.app.form.LoginForm;
 import io.renren.modules.app.service.UserService;
 import io.renren.modules.app.utils.JwtUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
@@ -36,12 +38,12 @@ public class ApiLoginController {
      */
     @PostMapping("login")
     @ApiOperation("登录")
-    public R login(String mobile, String password){
-        Assert.isBlank(mobile, "手机号不能为空");
-        Assert.isBlank(password, "密码不能为空");
+    public R login(@RequestBody LoginForm form){
+        //表单校验
+        ValidatorUtils.validateEntity(form);
 
         //用户登录
-        long userId = userService.login(mobile, password);
+        long userId = userService.login(form);
 
         //生成token
         String token = jwtUtils.generateToken(userId);

+ 16 - 5
src/main/java/io/renren/modules/app/controller/ApiRegisterController.java

@@ -2,15 +2,21 @@ package io.renren.modules.app.controller;
 
 
 import io.renren.common.utils.R;
-import io.renren.common.validator.Assert;
+import io.renren.common.validator.ValidatorUtils;
+import io.renren.modules.app.entity.UserEntity;
+import io.renren.modules.app.form.RegisterForm;
 import io.renren.modules.app.service.UserService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.apache.commons.codec.digest.DigestUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RestController;
 
+import java.util.Date;
+
 /**
  * 注册
  * @author chenshun
@@ -26,11 +32,16 @@ public class ApiRegisterController {
 
     @PostMapping("register")
     @ApiOperation("注册")
-    public R register(String mobile, String password){
-        Assert.isBlank(mobile, "手机号不能为空");
-        Assert.isBlank(password, "密码不能为空");
+    public R register(@RequestBody RegisterForm form){
+        //表单校验
+        ValidatorUtils.validateEntity(form);
 
-        userService.save(mobile, password);
+        UserEntity user = new UserEntity();
+        user.setMobile(form.getMobile());
+        user.setUsername(form.getMobile());
+        user.setPassword(DigestUtils.sha256Hex(form.getPassword()));
+        user.setCreateTime(new Date());
+        userService.insert(user);
 
         return R.ok();
     }

+ 18 - 3
src/main/java/io/renren/modules/app/dao/UserDao.java

@@ -1,7 +1,23 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.app.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.app.entity.UserEntity;
-import io.renren.modules.sys.dao.BaseDao;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -12,7 +28,6 @@ import org.apache.ibatis.annotations.Mapper;
  * @date 2017-03-23 15:22:06
  */
 @Mapper
-public interface UserDao extends BaseDao<UserEntity> {
+public interface UserDao extends BaseMapper<UserEntity> {
 
-    UserEntity queryByMobile(String mobile);
 }

+ 38 - 8
src/main/java/io/renren/modules/app/entity/UserEntity.java

@@ -1,10 +1,28 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.app.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.Date;
 
 
-
 /**
  * 用户
  * 
@@ -12,18 +30,30 @@ import java.util.Date;
  * @email sunlightcs@gmail.com
  * @date 2017-03-23 15:22:06
  */
+@TableName("tb_user")
 public class UserEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-	
-	//用户ID
+
+	/**
+	 * 用户ID
+	 */
+	@TableId
 	private Long userId;
-	//用户名
+	/**
+	 * 用户名
+	 */
 	private String username;
-	//手机号
+	/**
+	 * 手机号
+	 */
 	private String mobile;
-	//密码
-	transient private String password;
-	//创建时间
+	/**
+	 * 密码
+	 */
+	private String password;
+	/**
+	 * 创建时间
+	 */
 	private Date createTime;
 
 	/**

+ 17 - 16
src/main/java/io/renren/modules/sys/form/LoginForm.java

@@ -14,25 +14,34 @@
  * the License.
  */
 
-package io.renren.modules.sys.form;
+package io.renren.modules.app.form;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.NotBlank;
 
 /**
  * 登录表单
  *
  * @author Mark sunlightcs@gmail.com
- * @since 1.4.0 2018-01-25
+ * @since 3.1.0 2018-01-25
  */
+@ApiModel(value = "登录表单")
 public class LoginForm {
-    private String username;
+    @ApiModelProperty(value = "手机号")
+    @NotBlank(message="手机号不能为空")
+    private String mobile;
+
+    @ApiModelProperty(value = "密码")
+    @NotBlank(message="密码不能为空")
     private String password;
-    private String captcha;
 
-    public String getUsername() {
-        return username;
+    public String getMobile() {
+        return mobile;
     }
 
-    public void setUsername(String username) {
-        this.username = username;
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
     }
 
     public String getPassword() {
@@ -42,12 +51,4 @@ public class LoginForm {
     public void setPassword(String password) {
         this.password = password;
     }
-
-    public String getCaptcha() {
-        return captcha;
-    }
-
-    public void setCaptcha(String captcha) {
-        this.captcha = captcha;
-    }
 }

+ 54 - 0
src/main/java/io/renren/modules/app/form/RegisterForm.java

@@ -0,0 +1,54 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.modules.app.form;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import org.hibernate.validator.constraints.NotBlank;
+
+/**
+ * 注册表单
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 3.1.0 2018-01-25
+ */
+@ApiModel(value = "注册表单")
+public class RegisterForm {
+    @ApiModelProperty(value = "手机号")
+    @NotBlank(message="手机号不能为空")
+    private String mobile;
+
+    @ApiModelProperty(value = "密码")
+    @NotBlank(message="密码不能为空")
+    private String password;
+
+    public String getMobile() {
+        return mobile;
+    }
+
+    public void setMobile(String mobile) {
+        this.mobile = mobile;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

+ 1 - 1
src/main/java/io/renren/modules/app/resolver/LoginUserHandlerMethodArgumentResolver.java

@@ -39,7 +39,7 @@ public class LoginUserHandlerMethodArgumentResolver implements HandlerMethodArgu
         }
 
         //获取用户信息
-        UserEntity user = userService.queryObject((Long)object);
+        UserEntity user = userService.selectById((Long)object);
 
         return user;
     }

+ 6 - 22
src/main/java/io/renren/modules/app/service/UserService.java

@@ -1,10 +1,9 @@
 package io.renren.modules.app.service;
 
 
+import com.baomidou.mybatisplus.service.IService;
 import io.renren.modules.app.entity.UserEntity;
-
-import java.util.List;
-import java.util.Map;
+import io.renren.modules.app.form.LoginForm;
 
 /**
  * 用户
@@ -13,29 +12,14 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2017-03-23 15:22:06
  */
-public interface UserService {
-
-	UserEntity queryObject(Long userId);
-	
-	List<UserEntity> queryList(Map<String, Object> map);
-	
-	int queryTotal(Map<String, Object> map);
-	
-	void save(String mobile, String password);
-	
-	void update(UserEntity user);
-	
-	void delete(Long userId);
-	
-	void deleteBatch(Long[] userIds);
+public interface UserService extends IService<UserEntity> {
 
 	UserEntity queryByMobile(String mobile);
 
 	/**
 	 * 用户登录
-	 * @param mobile    手机号
-	 * @param password  密码
-	 * @return          返回用户ID
+	 * @param form    登录表单
+	 * @return        返回用户ID
 	 */
-	long login(String mobile, String password);
+	long login(LoginForm form);
 }

+ 9 - 53
src/main/java/io/renren/modules/app/service/impl/UserServiceImpl.java

@@ -1,78 +1,34 @@
 package io.renren.modules.app.service.impl;
 
 
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import io.renren.common.exception.RRException;
 import io.renren.common.validator.Assert;
 import io.renren.modules.app.dao.UserDao;
 import io.renren.modules.app.entity.UserEntity;
+import io.renren.modules.app.form.LoginForm;
 import io.renren.modules.app.service.UserService;
 import org.apache.commons.codec.digest.DigestUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-
 
 @Service("userService")
-public class UserServiceImpl implements UserService {
-	@Autowired
-	private UserDao userDao;
-	
-	@Override
-	public UserEntity queryObject(Long userId){
-		return userDao.queryObject(userId);
-	}
-	
-	@Override
-	public List<UserEntity> queryList(Map<String, Object> map){
-		return userDao.queryList(map);
-	}
-	
-	@Override
-	public int queryTotal(Map<String, Object> map){
-		return userDao.queryTotal(map);
-	}
-	
-	@Override
-	public void save(String mobile, String password){
-		UserEntity user = new UserEntity();
-		user.setMobile(mobile);
-		user.setUsername(mobile);
-		user.setPassword(DigestUtils.sha256Hex(password));
-		user.setCreateTime(new Date());
-		userDao.save(user);
-	}
-	
-	@Override
-	public void update(UserEntity user){
-		userDao.update(user);
-	}
-	
-	@Override
-	public void delete(Long userId){
-		userDao.delete(userId);
-	}
-	
-	@Override
-	public void deleteBatch(Long[] userIds){
-		userDao.deleteBatch(userIds);
-	}
+public class UserServiceImpl extends ServiceImpl<UserDao, UserEntity> implements UserService {
 
 	@Override
 	public UserEntity queryByMobile(String mobile) {
-		return userDao.queryByMobile(mobile);
+		UserEntity userEntity = new UserEntity();
+		userEntity.setMobile(mobile);
+		return baseMapper.selectOne(userEntity);
 	}
 
 	@Override
-	public long login(String mobile, String password) {
-		UserEntity user = queryByMobile(mobile);
+	public long login(LoginForm form) {
+		UserEntity user = queryByMobile(form.getMobile());
 		Assert.isNull(user, "手机号或密码错误");
 
 		//密码错误
-		if(!user.getPassword().equals(DigestUtils.sha256Hex(password))){
+		if(!user.getPassword().equals(DigestUtils.sha256Hex(form.getPassword()))){
 			throw new RRException("手机号或密码错误");
 		}
 

+ 18 - 3
src/main/java/io/renren/modules/job/config/ScheduleConfig.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.config;
 
 import org.springframework.context.annotation.Bean;
@@ -10,9 +26,8 @@ import java.util.Properties;
 /**
  * 定时任务配置
  *
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2017-04-20 23:38
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2017-04-20
  */
 @Configuration
 public class ScheduleConfig {

+ 34 - 26
src/main/java/io/renren/modules/job/controller/ScheduleJobController.java

@@ -1,25 +1,38 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.controller;
 
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.modules.job.service.ScheduleJobService;
+import io.renren.common.annotation.SysLog;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
-import io.renren.common.annotation.SysLog;
 import io.renren.common.validator.ValidatorUtils;
+import io.renren.modules.job.entity.ScheduleJobEntity;
+import io.renren.modules.job.service.ScheduleJobService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
 import java.util.Map;
 
 /**
  * 定时任务
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月28日 下午2:16:40
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 @RestController
 @RequestMapping("/sys/schedule")
@@ -30,26 +43,21 @@ public class ScheduleJobController {
 	/**
 	 * 定时任务列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:schedule:list")
 	public R list(@RequestParam Map<String, Object> params){
-		//查询列表数据
-		Query query = new Query(params);
-		List<ScheduleJobEntity> jobList = scheduleJobService.queryList(query);
-		int total = scheduleJobService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(jobList, total, query.getLimit(), query.getPage());
-		
-		return R.ok().put("page", pageUtil);
+		PageUtils page = scheduleJobService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 	
 	/**
 	 * 定时任务信息
 	 */
-	@RequestMapping("/info/{jobId}")
+	@GetMapping("/info/{jobId}")
 	@RequiresPermissions("sys:schedule:info")
 	public R info(@PathVariable("jobId") Long jobId){
-		ScheduleJobEntity schedule = scheduleJobService.queryObject(jobId);
+		ScheduleJobEntity schedule = scheduleJobService.selectById(jobId);
 		
 		return R.ok().put("schedule", schedule);
 	}
@@ -58,7 +66,7 @@ public class ScheduleJobController {
 	 * 保存定时任务
 	 */
 	@SysLog("保存定时任务")
-	@RequestMapping("/save")
+	@PostMapping("/save")
 	@RequiresPermissions("sys:schedule:save")
 	public R save(@RequestBody ScheduleJobEntity scheduleJob){
 		ValidatorUtils.validateEntity(scheduleJob);
@@ -72,7 +80,7 @@ public class ScheduleJobController {
 	 * 修改定时任务
 	 */
 	@SysLog("修改定时任务")
-	@RequestMapping("/update")
+	@PostMapping("/update")
 	@RequiresPermissions("sys:schedule:update")
 	public R update(@RequestBody ScheduleJobEntity scheduleJob){
 		ValidatorUtils.validateEntity(scheduleJob);
@@ -86,7 +94,7 @@ public class ScheduleJobController {
 	 * 删除定时任务
 	 */
 	@SysLog("删除定时任务")
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:schedule:delete")
 	public R delete(@RequestBody Long[] jobIds){
 		scheduleJobService.deleteBatch(jobIds);
@@ -98,7 +106,7 @@ public class ScheduleJobController {
 	 * 立即执行任务
 	 */
 	@SysLog("立即执行任务")
-	@RequestMapping("/run")
+	@PostMapping("/run")
 	@RequiresPermissions("sys:schedule:run")
 	public R run(@RequestBody Long[] jobIds){
 		scheduleJobService.run(jobIds);
@@ -110,7 +118,7 @@ public class ScheduleJobController {
 	 * 暂停定时任务
 	 */
 	@SysLog("暂停定时任务")
-	@RequestMapping("/pause")
+	@PostMapping("/pause")
 	@RequiresPermissions("sys:schedule:pause")
 	public R pause(@RequestBody Long[] jobIds){
 		scheduleJobService.pause(jobIds);
@@ -122,7 +130,7 @@ public class ScheduleJobController {
 	 * 恢复定时任务
 	 */
 	@SysLog("恢复定时任务")
-	@RequestMapping("/resume")
+	@PostMapping("/resume")
 	@RequiresPermissions("sys:schedule:resume")
 	public R resume(@RequestBody Long[] jobIds){
 		scheduleJobService.resume(jobIds);

+ 27 - 22
src/main/java/io/renren/modules/job/controller/ScheduleJobLogController.java

@@ -1,26 +1,36 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.controller;
 
-import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import io.renren.modules.job.service.ScheduleJobLogService;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
+import io.renren.modules.job.entity.ScheduleJobLogEntity;
+import io.renren.modules.job.service.ScheduleJobLogService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
 import java.util.Map;
 
 /**
  * 定时任务日志
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月1日 下午10:39:52
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 @RestController
 @RequestMapping("/sys/scheduleLog")
@@ -31,25 +41,20 @@ public class ScheduleJobLogController {
 	/**
 	 * 定时任务日志列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:schedule:log")
 	public R list(@RequestParam Map<String, Object> params){
-		//查询列表数据
-		Query query = new Query(params);
-		List<ScheduleJobLogEntity> jobList = scheduleJobLogService.queryList(query);
-		int total = scheduleJobLogService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(jobList, total, query.getLimit(), query.getPage());
+		PageUtils page = scheduleJobLogService.queryPage(params);
 		
-		return R.ok().put("page", pageUtil);
+		return R.ok().put("page", page);
 	}
 	
 	/**
 	 * 定时任务日志信息
 	 */
-	@RequestMapping("/info/{logId}")
+	@GetMapping("/info/{logId}")
 	public R info(@PathVariable("logId") Long logId){
-		ScheduleJobLogEntity log = scheduleJobLogService.queryObject(logId);
+		ScheduleJobLogEntity log = scheduleJobLogService.selectById(logId);
 		
 		return R.ok().put("log", log);
 	}

+ 21 - 6
src/main/java/io/renren/modules/job/dao/ScheduleJobDao.java

@@ -1,20 +1,35 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.modules.sys.dao.BaseDao;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.Map;
 
 /**
  * 定时任务
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月1日 下午10:29:57
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 @Mapper
-public interface ScheduleJobDao extends BaseDao<ScheduleJobEntity> {
+public interface ScheduleJobDao extends BaseMapper<ScheduleJobEntity> {
 	
 	/**
 	 * 批量更新状态

+ 21 - 6
src/main/java/io/renren/modules/job/dao/ScheduleJobLogDao.java

@@ -1,17 +1,32 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
-import io.renren.modules.sys.dao.BaseDao;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
  * 定时任务日志
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月1日 下午10:30:02
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 @Mapper
-public interface ScheduleJobLogDao extends BaseDao<ScheduleJobLogEntity> {
+public interface ScheduleJobLogDao extends BaseMapper<ScheduleJobLogEntity> {
 	
 }

+ 26 - 7
src/main/java/io/renren/modules/job/entity/ScheduleJobEntity.java

@@ -1,20 +1,38 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
 import org.hibernate.validator.constraints.NotBlank;
 
 import java.io.Serializable;
 import java.util.Date;
 
 /**
- * 定时器
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月28日 下午12:54:44
+ * 定时任务
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
+@TableName("schedule_job")
 public class ScheduleJobEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-
+	
 	/**
 	 * 任务调度参数key
 	 */
@@ -23,6 +41,7 @@ public class ScheduleJobEntity implements Serializable {
 	/**
 	 * 任务id
 	 */
+	@TableId
 	private Long jobId;
 
 	/**
@@ -49,7 +68,7 @@ public class ScheduleJobEntity implements Serializable {
 	private String cronExpression;
 
 	/**
-	 * 任务状态  0:正常  1:暂停
+	 * 任务状态
 	 */
 	private Integer status;
 

+ 26 - 6
src/main/java/io/renren/modules/job/entity/ScheduleJobLogEntity.java

@@ -1,21 +1,41 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.Date;
 
 /**
- * 定时执行日志
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月1日 下午10:26:18
+ * 定时任务日志
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
+@TableName("schedule_job_log")
 public class ScheduleJobLogEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-
+	
 	/**
 	 * 日志id
 	 */
+	@TableId
 	private Long logId;
 	
 	/**

+ 23 - 25
src/main/java/io/renren/modules/job/service/ScheduleJobLogService.java

@@ -1,37 +1,35 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
 
-import java.util.List;
 import java.util.Map;
 
 /**
  * 定时任务日志
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年12月1日 下午10:34:48
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
-public interface ScheduleJobLogService {
+public interface ScheduleJobLogService extends IService<ScheduleJobLogEntity> {
 
-	/**
-	 * 根据ID,查询定时任务日志
-	 */
-	ScheduleJobLogEntity queryObject(Long jobId);
-	
-	/**
-	 * 查询定时任务日志列表
-	 */
-	List<ScheduleJobLogEntity> queryList(Map<String, Object> map);
-	
-	/**
-	 * 查询总数
-	 */
-	int queryTotal(Map<String, Object> map);
-	
-	/**
-	 * 保存定时任务日志
-	 */
-	void save(ScheduleJobLogEntity log);
+	PageUtils queryPage(Map<String, Object> params);
 	
 }

+ 24 - 21
src/main/java/io/renren/modules/job/service/ScheduleJobService.java

@@ -1,34 +1,37 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.job.entity.ScheduleJobEntity;
 
-import java.util.List;
 import java.util.Map;
 
 /**
  * 定时任务
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月28日 上午9:55:32
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
-public interface ScheduleJobService {
+public interface ScheduleJobService extends IService<ScheduleJobEntity> {
+
+	PageUtils queryPage(Map<String, Object> params);
 
-	/**
-	 * 根据ID,查询定时任务
-	 */
-	ScheduleJobEntity queryObject(Long jobId);
-	
-	/**
-	 * 查询定时任务列表
-	 */
-	List<ScheduleJobEntity> queryList(Map<String, Object> map);
-	
-	/**
-	 * 查询总数
-	 */
-	int queryTotal(Map<String, Object> map);
-	
 	/**
 	 * 保存定时任务
 	 */

+ 31 - 22
src/main/java/io/renren/modules/job/service/impl/ScheduleJobLogServiceImpl.java

@@ -1,38 +1,47 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.job.dao.ScheduleJobLogDao;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
 import io.renren.modules.job.service.ScheduleJobLogService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
 
-import java.util.List;
 import java.util.Map;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
 @Service("scheduleJobLogService")
-public class ScheduleJobLogServiceImpl implements ScheduleJobLogService {
-	@Autowired
-	private ScheduleJobLogDao scheduleJobLogDao;
-	
-	@Override
-	public ScheduleJobLogEntity queryObject(Long jobId) {
-		return scheduleJobLogDao.queryObject(jobId);
-	}
+public class ScheduleJobLogServiceImpl extends ServiceImpl<ScheduleJobLogDao, ScheduleJobLogEntity> implements ScheduleJobLogService {
 
 	@Override
-	public List<ScheduleJobLogEntity> queryList(Map<String, Object> map) {
-		return scheduleJobLogDao.queryList(map);
-	}
+	public PageUtils queryPage(Map<String, Object> params) {
+		String jobId = (String)params.get("jobId");
 
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return scheduleJobLogDao.queryTotal(map);
-	}
+		Page<ScheduleJobLogEntity> page = this.selectPage(
+				new Query<ScheduleJobLogEntity>(params).getPage(),
+				new EntityWrapper<ScheduleJobLogEntity>().like(StringUtils.isNotBlank(jobId),"job_id", jobId)
+		);
 
-	@Override
-	public void save(ScheduleJobLogEntity log) {
-		scheduleJobLogDao.save(log);
+		return new PageUtils(page);
 	}
 
 }

+ 51 - 38
src/main/java/io/renren/modules/job/service/impl/ScheduleJobServiceImpl.java

@@ -1,37 +1,52 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.Constant;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.job.dao.ScheduleJobDao;
 import io.renren.modules.job.entity.ScheduleJobEntity;
 import io.renren.modules.job.service.ScheduleJobService;
-import io.renren.common.utils.Constant.ScheduleStatus;
 import io.renren.modules.job.utils.ScheduleUtils;
-
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.annotation.PostConstruct;
-
+import org.apache.commons.lang.StringUtils;
 import org.quartz.CronTrigger;
 import org.quartz.Scheduler;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.PostConstruct;
+import java.util.*;
+
 @Service("scheduleJobService")
-public class ScheduleJobServiceImpl implements ScheduleJobService {
+public class ScheduleJobServiceImpl extends ServiceImpl<ScheduleJobDao, ScheduleJobEntity> implements ScheduleJobService {
 	@Autowired
     private Scheduler scheduler;
-	@Autowired
-	private ScheduleJobDao schedulerJobDao;
 	
 	/**
 	 * 项目启动时,初始化定时器
 	 */
 	@PostConstruct
 	public void init(){
-		List<ScheduleJobEntity> scheduleJobList = schedulerJobDao.queryList(new HashMap<>());
+		List<ScheduleJobEntity> scheduleJobList = this.selectList(null);
 		for(ScheduleJobEntity scheduleJob : scheduleJobList){
 			CronTrigger cronTrigger = ScheduleUtils.getCronTrigger(scheduler, scheduleJob.getJobId());
             //如果不存在,则创建
@@ -42,49 +57,47 @@ public class ScheduleJobServiceImpl implements ScheduleJobService {
             }
 		}
 	}
-	
-	@Override
-	public ScheduleJobEntity queryObject(Long jobId) {
-		return schedulerJobDao.queryObject(jobId);
-	}
 
 	@Override
-	public List<ScheduleJobEntity> queryList(Map<String, Object> map) {
-		return schedulerJobDao.queryList(map);
-	}
+	public PageUtils queryPage(Map<String, Object> params) {
+		String beanName = (String)params.get("beanName");
 
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return schedulerJobDao.queryTotal(map);
+		Page<ScheduleJobEntity> page = this.selectPage(
+				new Query<ScheduleJobEntity>(params).getPage(),
+				new EntityWrapper<ScheduleJobEntity>().like(StringUtils.isNotBlank(beanName),"bean_name", beanName)
+		);
+
+		return new PageUtils(page);
 	}
 
+
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void save(ScheduleJobEntity scheduleJob) {
 		scheduleJob.setCreateTime(new Date());
-		scheduleJob.setStatus(ScheduleStatus.NORMAL.getValue());
-        schedulerJobDao.save(scheduleJob);
+		scheduleJob.setStatus(Constant.ScheduleStatus.NORMAL.getValue());
+        this.insert(scheduleJob);
         
         ScheduleUtils.createScheduleJob(scheduler, scheduleJob);
     }
 	
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void update(ScheduleJobEntity scheduleJob) {
         ScheduleUtils.updateScheduleJob(scheduler, scheduleJob);
                 
-        schedulerJobDao.update(scheduleJob);
+        this.updateById(scheduleJob);
     }
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
     public void deleteBatch(Long[] jobIds) {
     	for(Long jobId : jobIds){
     		ScheduleUtils.deleteScheduleJob(scheduler, jobId);
     	}
     	
     	//删除数据
-    	schedulerJobDao.deleteBatch(jobIds);
+    	this.deleteBatchIds(Arrays.asList(jobIds));
 	}
 
 	@Override
@@ -92,35 +105,35 @@ public class ScheduleJobServiceImpl implements ScheduleJobService {
     	Map<String, Object> map = new HashMap<>();
     	map.put("list", jobIds);
     	map.put("status", status);
-    	return schedulerJobDao.updateBatch(map);
+    	return baseMapper.updateBatch(map);
     }
     
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
     public void run(Long[] jobIds) {
     	for(Long jobId : jobIds){
-    		ScheduleUtils.run(scheduler, queryObject(jobId));
+    		ScheduleUtils.run(scheduler, this.selectById(jobId));
     	}
     }
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
     public void pause(Long[] jobIds) {
         for(Long jobId : jobIds){
     		ScheduleUtils.pauseJob(scheduler, jobId);
     	}
         
-    	updateBatch(jobIds, ScheduleStatus.PAUSE.getValue());
+    	updateBatch(jobIds, Constant.ScheduleStatus.PAUSE.getValue());
     }
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
     public void resume(Long[] jobIds) {
     	for(Long jobId : jobIds){
     		ScheduleUtils.resumeJob(scheduler, jobId);
     	}
 
-    	updateBatch(jobIds, ScheduleStatus.NORMAL.getValue());
+    	updateBatch(jobIds, Constant.ScheduleStatus.NORMAL.getValue());
     }
     
 }

+ 22 - 9
src/main/java/io/renren/modules/job/task/TestTask.java

@@ -1,8 +1,23 @@
 package io.renren.modules.job.task;
 
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 import io.renren.modules.sys.entity.SysUserEntity;
 import io.renren.modules.sys.service.SysUserService;
-
 import org.apache.commons.lang.builder.ToStringBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -11,12 +26,11 @@ import org.springframework.stereotype.Component;
 
 /**
  * 测试定时任务(演示Demo,可删除)
- * 
+ *
  * testTask为spring bean的名称
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月30日 下午1:34:24
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 @Component("testTask")
 public class TestTask {
@@ -24,8 +38,7 @@ public class TestTask {
 	
 	@Autowired
 	private SysUserService sysUserService;
-
-	//定时任务只能接受一个参数;如果有多个参数,使用json数据即可
+	
 	public void test(String params){
 		logger.info("我是带参数的test方法,正在被执行,参数为:" + params);
 		
@@ -35,7 +48,7 @@ public class TestTask {
 			e.printStackTrace();
 		}
 		
-		SysUserEntity user = sysUserService.queryObject(1L);
+		SysUserEntity user = sysUserService.selectById(1L);
 		System.out.println(ToStringBuilder.reflectionToString(user));
 		
 	}

+ 26 - 12
src/main/java/io/renren/modules/job/utils/ScheduleJob.java

@@ -1,10 +1,25 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.utils;
 
-import com.google.gson.Gson;
+import io.renren.common.utils.SpringContextUtils;
 import io.renren.modules.job.entity.ScheduleJobEntity;
 import io.renren.modules.job.entity.ScheduleJobLogEntity;
 import io.renren.modules.job.service.ScheduleJobLogService;
-import io.renren.common.utils.SpringContextUtils;
 import org.apache.commons.lang.StringUtils;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
@@ -20,10 +35,9 @@ import java.util.concurrent.Future;
 
 /**
  * 定时任务
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月30日 下午12:44:21
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 public class ScheduleJob extends QuartzJobBean {
 	private Logger logger = LoggerFactory.getLogger(getClass());
@@ -31,10 +45,10 @@ public class ScheduleJob extends QuartzJobBean {
 	
     @Override
     protected void executeInternal(JobExecutionContext context) throws JobExecutionException {
-		String jsonJob = context.getMergedJobDataMap().getString(ScheduleJobEntity.JOB_PARAM_KEY);
-		ScheduleJobEntity scheduleJob = new Gson().fromJson(jsonJob, ScheduleJobEntity.class);
-
-		//获取scheduleJobLogService
+        ScheduleJobEntity scheduleJob = (ScheduleJobEntity) context.getMergedJobDataMap()
+        		.get(ScheduleJobEntity.JOB_PARAM_KEY);
+        
+        //获取spring bean
         ScheduleJobLogService scheduleJobLogService = (ScheduleJobLogService) SpringContextUtils.getBean("scheduleJobLogService");
         
         //数据库保存执行记录
@@ -51,7 +65,7 @@ public class ScheduleJob extends QuartzJobBean {
         try {
             //执行任务
         	logger.info("任务准备执行,任务ID:" + scheduleJob.getJobId());
-            ScheduleRunnable task = new ScheduleRunnable(scheduleJob.getBeanName(), 
+            ScheduleRunnable task = new ScheduleRunnable(scheduleJob.getBeanName(),
             		scheduleJob.getMethodName(), scheduleJob.getParams());
             Future<?> future = service.submit(task);
             
@@ -75,7 +89,7 @@ public class ScheduleJob extends QuartzJobBean {
 			log.setStatus(1);
 			log.setError(StringUtils.substring(e.toString(), 0, 2000));
 		}finally {
-			scheduleJobLogService.save(log);
+			scheduleJobLogService.insert(log);
 		}
     }
 }

+ 19 - 4
src/main/java/io/renren/modules/job/utils/ScheduleRunnable.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.utils;
 
 import io.renren.common.exception.RRException;
@@ -9,10 +25,9 @@ import java.lang.reflect.Method;
 
 /**
  * 执行定时任务
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月30日 下午12:49:33
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 public class ScheduleRunnable implements Runnable {
 	private Object target;

+ 33 - 20
src/main/java/io/renren/modules/job/utils/ScheduleUtils.java

@@ -1,17 +1,31 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.job.utils;
 
-import com.google.gson.Gson;
-import io.renren.modules.job.entity.ScheduleJobEntity;
-import io.renren.common.utils.Constant.ScheduleStatus;
 import io.renren.common.exception.RRException;
+import io.renren.common.utils.Constant;
+import io.renren.modules.job.entity.ScheduleJobEntity;
 import org.quartz.*;
 
 /**
  * 定时任务工具类
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年11月30日 下午12:44:59
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 1.2.0 2016-11-28
  */
 public class ScheduleUtils {
     private final static String JOB_NAME = "TASK_";
@@ -19,14 +33,14 @@ public class ScheduleUtils {
     /**
      * 获取触发器key
      */
-    private static TriggerKey getTriggerKey(Long jobId) {
+    public static TriggerKey getTriggerKey(Long jobId) {
         return TriggerKey.triggerKey(JOB_NAME + jobId);
     }
     
     /**
      * 获取jobKey
      */
-    private static JobKey getJobKey(Long jobId) {
+    public static JobKey getJobKey(Long jobId) {
         return JobKey.jobKey(JOB_NAME + jobId);
     }
 
@@ -37,7 +51,7 @@ public class ScheduleUtils {
         try {
             return (CronTrigger) scheduler.getTrigger(getTriggerKey(jobId));
         } catch (SchedulerException e) {
-            throw new RRException("getCronTrigger异常,请检查qrtz开头的表,是否有脏数据", e);
+            throw new RRException("获取定时任务CronTrigger出现异常", e);
         }
     }
 
@@ -46,24 +60,23 @@ public class ScheduleUtils {
      */
     public static void createScheduleJob(Scheduler scheduler, ScheduleJobEntity scheduleJob) {
         try {
-        	//构建job
+        	//构建job信息
             JobDetail jobDetail = JobBuilder.newJob(ScheduleJob.class).withIdentity(getJobKey(scheduleJob.getJobId())).build();
 
-            //构建cron
+            //表达式调度构建器
             CronScheduleBuilder scheduleBuilder = CronScheduleBuilder.cronSchedule(scheduleJob.getCronExpression())
             		.withMisfireHandlingInstructionDoNothing();
 
-            //根据cron,构建一个CronTrigger
-            CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).
-                    withSchedule(scheduleBuilder).build();
+            //按新的cronExpression表达式构建一个新的trigger
+            CronTrigger trigger = TriggerBuilder.newTrigger().withIdentity(getTriggerKey(scheduleJob.getJobId())).withSchedule(scheduleBuilder).build();
 
             //放入参数,运行时的方法可以获取
-            jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, new Gson().toJson(scheduleJob));
+            jobDetail.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
 
             scheduler.scheduleJob(jobDetail, trigger);
             
             //暂停任务
-            if(scheduleJob.getStatus() == ScheduleStatus.PAUSE.getValue()){
+            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
             	pauseJob(scheduler, scheduleJob.getJobId());
             }
         } catch (SchedulerException e) {
@@ -88,12 +101,12 @@ public class ScheduleUtils {
             trigger = trigger.getTriggerBuilder().withIdentity(triggerKey).withSchedule(scheduleBuilder).build();
             
             //参数
-            trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, new Gson().toJson(scheduleJob));
+            trigger.getJobDataMap().put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
             
             scheduler.rescheduleJob(triggerKey, trigger);
             
             //暂停任务
-            if(scheduleJob.getStatus() == ScheduleStatus.PAUSE.getValue()){
+            if(scheduleJob.getStatus() == Constant.ScheduleStatus.PAUSE.getValue()){
             	pauseJob(scheduler, scheduleJob.getJobId());
             }
             
@@ -109,7 +122,7 @@ public class ScheduleUtils {
         try {
         	//参数
         	JobDataMap dataMap = new JobDataMap();
-        	dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, new Gson().toJson(scheduleJob));
+        	dataMap.put(ScheduleJobEntity.JOB_PARAM_KEY, scheduleJob);
         	
             scheduler.triggerJob(getJobKey(scheduleJob.getJobId()), dataMap);
         } catch (SchedulerException e) {

+ 16 - 0
src/main/java/io/renren/modules/oss/cloud/AliyunCloudStorageService.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
 import com.aliyun.oss.OSSClient;

+ 17 - 0
src/main/java/io/renren/modules/oss/cloud/CloudStorageConfig.java

@@ -1,5 +1,22 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
+
 import io.renren.common.validator.group.AliyunGroup;
 import io.renren.common.validator.group.QcloudGroup;
 import io.renren.common.validator.group.QiniuGroup;

+ 16 - 0
src/main/java/io/renren/modules/oss/cloud/CloudStorageService.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
 import io.renren.common.utils.DateUtils;

+ 18 - 1
src/main/java/io/renren/modules/oss/cloud/OSSFactory.java

@@ -1,9 +1,26 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
-import io.renren.modules.sys.service.SysConfigService;
+
 import io.renren.common.utils.ConfigConstant;
 import io.renren.common.utils.Constant;
 import io.renren.common.utils.SpringContextUtils;
+import io.renren.modules.sys.service.SysConfigService;
 
 /**
  * 文件上传Factory

+ 16 - 0
src/main/java/io/renren/modules/oss/cloud/QcloudCloudStorageService.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
 

+ 16 - 0
src/main/java/io/renren/modules/oss/cloud/QiniuCloudStorageService.java

@@ -1,3 +1,19 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.cloud;
 
 import com.qiniu.common.Zone;

+ 32 - 23
src/main/java/io/renren/modules/oss/controller/SysOssController.java

@@ -1,8 +1,27 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.controller;
 
 import com.google.gson.Gson;
 import io.renren.common.exception.RRException;
-import io.renren.common.utils.*;
+import io.renren.common.utils.ConfigConstant;
+import io.renren.common.utils.Constant;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.R;
 import io.renren.common.validator.ValidatorUtils;
 import io.renren.common.validator.group.AliyunGroup;
 import io.renren.common.validator.group.QcloudGroup;
@@ -14,17 +33,13 @@ import io.renren.modules.oss.service.SysOssService;
 import io.renren.modules.sys.service.SysConfigService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 import org.springframework.web.multipart.MultipartFile;
 
+import java.util.Arrays;
 import java.util.Date;
-import java.util.List;
 import java.util.Map;
 
-
 /**
  * 文件上传
  * 
@@ -45,24 +60,19 @@ public class SysOssController {
 	/**
 	 * 列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:oss:all")
 	public R list(@RequestParam Map<String, Object> params){
-		//查询列表数据
-		Query query = new Query(params);
-		List<SysOssEntity> sysOssList = sysOssService.queryList(query);
-		int total = sysOssService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(sysOssList, total, query.getLimit(), query.getPage());
-		
-		return R.ok().put("page", pageUtil);
+		PageUtils page = sysOssService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 
 
     /**
      * 云存储配置信息
      */
-    @RequestMapping("/config")
+    @GetMapping("/config")
     @RequiresPermissions("sys:oss:all")
     public R config(){
         CloudStorageConfig config = sysConfigService.getConfigObject(KEY, CloudStorageConfig.class);
@@ -74,7 +84,7 @@ public class SysOssController {
 	/**
 	 * 保存云存储配置信息
 	 */
-	@RequestMapping("/saveConfig")
+	@PostMapping("/saveConfig")
 	@RequiresPermissions("sys:oss:all")
 	public R saveConfig(@RequestBody CloudStorageConfig config){
 		//校验类型
@@ -90,7 +100,6 @@ public class SysOssController {
 			//校验腾讯云数据
 			ValidatorUtils.validateEntity(config, QcloudGroup.class);
 		}
-		
 
         sysConfigService.updateValueByKey(KEY, new Gson().toJson(config));
 
@@ -101,7 +110,7 @@ public class SysOssController {
 	/**
 	 * 上传文件
 	 */
-	@RequestMapping("/upload")
+	@PostMapping("/upload")
 	@RequiresPermissions("sys:oss:all")
 	public R upload(@RequestParam("file") MultipartFile file) throws Exception {
 		if (file.isEmpty()) {
@@ -116,7 +125,7 @@ public class SysOssController {
 		SysOssEntity ossEntity = new SysOssEntity();
 		ossEntity.setUrl(url);
 		ossEntity.setCreateDate(new Date());
-		sysOssService.save(ossEntity);
+		sysOssService.insert(ossEntity);
 
 		return R.ok().put("url", url);
 	}
@@ -125,10 +134,10 @@ public class SysOssController {
 	/**
 	 * 删除
 	 */
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:oss:all")
 	public R delete(@RequestBody Long[] ids){
-		sysOssService.deleteBatch(ids);
+		sysOssService.deleteBatchIds(Arrays.asList(ids));
 
 		return R.ok();
 	}

+ 19 - 2
src/main/java/io/renren/modules/oss/dao/SysOssDao.java

@@ -1,7 +1,24 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.dao;
 
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.oss.entity.SysOssEntity;
-import io.renren.modules.sys.dao.BaseDao;
 import org.apache.ibatis.annotations.Mapper;
 
 /**
@@ -12,6 +29,6 @@ import org.apache.ibatis.annotations.Mapper;
  * @date 2017-03-25 12:13:26
  */
 @Mapper
-public interface SysOssDao extends BaseDao<SysOssEntity> {
+public interface SysOssDao extends BaseMapper<SysOssEntity> {
 	
 }

+ 21 - 2
src/main/java/io/renren/modules/oss/entity/SysOssEntity.java

@@ -1,10 +1,28 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.Date;
 
 
-
 /**
  * 文件上传
  * 
@@ -12,10 +30,11 @@ import java.util.Date;
  * @email sunlightcs@gmail.com
  * @date 2017-03-25 12:13:26
  */
+@TableName("sys_oss")
 public class SysOssEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	
-	//
+	@TableId
 	private Long id;
 	//URL地址
 	private String url;

+ 21 - 16
src/main/java/io/renren/modules/oss/service/SysOssService.java

@@ -1,8 +1,25 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.oss.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.oss.entity.SysOssEntity;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -12,19 +29,7 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2017-03-25 12:13:26
  */
-public interface SysOssService {
-	
-	SysOssEntity queryObject(Long id);
-	
-	List<SysOssEntity> queryList(Map<String, Object> map);
-	
-	int queryTotal(Map<String, Object> map);
-	
-	void save(SysOssEntity sysOss);
-	
-	void update(SysOssEntity sysOss);
-	
-	void delete(Long id);
-	
-	void deleteBatch(Long[] ids);
+public interface SysOssService extends IService<SysOssEntity> {
+
+	PageUtils queryPage(Map<String, Object> params);
 }

+ 30 - 42
src/main/java/io/renren/modules/oss/service/impl/SysOssServiceImpl.java

@@ -1,55 +1,43 @@
-package io.renren.modules.oss.service.impl;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 
-import java.util.List;
-import java.util.Map;
+package io.renren.modules.oss.service.impl;
 
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.oss.dao.SysOssDao;
 import io.renren.modules.oss.entity.SysOssEntity;
 import io.renren.modules.oss.service.SysOssService;
+import org.springframework.stereotype.Service;
 
+import java.util.Map;
 
 
 @Service("sysOssService")
-public class SysOssServiceImpl implements SysOssService {
-	@Autowired
-	private SysOssDao sysOssDao;
-	
-	@Override
-	public SysOssEntity queryObject(Long id){
-		return sysOssDao.queryObject(id);
-	}
-	
-	@Override
-	public List<SysOssEntity> queryList(Map<String, Object> map){
-		return sysOssDao.queryList(map);
-	}
-	
-	@Override
-	public int queryTotal(Map<String, Object> map){
-		return sysOssDao.queryTotal(map);
-	}
-	
-	@Override
-	public void save(SysOssEntity sysOss){
-		sysOssDao.save(sysOss);
-	}
-	
-	@Override
-	public void update(SysOssEntity sysOss){
-		sysOssDao.update(sysOss);
-	}
-	
-	@Override
-	public void delete(Long id){
-		sysOssDao.delete(id);
-	}
-	
+public class SysOssServiceImpl extends ServiceImpl<SysOssDao, SysOssEntity> implements SysOssService {
+
 	@Override
-	public void deleteBatch(Long[] ids){
-		sysOssDao.deleteBatch(ids);
+	public PageUtils queryPage(Map<String, Object> params) {
+		Page<SysOssEntity> page = this.selectPage(
+				new Query<SysOssEntity>(params).getPage()
+		);
+
+		return new PageUtils(page);
 	}
 	
 }

+ 29 - 19
src/main/java/io/renren/modules/sys/controller/SysConfigController.java

@@ -1,21 +1,36 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.controller;
 
+
 import io.renren.common.annotation.SysLog;
-import io.renren.modules.sys.entity.SysConfigEntity;
-import io.renren.modules.sys.service.SysConfigService;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
 import io.renren.common.validator.ValidatorUtils;
+import io.renren.modules.sys.entity.SysConfigEntity;
+import io.renren.modules.sys.service.SysConfigService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 
-import java.util.List;
 import java.util.Map;
 
 /**
- * 系统参数信息
+ * 系统配置信息
  * 
  * @author chenshun
  * @email sunlightcs@gmail.com
@@ -30,27 +45,22 @@ public class SysConfigController extends AbstractController {
 	/**
 	 * 所有配置列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:config:list")
 	public R list(@RequestParam Map<String, Object> params){
-		//查询列表数据
-		Query query = new Query(params);
-		List<SysConfigEntity> configList = sysConfigService.queryList(query);
-		int total = sysConfigService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(configList, total, query.getLimit(), query.getPage());
-		
-		return R.ok().put("page", pageUtil);
+		PageUtils page = sysConfigService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 	
 	
 	/**
 	 * 配置信息
 	 */
-	@RequestMapping("/info/{id}")
+	@GetMapping("/info/{id}")
 	@RequiresPermissions("sys:config:info")
 	public R info(@PathVariable("id") Long id){
-		SysConfigEntity config = sysConfigService.queryObject(id);
+		SysConfigEntity config = sysConfigService.selectById(id);
 		
 		return R.ok().put("config", config);
 	}
@@ -59,7 +69,7 @@ public class SysConfigController extends AbstractController {
 	 * 保存配置
 	 */
 	@SysLog("保存配置")
-	@RequestMapping("/save")
+	@PostMapping("/save")
 	@RequiresPermissions("sys:config:save")
 	public R save(@RequestBody SysConfigEntity config){
 		ValidatorUtils.validateEntity(config);
@@ -73,7 +83,7 @@ public class SysConfigController extends AbstractController {
 	 * 修改配置
 	 */
 	@SysLog("修改配置")
-	@RequestMapping("/update")
+	@PostMapping("/update")
 	@RequiresPermissions("sys:config:update")
 	public R update(@RequestBody SysConfigEntity config){
 		ValidatorUtils.validateEntity(config);
@@ -87,7 +97,7 @@ public class SysConfigController extends AbstractController {
 	 * 删除配置
 	 */
 	@SysLog("删除配置")
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:config:delete")
 	public R delete(@RequestBody Long[] ids){
 		sysConfigService.deleteBatch(ids);

+ 22 - 12
src/main/java/io/renren/modules/sys/controller/SysLogController.java

@@ -1,18 +1,32 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.controller;
 
-import io.renren.modules.sys.entity.SysLogEntity;
-import io.renren.modules.sys.service.SysLogService;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
+import io.renren.modules.sys.service.SysLogService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
 
-import java.util.List;
 import java.util.Map;
 
 
@@ -33,16 +47,12 @@ public class SysLogController {
 	 * 列表
 	 */
 	@ResponseBody
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:log:list")
 	public R list(@RequestParam Map<String, Object> params){
-		//查询列表数据
-		Query query = new Query(params);
-		List<SysLogEntity> sysLogList = sysLogService.queryList(query);
-		int total = sysLogService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(sysLogList, total, query.getLimit(), query.getPage());
-		return R.ok().put("page", pageUtil);
+		PageUtils page = sysLogService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 	
 }

+ 17 - 25
src/main/java/io/renren/modules/sys/controller/SysLoginController.java

@@ -1,19 +1,17 @@
 package io.renren.modules.sys.controller;
 
-import com.google.code.kaptcha.Constants;
-import com.google.code.kaptcha.Producer;
 import io.renren.common.utils.R;
-import io.renren.common.utils.ShiroUtils;
 import io.renren.modules.sys.entity.SysUserEntity;
-import io.renren.modules.sys.form.LoginForm;
+import io.renren.modules.sys.form.SysLoginForm;
+import io.renren.modules.sys.service.SysCaptchaService;
 import io.renren.modules.sys.service.SysUserService;
 import io.renren.modules.sys.service.SysUserTokenService;
 import org.apache.commons.io.IOUtils;
 import org.apache.shiro.crypto.hash.Sha256Hash;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.imageio.ImageIO;
@@ -34,26 +32,22 @@ import java.util.Map;
 @RestController
 public class SysLoginController extends AbstractController {
 	@Autowired
-	private Producer producer;
-	@Autowired
 	private SysUserService sysUserService;
 	@Autowired
 	private SysUserTokenService sysUserTokenService;
+	@Autowired
+	private SysCaptchaService sysCaptchaService;
 
 	/**
 	 * 验证码
 	 */
-	@RequestMapping("captcha.jpg")
-	public void captcha(HttpServletResponse response)throws ServletException, IOException {
+	@GetMapping("captcha.jpg")
+	public void captcha(HttpServletResponse response, String uuid)throws ServletException, IOException {
 		response.setHeader("Cache-Control", "no-store, no-cache");
 		response.setContentType("image/jpeg");
 
-		//生成文字验证码
-		String text = producer.createText();
-		//生成图片验证码
-		BufferedImage image = producer.createImage(text);
-		//保存到shiro session
-		ShiroUtils.setSessionAttribute(Constants.KAPTCHA_SESSION_KEY, text);
+		//获取图片验证码
+		BufferedImage image = sysCaptchaService.getCaptcha(uuid);
 
 		ServletOutputStream out = response.getOutputStream();
 		ImageIO.write(image, "jpg", out);
@@ -63,14 +57,12 @@ public class SysLoginController extends AbstractController {
 	/**
 	 * 登录
 	 */
-	@RequestMapping(value = "/sys/login", method = RequestMethod.POST)
-	public Map<String, Object> login(@RequestBody LoginForm form)throws IOException {
-		//本项目已实现,前后端完全分离,但页面还是跟项目放在一起了,所以还是会依赖session
-		//如果想把页面单独放到nginx里,实现前后端完全分离,则需要把验证码注释掉(因为不再依赖session了)
-//		String kaptcha = ShiroUtils.getKaptcha(Constants.KAPTCHA_SESSION_KEY);
-//		if(!captcha.equalsIgnoreCase(kaptcha)){
-//			return R.error("验证码不正确");
-//		}
+	@PostMapping("/sys/login")
+	public Map<String, Object> login(@RequestBody SysLoginForm form)throws IOException {
+		boolean captcha = sysCaptchaService.validate(form.getUuid(), form.getCaptcha());
+		if(!captcha){
+			return R.error("验证码不正确");
+		}
 
 		//用户信息
 		SysUserEntity user = sysUserService.queryByUserName(form.getUsername());
@@ -94,7 +86,7 @@ public class SysLoginController extends AbstractController {
 	/**
 	 * 退出
 	 */
-	@RequestMapping(value = "/sys/logout", method = RequestMethod.POST)
+	@PostMapping("/sys/logout")
 	public R logout() {
 		sysUserTokenService.logout(getUserId());
 		return R.ok();

+ 49 - 27
src/main/java/io/renren/modules/sys/controller/SysMenuController.java

@@ -1,8 +1,24 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.controller;
 
 import io.renren.common.annotation.SysLog;
 import io.renren.common.exception.RRException;
-import io.renren.common.utils.Constant.MenuType;
+import io.renren.common.utils.Constant;
 import io.renren.common.utils.R;
 import io.renren.modules.sys.entity.SysMenuEntity;
 import io.renren.modules.sys.service.ShiroService;
@@ -10,12 +26,8 @@ import io.renren.modules.sys.service.SysMenuService;
 import org.apache.commons.lang.StringUtils;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
-import java.util.HashMap;
 import java.util.List;
 import java.util.Set;
 
@@ -37,7 +49,7 @@ public class SysMenuController extends AbstractController {
 	/**
 	 * 导航菜单
 	 */
-	@RequestMapping("/nav")
+	@GetMapping("/nav")
 	public R nav(){
 		List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
 		Set<String> permissions = shiroService.getUserPermissions(getUserId());
@@ -47,10 +59,16 @@ public class SysMenuController extends AbstractController {
 	/**
 	 * 所有菜单列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:menu:list")
 	public List<SysMenuEntity> list(){
-		List<SysMenuEntity> menuList = sysMenuService.queryList(new HashMap<String, Object>());
+		List<SysMenuEntity> menuList = sysMenuService.selectList(null);
+		for(SysMenuEntity sysMenuEntity : menuList){
+			SysMenuEntity parentMenuEntity = sysMenuService.selectById(sysMenuEntity.getParentId());
+			if(parentMenuEntity != null){
+				sysMenuEntity.setParentName(parentMenuEntity.getName());
+			}
+		}
 
 		return menuList;
 	}
@@ -58,7 +76,7 @@ public class SysMenuController extends AbstractController {
 	/**
 	 * 选择菜单(添加、修改菜单)
 	 */
-	@RequestMapping("/select")
+	@GetMapping("/select")
 	@RequiresPermissions("sys:menu:select")
 	public R select(){
 		//查询列表数据
@@ -78,10 +96,10 @@ public class SysMenuController extends AbstractController {
 	/**
 	 * 菜单信息
 	 */
-	@RequestMapping("/info/{menuId}")
+	@GetMapping("/info/{menuId}")
 	@RequiresPermissions("sys:menu:info")
 	public R info(@PathVariable("menuId") Long menuId){
-		SysMenuEntity menu = sysMenuService.queryObject(menuId);
+		SysMenuEntity menu = sysMenuService.selectById(menuId);
 		return R.ok().put("menu", menu);
 	}
 	
@@ -89,13 +107,13 @@ public class SysMenuController extends AbstractController {
 	 * 保存
 	 */
 	@SysLog("保存菜单")
-	@RequestMapping("/save")
+	@PostMapping("/save")
 	@RequiresPermissions("sys:menu:save")
 	public R save(@RequestBody SysMenuEntity menu){
 		//数据校验
 		verifyForm(menu);
 		
-		sysMenuService.save(menu);
+		sysMenuService.insert(menu);
 		
 		return R.ok();
 	}
@@ -104,13 +122,13 @@ public class SysMenuController extends AbstractController {
 	 * 修改
 	 */
 	@SysLog("修改菜单")
-	@RequestMapping("/update")
+	@PostMapping("/update")
 	@RequiresPermissions("sys:menu:update")
 	public R update(@RequestBody SysMenuEntity menu){
 		//数据校验
 		verifyForm(menu);
 				
-		sysMenuService.update(menu);
+		sysMenuService.updateById(menu);
 		
 		return R.ok();
 	}
@@ -119,17 +137,21 @@ public class SysMenuController extends AbstractController {
 	 * 删除
 	 */
 	@SysLog("删除菜单")
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:menu:delete")
 	public R delete(long menuId){
+		if(menuId <= 31){
+			return R.error("系统菜单,不能删除");
+		}
+
 		//判断是否有子菜单或按钮
 		List<SysMenuEntity> menuList = sysMenuService.queryListParentId(menuId);
 		if(menuList.size() > 0){
 			return R.error("请先删除子菜单或按钮");
 		}
 
-		sysMenuService.deleteBatch(new Long[]{menuId});
-		
+		sysMenuService.delete(menuId);
+
 		return R.ok();
 	}
 	
@@ -146,31 +168,31 @@ public class SysMenuController extends AbstractController {
 		}
 		
 		//菜单
-		if(menu.getType() == MenuType.MENU.getValue()){
+		if(menu.getType() == Constant.MenuType.MENU.getValue()){
 			if(StringUtils.isBlank(menu.getUrl())){
 				throw new RRException("菜单URL不能为空");
 			}
 		}
 		
 		//上级菜单类型
-		int parentType = MenuType.CATALOG.getValue();
+		int parentType = Constant.MenuType.CATALOG.getValue();
 		if(menu.getParentId() != 0){
-			SysMenuEntity parentMenu = sysMenuService.queryObject(menu.getParentId());
+			SysMenuEntity parentMenu = sysMenuService.selectById(menu.getParentId());
 			parentType = parentMenu.getType();
 		}
 		
 		//目录、菜单
-		if(menu.getType() == MenuType.CATALOG.getValue() ||
-				menu.getType() == MenuType.MENU.getValue()){
-			if(parentType != MenuType.CATALOG.getValue()){
+		if(menu.getType() == Constant.MenuType.CATALOG.getValue() ||
+				menu.getType() == Constant.MenuType.MENU.getValue()){
+			if(parentType != Constant.MenuType.CATALOG.getValue()){
 				throw new RRException("上级菜单只能为目录类型");
 			}
 			return ;
 		}
 		
 		//按钮
-		if(menu.getType() == MenuType.BUTTON.getValue()){
-			if(parentType != MenuType.MENU.getValue()){
+		if(menu.getType() == Constant.MenuType.BUTTON.getValue()){
+			if(parentType != Constant.MenuType.MENU.getValue()){
 				throw new RRException("上级菜单只能为菜单类型");
 			}
 			return ;

+ 16 - 22
src/main/java/io/renren/modules/sys/controller/SysRoleController.java

@@ -1,14 +1,13 @@
 package io.renren.modules.sys.controller;
 
 import io.renren.common.annotation.SysLog;
-import io.renren.modules.sys.entity.SysRoleEntity;
-import io.renren.modules.sys.service.SysRoleMenuService;
-import io.renren.modules.sys.service.SysRoleService;
 import io.renren.common.utils.Constant;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
 import io.renren.common.validator.ValidatorUtils;
+import io.renren.modules.sys.entity.SysRoleEntity;
+import io.renren.modules.sys.service.SysRoleMenuService;
+import io.renren.modules.sys.service.SysRoleService;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
@@ -31,32 +30,27 @@ public class SysRoleController extends AbstractController {
 	private SysRoleService sysRoleService;
 	@Autowired
 	private SysRoleMenuService sysRoleMenuService;
-	
+
 	/**
 	 * 角色列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:role:list")
 	public R list(@RequestParam Map<String, Object> params){
 		//如果不是超级管理员,则只查询自己创建的角色列表
 		if(getUserId() != Constant.SUPER_ADMIN){
 			params.put("createUserId", getUserId());
 		}
-		
-		//查询列表数据
-		Query query = new Query(params);
-		List<SysRoleEntity> list = sysRoleService.queryList(query);
-		int total = sysRoleService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(list, total, query.getLimit(), query.getPage());
-		
-		return R.ok().put("page", pageUtil);
+
+		PageUtils page = sysRoleService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 	
 	/**
 	 * 角色列表
 	 */
-	@RequestMapping("/select")
+	@GetMapping("/select")
 	@RequiresPermissions("sys:role:select")
 	public R select(){
 		Map<String, Object> map = new HashMap<>();
@@ -65,7 +59,7 @@ public class SysRoleController extends AbstractController {
 		if(getUserId() != Constant.SUPER_ADMIN){
 			map.put("createUserId", getUserId());
 		}
-		List<SysRoleEntity> list = sysRoleService.queryList(map);
+		List<SysRoleEntity> list = sysRoleService.selectByMap(map);
 		
 		return R.ok().put("list", list);
 	}
@@ -73,10 +67,10 @@ public class SysRoleController extends AbstractController {
 	/**
 	 * 角色信息
 	 */
-	@RequestMapping("/info/{roleId}")
+	@GetMapping("/info/{roleId}")
 	@RequiresPermissions("sys:role:info")
 	public R info(@PathVariable("roleId") Long roleId){
-		SysRoleEntity role = sysRoleService.queryObject(roleId);
+		SysRoleEntity role = sysRoleService.selectById(roleId);
 		
 		//查询角色对应的菜单
 		List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
@@ -89,7 +83,7 @@ public class SysRoleController extends AbstractController {
 	 * 保存角色
 	 */
 	@SysLog("保存角色")
-	@RequestMapping("/save")
+	@PostMapping("/save")
 	@RequiresPermissions("sys:role:save")
 	public R save(@RequestBody SysRoleEntity role){
 		ValidatorUtils.validateEntity(role);
@@ -104,7 +98,7 @@ public class SysRoleController extends AbstractController {
 	 * 修改角色
 	 */
 	@SysLog("修改角色")
-	@RequestMapping("/update")
+	@PostMapping("/update")
 	@RequiresPermissions("sys:role:update")
 	public R update(@RequestBody SysRoleEntity role){
 		ValidatorUtils.validateEntity(role);
@@ -119,7 +113,7 @@ public class SysRoleController extends AbstractController {
 	 * 删除角色
 	 */
 	@SysLog("删除角色")
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:role:delete")
 	public R delete(@RequestBody Long[] roleIds){
 		sysRoleService.deleteBatch(roleIds);

+ 16 - 22
src/main/java/io/renren/modules/sys/controller/SysUserController.java

@@ -3,7 +3,6 @@ package io.renren.modules.sys.controller;
 import io.renren.common.annotation.SysLog;
 import io.renren.common.utils.Constant;
 import io.renren.common.utils.PageUtils;
-import io.renren.common.utils.Query;
 import io.renren.common.utils.R;
 import io.renren.common.validator.Assert;
 import io.renren.common.validator.ValidatorUtils;
@@ -36,32 +35,27 @@ public class SysUserController extends AbstractController {
 	private SysUserService sysUserService;
 	@Autowired
 	private SysUserRoleService sysUserRoleService;
-	
+
+
 	/**
 	 * 所有用户列表
 	 */
-	@RequestMapping("/list")
+	@GetMapping("/list")
 	@RequiresPermissions("sys:user:list")
 	public R list(@RequestParam Map<String, Object> params){
 		//只有超级管理员,才能查看所有管理员列表
 		if(getUserId() != Constant.SUPER_ADMIN){
 			params.put("createUserId", getUserId());
 		}
-		
-		//查询列表数据
-		Query query = new Query(params);
-		List<SysUserEntity> userList = sysUserService.queryList(query);
-		int total = sysUserService.queryTotal(query);
-		
-		PageUtils pageUtil = new PageUtils(userList, total, query.getLimit(), query.getPage());
-		
-		return R.ok().put("page", pageUtil);
+		PageUtils page = sysUserService.queryPage(params);
+
+		return R.ok().put("page", page);
 	}
 	
 	/**
 	 * 获取登录的用户信息
 	 */
-	@RequestMapping("/info")
+	@GetMapping("/info")
 	public R info(){
 		return R.ok().put("user", getUser());
 	}
@@ -70,7 +64,7 @@ public class SysUserController extends AbstractController {
 	 * 修改登录用户密码
 	 */
 	@SysLog("修改密码")
-	@RequestMapping("/password")
+	@PostMapping("/password")
 	public R password(@RequestBody PasswordForm form){
 		Assert.isBlank(form.getNewPassword(), "新密码不为能空");
 		
@@ -80,8 +74,8 @@ public class SysUserController extends AbstractController {
 		String newPassword = new Sha256Hash(form.getNewPassword(), getUser().getSalt()).toHex();
 				
 		//更新密码
-		int count = sysUserService.updatePassword(getUserId(), password, newPassword);
-		if(count == 0){
+		boolean flag = sysUserService.updatePassword(getUserId(), password, newPassword);
+		if(!flag){
 			return R.error("原密码不正确");
 		}
 		
@@ -91,10 +85,10 @@ public class SysUserController extends AbstractController {
 	/**
 	 * 用户信息
 	 */
-	@RequestMapping("/info/{userId}")
+	@GetMapping("/info/{userId}")
 	@RequiresPermissions("sys:user:info")
 	public R info(@PathVariable("userId") Long userId){
-		SysUserEntity user = sysUserService.queryObject(userId);
+		SysUserEntity user = sysUserService.selectById(userId);
 		
 		//获取用户所属的角色列表
 		List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
@@ -107,7 +101,7 @@ public class SysUserController extends AbstractController {
 	 * 保存用户
 	 */
 	@SysLog("保存用户")
-	@RequestMapping("/save")
+	@PostMapping("/save")
 	@RequiresPermissions("sys:user:save")
 	public R save(@RequestBody SysUserEntity user){
 		ValidatorUtils.validateEntity(user, AddGroup.class);
@@ -122,11 +116,11 @@ public class SysUserController extends AbstractController {
 	 * 修改用户
 	 */
 	@SysLog("修改用户")
-	@RequestMapping("/update")
+	@PostMapping("/update")
 	@RequiresPermissions("sys:user:update")
 	public R update(@RequestBody SysUserEntity user){
 		ValidatorUtils.validateEntity(user, UpdateGroup.class);
-		
+
 		user.setCreateUserId(getUserId());
 		sysUserService.update(user);
 		
@@ -137,7 +131,7 @@ public class SysUserController extends AbstractController {
 	 * 删除用户
 	 */
 	@SysLog("删除用户")
-	@RequestMapping("/delete")
+	@PostMapping("/delete")
 	@RequiresPermissions("sys:user:delete")
 	public R delete(@RequestBody Long[] userIds){
 		if(ArrayUtils.contains(userIds, 1L)){

+ 0 - 41
src/main/java/io/renren/modules/sys/dao/BaseDao.java

@@ -1,41 +0,0 @@
-package io.renren.modules.sys.dao;
-
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * 基础Dao(还需在XML文件里,有对应的SQL语句)
- * 
- * @author chenshun
- * @email sunlightcs@gmail.com
- * @date 2016年9月18日 上午9:31:36
- */
-public interface BaseDao<T> {
-	
-	void save(T t);
-	
-	void save(Map<String, Object> map);
-	
-	void saveBatch(List<T> list);
-	
-	int update(T t);
-	
-	int update(Map<String, Object> map);
-	
-	int delete(Object id);
-	
-	int delete(Map<String, Object> map);
-	
-	int deleteBatch(Object[] id);
-
-	T queryObject(Object id);
-	
-	List<T> queryList(Map<String, Object> map);
-	
-	List<T> queryList(Object id);
-	
-	int queryTotal(Map<String, Object> map);
-
-	int queryTotal();
-}

+ 32 - 0
src/main/java/io/renren/modules/sys/dao/SysCaptchaDao.java

@@ -0,0 +1,32 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.modules.sys.dao;
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
+import io.renren.modules.sys.entity.SysCaptchaEntity;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 验证码
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 3.1.0 2018-02-10
+ */
+@Mapper
+public interface SysCaptchaDao extends BaseMapper<SysCaptchaEntity> {
+
+}

+ 21 - 3
src/main/java/io/renren/modules/sys/dao/SysConfigDao.java

@@ -1,5 +1,23 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.dao;
 
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysConfigEntity;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
@@ -12,13 +30,13 @@ import org.apache.ibatis.annotations.Param;
  * @date 2016年12月4日 下午6:46:16
  */
 @Mapper
-public interface SysConfigDao extends BaseDao<SysConfigEntity> {
-	
+public interface SysConfigDao extends BaseMapper<SysConfigEntity> {
+
 	/**
 	 * 根据key,查询value
 	 */
 	SysConfigEntity queryByKey(String paramKey);
-	
+
 	/**
 	 * 根据key,更新value
 	 */

+ 19 - 1
src/main/java/io/renren/modules/sys/dao/SysLogDao.java

@@ -1,5 +1,23 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.dao;
 
+
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysLogEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -11,6 +29,6 @@ import org.apache.ibatis.annotations.Mapper;
  * @date 2017-03-08 10:40:56
  */
 @Mapper
-public interface SysLogDao extends BaseDao<SysLogEntity> {
+public interface SysLogDao extends BaseMapper<SysLogEntity> {
 	
 }

+ 19 - 6
src/main/java/io/renren/modules/sys/dao/SysMenuDao.java

@@ -1,5 +1,22 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysMenuEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -13,7 +30,7 @@ import java.util.List;
  * @date 2016年9月18日 上午9:33:01
  */
 @Mapper
-public interface SysMenuDao extends BaseDao<SysMenuEntity> {
+public interface SysMenuDao extends BaseMapper<SysMenuEntity> {
 	
 	/**
 	 * 根据父菜单,查询子菜单
@@ -25,9 +42,5 @@ public interface SysMenuDao extends BaseDao<SysMenuEntity> {
 	 * 获取不包含按钮的菜单列表
 	 */
 	List<SysMenuEntity> queryNotButtonList();
-	
-	/**
-	 * 查询用户的权限列表
-	 */
-	List<SysMenuEntity> queryUserList(Long userId);
+
 }

+ 2 - 1
src/main/java/io/renren/modules/sys/dao/SysRoleDao.java

@@ -1,5 +1,6 @@
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysRoleEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -13,7 +14,7 @@ import java.util.List;
  * @date 2016年9月18日 上午9:33:33
  */
 @Mapper
-public interface SysRoleDao extends BaseDao<SysRoleEntity> {
+public interface SysRoleDao extends BaseMapper<SysRoleEntity> {
 	
 	/**
 	 * 查询用户创建的角色ID列表

+ 7 - 1
src/main/java/io/renren/modules/sys/dao/SysRoleMenuDao.java

@@ -1,5 +1,6 @@
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysRoleMenuEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -13,10 +14,15 @@ import java.util.List;
  * @date 2016年9月18日 上午9:33:46
  */
 @Mapper
-public interface SysRoleMenuDao extends BaseDao<SysRoleMenuEntity> {
+public interface SysRoleMenuDao extends BaseMapper<SysRoleMenuEntity> {
 	
 	/**
 	 * 根据角色ID,获取菜单ID列表
 	 */
 	List<Long> queryMenuIdList(Long roleId);
+
+	/**
+	 * 根据角色ID数组,批量删除
+	 */
+	int deleteBatch(Long[] roleIds);
 }

+ 3 - 7
src/main/java/io/renren/modules/sys/dao/SysUserDao.java

@@ -1,10 +1,10 @@
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysUserEntity;
 import org.apache.ibatis.annotations.Mapper;
 
 import java.util.List;
-import java.util.Map;
 
 /**
  * 系统用户
@@ -14,7 +14,7 @@ import java.util.Map;
  * @date 2016年9月18日 上午9:34:11
  */
 @Mapper
-public interface SysUserDao extends BaseDao<SysUserEntity> {
+public interface SysUserDao extends BaseMapper<SysUserEntity> {
 	
 	/**
 	 * 查询用户的所有权限
@@ -31,9 +31,5 @@ public interface SysUserDao extends BaseDao<SysUserEntity> {
 	 * 根据用户名,查询系统用户
 	 */
 	SysUserEntity queryByUserName(String username);
-	
-	/**
-	 * 修改密码
-	 */
-	int updatePassword(Map<String, Object> map);
+
 }

+ 8 - 1
src/main/java/io/renren/modules/sys/dao/SysUserRoleDao.java

@@ -1,5 +1,6 @@
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysUserRoleEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -13,10 +14,16 @@ import java.util.List;
  * @date 2016年9月18日 上午9:34:46
  */
 @Mapper
-public interface SysUserRoleDao extends BaseDao<SysUserRoleEntity> {
+public interface SysUserRoleDao extends BaseMapper<SysUserRoleEntity> {
 	
 	/**
 	 * 根据用户ID,获取角色ID列表
 	 */
 	List<Long> queryRoleIdList(Long userId);
+
+
+	/**
+	 * 根据角色ID数组,批量删除
+	 */
+	int deleteBatch(Long[] roleIds);
 }

+ 2 - 3
src/main/java/io/renren/modules/sys/dao/SysUserTokenDao.java

@@ -1,5 +1,6 @@
 package io.renren.modules.sys.dao;
 
+import com.baomidou.mybatisplus.mapper.BaseMapper;
 import io.renren.modules.sys.entity.SysUserTokenEntity;
 import org.apache.ibatis.annotations.Mapper;
 
@@ -11,9 +12,7 @@ import org.apache.ibatis.annotations.Mapper;
  * @date 2017-03-23 15:22:07
  */
 @Mapper
-public interface SysUserTokenDao extends BaseDao<SysUserTokenEntity> {
-    
-    SysUserTokenEntity queryByUserId(Long userId);
+public interface SysUserTokenDao extends BaseMapper<SysUserTokenEntity> {
 
     SysUserTokenEntity queryByToken(String token);
 	

+ 66 - 0
src/main/java/io/renren/modules/sys/entity/SysCaptchaEntity.java

@@ -0,0 +1,66 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.modules.sys.entity;
+
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+import com.baomidou.mybatisplus.enums.IdType;
+
+import java.util.Date;
+
+/**
+ * 系统验证码
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2018-02-10
+ */
+@TableName("sys_captcha")
+public class SysCaptchaEntity {
+    @TableId(type = IdType.INPUT)
+    private String uuid;
+    /**
+     * 验证码
+     */
+    private String code;
+    /**
+     * 过期时间
+     */
+    private Date expireTime;
+
+    public String getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(String uuid) {
+        this.uuid = uuid;
+    }
+
+    public String getCode() {
+        return code;
+    }
+
+    public void setCode(String code) {
+        this.code = code;
+    }
+
+    public Date getExpireTime() {
+        return expireTime;
+    }
+
+    public void setExpireTime(Date expireTime) {
+        this.expireTime = expireTime;
+    }
+}

+ 20 - 1
src/main/java/io/renren/modules/sys/entity/SysConfigEntity.java

@@ -1,6 +1,23 @@
-package io.renren.modules.sys.entity;
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
 
+package io.renren.modules.sys.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
 import org.hibernate.validator.constraints.NotBlank;
 
 /**
@@ -10,7 +27,9 @@ import org.hibernate.validator.constraints.NotBlank;
  * @email sunlightcs@gmail.com
  * @date 2016年12月4日 下午6:43:36
  */
+@TableName("sys_config")
 public class SysConfigEntity {
+	@TableId
 	private Long id;
 	@NotBlank(message="参数名不能为空")
 	private String key;

+ 21 - 1
src/main/java/io/renren/modules/sys/entity/SysLogEntity.java

@@ -1,5 +1,24 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -11,9 +30,10 @@ import java.util.Date;
  * @email sunlightcs@gmail.com
  * @date 2017-03-08 10:40:56
  */
+@TableName("sys_log")
 public class SysLogEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-	
+	@TableId
 	private Long id;
 	//用户名
 	private String username;

+ 26 - 1
src/main/java/io/renren/modules/sys/entity/SysMenuEntity.java

@@ -1,6 +1,26 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.entity;
 
 
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.List;
 
@@ -11,12 +31,14 @@ import java.util.List;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:26:39
  */
+@TableName("sys_menu")
 public class SysMenuEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	
 	/**
 	 * 菜单ID
 	 */
+	@TableId
 	private Long menuId;
 
 	/**
@@ -27,6 +49,7 @@ public class SysMenuEntity implements Serializable {
 	/**
 	 * 父菜单名称
 	 */
+	@TableField(exist=false)
 	private String parentName;
 
 	/**
@@ -62,8 +85,10 @@ public class SysMenuEntity implements Serializable {
 	/**
 	 * ztree属性
 	 */
+	@TableField(exist=false)
 	private Boolean open;
-	
+
+	@TableField(exist=false)
 	private List<?> list;
 
 	public void setMenuId(Long menuId) {

+ 7 - 1
src/main/java/io/renren/modules/sys/entity/SysRoleEntity.java

@@ -1,6 +1,9 @@
 package io.renren.modules.sys.entity;
 
 
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
 import org.hibernate.validator.constraints.NotBlank;
 
 import java.io.Serializable;
@@ -14,12 +17,14 @@ import java.util.List;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:27:38
  */
+@TableName("sys_role")
 public class SysRoleEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	
 	/**
 	 * 角色ID
 	 */
+	@TableId
 	private Long roleId;
 
 	/**
@@ -37,7 +42,8 @@ public class SysRoleEntity implements Serializable {
 	 * 创建者ID
 	 */
 	private Long createUserId;
-	
+
+	@TableField(exist=false)
 	private List<Long> menuIdList;
 	
 	/**

+ 6 - 1
src/main/java/io/renren/modules/sys/entity/SysRoleMenuEntity.java

@@ -1,6 +1,9 @@
 package io.renren.modules.sys.entity;
 
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 
 /**
@@ -10,9 +13,11 @@ import java.io.Serializable;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:28:13
  */
+@TableName("sys_role_menu")
 public class SysRoleMenuEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-	
+
+	@TableId
 	private Long id;
 
 	/**

+ 6 - 0
src/main/java/io/renren/modules/sys/entity/SysUserEntity.java

@@ -1,5 +1,8 @@
 package io.renren.modules.sys.entity;
 
+import com.baomidou.mybatisplus.annotations.TableField;
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
 import io.renren.common.validator.group.AddGroup;
 import io.renren.common.validator.group.UpdateGroup;
 import org.hibernate.validator.constraints.Email;
@@ -16,12 +19,14 @@ import java.util.List;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:28:55
  */
+@TableName("sys_user")
 public class SysUserEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	
 	/**
 	 * 用户ID
 	 */
+	@TableId
 	private Long userId;
 
 	/**
@@ -61,6 +66,7 @@ public class SysUserEntity implements Serializable {
 	/**
 	 * 角色ID列表
 	 */
+	@TableField(exist=false)
 	private List<Long> roleIdList;
 	
 	/**

+ 5 - 1
src/main/java/io/renren/modules/sys/entity/SysUserRoleEntity.java

@@ -1,6 +1,9 @@
 package io.renren.modules.sys.entity;
 
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 
 /**
@@ -10,9 +13,10 @@ import java.io.Serializable;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:28:39
  */
+@TableName("sys_user_role")
 public class SysUserRoleEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
-	
+	@TableId
 	private Long id;
 
 	/**

+ 5 - 0
src/main/java/io/renren/modules/sys/entity/SysUserTokenEntity.java

@@ -1,5 +1,8 @@
 package io.renren.modules.sys.entity;
 
+import com.baomidou.mybatisplus.annotations.TableId;
+import com.baomidou.mybatisplus.annotations.TableName;
+
 import java.io.Serializable;
 import java.util.Date;
 
@@ -7,10 +10,12 @@ import java.util.Date;
 /**
  * 系统用户Token
  */
+@TableName("sys_user_token")
 public class SysUserTokenEntity implements Serializable {
 	private static final long serialVersionUID = 1L;
 	
 	//用户ID
+	@TableId
 	private Long userId;
 	//token
 	private String token;

+ 5 - 0
src/main/java/io/renren/modules/sys/oauth2/OAuth2Filter.java

@@ -7,6 +7,7 @@ import org.apache.http.HttpStatus;
 import org.apache.shiro.authc.AuthenticationException;
 import org.apache.shiro.authc.AuthenticationToken;
 import org.apache.shiro.web.filter.authc.AuthenticatingFilter;
+import org.springframework.web.bind.annotation.RequestMethod;
 
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
@@ -37,6 +38,10 @@ public class OAuth2Filter extends AuthenticatingFilter {
 
     @Override
     protected boolean isAccessAllowed(ServletRequest request, ServletResponse response, Object mappedValue) {
+        if(((HttpServletRequest) request).getMethod().equals(RequestMethod.OPTIONS.name())){
+            return true;
+        }
+
         return false;
     }
 

+ 44 - 0
src/main/java/io/renren/modules/sys/service/SysCaptchaService.java

@@ -0,0 +1,44 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.modules.sys.service;
+
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.modules.sys.entity.SysCaptchaEntity;
+
+import java.awt.image.BufferedImage;
+
+/**
+ * 验证码
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2018-02-10
+ */
+public interface SysCaptchaService extends IService<SysCaptchaEntity> {
+
+    /**
+     * 获取图片验证码
+     */
+    BufferedImage getCaptcha(String uuid);
+
+    /**
+     * 验证码效验
+     * @param uuid  uuid
+     * @param code  验证码
+     * @return  true:成功  false:失败
+     */
+    boolean validate(String uuid, String code);
+}

+ 22 - 13
src/main/java/io/renren/modules/sys/service/SysConfigService.java

@@ -1,8 +1,26 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service;
 
+
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.sys.entity.SysConfigEntity;
 
-import java.util.List;
 import java.util.Map;
 
 /**
@@ -12,7 +30,9 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2016年12月4日 下午6:49:01
  */
-public interface SysConfigService {
+public interface SysConfigService extends IService<SysConfigEntity>  {
+
+	PageUtils queryPage(Map<String, Object> params);
 	
 	/**
 	 * 保存配置信息
@@ -35,17 +55,6 @@ public interface SysConfigService {
 	public void deleteBatch(Long[] ids);
 	
 	/**
-	 * 获取List列表
-	 */
-	public List<SysConfigEntity> queryList(Map<String, Object> map);
-	/**
-	 * 获取总记录数
-	 */
-	public int queryTotal(Map<String, Object> map);
-	
-	public SysConfigEntity queryObject(Long id);
-	
-	/**
 	 * 根据key,获取配置的value值
 	 * 
 	 * @param key           key

+ 24 - 14
src/main/java/io/renren/modules/sys/service/SysLogService.java

@@ -1,10 +1,29 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service;
 
+
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.sys.entity.SysLogEntity;
 
-import java.util.List;
 import java.util.Map;
 
+
 /**
  * 系统日志
  * 
@@ -12,17 +31,8 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2017-03-08 10:40:56
  */
-public interface SysLogService {
-	
-	SysLogEntity queryObject(Long id);
-	
-	List<SysLogEntity> queryList(Map<String, Object> map);
-	
-	int queryTotal(Map<String, Object> map);
-	
-	void save(SysLogEntity sysLog);
-
-	void delete(Long id);
-	
-	void deleteBatch(Long[] ids);
+public interface SysLogService extends IService<SysLogEntity> {
+
+    PageUtils queryPage(Map<String, Object> params);
+
 }

+ 22 - 35
src/main/java/io/renren/modules/sys/service/SysMenuService.java

@@ -1,9 +1,26 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service;
 
+
+import com.baomidou.mybatisplus.service.IService;
 import io.renren.modules.sys.entity.SysMenuEntity;
 
 import java.util.List;
-import java.util.Map;
 
 
 /**
@@ -13,8 +30,8 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:42:16
  */
-public interface SysMenuService {
-	
+public interface SysMenuService extends IService<SysMenuEntity> {
+
 	/**
 	 * 根据父菜单,查询子菜单
 	 * @param parentId 父菜单ID
@@ -37,39 +54,9 @@ public interface SysMenuService {
 	 * 获取用户菜单列表
 	 */
 	List<SysMenuEntity> getUserMenuList(Long userId);
-	
-	/**
-	 * 查询菜单
-	 */
-	SysMenuEntity queryObject(Long menuId);
-	
-	/**
-	 * 查询菜单列表
-	 */
-	List<SysMenuEntity> queryList(Map<String, Object> map);
-	
-	/**
-	 * 查询总数
-	 */
-	int queryTotal(Map<String, Object> map);
-	
-	/**
-	 * 保存菜单
-	 */
-	void save(SysMenuEntity menu);
-	
-	/**
-	 * 修改
-	 */
-	void update(SysMenuEntity menu);
-	
+
 	/**
 	 * 删除
 	 */
-	void deleteBatch(Long[] menuIds);
-	
-	/**
-	 * 查询用户的权限列表
-	 */
-	List<SysMenuEntity> queryUserList(Long userId);
+	void delete(Long menuId);
 }

+ 9 - 1
src/main/java/io/renren/modules/sys/service/SysRoleMenuService.java

@@ -1,5 +1,8 @@
 package io.renren.modules.sys.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.modules.sys.entity.SysRoleMenuEntity;
+
 import java.util.List;
 
 
@@ -11,7 +14,7 @@ import java.util.List;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:42:30
  */
-public interface SysRoleMenuService {
+public interface SysRoleMenuService extends IService<SysRoleMenuEntity> {
 	
 	void saveOrUpdate(Long roleId, List<Long> menuIdList);
 	
@@ -19,5 +22,10 @@ public interface SysRoleMenuService {
 	 * 根据角色ID,获取菜单ID列表
 	 */
 	List<Long> queryMenuIdList(Long roleId);
+
+	/**
+	 * 根据角色ID数组,批量删除
+	 */
+	int deleteBatch(Long[] roleIds);
 	
 }

+ 9 - 10
src/main/java/io/renren/modules/sys/service/SysRoleService.java

@@ -1,5 +1,7 @@
 package io.renren.modules.sys.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.sys.entity.SysRoleEntity;
 
 import java.util.List;
@@ -13,19 +15,16 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:42:52
  */
-public interface SysRoleService {
-	
-	SysRoleEntity queryObject(Long roleId);
-	
-	List<SysRoleEntity> queryList(Map<String, Object> map);
-	
-	int queryTotal(Map<String, Object> map);
-	
+public interface SysRoleService extends IService<SysRoleEntity> {
+
+	PageUtils queryPage(Map<String, Object> params);
+
 	void save(SysRoleEntity role);
-	
+
 	void update(SysRoleEntity role);
-	
+
 	void deleteBatch(Long[] roleIds);
+
 	
 	/**
 	 * 查询用户创建的角色ID列表

+ 9 - 3
src/main/java/io/renren/modules/sys/service/SysUserRoleService.java

@@ -1,5 +1,8 @@
 package io.renren.modules.sys.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.modules.sys.entity.SysUserRoleEntity;
+
 import java.util.List;
 
 
@@ -11,7 +14,7 @@ import java.util.List;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:43:24
  */
-public interface SysUserRoleService {
+public interface SysUserRoleService extends IService<SysUserRoleEntity> {
 	
 	void saveOrUpdate(Long userId, List<Long> roleIdList);
 	
@@ -19,6 +22,9 @@ public interface SysUserRoleService {
 	 * 根据用户ID,获取角色ID列表
 	 */
 	List<Long> queryRoleIdList(Long userId);
-	
-	void delete(Long userId);
+
+	/**
+	 * 根据角色ID数组,批量删除
+	 */
+	int deleteBatch(Long[] roleIds);
 }

+ 8 - 21
src/main/java/io/renren/modules/sys/service/SysUserService.java

@@ -1,5 +1,7 @@
 package io.renren.modules.sys.service;
 
+import com.baomidou.mybatisplus.service.IService;
+import io.renren.common.utils.PageUtils;
 import io.renren.modules.sys.entity.SysUserEntity;
 
 import java.util.List;
@@ -13,7 +15,9 @@ import java.util.Map;
  * @email sunlightcs@gmail.com
  * @date 2016年9月18日 上午9:43:39
  */
-public interface SysUserService {
+public interface SysUserService extends IService<SysUserEntity> {
+
+	PageUtils queryPage(Map<String, Object> params);
 
 	/**
 	 * 查询用户的所有权限
@@ -30,24 +34,7 @@ public interface SysUserService {
 	 * 根据用户名,查询系统用户
 	 */
 	SysUserEntity queryByUserName(String username);
-	
-	/**
-	 * 根据用户ID,查询用户
-	 * @param userId
-	 * @return
-	 */
-	SysUserEntity queryObject(Long userId);
-	
-	/**
-	 * 查询用户列表
-	 */
-	List<SysUserEntity> queryList(Map<String, Object> map);
-	
-	/**
-	 * 查询总数
-	 */
-	int queryTotal(Map<String, Object> map);
-	
+
 	/**
 	 * 保存用户
 	 */
@@ -62,12 +49,12 @@ public interface SysUserService {
 	 * 删除用户
 	 */
 	void deleteBatch(Long[] userIds);
-	
+
 	/**
 	 * 修改密码
 	 * @param userId       用户ID
 	 * @param password     原密码
 	 * @param newPassword  新密码
 	 */
-	int updatePassword(Long userId, String password, String newPassword);
+	boolean updatePassword(Long userId, String password, String newPassword);
 }

+ 3 - 8
src/main/java/io/renren/modules/sys/service/SysUserTokenService.java

@@ -1,7 +1,8 @@
 package io.renren.modules.sys.service;
 
-import io.renren.modules.sys.entity.SysUserTokenEntity;
+import com.baomidou.mybatisplus.service.IService;
 import io.renren.common.utils.R;
+import io.renren.modules.sys.entity.SysUserTokenEntity;
 
 /**
  * 用户Token
@@ -10,13 +11,7 @@ import io.renren.common.utils.R;
  * @email sunlightcs@gmail.com
  * @date 2017-03-23 15:22:07
  */
-public interface SysUserTokenService {
-
-	SysUserTokenEntity queryByUserId(Long userId);
-
-	void save(SysUserTokenEntity token);
-	
-	void update(SysUserTokenEntity token);
+public interface SysUserTokenService extends IService<SysUserTokenEntity> {
 
 	/**
 	 * 生成token

+ 2 - 2
src/main/java/io/renren/modules/sys/service/impl/ShiroServiceImpl.java

@@ -29,7 +29,7 @@ public class ShiroServiceImpl implements ShiroService {
 
         //系统管理员,拥有最高权限
         if(userId == Constant.SUPER_ADMIN){
-            List<SysMenuEntity> menuList = sysMenuDao.queryList(new HashMap<>());
+            List<SysMenuEntity> menuList = sysMenuDao.selectList(null);
             permsList = new ArrayList<>(menuList.size());
             for(SysMenuEntity menu : menuList){
                 permsList.add(menu.getPerms());
@@ -55,6 +55,6 @@ public class ShiroServiceImpl implements ShiroService {
 
     @Override
     public SysUserEntity queryUser(Long userId) {
-        return sysUserDao.queryObject(userId);
+        return sysUserDao.selectById(userId);
     }
 }

+ 79 - 0
src/main/java/io/renren/modules/sys/service/impl/SysCaptchaServiceImpl.java

@@ -0,0 +1,79 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
+package io.renren.modules.sys.service.impl;
+
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import com.google.code.kaptcha.Producer;
+import io.renren.common.exception.RRException;
+import io.renren.common.utils.DateUtils;
+import io.renren.modules.sys.dao.SysCaptchaDao;
+import io.renren.modules.sys.entity.SysCaptchaEntity;
+import io.renren.modules.sys.service.SysCaptchaService;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.awt.image.BufferedImage;
+import java.util.Date;
+
+/**
+ * 验证码
+ *
+ * @author Mark sunlightcs@gmail.com
+ * @since 2.0.0 2018-02-10
+ */
+@Service("sysCaptchaService")
+public class SysCaptchaServiceImpl extends ServiceImpl<SysCaptchaDao, SysCaptchaEntity> implements SysCaptchaService {
+    @Autowired
+    private Producer producer;
+
+    @Override
+    public BufferedImage getCaptcha(String uuid) {
+        if(StringUtils.isBlank(uuid)){
+            throw new RRException("uuid不能为空");
+        }
+        //生成文字验证码
+        String code = producer.createText();
+
+        SysCaptchaEntity captchaEntity = new SysCaptchaEntity();
+        captchaEntity.setUuid(uuid);
+        captchaEntity.setCode(code);
+        //5分钟后过期
+        captchaEntity.setExpireTime(DateUtils.addDateMinutes(new Date(), 5));
+        this.insert(captchaEntity);
+
+        return producer.createImage(code);
+    }
+
+    @Override
+    public boolean validate(String uuid, String code) {
+        SysCaptchaEntity captchaEntity = this.selectOne(new EntityWrapper<SysCaptchaEntity>().eq("uuid", uuid));
+        if(captchaEntity == null){
+            return false;
+        }
+
+        //删除验证码
+        this.deleteById(uuid);
+
+        if(captchaEntity.getCode().equalsIgnoreCase(code) && captchaEntity.getExpireTime().getTime() >= System.currentTimeMillis()){
+            return true;
+        }
+
+        return false;
+    }
+}

+ 46 - 29
src/main/java/io/renren/modules/sys/service/impl/SysConfigServiceImpl.java

@@ -1,7 +1,28 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import com.google.gson.Gson;
 import io.renren.common.exception.RRException;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.sys.dao.SysConfigDao;
 import io.renren.modules.sys.entity.SysConfigEntity;
 import io.renren.modules.sys.redis.SysConfigRedis;
@@ -11,68 +32,64 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.List;
+import java.util.Arrays;
 import java.util.Map;
 
 @Service("sysConfigService")
-public class SysConfigServiceImpl implements SysConfigService {
-	@Autowired
-	private SysConfigDao sysConfigDao;
+public class SysConfigServiceImpl extends ServiceImpl<SysConfigDao, SysConfigEntity> implements SysConfigService {
 	@Autowired
 	private SysConfigRedis sysConfigRedis;
+
+	@Override
+	public PageUtils queryPage(Map<String, Object> params) {
+		String key = (String)params.get("key");
+
+		Page<SysConfigEntity> page = this.selectPage(
+				new Query<SysConfigEntity>(params).getPage(),
+				new EntityWrapper<SysConfigEntity>()
+					.like(StringUtils.isNotBlank(key),"key", key)
+					.eq("status", 1)
+		);
+
+		return new PageUtils(page);
+	}
 	
 	@Override
-	@Transactional
 	public void save(SysConfigEntity config) {
-		sysConfigDao.save(config);
+		this.insert(config);
 		sysConfigRedis.saveOrUpdate(config);
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void update(SysConfigEntity config) {
-		sysConfigDao.update(config);
+		this.updateById(config);
 		sysConfigRedis.saveOrUpdate(config);
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void updateValueByKey(String key, String value) {
-		sysConfigDao.updateValueByKey(key, value);
+		baseMapper.updateValueByKey(key, value);
 		sysConfigRedis.delete(key);
 	}
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void deleteBatch(Long[] ids) {
 		for(Long id : ids){
-			SysConfigEntity config = queryObject(id);
+			SysConfigEntity config = this.selectById(id);
 			sysConfigRedis.delete(config.getKey());
 		}
 
-		sysConfigDao.deleteBatch(ids);
-	}
-
-	@Override
-	public List<SysConfigEntity> queryList(Map<String, Object> map) {
-		return sysConfigDao.queryList(map);
-	}
-
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return sysConfigDao.queryTotal(map);
-	}
-
-	@Override
-	public SysConfigEntity queryObject(Long id) {
-		return sysConfigDao.queryObject(id);
+		this.deleteBatchIds(Arrays.asList(ids));
 	}
 
 	@Override
 	public String getValue(String key) {
 		SysConfigEntity config = sysConfigRedis.get(key);
 		if(config == null){
-			config = sysConfigDao.queryByKey(key);
+			config = baseMapper.queryByKey(key);
 			sysConfigRedis.saveOrUpdate(config);
 		}
 

+ 35 - 37
src/main/java/io/renren/modules/sys/service/impl/SysLogServiceImpl.java

@@ -1,49 +1,47 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.sys.dao.SysLogDao;
 import io.renren.modules.sys.entity.SysLogEntity;
 import io.renren.modules.sys.service.SysLogService;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
 import java.util.Map;
 
 
-
 @Service("sysLogService")
-public class SysLogServiceImpl implements SysLogService {
-	@Autowired
-	private SysLogDao sysLogDao;
-	
-	@Override
-	public SysLogEntity queryObject(Long id){
-		return sysLogDao.queryObject(id);
-	}
-	
-	@Override
-	public List<SysLogEntity> queryList(Map<String, Object> map){
-		return sysLogDao.queryList(map);
-	}
-	
-	@Override
-	public int queryTotal(Map<String, Object> map){
-		return sysLogDao.queryTotal(map);
-	}
-	
-	@Override
-	public void save(SysLogEntity sysLog){
-		sysLogDao.save(sysLog);
-	}
-	
-	@Override
-	public void delete(Long id){
-		sysLogDao.delete(id);
-	}
-	
-	@Override
-	public void deleteBatch(Long[] ids){
-		sysLogDao.deleteBatch(ids);
-	}
-	
+public class SysLogServiceImpl extends ServiceImpl<SysLogDao, SysLogEntity> implements SysLogService {
+
+    @Override
+    public PageUtils queryPage(Map<String, Object> params) {
+        String key = (String)params.get("key");
+
+        Page<SysLogEntity> page = this.selectPage(
+            new Query<SysLogEntity>(params).getPage(),
+            new EntityWrapper<SysLogEntity>().like(StringUtils.isNotBlank(key),"username", key)
+        );
+
+        return new PageUtils(page);
+    }
 }

+ 34 - 42
src/main/java/io/renren/modules/sys/service/impl/SysMenuServiceImpl.java

@@ -1,24 +1,43 @@
+/**
+ * Copyright 2018 人人开源 http://www.renren.io
+ * <p>
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may not
+ * use this file except in compliance with the License. You may obtain a copy of
+ * the License at
+ * <p>
+ * http://www.apache.org/licenses/LICENSE-2.0
+ * <p>
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations under
+ * the License.
+ */
+
 package io.renren.modules.sys.service.impl;
 
+
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import io.renren.common.utils.Constant;
+import io.renren.common.utils.MapUtils;
 import io.renren.modules.sys.dao.SysMenuDao;
 import io.renren.modules.sys.entity.SysMenuEntity;
 import io.renren.modules.sys.service.SysMenuService;
+import io.renren.modules.sys.service.SysRoleMenuService;
 import io.renren.modules.sys.service.SysUserService;
-import io.renren.common.utils.Constant.MenuType;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
 
-import java.util.*;
+import java.util.ArrayList;
+import java.util.List;
 
 
 @Service("sysMenuService")
-public class SysMenuServiceImpl implements SysMenuService {
-	@Autowired
-	private SysMenuDao sysMenuDao;
+public class SysMenuServiceImpl extends ServiceImpl<SysMenuDao, SysMenuEntity> implements SysMenuService {
 	@Autowired
 	private SysUserService sysUserService;
+	@Autowired
+	private SysRoleMenuService sysRoleMenuService;
 	
 	@Override
 	public List<SysMenuEntity> queryListParentId(Long parentId, List<Long> menuIdList) {
@@ -38,12 +57,12 @@ public class SysMenuServiceImpl implements SysMenuService {
 
 	@Override
 	public List<SysMenuEntity> queryListParentId(Long parentId) {
-		return sysMenuDao.queryListParentId(parentId);
+		return baseMapper.queryListParentId(parentId);
 	}
 
 	@Override
 	public List<SysMenuEntity> queryNotButtonList() {
-		return sysMenuDao.queryNotButtonList();
+		return baseMapper.queryNotButtonList();
 	}
 
 	@Override
@@ -57,41 +76,13 @@ public class SysMenuServiceImpl implements SysMenuService {
 		List<Long> menuIdList = sysUserService.queryAllMenuId(userId);
 		return getAllMenuList(menuIdList);
 	}
-	
-	@Override
-	public SysMenuEntity queryObject(Long menuId) {
-		return sysMenuDao.queryObject(menuId);
-	}
-
-	@Override
-	public List<SysMenuEntity> queryList(Map<String, Object> map) {
-		return sysMenuDao.queryList(map);
-	}
-
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return sysMenuDao.queryTotal(map);
-	}
-
-	@Override
-	public void save(SysMenuEntity menu) {
-		sysMenuDao.save(menu);
-	}
 
 	@Override
-	public void update(SysMenuEntity menu) {
-		sysMenuDao.update(menu);
-	}
-
-	@Override
-	@Transactional
-	public void deleteBatch(Long[] menuIds) {
-		sysMenuDao.deleteBatch(menuIds);
-	}
-	
-	@Override
-	public List<SysMenuEntity> queryUserList(Long userId) {
-		return sysMenuDao.queryUserList(userId);
+	public void delete(Long menuId){
+		//删除菜单
+		this.deleteById(menuId);
+		//删除菜单与角色关联
+		sysRoleMenuService.deleteByMap(new MapUtils().put("menu_id", menuId));
 	}
 
 	/**
@@ -113,7 +104,8 @@ public class SysMenuServiceImpl implements SysMenuService {
 		List<SysMenuEntity> subMenuList = new ArrayList<SysMenuEntity>();
 		
 		for(SysMenuEntity entity : menuList){
-			if(entity.getType() == MenuType.CATALOG.getValue()){//目录
+			//目录
+			if(entity.getType() == Constant.MenuType.CATALOG.getValue()){
 				entity.setList(getMenuTreeList(queryListParentId(entity.getMenuId(), menuIdList), menuIdList));
 			}
 			subMenuList.add(entity);

+ 23 - 16
src/main/java/io/renren/modules/sys/service/impl/SysRoleMenuServiceImpl.java

@@ -1,16 +1,15 @@
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import io.renren.modules.sys.dao.SysRoleMenuDao;
+import io.renren.modules.sys.entity.SysRoleMenuEntity;
 import io.renren.modules.sys.service.SysRoleMenuService;
-
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import java.util.ArrayList;
+import java.util.List;
+
 
 
 /**
@@ -21,30 +20,38 @@ import org.springframework.transaction.annotation.Transactional;
  * @date 2016年9月18日 上午9:44:35
  */
 @Service("sysRoleMenuService")
-public class SysRoleMenuServiceImpl implements SysRoleMenuService {
-	@Autowired
-	private SysRoleMenuDao sysRoleMenuDao;
+public class SysRoleMenuServiceImpl extends ServiceImpl<SysRoleMenuDao, SysRoleMenuEntity> implements SysRoleMenuService {
 
 	@Override
-	@Transactional
+	@Transactional(rollbackFor = Exception.class)
 	public void saveOrUpdate(Long roleId, List<Long> menuIdList) {
 		//先删除角色与菜单关系
-		sysRoleMenuDao.delete(roleId);
+		deleteBatch(new Long[]{roleId});
 
 		if(menuIdList.size() == 0){
 			return ;
 		}
 
 		//保存角色与菜单关系
-		Map<String, Object> map = new HashMap<>();
-		map.put("roleId", roleId);
-		map.put("menuIdList", menuIdList);
-		sysRoleMenuDao.save(map);
+		List<SysRoleMenuEntity> list = new ArrayList<>(menuIdList.size());
+		for(Long menuId : menuIdList){
+			SysRoleMenuEntity sysRoleMenuEntity = new SysRoleMenuEntity();
+			sysRoleMenuEntity.setMenuId(menuId);
+			sysRoleMenuEntity.setRoleId(roleId);
+
+			list.add(sysRoleMenuEntity);
+		}
+		this.insertBatch(list);
 	}
 
 	@Override
 	public List<Long> queryMenuIdList(Long roleId) {
-		return sysRoleMenuDao.queryMenuIdList(roleId);
+		return baseMapper.queryMenuIdList(roleId);
+	}
+
+	@Override
+	public int deleteBatch(Long[] roleIds){
+		return baseMapper.deleteBatch(roleIds);
 	}
 
 }

+ 64 - 54
src/main/java/io/renren/modules/sys/service/impl/SysRoleServiceImpl.java

@@ -1,23 +1,27 @@
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.exception.RRException;
+import io.renren.common.utils.Constant;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.sys.dao.SysRoleDao;
 import io.renren.modules.sys.entity.SysRoleEntity;
 import io.renren.modules.sys.service.SysRoleMenuService;
 import io.renren.modules.sys.service.SysRoleService;
 import io.renren.modules.sys.service.SysUserRoleService;
 import io.renren.modules.sys.service.SysUserService;
-import io.renren.common.utils.Constant;
-import io.renren.common.exception.RRException;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
+import org.apache.commons.lang.StringUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 角色
@@ -27,65 +31,71 @@ import org.springframework.transaction.annotation.Transactional;
  * @date 2016年9月18日 上午9:45:12
  */
 @Service("sysRoleService")
-public class SysRoleServiceImpl implements SysRoleService {
-	@Autowired
-	private SysRoleDao sysRoleDao;
+public class SysRoleServiceImpl extends ServiceImpl<SysRoleDao, SysRoleEntity> implements SysRoleService {
 	@Autowired
 	private SysRoleMenuService sysRoleMenuService;
 	@Autowired
-	private SysUserRoleService sysUserRoleService;
-	@Autowired
 	private SysUserService sysUserService;
+    @Autowired
+    private SysUserRoleService sysUserRoleService;
 
 	@Override
-	public SysRoleEntity queryObject(Long roleId) {
-		return sysRoleDao.queryObject(roleId);
-	}
+	public PageUtils queryPage(Map<String, Object> params) {
+		String roleName = (String)params.get("roleName");
+		Long createUserId = (Long)params.get("createUserId");
 
-	@Override
-	public List<SysRoleEntity> queryList(Map<String, Object> map) {
-		return sysRoleDao.queryList(map);
-	}
+		Page<SysRoleEntity> page = this.selectPage(
+			new Query<SysRoleEntity>(params).getPage(),
+			new EntityWrapper<SysRoleEntity>()
+				.like(StringUtils.isNotBlank(roleName),"role_name", roleName)
+				.eq(createUserId != null,"create_user_id", createUserId)
+		);
 
-	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return sysRoleDao.queryTotal(map);
+		return new PageUtils(page);
 	}
 
-	@Override
-	@Transactional
-	public void save(SysRoleEntity role) {
-		role.setCreateTime(new Date());
-		sysRoleDao.save(role);
-		
-		//检查权限是否越权
-		checkPrems(role);
-		
-		//保存角色与菜单关系
-		sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
-	}
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void save(SysRoleEntity role) {
+        role.setCreateTime(new Date());
+        this.insert(role);
 
-	@Override
-	@Transactional
-	public void update(SysRoleEntity role) {
-		sysRoleDao.update(role);
-		
-		//检查权限是否越权
-		checkPrems(role);
-		
-		//更新角色与菜单关系
-		sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
-	}
+        //检查权限是否越权
+        checkPrems(role);
 
-	@Override
-	@Transactional
-	public void deleteBatch(Long[] roleIds) {
-		sysRoleDao.deleteBatch(roleIds);
-	}
-	
-	@Override
+        //保存角色与菜单关系
+        sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void update(SysRoleEntity role) {
+        this.updateById(role);
+
+        //检查权限是否越权
+        checkPrems(role);
+
+        //更新角色与菜单关系
+        sysRoleMenuService.saveOrUpdate(role.getRoleId(), role.getMenuIdList());
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public void deleteBatch(Long[] roleIds) {
+        //删除角色
+        this.deleteBatchIds(Arrays.asList(roleIds));
+
+        //删除角色与菜单关联
+        sysRoleMenuService.deleteBatch(roleIds);
+
+        //删除角色与用户关联
+        sysUserRoleService.deleteBatch(roleIds);
+    }
+
+
+    @Override
 	public List<Long> queryRoleIdList(Long createUserId) {
-		return sysRoleDao.queryRoleIdList(createUserId);
+		return baseMapper.queryRoleIdList(createUserId);
 	}
 
 	/**

+ 20 - 17
src/main/java/io/renren/modules/sys/service/impl/SysUserRoleServiceImpl.java

@@ -1,14 +1,14 @@
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.MapUtils;
 import io.renren.modules.sys.dao.SysUserRoleDao;
+import io.renren.modules.sys.entity.SysUserRoleEntity;
 import io.renren.modules.sys.service.SysUserRoleService;
+import org.springframework.stereotype.Service;
 
-import java.util.HashMap;
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Map;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
 
 
 
@@ -20,33 +20,36 @@ import org.springframework.stereotype.Service;
  * @date 2016年9月18日 上午9:45:48
  */
 @Service("sysUserRoleService")
-public class SysUserRoleServiceImpl implements SysUserRoleService {
-	@Autowired
-	private SysUserRoleDao sysUserRoleDao;
+public class SysUserRoleServiceImpl extends ServiceImpl<SysUserRoleDao, SysUserRoleEntity> implements SysUserRoleService {
 
 	@Override
 	public void saveOrUpdate(Long userId, List<Long> roleIdList) {
 		//先删除用户与角色关系
-		sysUserRoleDao.delete(userId);
+		this.deleteByMap(new MapUtils().put("user_id", userId));
 
 		if(roleIdList == null || roleIdList.size() == 0){
 			return ;
 		}
-		
+
 		//保存用户与角色关系
-		Map<String, Object> map = new HashMap<>();
-		map.put("userId", userId);
-		map.put("roleIdList", roleIdList);
-		sysUserRoleDao.save(map);
+		List<SysUserRoleEntity> list = new ArrayList<>(roleIdList.size());
+		for(Long roleId : roleIdList){
+			SysUserRoleEntity sysUserRoleEntity = new SysUserRoleEntity();
+			sysUserRoleEntity.setUserId(userId);
+			sysUserRoleEntity.setRoleId(roleId);
+
+			list.add(sysUserRoleEntity);
+		}
+		this.insertBatch(list);
 	}
 
 	@Override
 	public List<Long> queryRoleIdList(Long userId) {
-		return sysUserRoleDao.queryRoleIdList(userId);
+		return baseMapper.queryRoleIdList(userId);
 	}
 
 	@Override
-	public void delete(Long userId) {
-		sysUserRoleDao.delete(userId);
+	public int deleteBatch(Long[] roleIds){
+		return baseMapper.deleteBatch(roleIds);
 	}
 }

+ 33 - 36
src/main/java/io/renren/modules/sys/service/impl/SysUserServiceImpl.java

@@ -1,7 +1,12 @@
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.mapper.EntityWrapper;
+import com.baomidou.mybatisplus.plugins.Page;
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
 import io.renren.common.exception.RRException;
 import io.renren.common.utils.Constant;
+import io.renren.common.utils.PageUtils;
+import io.renren.common.utils.Query;
 import io.renren.modules.sys.dao.SysUserDao;
 import io.renren.modules.sys.entity.SysUserEntity;
 import io.renren.modules.sys.service.SysRoleService;
@@ -15,11 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
+import java.util.*;
 
 
 /**
@@ -30,42 +31,40 @@ import java.util.Map;
  * @date 2016年9月18日 上午9:46:09
  */
 @Service("sysUserService")
-public class SysUserServiceImpl implements SysUserService {
-	@Autowired
-	private SysUserDao sysUserDao;
+public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> implements SysUserService {
 	@Autowired
 	private SysUserRoleService sysUserRoleService;
 	@Autowired
 	private SysRoleService sysRoleService;
 
 	@Override
-	public List<String> queryAllPerms(Long userId) {
-		return sysUserDao.queryAllPerms(userId);
-	}
+	public PageUtils queryPage(Map<String, Object> params) {
+		String username = (String)params.get("username");
+		Long createUserId = (Long)params.get("createUserId");
 
-	@Override
-	public List<Long> queryAllMenuId(Long userId) {
-		return sysUserDao.queryAllMenuId(userId);
-	}
+		Page<SysUserEntity> page = this.selectPage(
+			new Query<SysUserEntity>(params).getPage(),
+			new EntityWrapper<SysUserEntity>()
+				.like(StringUtils.isNotBlank(username),"username", username)
+				.eq(createUserId != null,"create_user_id", createUserId)
+		);
 
-	@Override
-	public SysUserEntity queryByUserName(String username) {
-		return sysUserDao.queryByUserName(username);
+		return new PageUtils(page);
 	}
-	
+
 	@Override
-	public SysUserEntity queryObject(Long userId) {
-		return sysUserDao.queryObject(userId);
+	public List<String> queryAllPerms(Long userId) {
+		return baseMapper.queryAllPerms(userId);
 	}
 
 	@Override
-	public List<SysUserEntity> queryList(Map<String, Object> map){
-		return sysUserDao.queryList(map);
+	public List<Long> queryAllMenuId(Long userId) {
+		return baseMapper.queryAllMenuId(userId);
 	}
-	
+
 	@Override
-	public int queryTotal(Map<String, Object> map) {
-		return sysUserDao.queryTotal(map);
+	public SysUserEntity queryByUserName(String username) {
+		return baseMapper.queryByUserName(username);
 	}
 
 	@Override
@@ -76,7 +75,7 @@ public class SysUserServiceImpl implements SysUserService {
 		String salt = RandomStringUtils.randomAlphanumeric(20);
 		user.setPassword(new Sha256Hash(user.getPassword(), salt).toHex());
 		user.setSalt(salt);
-		sysUserDao.save(user);
+		this.insert(user);
 		
 		//检查角色是否越权
 		checkRole(user);
@@ -93,7 +92,7 @@ public class SysUserServiceImpl implements SysUserService {
 		}else{
 			user.setPassword(new Sha256Hash(user.getPassword(), user.getSalt()).toHex());
 		}
-		sysUserDao.update(user);
+		this.updateById(user);
 		
 		//检查角色是否越权
 		checkRole(user);
@@ -103,18 +102,16 @@ public class SysUserServiceImpl implements SysUserService {
 	}
 
 	@Override
-	@Transactional
 	public void deleteBatch(Long[] userId) {
-		sysUserDao.deleteBatch(userId);
+		this.deleteBatchIds(Arrays.asList(userId));
 	}
 
 	@Override
-	public int updatePassword(Long userId, String password, String newPassword) {
-		Map<String, Object> map = new HashMap<>();
-		map.put("userId", userId);
-		map.put("password", password);
-		map.put("newPassword", newPassword);
-		return sysUserDao.updatePassword(map);
+	public boolean updatePassword(Long userId, String password, String newPassword) {
+		SysUserEntity userEntity = new SysUserEntity();
+		userEntity.setPassword(newPassword);
+		return this.update(userEntity,
+				new EntityWrapper<SysUserEntity>().eq("user_id", userId).eq("password", password));
 	}
 	
 	/**

+ 8 - 24
src/main/java/io/renren/modules/sys/service/impl/SysUserTokenServiceImpl.java

@@ -1,37 +1,21 @@
 package io.renren.modules.sys.service.impl;
 
+import com.baomidou.mybatisplus.service.impl.ServiceImpl;
+import io.renren.common.utils.R;
 import io.renren.modules.sys.dao.SysUserTokenDao;
 import io.renren.modules.sys.entity.SysUserTokenEntity;
-import io.renren.modules.sys.service.SysUserTokenService;
-import io.renren.common.utils.R;
 import io.renren.modules.sys.oauth2.TokenGenerator;
-import org.springframework.beans.factory.annotation.Autowired;
+import io.renren.modules.sys.service.SysUserTokenService;
 import org.springframework.stereotype.Service;
 
 import java.util.Date;
 
 
 @Service("sysUserTokenService")
-public class SysUserTokenServiceImpl implements SysUserTokenService {
-	@Autowired
-	private SysUserTokenDao sysUserTokenDao;
+public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUserTokenEntity> implements SysUserTokenService {
 	//12小时后过期
 	private final static int EXPIRE = 3600 * 12;
 
-	@Override
-	public SysUserTokenEntity queryByUserId(Long userId) {
-		return sysUserTokenDao.queryByUserId(userId);
-	}
-
-	@Override
-	public void save(SysUserTokenEntity token){
-		sysUserTokenDao.save(token);
-	}
-	
-	@Override
-	public void update(SysUserTokenEntity token){
-		sysUserTokenDao.update(token);
-	}
 
 	@Override
 	public R createToken(long userId) {
@@ -44,7 +28,7 @@ public class SysUserTokenServiceImpl implements SysUserTokenService {
 		Date expireTime = new Date(now.getTime() + EXPIRE * 1000);
 
 		//判断是否生成过token
-		SysUserTokenEntity tokenEntity = queryByUserId(userId);
+		SysUserTokenEntity tokenEntity = this.selectById(userId);
 		if(tokenEntity == null){
 			tokenEntity = new SysUserTokenEntity();
 			tokenEntity.setUserId(userId);
@@ -53,14 +37,14 @@ public class SysUserTokenServiceImpl implements SysUserTokenService {
 			tokenEntity.setExpireTime(expireTime);
 
 			//保存token
-			save(tokenEntity);
+			this.insert(tokenEntity);
 		}else{
 			tokenEntity.setToken(token);
 			tokenEntity.setUpdateTime(now);
 			tokenEntity.setExpireTime(expireTime);
 
 			//更新token
-			update(tokenEntity);
+			this.updateById(tokenEntity);
 		}
 
 		R r = R.ok().put("token", token).put("expire", EXPIRE);
@@ -77,6 +61,6 @@ public class SysUserTokenServiceImpl implements SysUserTokenService {
 		SysUserTokenEntity tokenEntity = new SysUserTokenEntity();
 		tokenEntity.setUserId(userId);
 		tokenEntity.setToken(token);
-		update(tokenEntity);
+		this.updateById(tokenEntity);
 	}
 }

+ 1 - 0
src/main/resources/application-dev.yml

@@ -7,6 +7,7 @@ spring:
                 url: jdbc:mysql://localhost:3306/renren_fast?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
                 username: renren
                 password: 123456
+                #password: Mark@69013275
             second:  #数据源2
                 url: jdbc:mysql://localhost:3306/renren_fast?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8
                 username: renren

src/main/resources/application-pro.yml → src/main/resources/application-prod.yml


+ 32 - 9
src/main/resources/application.yml

@@ -9,7 +9,7 @@ server:
     context-path: /renren-fast
 
 spring:
-    # 环境 dev|test|pro
+    # 环境 dev|test|prod
     profiles:
         active: dev
     # jackson时间格式化
@@ -21,13 +21,11 @@ spring:
             max-file-size: 100MB
             max-request-size: 100MB
             enabled: true
-    resources: # 指定静态资源的路径
-        static-locations: classpath:/static/,classpath:/views/
     redis:
         open: false  # 是否开启redis缓存  true开启   false关闭
         database: 0
         host: localhost
-        port: 16379
+        port: 6379
         password:       # 密码(默认为空)
         timeout: 6000  # 连接超时时长(毫秒)
         pool:
@@ -36,11 +34,36 @@ spring:
             max-idle: 10      # 连接池中的最大空闲连接
             min-idle: 5       # 连接池中的最小空闲连接
 
-# Mybatis配置
-mybatis:
-    mapperLocations: classpath:mapper/**/*.xml
-    configuration:
-        map-underscore-to-camel-case: true
+
+#mybatis
+mybatis-plus:
+  mapper-locations: classpath:mapper/**/*.xml
+  #实体扫描,多个package用逗号或者分号分隔
+  typeAliasesPackage: io.renren.modules.*.entity
+  global-config:
+    #主键类型  0:"数据库ID自增", 1:"用户输入ID",2:"全局唯一ID (数字类型唯一ID)", 3:"全局唯一ID UUID";
+    id-type: 0
+    #字段策略 0:"忽略判断",1:"非 NULL 判断"),2:"非空判断"
+    field-strategy: 2
+    #驼峰下划线转换
+    db-column-underline: true
+    #刷新mapper 调试神器
+    refresh-mapper: true
+    #数据库大写下划线转换
+    #capital-mode: true
+    #序列接口实现类配置
+    #key-generator: com.baomidou.springboot.xxx
+    #逻辑删除配置
+    logic-delete-value: -1
+    logic-not-delete-value: 0
+    #自定义填充策略接口实现
+    #meta-object-handler: com.baomidou.springboot.xxx
+    #自定义SQL注入器
+    sql-injector: com.baomidou.mybatisplus.mapper.LogicSqlInjector
+  configuration:
+    map-underscore-to-camel-case: true
+    cache-enabled: false
+    call-setters-on-nulls: true
 
 renren:
     # APP模块,是通过jwt认证的,如果要使用APP模块,则需要修改【加密秘钥】

+ 1 - 1
src/main/resources/banner.txt

@@ -1,5 +1,5 @@
 ====================================================================================================================
 
-                    欢迎使用 renren-fast 人人快速开发平台 - Powered By http://www.renren.io/open/
+                    欢迎使用 renren-fast 人人快速开发平台 - Powered By http://www.renren.io/
 
 ====================================================================================================================

+ 1 - 1
src/main/resources/logback-spring.xml

@@ -12,7 +12,7 @@
     </springProfile>
 
     <!-- 生产环境 -->
-    <springProfile name="pro">
+    <springProfile name="prod">
         <logger name="org.springframework.web" level="ERROR"/>
         <logger name="org.springboot.sample" level="ERROR" />
         <logger name="io.renren" level="ERROR" />

+ 0 - 24
src/main/resources/mapper/app/UserDao.xml

@@ -3,29 +3,5 @@
 
 <mapper namespace="io.renren.modules.app.dao.UserDao">
 
-	<insert id="save" parameterType="io.renren.modules.app.entity.UserEntity" useGeneratedKeys="true" keyProperty="userId">
-		insert into tb_user
-		(
-			`username`,
-			`mobile`,
-			`password`,
-			`create_time`
-		)
-		values
-			(
-				#{username},
-				#{mobile},
-				#{password},
-				#{createTime}
-			)
-	</insert>
-
-	<select id="queryObject" resultType="io.renren.modules.app.entity.UserEntity">
-		select * from tb_user where user_id = #{value}
-	</select>
-
-	<select id="queryByMobile" resultType="io.renren.modules.app.entity.UserEntity">
-		select * from tb_user where mobile = #{value}
-	</select>
 
 </mapper>

+ 0 - 0
src/main/resources/mapper/job/ScheduleJobDao.xml


Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini