完成数据大屏核心接口
This commit is contained in:
parent
f589308199
commit
09e2aa129c
@ -1,6 +1,5 @@
|
|||||||
package com.xhpc.databigscreen.domain;
|
package com.xhpc.databigscreen.domain;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
@ -15,9 +14,8 @@ import lombok.NoArgsConstructor;
|
|||||||
@Data
|
@Data
|
||||||
public class CoreParam {
|
public class CoreParam {
|
||||||
|
|
||||||
@JsonProperty("tenantIds")
|
|
||||||
private String tenantIds;
|
private String tenantIds;
|
||||||
private String areaCode;
|
private Integer areaCode;
|
||||||
private String chargingStationIds;
|
private String chargingStationIds;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
package com.xhpc.databigscreen.mapper;
|
package com.xhpc.databigscreen.mapper;
|
||||||
|
|
||||||
import com.xhpc.databigscreen.pojo.XhpcChargingStation;
|
import com.xhpc.databigscreen.pojo.XhpcChargingStation;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -21,12 +22,17 @@ public interface XhpcChargingStationMapper {
|
|||||||
int updateByPrimaryKey(XhpcChargingStation record);
|
int updateByPrimaryKey(XhpcChargingStation record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* query charging station infos of special tenant or all ones by tenant Id List
|
|
||||||
*
|
|
||||||
* @author WH
|
* @author WH
|
||||||
* @date 2022/2/28 17:50
|
* @date 2022/2/28 17:50
|
||||||
* @since version-1.0
|
* @since version-1.0
|
||||||
*/
|
*/
|
||||||
List<Map<String, Object>> selectByTenantId(ArrayList<Long> tenantIdList);
|
List<Map<String, Object>> selectByTenantIdAndChargingStationId(@Param("tenantIdList") ArrayList<Long> tenantIdList, @Param("chargingStationId") Long chargingStationId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author WH
|
||||||
|
* @date 2022/3/3 15:20
|
||||||
|
* @since version-1.0
|
||||||
|
*/
|
||||||
|
List<Map<String, Object>> selectByTenantIdAndAreaCode(@Param("tenantIdStr") String tenantIdStr, @Param("areaCode") Integer areaCode);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -39,11 +39,25 @@ public class XhpcDataBigScreenServiceImpl implements XhpcDataBigScreenService {
|
|||||||
tenantIdList.add(tenantId);
|
tenantIdList.add(tenantId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
List<Map<String, Object>> xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantId(tenantIdList);
|
List<Map<String, Object>> xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, null);
|
||||||
|
return R.ok(xhpcChargingStationList);
|
||||||
|
} else {
|
||||||
|
//query location info of special charging station of special tenant
|
||||||
|
String tenantIdStr = coreParam.getTenantIds();
|
||||||
|
ArrayList<Long> tenantIdList = new ArrayList<>();
|
||||||
|
long tenantId = Long.parseLong(tenantIdStr);
|
||||||
|
tenantIdList.add(tenantId);
|
||||||
|
String chargingStationIdStr = coreParam.getChargingStationIds();
|
||||||
|
long chargingStationId = Long.parseLong(chargingStationIdStr);
|
||||||
|
List<Map<String, Object>> xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndChargingStationId(tenantIdList, chargingStationId);
|
||||||
return R.ok(xhpcChargingStationList);
|
return R.ok(xhpcChargingStationList);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
//query charging station infos of whole area
|
||||||
|
String tenantIdStr = coreParam.getTenantIds();
|
||||||
|
Integer areaCode = coreParam.getAreaCode();
|
||||||
|
List<Map<String, Object>> xhpcChargingStationList = xhpcChargingStationMapper.selectByTenantIdAndAreaCode(tenantIdStr, areaCode);
|
||||||
|
return R.ok(xhpcChargingStationList);
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,12 +51,12 @@
|
|||||||
from xhpc_charging_station
|
from xhpc_charging_station
|
||||||
where charging_station_id = #{chargingStationId,jdbcType=BIGINT}
|
where charging_station_id = #{chargingStationId,jdbcType=BIGINT}
|
||||||
</select>
|
</select>
|
||||||
<select id="selectByTenantId" resultType="Map">
|
<select id="selectByTenantIdAndChargingStationId" resultType="Map">
|
||||||
SELECT
|
SELECT
|
||||||
xhpc_charging_station.tenant_id tenantId,
|
xhpc_charging_station.tenant_id tenantId,
|
||||||
xhpc_charging_station.chargingStationId,
|
xhpc_charging_station.charging_station_id chargingStationId,
|
||||||
xhpc_charging_station.`name`,
|
xhpc_charging_station.`name`,
|
||||||
xhpc_charging_station.areaCode,
|
xhpc_charging_station.area_code areaCode,
|
||||||
xhpc_charging_station.longitude,
|
xhpc_charging_station.longitude,
|
||||||
xhpc_charging_station.latitude
|
xhpc_charging_station.latitude
|
||||||
FROM
|
FROM
|
||||||
@ -64,12 +64,34 @@
|
|||||||
WHERE
|
WHERE
|
||||||
xhpc_charging_station.del_flag = 0
|
xhpc_charging_station.del_flag = 0
|
||||||
AND xhpc_charging_station.`status` = 0
|
AND xhpc_charging_station.`status` = 0
|
||||||
<if test="list!=null and list.size()!=0">
|
<if test="tenantIdList!=null and tenantIdList.size()!=0">
|
||||||
AND xhpc_charging_station.tenant_id in
|
AND xhpc_charging_station.tenant_id in
|
||||||
<foreach collection="list" separator="," open="(" close=")" item="tenantId">
|
<foreach collection="tenantIdList" separator="," open="(" close=")" item="tenantId">
|
||||||
#{tenantId}
|
#{tenantId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="chargingStationId!=null">
|
||||||
|
AND xhpc_charging_station.charging_station_id = #{chargingStationId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
<select id="selectByTenantIdAndAreaCode" resultType="map">
|
||||||
|
SELECT
|
||||||
|
xhpc_charging_station.tenant_id tenantId,
|
||||||
|
xhpc_charging_station.charging_station_id chargingStationId,
|
||||||
|
xhpc_charging_station.`name`,
|
||||||
|
xhpc_charging_station.area_code areaCode,
|
||||||
|
xhpc_charging_station.longitude,
|
||||||
|
xhpc_charging_station.latitude
|
||||||
|
FROM
|
||||||
|
xhpc_charging_station
|
||||||
|
WHERE
|
||||||
|
del_flag = 0
|
||||||
|
<if test="tenantIdStr!=null and tenantIdStr!='' ">
|
||||||
|
AND tenant_id = #{tenantIdStr}
|
||||||
|
</if>
|
||||||
|
<if test="areaCode != null and areaCode != '' ">
|
||||||
|
AND area_code = #{areaCode}
|
||||||
|
</if>
|
||||||
</select>
|
</select>
|
||||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||||
delete
|
delete
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user