ソースを参照

Merge branch 'wanghaicheng' of http://132.232.206.88:3000/lift-manager/lift-server into wanghaicheng

wanghaicheng 4 年 前
コミット
704c260c87

+ 3 - 2
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/dao/mapper/MaintenancePlanMapper.java

@@ -15,6 +15,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
 
+import java.time.LocalDate;
 import java.util.List;
 import java.util.Map;
 
@@ -59,6 +60,6 @@ public interface MaintenancePlanMapper extends BaseMapper<MaintenancePlan> {
     Long getCountByPlanId(Long planId);
 
     @Select("select (select value from global_set where company_id = #{mtCompanyId}  and code = 'sameUnits') >" +
-            "       (select count(*) from maintenance_record where mt_company_id=#{mtCompanyId} and worker_id1 = #{workerId1} and status = '1')")
-    boolean selectLiftMaintainableBy(Long workerId1, Long mtCompanyId);
+            "       (select count(*) from maintenance_record where mt_company_id=#{mtCompanyId} and worker_id1 = #{workerId1} and status = '1' and work_date = #{today})")
+    boolean selectLiftMaintainableBy(Long workerId1, Long mtCompanyId, LocalDate today);
 }

+ 1 - 1
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenanceRecordService.java

@@ -235,7 +235,7 @@ public class MaintenanceRecordService extends ServiceImpl<MaintenanceRecordMappe
         if (result)
             return RestResponse.fail(MessageUtils.get("msg.error.person.scope"));
         log.debug("根据全局设置判断当前维保工是否可以继续维保电梯");
-        boolean maintainable = maintenancePlanService.getBaseMapper().selectLiftMaintainableBy(request.getUserId(), request.getMtCompanyId());
+        boolean maintainable = maintenancePlanService.getBaseMapper().selectLiftMaintainableBy(request.getUserId(), request.getMtCompanyId(),LocalDate.now());
         if (!maintainable) {
             return RestResponse.fail("超出公司设置的维保工可维保电梯上限数量");
         }

+ 2 - 2
lift-common/src/main/java/cn.com.ty.lift.common/constants/SqlConstants.java

@@ -152,9 +152,9 @@ public interface SqlConstants {
                     "     , r.id            id" +
                     "   from region r" +
                     "         left join user_info ui on r.user_id = ui.user_id" +
-                    "     where mt_company_id = #{mtCompanyId}" +
+                    "     where r.mt_company_id = #{mtCompanyId}" +
                     "       and (r.area_name like '%${name}%' or ui.name like '%${name}%')" +
-                    "   order by create_time desc";
+                    "   order by r.create_time desc";
 
     //根据用户id查询待维保数量
     String QUERY_MAINTENANCE_COUNT_BY_USER_ID =