Browse Source

增加排序

zhaops 6 years ago
parent
commit
5c45900c50

+ 8 - 1
diagbotman-service/src/main/java/com/diagbot/facade/ServiceInfoFacade.java

@@ -37,7 +37,14 @@ public class ServiceInfoFacade extends ServiceInfoServiceImpl {
      */
     public ServiceInfo createService(ServiceSaveVO serviceSaveVO) {
         Long userId = Long.parseLong(UserUtils.getCurrentPrincipleID());
-        ServiceInfo serviceInfo = new ServiceInfo();
+        QueryWrapper<ServiceInfo> qw = new QueryWrapper<>();
+        qw.eq("name", serviceSaveVO.getName());
+        qw.eq("is_deleted", IsDeleteEnum.N.getKey());
+        ServiceInfo serviceInfo = this.getOne(qw);
+        if (serviceInfo != null) {
+            throw new CommonException(CommonErrorCode.IS_EXISTS,
+                    "服务端【" + serviceSaveVO.getName() + "】已存在,不允许重复建立");
+        }
         serviceInfo.setName(serviceSaveVO.getName());
         serviceInfo.setDescription(serviceSaveVO.getDescription());
         serviceInfo.setType(serviceSaveVO.getType());

+ 1 - 0
diagbotman-service/src/main/resources/mapper/ProductServiceMapper.xml

@@ -44,5 +44,6 @@
         <if test="productService.userId != null and productService.userId != '' ">
             and b.user_id=#{productService.userId} and c.user_id=#{productService.userId}
         </if>
+        order by a.gmt_create desc
     </select>
 </mapper>