瀏覽代碼

Merge branch 'feature-bieao' of lift-manager/lift-server into develop

bieao 5 年之前
父節點
當前提交
1306025385

+ 10 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -152,14 +152,17 @@ public class LiftService {
     public RestResponse add(LiftExtensionRequest request) {
         //获取新增标记 (0:新增,1:查询后带入)
         String mark = request.getMark();
-        Lift lift = request.getLift();
         //公司id
         Long mtCompanyId = request.getMtCompanyId();
+        //电梯id
+        Long id;
         /*if (judge(mtCompanyId))
         return RestResponse.fail(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.limit.num"));*/
-        RestResponse response = preJudgment(mtCompanyId, lift.getRegistrationCode(), null);
-        if (ObjectUtil.isNotEmpty(response.getData())) return response;
+        RestResponse response = preJudgment(mtCompanyId, request.getCode(), null);
+        if (ApiConstants.RESULT_ERROR.equals(response.getMessage())) return response;
+        //新增标记 (0:新增,1:查询后带入)
         if ("0".equals(mark)) {
+            Lift lift = request.getLift();
             //按当前日期时间戳自动生成电梯编号
             String liftCode = ApiConstants.STRAIGHT_LADDER + DateUtils.generateCode();
             if (CommonEnum.LiftType.STAIRCASE.getCode().equals(Objects.toString(lift.getLiftType()))) {
@@ -170,9 +173,10 @@ public class LiftService {
             if (liftResult == 0) {
                 return RestResponse.fail(MessageUtils.get("msg.add.fail"));
             }
+            id = lift.getId();
+        } else {
+            id = Long.parseLong(request.getId());
         }
-        //电梯id
-        Long id = lift.getId();
         //新增电梯来源
         String source = request.getSource();
         switch (source) {
@@ -225,7 +229,7 @@ public class LiftService {
             liftId = lift.getId().toString();
         }
         RestResponse response = preJudgment(null, lift.getRegistrationCode(), liftId);
-        if (ObjectUtil.isNotEmpty(response.getData())) return response;
+        if (ApiConstants.RESULT_ERROR.equals(response.getMessage())) return response;
         int result = liftMapper.updateById(lift);
         if (result > 0) {
             return RestResponse.success();

+ 1 - 0
lift-business-service/src/main/resources/mapper/lift/LiftMapper.xml

@@ -78,6 +78,7 @@
         LEFT JOIN project_lift_relevance plr ON pclr.company_id = plr.company_id and pclr.lift_id = plr.lift_id
         LEFT JOIN project p ON pclr.company_id = p.mt_company_id and plr.project_id = p.id
         LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
+		WHERE 1=1
         <if test="request.companyId!=null and request.companyId!=''">
 			AND pclr.company_id = #{request.companyId,jdbcType=BIGINT}
         </if>