Parcourir la source

选取电梯代码修改

别傲 il y a 5 ans
Parent
commit
655d784c27

+ 2 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/library/controller/LiftController.java

@@ -136,7 +136,7 @@ public class LiftController {
      */
     @PostMapping("detail")
     public RestResponse detail(@Valid @RequestBody LiftDetailRequest request) {
-        LiftExtendResponse response = liftService.detail(request.getId(), request.getProjectId());
+        Object response = liftService.detail(request.getId(), request.getProjectId());
         if (ObjectUtil.isEmpty(response)) {
             return RestResponse.success();
         }
@@ -151,7 +151,7 @@ public class LiftController {
      */
     @PostMapping("preJudgment")
     public RestResponse preJudgment(@RequestBody LiftExtensionRequest request) {
-        return liftService.preJudgment(request.getMtCompanyId(), request.getCode(), request.getProjectId());
+        return liftService.preJudgment(request.getMtCompanyId(), request.getCode());
     }
 
     /**

+ 5 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/model/response/LiftResponse.java

@@ -13,22 +13,22 @@ public class LiftResponse {
     /**
      * 电梯ID
      */
-    private String id;
+    private Long id;
 
     /**
      * 公司电梯关联主键id
      */
-    private String companyRelevanceId;
+    private Long companyRelevanceId;
 
     /**
      * 项目电梯关联主键id
      */
-    private String projectRelevanceId;
+    private Long projectRelevanceId;
 
     /**
      * 项目id
      */
-    private String projectId;
+    private Long projectId;
 
     /**
      * 电梯编号
@@ -64,7 +64,7 @@ public class LiftResponse {
     /**
      * 维保工id
      */
-    private String workerId;
+    private Long workerId;
     /**
      * 首保时间
      */

+ 7 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -102,7 +102,10 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
      * @description 查询电梯详情
      * @date 2019/12/6 10:51 AM
      */
-    public LiftExtendResponse detail(Long id, Long projectId) {
+    public Object detail(Long id, Long projectId) {
+        if (ObjectUtil.isEmpty(projectId)) {
+            return getOne(null, id);
+        }
         return baseMapper.queryById(id, projectId);
     }
 
@@ -114,7 +117,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
      * @description 新增电梯前置判断条件
      * @date 2019/12/20 2:31 PM
      */
-    public RestResponse preJudgment(Long mtCompanyId, String registrationCode,Long projectId) {
+    public RestResponse preJudgment(Long mtCompanyId, String registrationCode) {
         //查询电梯表是否有该电梯
         Optional<Lift> lift = getOne(registrationCode, null);
         Long liftId = lift.map(Lift::getId).orElse(null);
@@ -127,7 +130,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
             if (result) {
                 return RestResponse.fail(MessageUtils.get("msg.lift.exist"));
             } else {
-                LiftExtendResponse detail = detail(liftId,projectId);
+                Object detail = detail(liftId, null);
                 return RestResponse.success(detail, MessageUtils.get("msg.lift.company.exist"));
             }
         } else {
@@ -193,7 +196,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         Lift lift = request.getLift();
         /*if (judge(mtCompanyId))
         return RestResponse.fail(ApiConstants.RESULT_ERROR, MessageUtils.get("msg.limit.num"));*/
-        RestResponse response = preJudgment(mtCompanyId, lift.getRegistrationCode(),request.getProjectId());
+        RestResponse response = preJudgment(mtCompanyId, lift.getRegistrationCode());
         if (ApiConstants.RESULT_ERROR.equals(response.getStatusCode())) return response;
         //新增标记 (0:新增,1:查询后带入)
         if ("0".equals(mark)) {

+ 0 - 5
lift-business-service/src/main/java/cn/com/ty/lift/business/project/dao/entity/ProjectLiftRelevance.java

@@ -54,11 +54,6 @@ public class ProjectLiftRelevance extends BaseEntity {
      */
     private Integer liftLocked;
 
-    /**
-     * 是否删除 0否 1是
-     */
-    private Integer deleteFlag;
-
     /**
      * 首保时间
      */

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

@@ -81,7 +81,7 @@
         LEFT JOIN project_lift_relevance plr ON pclr.mt_company_id = plr.mt_company_id and pclr.lift_id = plr.lift_id
         LEFT JOIN project p ON pclr.mt_company_id = p.mt_company_id and plr.project_id = p.id
         LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
-        WHERE plr.delete_flag = '0'
+        WHERE 1=1
         <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
             AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
         </if>
@@ -132,7 +132,7 @@
         LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
         LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
         LEFT JOIN platform_company_lift_relevance pclr ON plr.lift_id = pclr.lift_id AND pclr.id = plr.relevance_id
-        WHERE plr.delete_flag = '0'
+        WHERE 1=1
         <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
             AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
         </if>
@@ -144,29 +144,29 @@
     <!-- 选择电梯 -->
     <select id="chooseLiftList" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftResponse"
             parameterType="cn.com.ty.lift.business.library.dao.entity.model.request.LiftChooseRequest">
-        SELECT
-        l.id AS id,
-        l.lift_code AS liftCode,
-        l.registration_code AS registrationCode,
-        l.lift_type AS liftType,
-        l.device_position AS devicePosition,
-        lb.name AS liftBrand,
-        l.annual_inspection_date AS annualInspectionDate,
-        pclr.lift_company_status AS liftStatus,
-        pclr.id AS companyRelevanceId,
-        ui.name AS workerName,
-        plr.worker_id AS workerId
+        SELECT  l.id                     AS id,
+                l.lift_code              AS liftCode,
+                l.registration_code      AS registrationCode,
+                l.lift_type              AS liftType,
+                l.device_position        AS devicePosition,
+                lb.name                  AS liftBrand,
+                l.annual_inspection_date AS annualInspectionDate,
+                pclr.lift_company_status AS liftStatus,
+                pclr.id                  AS companyRelevanceId,
+                ui.name                  AS workerName,
+                plr.worker_id            AS workerId
         FROM platform_company_lift_relevance pclr
-        LEFT JOIN lift l ON pclr.lift_id = l.id
-        LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
-        LEFT JOIN project_lift_relevance plr ON pclr.lift_id = plr.lift_id
+                LEFT JOIN lift l ON pclr.lift_id = l.id
+                LEFT JOIN lift_brand lb ON l.lift_brand = lb.code
+                LEFT JOIN project_lift_relevance plr ON pclr.lift_id = plr.lift_id
         AND pclr.id = plr.relevance_id
-        LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
+                LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
         WHERE pclr.lift_company_status != '1'
-        AND plr.delete_flag = '0'
+        AND l.lift_status = '2'
         <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
             AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
         </if>
+        AND plr.project_id IS NULL
     </select>
 
     <!--根据公司和项目查询电梯 -->
@@ -194,7 +194,7 @@
                  LEFT JOIN project_lift_relevance plr ON l.id = plr.lift_id
                  LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
         WHERE l.id = #{id,jdbcType=BIGINT}
-          and plr.project_id = #{projectId};
+          AND plr.project_id = #{projectId}
     </select>
 
     <select id="queryLiftListByIdList" parameterType="java.util.List"

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

@@ -8,7 +8,6 @@
 		<result column="relevance_id" property="relevanceId" jdbcType="BIGINT" />
 		<result column="worker_id" property="workerId" jdbcType="BIGINT" />
 		<result column="lift_locked" property="liftLocked" jdbcType="BIT" />
-		<result column="delete_flag" property="deleteFlag" jdbcType="TINYINT" />
 		<result column="mt_companyId" property="mtCompanyId" jdbcType="BIGINT" />
 		<result column="first_time" property="firstTime" jdbcType="DATE" />
 		<result column="out_service_date" property="outServiceDate" jdbcType="DATE" />