wanghaicheng 5 vuotta sitten
vanhempi
commit
eb35a4552f

+ 1 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/PropertyCertificate.java

@@ -1,6 +1,5 @@
 package cn.com.ty.lift.enterprise.custom.dao.entity;
 
-import cn.com.xwy.boot.controller.BaseRequestModel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -30,7 +29,7 @@ public class PropertyCertificate implements Serializable {
     /**
      * 用户id
      */
-    @TableId(value = "user_id",type = IdType.AUTO)
+    @TableId(value = "user_id",type = IdType.ID_WORKER)
     private Long userId;
 
     /**

+ 1 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/PropertyCompany.java

@@ -1,6 +1,5 @@
 package cn.com.ty.lift.enterprise.custom.dao.entity;
 
-import cn.com.xwy.boot.controller.BaseRequestModel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -30,7 +29,7 @@ public class PropertyCompany implements Serializable {
     /**
      * 甲方公司id
      */
-    @TableId(value = "id",type = IdType.AUTO)
+    @TableId(value = "id",type = IdType.ID_WORKER)
     private Long id;
 
     /**

+ 1 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/PropertyContact.java

@@ -1,6 +1,5 @@
 package cn.com.ty.lift.enterprise.custom.dao.entity;
 
-import cn.com.xwy.boot.controller.BaseRequestModel;
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
@@ -29,7 +28,7 @@ public class PropertyContact implements Serializable {
     /**
      * 联系人id
      */
-    @TableId(value = "id",type = IdType.AUTO)
+    @TableId(value = "id",type = IdType.ID_WORKER)
     private Long id;
 
     /**

+ 1 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/model/PropertyCompanyReq.java

@@ -30,7 +30,7 @@ public class PropertyCompanyReq extends BaseRequestModel implements Serializable
     /**
      * 甲方公司id
      */
-    @TableId(value = "id",type = IdType.AUTO)
+    @TableId(value = "id",type = IdType.ID_WORKER)
     private Long id;
 
     /**

+ 1 - 1
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/dao/entity/model/PropertyContactReq.java

@@ -29,7 +29,7 @@ public class PropertyContactReq extends BaseRequestModel implements Serializable
     /**
      * 联系人id
      */
-    @TableId(value = "id",type = IdType.AUTO)
+    @TableId(value = "id",type = IdType.ID_WORKER)
     private Long id;
 
     /**

+ 14 - 46
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java

@@ -14,6 +14,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.AllArgsConstructor;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
+
 import java.util.Map;
 
 /**
@@ -34,7 +35,6 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         if (null != this.getOne(new QueryWrapper<PropertyCompany>().eq("name", propertyCompany.getName()))) {
             return RestResponse.ok(null, "0", "客户已存在");
         }
-
         if (this.save(propertyCompany)) {
             return RestResponse.ok(null, "1", "新增客户成功");
         } else {
@@ -47,18 +47,18 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         if (this.getMaintenanceLiftNum() > 0) {
             //就不删除
             return "维保电梯大于0,无法删除";
+        }
+        //如果维保电梯小于等于0,逻辑删除
+        PropertyCompany one = this.getOne(new QueryWrapper<PropertyCompany>().eq("id", id));
+        if (null != one) {
+            one.setStatus(0);
+            this.updateById(one);
+            this.deleteForContact(id);
+            return "删除成功";
         } else {
-            //如果维保电梯小于等于0,逻辑删除
-            PropertyCompany one = this.getOne(new QueryWrapper<PropertyCompany>().eq("id", id));
-            if (null != one) {
-                one.setStatus(0);
-                this.updateById(one);
-                this.deleteForContact(id);
-                return "删除成功";
-            } else {
-                return "删除失败";
-            }
+            return "删除失败";
         }
+
     }
 
     public int deleteForContact(Long id) {
@@ -84,40 +84,6 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         return 888;
     }
 
-    /**
-     * @param
-     * @return
-     * @description 根据id分页查询客户
-     * @date 2019/12/2 10:15
-     */
-    public RestResponse propertyCompanies(Long mtCompanyId, Integer pageNum, Integer pageSize) {
-        Page<PropertyCompany> page = new Page<>(pageNum, pageSize);
-        IPage<Map<String, Object>> records = this.pageMaps(page, new QueryWrapper<PropertyCompany>()
-                .select("id", "code", "name", "address", "telephone")
-                .eq("mt_company_id", mtCompanyId));
-        records.getRecords().forEach(record -> {
-            record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());
-        });
-        return RestResponse.ok(records, "查询成功");
-    }
-
-    /**
-     * @param
-     * @return
-     * @description 根据rowName(字段名),分页查询
-     * @date 2019/12/2 10:16
-     */
-    public RestResponse propertyCompaniesFromRowName(Long mtCompanyId, Integer pageNum, Integer pageSize, String rowName, Object rowValue) {
-        Page<PropertyCompany> page = new Page<>(pageNum, pageSize);
-        IPage<Map<String, Object>> records = this.pageMaps(page, new QueryWrapper<PropertyCompany>()
-                .select("id", "code", "name", "address", "telephone").like(rowName, rowValue)
-                .eq("mt_company_id", mtCompanyId));
-        records.getRecords().forEach(record -> {
-            record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());
-        });
-        return RestResponse.ok(records, "1", "查询成功");
-    }
-
     public RestResponse propertyCompaniesForCondition(PropertyCompanyReq propertyCompany) {
         String name = propertyCompany.getName();
         String address = propertyCompany.getAddress();
@@ -131,7 +97,9 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
                 .pageMaps(page, new QueryWrapper<PropertyCompany>()
                         .select("id", "code", "name", "address", "telephone")
                         .eq("mt_company_id", propertyCompany.getMtCompanyId())
-                        .like(nameFlag, "name", name).like(addressFlag, "address", address).like(telephoneFlag, "telephone", telephone));
+                        .like(nameFlag, "name", name)
+                        .like(addressFlag, "address", address)
+                        .like(telephoneFlag, "telephone", telephone));
         if (!records.getRecords().isEmpty()) {
             records.getRecords().forEach(record -> {
                 record.put("maintenanceLiftNum", this.getMaintenanceLiftNum());

+ 1 - 1
lift-quan-service/pom.xml

@@ -22,7 +22,7 @@
             <groupId>cn.com.xwy</groupId>
             <artifactId>xwy-cloud-dependencies</artifactId>
         </dependency>-->
-
+        
     </dependencies>
 
 </project>

+ 4 - 4
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/controller/QuanNewsController.java

@@ -63,7 +63,7 @@ public class QuanNewsController {
      * @param [新闻id]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse news(@PathVariable int id) {
+    public RestResponse news(@PathVariable Long id) {
         QuanNews byId = quanNewsService.getById(id);
         if (null != byId) {
             return RestResponse.ok(byId, "1", "查询成功");
@@ -79,13 +79,13 @@ public class QuanNewsController {
      * @param [新闻标题, 新闻内容, 视频文件, 发布人id]
      * @return org.springframework.http.ResponseEntity
      */
-    public RestResponse add(@RequestParam String title, @RequestParam String content, @RequestParam Long releaseId, @RequestParam String releaseUser, @RequestParam MultipartFile videoFile, @RequestParam Integer haveTops) {
+    public RestResponse add(@RequestParam String title, @RequestParam String content, @RequestParam Long releaseId, @RequestParam String releaseUser, @RequestParam MultipartFile videoFile, @RequestParam Integer isTop) {
         QuanNews quanNews = new QuanNews();
         quanNews.setTitle(title)
                 .setContent(content)
                 .setReleaseId(releaseId)
                 .setReleaseUser(releaseUser);
-        return quanNewsService.addNew(quanNews, videoFile, haveTops);
+        return quanNewsService.addNew(quanNews, videoFile, isTop);
     }
 
     @PostMapping("/update")
@@ -95,7 +95,7 @@ public class QuanNewsController {
      * @param [新闻id, 新闻标题, 新闻内容]
      * @return org.springframework.http.ResponseEntity
      */
-    public RestResponse updateNews(@RequestParam Integer id, @RequestParam String title, @RequestParam String content, @RequestParam Long releaseId, @RequestParam String releaseUser, @RequestParam MultipartFile videoFile) {
+    public RestResponse updateNews(@RequestParam Long id, @RequestParam String title, @RequestParam String content, @RequestParam Long releaseId, @RequestParam String releaseUser, @RequestParam MultipartFile videoFile) {
         QuanNews quanNews = new QuanNews();
         quanNews.setId(id)
                 .setTitle(title)

+ 2 - 2
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/dao/entity/QuanNews.java

@@ -29,8 +29,8 @@ public class QuanNews implements Serializable {
     /**
      * 新闻id
      */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    @TableId(value = "id", type = IdType.ID_WORKER)
+    private Long id;
 
     /**
      * 置顶排序 0不置顶 非0就是置顶(按照数字大小排序)

+ 2 - 2
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/dao/entity/model/QuanNewsReq.java

@@ -30,8 +30,8 @@ public class QuanNewsReq extends BaseRequestModel implements Serializable {
     /**
      * 新闻id
      */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    @TableId(value = "id", type = IdType.ID_WORKER)
+    private Long id;
 
     /**
      * 置顶排序 0不置顶 非0就是置顶(按照数字大小排序)

+ 6 - 5
lift-quan-service/src/main/java/cn/com/ty/lift/quan/news/service/impl/QuanNewsServiceImpl.java

@@ -31,7 +31,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
      * @description 将新闻置顶
      * @date 2019/12/3 11:23
      */
-    public RestResponse top(int id) {
+    public RestResponse top(Long id) {
         QuanNews byId = this.getById(id);
         if (byId == null) {
             return RestResponse.ok(null, "0", "新闻不存在");
@@ -54,10 +54,11 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
                 news.forEach(n -> {
                     n.setTopSerial(n.getTopSerial() + 1);
                 });
+                this.updateBatchById(news, 100);
             }
             byId.setTopSerial(1);
             //更新置顶新闻列表,新闻
-            if (this.updateBatchById(news, 100) && this.updateById(byId)) {
+            if ( this.updateById(byId)) {
                 return RestResponse.ok(null, "1", "置顶成功");
             } else {
                 return RestResponse.ok(null, "0", "置顶失败");
@@ -70,9 +71,9 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
      * @description 新闻取消置顶
      * @date 2019/12/3 13:28
      */
-    public RestResponse cancelTop(Integer id) {
+    public RestResponse cancelTop(Long id) {
         QuanNews byId = this.getById(id);
-        if (null != byId) {
+        if (null == byId) {
             //没有这个新闻
             return RestResponse.ok(null, "9", "无此新闻");
         }
@@ -196,7 +197,7 @@ public class QuanNewsServiceImpl extends ServiceImpl<QuanNewsMapper, QuanNews> i
      * @description 删除新闻
      * @date 2019/12/4 13:55
      */
-    public RestResponse delete(int id) {
+    public RestResponse delete(Long id) {
         QuanNews byId = this.getById(id);
         if (null == byId) {
             return RestResponse.ok(null, "9", "无数据");

+ 14 - 14
lift-system-service/src/main/java/cn/com/ty/lift/system/faq/controller/FaqController.java

@@ -13,8 +13,8 @@ import java.util.List;
 
 /**
  * @author wang-hai-cheng
- * @date 2019/11/27
- * @description 常见问题级常见问题分类表 前端控制器
+ * @date 2019/12/4
+ * @description 常见问题级常见问题分类表
  */
 @RestController
 @RequestMapping("/faq")
@@ -40,7 +40,7 @@ public class FaqController {
      * @param [parentId]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse child(@RequestParam Integer parentId) {
+    public RestResponse child(@RequestParam Long parentId) {
         return RestResponse.ok(faqService.list(new QueryWrapper<Faq>().eq("type", 1).eq("parent_id", parentId).orderByAsc("serial")), "1", "查询成功");
     }
 
@@ -51,7 +51,7 @@ public class FaqController {
      * @param [parentId]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse question(@RequestParam Integer parentId) {
+    public RestResponse question(@RequestParam Long parentId) {
         List<Faq> list = faqService.list(new QueryWrapper<Faq>().eq("type", 2).eq("parent_id", parentId).orderByAsc("serial"));
         if (!list.isEmpty()) {
             return RestResponse.ok(list, "1", "查询成功");
@@ -67,7 +67,7 @@ public class FaqController {
      * @param [parentId]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse answer(@RequestParam Integer parentId) {
+    public RestResponse answer(@RequestParam Long parentId) {
         return RestResponse.ok(faqService.getOne(new QueryWrapper<Faq>().eq("type", 3).eq("parent_id", parentId).orderByAsc("serial")), "1", "查询成功");
     }
 
@@ -126,26 +126,26 @@ public class FaqController {
         return faqService.up(faq.getId(), faq.getContent(), faq.getDescription());
     }
 
-    @GetMapping("/delete")
+    @PostMapping("/delete")
     /**
      * @description 根据id删除此id下的分类和问答
      * @date 2019/11/27 10:51
      * @param [id]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse deleteAll(@RequestParam Integer id) {
-        return faqService.delete(id);
+    public RestResponse deleteAll(@RequestBody Faq faq) {
+        return faqService.delete(faq.getId());
     }
 
     @GetMapping("/up")
-    /** 排序上移一位
-     * @description
+    /**
+     * @description 排序上移一位
      * @date 2019/11/27 10:52
      * @param [id]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse up(@RequestParam Integer id) {
-        return faqService.up(id);
+    public RestResponse up(@RequestBody Faq faq) {
+        return faqService.up(faq.getId());
     }
 
     @GetMapping("/down")
@@ -155,7 +155,7 @@ public class FaqController {
      * @param [id]
      * @return cn.com.xwy.boot.web.dto.RestResponse
      */
-    public RestResponse down(@RequestParam Integer id) {
-        return faqService.down(id);
+    public RestResponse down(@RequestBody Faq faq) {
+        return faqService.down(faq.getId());
     }
 }

+ 3 - 3
lift-system-service/src/main/java/cn/com/ty/lift/system/faq/entity/Faq.java

@@ -27,8 +27,8 @@ public class Faq implements Serializable {
     /**
      * (分类 问题标题 答案) 的id
      */
-    @TableId(value = "id", type = IdType.AUTO)
-    private Integer id;
+    @TableId(value = "id", type = IdType.ID_WORKER)
+    private Long id;
 
     /**
      * 内容
@@ -46,7 +46,7 @@ public class Faq implements Serializable {
      * 父id
      */
     @TableField("parent_id")
-    private Integer parentId;
+    private Long parentId;
 
     /**
      * 序号

+ 9 - 9
lift-system-service/src/main/java/cn/com/ty/lift/system/faq/service/impl/FaqServiceImpl.java

@@ -27,7 +27,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
 
     public RestResponse addOne(String title, String description) {
         Faq faq = new Faq();
-        faq.setContent(title).setType(1).setParentId(0).setDescription(description);
+        faq.setContent(title).setType(1).setParentId(0L).setDescription(description);
         faq.setSerial(this.count(new QueryWrapper<Faq>().eq("type", 1).eq("parent_id", 0)) + 1);
         if (this.save(faq)) {
             return RestResponse.ok(null, "1", "新增一级分类成功");
@@ -36,7 +36,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse addChild(int parentId, String title, String description) {
+    public RestResponse addChild(Long parentId, String title, String description) {
         Faq faq = new Faq();
         faq.setContent(title).setType(1).setParentId(parentId).setDescription(description);
         faq.setSerial(this.list(new QueryWrapper<Faq>().eq("type", 1).eq("parent_id", parentId)).size() + 1);
@@ -47,7 +47,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse addQuestion(int parentId, String title, String description) {
+    public RestResponse addQuestion(Long parentId, String title, String description) {
         Faq faq = new Faq();
         faq.setContent(title).setType(2).setParentId(parentId).setDescription(description);
         faq.setSerial(this.list(new QueryWrapper<Faq>().eq("type", 2).eq("parent_id", parentId)).size() + 1);
@@ -58,7 +58,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse addAnswer(int parentId, String content, String description) {
+    public RestResponse addAnswer(Long parentId, String content, String description) {
         Faq faq = new Faq();
         faq.setContent(content).setType(3).setParentId(parentId).setDescription(description);
         faq.setSerial(this.list(new QueryWrapper<Faq>().eq("type", 3).eq("parent_id", parentId)).size() + 1);
@@ -69,7 +69,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse up(int id, String title, String description) {
+    public RestResponse up(Long id, String title, String description) {
         Faq byId = this.getById(id);
         byId.setContent(title).setDescription(description);
         if (this.updateById(byId)) {
@@ -79,7 +79,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse delete(int id) {
+    public RestResponse delete(Long id) {
         if (deleteAll(id)) {
             return RestResponse.ok(null, "1", "删除成功");
         } else {
@@ -88,7 +88,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
     }
 
     //递归删除id及它下面所有分类,问答
-    private boolean deleteAll(int id) {
+    private boolean deleteAll(Long id) {
         //获取父id下的所有子分类或问答
         List<Faq> faqs = this.list(new QueryWrapper<Faq>().eq("parent_id", id));
         //删除父id下的所有子分类或问答
@@ -112,7 +112,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse up(int id) {
+    public RestResponse up(Long id) {
         Faq up = this.getById(id);
         if (up != null) {
             if (up.getSerial() > 1) {
@@ -130,7 +130,7 @@ public class FaqServiceImpl extends ServiceImpl<FaqMapper, Faq> implements FaqSe
         }
     }
 
-    public RestResponse down(int id) {
+    public RestResponse down(Long id) {
         Faq up = this.getById(id);
         if (up != null) {
             if (this.count(new QueryWrapper<Faq>().eq("type", up.getType()).eq("parent_id", up.getParentId()).eq("serial", up.getSerial())) > up.getSerial()) {