Kaynağa Gözat

电梯档案-编辑电梯-bug修改

wang-hai-cheng 5 yıl önce
ebeveyn
işleme
c329ebe58d

+ 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());
+        LiftExtendResponse 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());
+        return liftService.preJudgment(request.getMtCompanyId(), request.getCode(), request.getProjectId());
     }
 
     /**

+ 6 - 0
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/entity/model/request/LiftDetailRequest.java

@@ -17,4 +17,10 @@ public class LiftDetailRequest {
      */
     @NotNull(message = "notEmpty")
     private Long id;
+
+    /**
+     * 项目ID
+     */
+    @NotNull(message = "notEmpty")
+    private Long projectId;
 }

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/library/dao/mapper/LiftMapper.java

@@ -31,7 +31,7 @@ public interface LiftMapper extends BaseMapper<Lift> {
 
     IPage<LiftResponse> chooseLiftList(IPage<LiftResponse> page, @Param("request") LiftChooseRequest request);
 
-    LiftExtendResponse queryById(@Param("id") Long id);
+    LiftExtendResponse queryById(@Param("id") Long id, @Param("projectId") Long projectId);
 
     /**
      * @param liftIdList 电梯id列表

+ 24 - 20
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -102,8 +102,8 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
      * @description 查询电梯详情
      * @date 2019/12/6 10:51 AM
      */
-    public LiftExtendResponse detail(Long id) {
-        return baseMapper.queryById(id);
+    public LiftExtendResponse detail(Long id, Long projectId) {
+        return baseMapper.queryById(id, projectId);
     }
 
 
@@ -114,7 +114,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
      * @description 新增电梯前置判断条件
      * @date 2019/12/20 2:31 PM
      */
-    public RestResponse preJudgment(Long mtCompanyId, String registrationCode) {
+    public RestResponse preJudgment(Long mtCompanyId, String registrationCode,Long projectId) {
         //查询电梯表是否有该电梯
         Optional<Lift> lift = getOne(registrationCode, null);
         Long liftId = lift.map(Lift::getId).orElse(null);
@@ -127,7 +127,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
             if (result) {
                 return RestResponse.fail(MessageUtils.get("msg.lift.exist"));
             } else {
-                LiftExtendResponse detail = detail(liftId);
+                LiftExtendResponse detail = detail(liftId,projectId);
                 return RestResponse.success(detail, MessageUtils.get("msg.lift.company.exist"));
             }
         } else {
@@ -154,7 +154,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
     }
 
     /**
-     * @param id 电梯id
+     * @param id          电梯id
      * @param mtCompanyId 公司id
      * @return RestResponse 是否成功
      * @description 保存公司电梯关联数据、平台电梯关联数据
@@ -193,7 +193,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());
+        RestResponse response = preJudgment(mtCompanyId, lift.getRegistrationCode(),request.getProjectId());
         if (ApiConstants.RESULT_ERROR.equals(response.getStatusCode())) return response;
         //新增标记 (0:新增,1:查询后带入)
         if ("0".equals(mark)) {
@@ -278,21 +278,22 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
      * @date 2020/2/17 4:47 下午
      */
     public List<LiftPrintResponse> queryLiftListByIdList(List<Long> liftIdList) {
-       return baseMapper.queryLiftListByIdList(liftIdList);
+        return baseMapper.queryLiftListByIdList(liftIdList);
     }
 
-    private void rollback(){
+    private void rollback() {
         //强制手动事务回滚
         TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
     }
 
     /**
      * 解析excel导入电梯
-     * @author wcz
+     *
      * @param liftImportModels 解析表格lift数据
-     * @param mtCompanyId 维保公司
-     * @param projectId 项目id
+     * @param mtCompanyId      维保公司
+     * @param projectId        项目id
      * @return RestResponse
+     * @author wcz
      */
     @Transactional(rollbackFor = Exception.class)
     public RestResponse assemble(List<LiftImportModel> liftImportModels, Long mtCompanyId, Long projectId) {
@@ -307,7 +308,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         //根据维保公司和项目id查询
         List<LiftProjectModel> liftProjectModelList = baseMapper.listByCompanyAndProject(mtCompanyId, projectId);
         //根据维保公司和项目查询
-        List<ProjectLiftRelevance> projectLiftRelevanceList = projectRelevanceService.findLiftList(mtCompanyId,projectId);
+        List<ProjectLiftRelevance> projectLiftRelevanceList = projectRelevanceService.findLiftList(mtCompanyId, projectId);
         //根据维保公司
         List<PlatformCompanyLiftRelevance> platformCompanyLiftRelevanceList = platformService.listByCompany(mtCompanyId);
 
@@ -352,7 +353,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
                 log.info("新建PlatformCompanyLiftRelevance:{}", platformCompanyLiftRelevance);
                 //加入到新建list中批量插入
                 platformCompanyLiftRelevances.add(platformCompanyLiftRelevance);
-            }else{
+            } else {
                 platformCompanyLiftRelevance = pclrOptional.get();
             }
 
@@ -402,12 +403,14 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         }
         return RestResponse.success("导入成功");
     }
+
     /**
      * 根据RegistrationCode分组查询存在电梯注册代码相同的重复电梯数据
-     * @author wcz
+     *
      * @return List<Lift>
+     * @author wcz
      */
-    public List<Lift> groupByRegistrationCode(){
+    public List<Lift> groupByRegistrationCode() {
         QueryWrapper<Lift> queryWrapper = new QueryWrapper<>();
         LambdaQueryWrapper<Lift> lambdaQueryWrapper = queryWrapper.lambda();
         lambdaQueryWrapper.groupBy(Lift::getRegistrationCode);
@@ -417,8 +420,9 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
 
     /**
      * 去掉lift中registration_code对应的重复数据,同步其他表中lift_id
-     * @author wcz
+     *
      * @return boolean
+     * @author wcz
      */
     public boolean clearData() {
         //1 获取同一registration_code对应多个电梯的记录
@@ -430,7 +434,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         //根据存在重复lift的code去查询registration_code <--> id的对应关系
         Map<String, List<Long>> codeIdMap = new HashMap<>();
         //sB201707197996 SB201707197996
-        codesMap.forEach((code,liftList) -> {
+        codesMap.forEach((code, liftList) -> {
             codeIdMap.put(code, liftList.stream().map(Lift::getId).collect(Collectors.toList()));
         });
         //从相同registration_code中的lift_id的集合,取出第一个id保留,剩下的删除,并且把删除的id引用update成保留的id
@@ -453,7 +457,7 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
         //保存脚本到文件
         String sqlname = "./sql/1.delete_lift.sql";
         FileUtil.writeString(deleteBuffer.toString(), new File(sqlname), "utf-8");
-        log.info("生成DELETE操作sql文件:{}",sqlname);
+        log.info("生成DELETE操作sql文件:{}", sqlname);
 
         StringBuffer updateBuffer = new StringBuffer();
         //需要更新lift_id的表
@@ -477,9 +481,9 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
             updateIds.entrySet().forEach(entry -> {
                 updateBuffer.append(StrUtil.format("UPDATE {} SET lift_id = {} WHERE lift_id IN ({});", table, entry.getKey(), StrUtil.join(",", entry.getValue()))).append("\n");
             });
-            sqlname = StrUtil.format("./sql/{}.update_{}.sql",(i + 2),table);
+            sqlname = StrUtil.format("./sql/{}.update_{}.sql", (i + 2), table);
             FileUtil.writeString(updateBuffer.toString(), new File(sqlname), "utf-8");
-            log.info("生成UPDATE操作sql文件:{}",sqlname);
+            log.info("生成UPDATE操作sql文件:{}", sqlname);
             //清空buffer
             updateBuffer.setLength(0);
         }

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

@@ -1,206 +1,208 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="cn.com.ty.lift.business.library.dao.mapper.LiftMapper" >
-	<resultMap id="BaseResultMap" type="cn.com.ty.lift.business.library.dao.entity.Lift" >
-		<id column="id" property="id" jdbcType="BIGINT" />
-		<result column="registration_code" property="registrationCode" jdbcType="VARCHAR" />
-		<result column="category" property="category" jdbcType="INTEGER" />
-		<result column="lift_type" property="liftType" jdbcType="INTEGER" />
-		<result column="lift_code" property="liftCode" jdbcType="CHAR" />
-		<result column="manufacture_date" property="manufactureDate" jdbcType="DATE" />
-		<result column="factory_code" property="factoryCode" jdbcType="VARCHAR" />
-		<result column="device_usage" property="deviceUsage" jdbcType="INTEGER" />
-		<result column="lift_brand" property="liftBrand" jdbcType="VARCHAR" />
-		<result column="install_company" property="installCompany" jdbcType="VARCHAR" />
-		<result column="lift_model" property="liftModel" jdbcType="VARCHAR" />
-		<result column="pulley_diameter" property="pulleyDiameter" jdbcType="DECIMAL" />
-		<result column="rope_num" property="ropeNum" jdbcType="INTEGER" />
-		<result column="lock_model" property="lockModel" jdbcType="VARCHAR" />
-		<result column="rated_load" property="ratedLoad" jdbcType="INTEGER" />
-		<result column="promote_height" property="promoteHeight" jdbcType="DECIMAL" />
-		<result column="step_width" property="stepWidth" jdbcType="DECIMAL" />
-		<result column="sidewalk_length" property="sidewalkLength" jdbcType="DECIMAL" />
-		<result column="tilt_angle" property="tiltAngle" jdbcType="DECIMAL" />
-		<result column="motor_power" property="motorPower" jdbcType="DECIMAL" />
-		<result column="rated_speed" property="ratedSpeed" jdbcType="DECIMAL" />
-		<result column="layer_station_door" property="layerStationDoor" jdbcType="VARCHAR" />
-		<result column="clamp_type" property="clampType" jdbcType="INTEGER" />
-		<result column="reform_company" property="reformCompany" jdbcType="VARCHAR" />
-		<result column="device_position" property="devicePosition" jdbcType="VARCHAR" />
-		<result column="coordinate" property="coordinate" jdbcType="VARCHAR" />
-		<result column="remarks" property="remarks" jdbcType="VARCHAR" />
-		<result column="creator_id" property="creatorId" jdbcType="BIGINT" />
-		<result column="create_date" property="createDate" jdbcType="TIMESTAMP" />
-		<result column="steel_belt" property="steelBelt" jdbcType="INTEGER" />
-		<result column="cylinder_type" property="cylinderType" jdbcType="VARCHAR" />
-		<result column="cylinder_num" property="cylinderNum" jdbcType="INTEGER" />
-		<result column="top_type" property="topType" jdbcType="INTEGER" />
-		<result column="control_type" property="controlType" jdbcType="VARCHAR" />
-		<result column="mpa" property="mpa" jdbcType="INTEGER" />
-		<result column="factory" property="factory" jdbcType="VARCHAR" />
-		<result column="custom_number" property="customNumber" jdbcType="VARCHAR" />
-		<result column="use_company_code" property="useCompanyCode" jdbcType="VARCHAR" />
-		<result column="device_position_code" property="devicePositionCode" jdbcType="CHAR" />
-		<result column="agency" property="agency" jdbcType="VARCHAR" />
-		<result column="reform_date" property="reformDate" jdbcType="TIMESTAMP" />
-		<result column="install_date" property="installDate" jdbcType="TIMESTAMP" />
-		<result column="inner_floor" property="innerFloor" jdbcType="INTEGER" />
-		<result column="annual_inspection_date" property="annualInspectionDate" jdbcType="DATE" />
-		<result column="area_code" property="areaCode" jdbcType="CHAR" />
-		<result column="device_id" property="deviceId" jdbcType="VARCHAR" />
-		<result column="device_type" property="deviceType" jdbcType="TINYINT" />
-	</resultMap>
+<mapper namespace="cn.com.ty.lift.business.library.dao.mapper.LiftMapper">
+    <resultMap id="BaseResultMap" type="cn.com.ty.lift.business.library.dao.entity.Lift">
+        <id column="id" property="id" jdbcType="BIGINT"/>
+        <result column="registration_code" property="registrationCode" jdbcType="VARCHAR"/>
+        <result column="category" property="category" jdbcType="INTEGER"/>
+        <result column="lift_type" property="liftType" jdbcType="INTEGER"/>
+        <result column="lift_code" property="liftCode" jdbcType="CHAR"/>
+        <result column="manufacture_date" property="manufactureDate" jdbcType="DATE"/>
+        <result column="factory_code" property="factoryCode" jdbcType="VARCHAR"/>
+        <result column="device_usage" property="deviceUsage" jdbcType="INTEGER"/>
+        <result column="lift_brand" property="liftBrand" jdbcType="VARCHAR"/>
+        <result column="install_company" property="installCompany" jdbcType="VARCHAR"/>
+        <result column="lift_model" property="liftModel" jdbcType="VARCHAR"/>
+        <result column="pulley_diameter" property="pulleyDiameter" jdbcType="DECIMAL"/>
+        <result column="rope_num" property="ropeNum" jdbcType="INTEGER"/>
+        <result column="lock_model" property="lockModel" jdbcType="VARCHAR"/>
+        <result column="rated_load" property="ratedLoad" jdbcType="INTEGER"/>
+        <result column="promote_height" property="promoteHeight" jdbcType="DECIMAL"/>
+        <result column="step_width" property="stepWidth" jdbcType="DECIMAL"/>
+        <result column="sidewalk_length" property="sidewalkLength" jdbcType="DECIMAL"/>
+        <result column="tilt_angle" property="tiltAngle" jdbcType="DECIMAL"/>
+        <result column="motor_power" property="motorPower" jdbcType="DECIMAL"/>
+        <result column="rated_speed" property="ratedSpeed" jdbcType="DECIMAL"/>
+        <result column="layer_station_door" property="layerStationDoor" jdbcType="VARCHAR"/>
+        <result column="clamp_type" property="clampType" jdbcType="INTEGER"/>
+        <result column="reform_company" property="reformCompany" jdbcType="VARCHAR"/>
+        <result column="device_position" property="devicePosition" jdbcType="VARCHAR"/>
+        <result column="coordinate" property="coordinate" jdbcType="VARCHAR"/>
+        <result column="remarks" property="remarks" jdbcType="VARCHAR"/>
+        <result column="creator_id" property="creatorId" jdbcType="BIGINT"/>
+        <result column="create_date" property="createDate" jdbcType="TIMESTAMP"/>
+        <result column="steel_belt" property="steelBelt" jdbcType="INTEGER"/>
+        <result column="cylinder_type" property="cylinderType" jdbcType="VARCHAR"/>
+        <result column="cylinder_num" property="cylinderNum" jdbcType="INTEGER"/>
+        <result column="top_type" property="topType" jdbcType="INTEGER"/>
+        <result column="control_type" property="controlType" jdbcType="VARCHAR"/>
+        <result column="mpa" property="mpa" jdbcType="INTEGER"/>
+        <result column="factory" property="factory" jdbcType="VARCHAR"/>
+        <result column="custom_number" property="customNumber" jdbcType="VARCHAR"/>
+        <result column="use_company_code" property="useCompanyCode" jdbcType="VARCHAR"/>
+        <result column="device_position_code" property="devicePositionCode" jdbcType="CHAR"/>
+        <result column="agency" property="agency" jdbcType="VARCHAR"/>
+        <result column="reform_date" property="reformDate" jdbcType="TIMESTAMP"/>
+        <result column="install_date" property="installDate" jdbcType="TIMESTAMP"/>
+        <result column="inner_floor" property="innerFloor" jdbcType="INTEGER"/>
+        <result column="annual_inspection_date" property="annualInspectionDate" jdbcType="DATE"/>
+        <result column="area_code" property="areaCode" jdbcType="CHAR"/>
+        <result column="device_id" property="deviceId" jdbcType="VARCHAR"/>
+        <result column="device_type" property="deviceType" jdbcType="TINYINT"/>
+    </resultMap>
 
-	<sql id="Base_Column_List" >
-		id, registration_code, category, lift_type, lift_code, manufacture_date, factory_code, 
+    <sql id="Base_Column_List">
+        id, registration_code, category, lift_type, lift_code, manufacture_date, factory_code,
 		device_usage, lift_brand, install_company, lift_model, pulley_diameter, rope_num, 
 		lock_model, rated_load, promote_height, step_width, sidewalk_length, tilt_angle, 
 		motor_power, rated_speed, layer_station_door, clamp_type, reform_company, device_position, 
 		coordinate, remarks, creator_id, create_date, steel_belt, cylinder_type, cylinder_num, 
 		top_type, control_type, mpa, factory, custom_number, use_company_code, device_position_code, 
 		agency, reform_date, install_date, inner_floor, annual_inspection_date, area_code, device_id, device_type
-	</sql>
+    </sql>
 
-	<!-- 根据区域,项目,电梯号,电梯品牌,电梯类型,维保工查询电梯列表信息-->
-	<select id="findByCondition" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftResponse"
-			parameterType="cn.com.ty.lift.business.library.dao.entity.model.request.LiftRequest" >
+    <!-- 根据区域,项目,电梯号,电梯品牌,电梯类型,维保工查询电梯列表信息-->
+    <select id="findByCondition" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftResponse"
+            parameterType="cn.com.ty.lift.business.library.dao.entity.model.request.LiftRequest">
         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,
-		pclr.lift_company_status AS liftStatus,
-		plr.first_time           AS firstMaintenanceTime,
-		p.project_name           AS projectName,
-        plr.lift_locked          AS liftLocked
+        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,
+        pclr.lift_company_status AS liftStatus,
+        plr.first_time AS firstMaintenanceTime,
+        p.project_name AS projectName,
+        p.id AS projectId,
+        plr.lift_locked AS liftLocked
         FROM platform_company_lift_relevance pclr
         LEFT JOIN lift l ON pclr.lift_id = l.id
         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 plr.delete_flag = '0'
         <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+            AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
+        <if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 1">
+            AND pclr.lift_company_status != 1
+        </if>
+        <if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 0">
+            AND pclr.lift_company_status = 1
+        </if>
+        <if test="request.liftType!=null and request.liftType!=''">
+            AND l.lift_type = #{request.liftType,jdbcType=VARCHAR}
         </if>
-		<if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 1">
-			AND pclr.lift_company_status != 1
-		</if>
-		<if test="request.liftStatus != null and request.liftStatus != '' and request.liftStatus == 0">
-			AND pclr.lift_company_status = 1
-		</if>
-		<if test="request.liftType!=null and request.liftType!=''">
-			AND l.lift_type = #{request.liftType,jdbcType=VARCHAR}
-		</if>
         <if test="request.liftBrand!=null and request.liftBrand!=''">
-			AND lb.code = #{request.liftBrand,jdbcType=VARCHAR}
+            AND lb.code = #{request.liftBrand,jdbcType=VARCHAR}
+        </if>
+        <if test="request.registrationCode!=null and request.registrationCode!=''">
+            AND l.registration_code LIKE #{request.registrationCode,jdbcType=VARCHAR}
         </if>
-		<if test="request.registrationCode!=null and request.registrationCode!=''">
-			AND l.registration_code LIKE #{request.registrationCode,jdbcType=VARCHAR}
-		</if>
-	</select>
+    </select>
 
-	<!-- 查询项目下电梯列表 -->
-    <select id="findLiftListByProjectId" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftResponse"
-			parameterType="cn.com.ty.lift.business.library.dao.entity.model.request.ProjectLiftRequest">
+    <!-- 查询项目下电梯列表 -->
+    <select id="findLiftListByProjectId"
+            resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftResponse"
+            parameterType="cn.com.ty.lift.business.library.dao.entity.model.request.ProjectLiftRequest">
         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.id                   AS companyRelevanceId,
-          pclr.lift_company_status  AS liftStatus,
-		  plr.id                    AS projectRelevanceId,
-          plr.project_id            AS projectId,
-          plr.worker_id             AS workerId,
-		  plr.lift_locked           AS liftLocked,
-		  ui.name                   AS workerName
+        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.id AS companyRelevanceId,
+        pclr.lift_company_status AS liftStatus,
+        plr.id AS projectRelevanceId,
+        plr.project_id AS projectId,
+        plr.worker_id AS workerId,
+        plr.lift_locked AS liftLocked,
+        ui.name AS workerName
         FROM project_lift_relevance plr
-          LEFT JOIN lift l ON plr.lift_id = l.id
-          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
+        LEFT JOIN lift l ON plr.lift_id = l.id
+        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'
-		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-		</if>
+        <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
+            AND plr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
         <if test="request.projectId!=null and request.projectId!=''">
             AND plr.project_id = #{request.projectId,jdbcType=BIGINT}
         </if>
     </select>
 
-	<!-- 选择电梯 -->
-	<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
-		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
-		AND pclr.id = plr.relevance_id
-		LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
-		WHERE pclr.lift_company_status != '1'
-		AND plr.delete_flag = '0'
-		<if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
-			AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
-		</if>
-	</select>
+    <!-- 选择电梯 -->
+    <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
+        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
+        AND pclr.id = plr.relevance_id
+        LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
+        WHERE pclr.lift_company_status != '1'
+        AND plr.delete_flag = '0'
+        <if test="request.mtCompanyId!=null and request.mtCompanyId!=''">
+            AND pclr.mt_company_id = #{request.mtCompanyId,jdbcType=BIGINT}
+        </if>
+    </select>
 
-	<!--根据公司和项目查询电梯 -->
-	<select id="listByCompanyAndProject" resultType="cn.com.ty.lift.business.library.dao.entity.model.LiftProjectModel">
-		SELECT
-			plr.id,
-			plr.project_id,
-			plr.lift_id,
-			li.registration_code,
-			plr.relevance_id,
-			plr.worker_id,
-			ui.`name` AS worker_name,
-			plr.mt_company_id
-		FROM
-			lift li
-			LEFT JOIN project_lift_relevance plr ON li.id = plr.lift_id
-			LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
-		WHERE
-			plr.mt_company_id = #{mtCompanyId}
-			AND plr.project_id = #{projectId}
-	</select>
+    <!--根据公司和项目查询电梯 -->
+    <select id="listByCompanyAndProject" resultType="cn.com.ty.lift.business.library.dao.entity.model.LiftProjectModel">
+        SELECT plr.id,
+               plr.project_id,
+               plr.lift_id,
+               li.registration_code,
+               plr.relevance_id,
+               plr.worker_id,
+               ui.`name` AS worker_name,
+               plr.mt_company_id
+        FROM lift li
+                 LEFT JOIN project_lift_relevance plr ON li.id = plr.lift_id
+                 LEFT JOIN user_info ui ON plr.worker_id = ui.user_id
+        WHERE plr.mt_company_id = #{mtCompanyId}
+          AND plr.project_id = #{projectId}
+    </select>
 
-	<select id="queryById" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftExtendResponse" parameterType="java.lang.Long">
-		SELECT l.*,
-			   ui.name as workerName
-		FROM lift l
-				 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}
-	</select>
+    <select id="queryById" resultType="cn.com.ty.lift.business.library.dao.entity.model.response.LiftExtendResponse"
+            parameterType="java.lang.Long">
+        SELECT l.*,
+               ui.name as workerName
+        FROM lift l
+                 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};
+    </select>
 
-	<select id="queryLiftListByIdList" parameterType="java.util.List" resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.LiftPrintResponse">
-		SELECT l.id                AS liftId,
-			   plr.project_id      AS projectId,
-		       plr.mt_company_id   AS mtCompanyId,
-			   l.registration_code AS registrationCode,
-			   l.device_position   AS devicePosition
-		FROM lift l
-				 LEFT JOIN project_lift_relevance plr ON l.id = plr.lift_id
-		WHERE l.id IN
-		<foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
-			#{id}
-		</foreach>
-	</select>
+    <select id="queryLiftListByIdList" parameterType="java.util.List"
+            resultType="cn.com.ty.lift.business.maintenance.dao.entity.model.response.LiftPrintResponse">
+        SELECT l.id AS liftId,
+        plr.project_id AS projectId,
+        plr.mt_company_id AS mtCompanyId,
+        l.registration_code AS registrationCode,
+        l.device_position AS devicePosition
+        FROM lift l
+        LEFT JOIN project_lift_relevance plr ON l.id = plr.lift_id
+        WHERE l.id IN
+        <foreach collection="list" item="id" index="index" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </select>
 </mapper>

+ 2 - 2
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/region/service/impl/RegionServiceImpl.java

@@ -100,8 +100,8 @@ public class RegionServiceImpl extends ServiceImpl<RegionMapper, Region> impleme
 
     //删除区域,如果区域下没有关联项目
     public RestResponse delete(Region region) {
-        Integer projectCount = (Integer) baseMapper.selectProjectCount(region.getId()).get("count");
-        if (projectCount.equals(0)) {
+        Long projectCount = (Long) baseMapper.selectProjectCount(region.getId()).get("count");
+        if (projectCount.equals(0L)) {
             if (this.removeById(region.getId())) {
                 return RestResponse.success(null, "成功");
             }