Commit 751ae06b by 杨林龙

开发 1.12.0 版本 优化工单列表校验车架号重复接口

1 parent b7f2f30b
......@@ -367,4 +367,13 @@ public interface VehicleMapper extends CommonBaseMapper<Vehicle> {
int updateSettleFlagById(@Param("id") Long id, @Param("settleFlag") Integer settleFlag);
int countByUserId(@Param("userId") Long userId);
/**
* 查询租户节点下面是否存在存在相同的车辆
*
* @param vin 车架号
* @param tenantId 租户ID
* @return
*/
List<Vehicle> getVehicleListByVinAndTenantId(@Param("vin") String vin, @Param("tenantId") Long tenantId);
}
\ No newline at end of file
......@@ -739,7 +739,14 @@ public class WorkOrderService extends AbstractCommonService {
* @return
*/
public Boolean verifyDuplicateVim(String vin) {
List<Vehicle> vehicleList = vehicleMapper.getVehicleListByVinWithAuth(vin);
// 获取当前账号的租户Id
Long tenantId = null;
boolean superAdmin = ShieldContextHolder.isSuperAdmin();
if (!superAdmin) {
tenantId = ShieldContextHolder.getTenantId();
}
List<Vehicle> vehicleList = vehicleMapper.getVehicleListByVinAndTenantId(vin, tenantId);
log.info("vehicleList===" + JSONUtil.toJsonStr(vehicleList));
return CollectionUtil.isNotEmpty(vehicleList);
}
......
......@@ -1418,4 +1418,16 @@
where id = #{id}
</update>
<select id="getVehicleListByVinAndTenantId" resultMap="BaseResultMap">
select tv.*
from t_vehicle tv
left join t_user tu on tu.id = tv.created_by
where tv.vin = #{vin}
and tv.del_flag = 0
<if test="tenantId != null">
and tu.tenant_id = #{tenantId}
</if>
and tu.del_flag = 0
</select>
</mapper>
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!