详情接口优化

This commit is contained in:
yuyang 2021-08-04 18:23:48 +08:00
parent c143084656
commit c5034108bd
4 changed files with 22 additions and 2 deletions

View File

@ -69,4 +69,11 @@ public interface XhpcChargingPileMapper {
* @return 结果
*/
int updateXhpcChargingPileById(@Param("chargingPileId")Long chargingPileId);
/**
* 判断
* @param serialNumber
* @return
*/
int getXhpcChargingPileSerialNumberCount(@Param("serialNumber")String serialNumber);
}

View File

@ -49,11 +49,19 @@ public class XhpcChargingPileServiceImpl implements IXhpcChargingPileService{
Map<String, Object> stringObjectMap = xhpcChargingPileMapper.selectXhpcChargingStationById(chargingStationId);
Long rateModelId = Long.parseLong(stringObjectMap.get("rateModelId").toString());
xhpcChargingPile.setRateModelId(rateModelId);
String serialNumber = xhpcChargingPile.getSerialNumber();
//判断桩编号是否重复
int count = xhpcChargingPileMapper.getXhpcChargingPileSerialNumberCount(serialNumber);
if(count>0){
return AjaxResult.error("桩编号重复");
}
//
xhpcChargingPileMapper.addXhpcChargingPile(xhpcChargingPile);
//终端
Long chargingPileId=xhpcChargingPile.getChargingPileId();
String serialNumber = xhpcChargingPile.getSerialNumber();
if(xhpcChargingPile.getGunNumber()>0){
for (int i = 0; i < xhpcChargingPile.getGunNumber(); i++) {
XhpcTerminal xhpcTerminal =new XhpcTerminal();

View File

@ -307,4 +307,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<update id="updateXhpcChargingPileById">
update xhpc_charging_pile set del_flag =1 where charging_pile_id = #{chargingPileId}
</update>
<select id="getXhpcChargingPileSerialNumberCount" resultType="int">
select count(charging_pile_id) from xhpc_charging_pile where serial_number=#{serialNumber}
</select>
</mapper>

View File

@ -189,6 +189,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
ct.construction_site as constructionSite,
(select dict_value from xhpc_dict_biz where code ='charging_construction_site' and dict_key =ct.construction_site) as constructionSiteName,
ct.address as address,
ct.remark as remark,
ct.detailed_address as detailedAddress,
ct.periphery_facilities as peripheryFacilities,
ct.service_facilities as serviceFacilities,
@ -728,7 +729,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getXhpcRateTimeOrderStatistics" resultType="java.util.Map">
select
sum(charging_degree) as chargingDegreeSum,
IF(SUM(charging_degree) IS NULL,0, charging_degree) as chargingDegreeSum,
COUNT(real_time_order_id) as realTimeOrderIdCount,
COUNT(DISTINCT user_id) as userIdCount
from xhpc_real_time_order