历史订单、订单详情
This commit is contained in:
parent
eb7c594cf2
commit
861d5f0660
@ -0,0 +1,52 @@
|
|||||||
|
package com.xhpc.order.controller;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.web.controller.BaseController;
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||||
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 历史订单
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/8/3 21:19
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/histotyOrder")
|
||||||
|
@Api(value = "历史订单清接口", tags = "历史订单接口")
|
||||||
|
public class XhpcHistoryOrderController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IXhpcHistoryOrderService xhpcHistoryOrderService;
|
||||||
|
/**
|
||||||
|
* 用户历史订单接口
|
||||||
|
*/
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(@RequestParam Long userId)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<Map<String,Object>> list = xhpcHistoryOrderService.list(userId);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单详情接口
|
||||||
|
*/
|
||||||
|
@GetMapping("/gethistotyOrderMessage")
|
||||||
|
public AjaxResult gethistotyOrderMessage(@RequestParam Long userId,@RequestParam Long historyOrderId)
|
||||||
|
{
|
||||||
|
return xhpcHistoryOrderService.gethistotyOrderMessage(userId,historyOrderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -3,6 +3,9 @@ package com.xhpc.order.mapper;
|
|||||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 历史订单信息 数据层
|
* 历史订单信息 数据层
|
||||||
*
|
*
|
||||||
@ -49,4 +52,19 @@ public interface XhpcHistoryOrderMapper {
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int updateSorting(String[] xhpcHistoryOrderIds);
|
public int updateSorting(String[] xhpcHistoryOrderIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户历史订单表
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> list(@Param("userId") Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单详情
|
||||||
|
* @param userId
|
||||||
|
* @param historyOrderId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String,Object> gethistotyOrderMessage(@Param("userId")Long userId,@Param("historyOrderId")Long historyOrderId);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.xhpc.order.service;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/8/3 21:23
|
||||||
|
*/
|
||||||
|
public interface IXhpcHistoryOrderService {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户历史订单表
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> list(Long userId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户订单详情
|
||||||
|
* @param userId
|
||||||
|
* @param historyOrderId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
AjaxResult gethistotyOrderMessage(Long userId,Long historyOrderId);
|
||||||
|
}
|
||||||
@ -0,0 +1,31 @@
|
|||||||
|
package com.xhpc.order.service.impl;
|
||||||
|
|
||||||
|
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||||
|
import com.xhpc.order.mapper.XhpcHistoryOrderMapper;
|
||||||
|
import com.xhpc.order.service.IXhpcHistoryOrderService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author yuyang
|
||||||
|
* @date 2021/8/3 21:23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class XhpcHistoryOrderServiceImpl implements IXhpcHistoryOrderService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private XhpcHistoryOrderMapper xhpcHistoryOrderMapper;
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> list(Long userId) {
|
||||||
|
return xhpcHistoryOrderMapper.list(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AjaxResult gethistotyOrderMessage(Long userId, Long historyOrderId) {
|
||||||
|
return AjaxResult.success(xhpcHistoryOrderMapper.gethistotyOrderMessage(userId,historyOrderId));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -294,4 +294,46 @@
|
|||||||
#{xhpcHistoryOrderId}
|
#{xhpcHistoryOrderId}
|
||||||
</foreach>
|
</foreach>
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="list" resultType="map">
|
||||||
|
SELECT
|
||||||
|
ho.history_order_id as historyOrderId,
|
||||||
|
ho.serial_number as serialNumber,
|
||||||
|
ho.create_time as createTime,
|
||||||
|
ho.type as type,
|
||||||
|
cs.name as chargingStationName,
|
||||||
|
te.name as terminalName,
|
||||||
|
ho.act_price as actPrice,
|
||||||
|
(select charging_degree from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as chargingDegree,
|
||||||
|
(select charging_time from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as chargingTime
|
||||||
|
FROM xhpc_history_order as ho
|
||||||
|
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
|
||||||
|
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
|
where ho.status=0 and ho.del_flag=0 and ho.user_id =#{userId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="gethistotyOrderMessage" resultType="map">
|
||||||
|
SELECT
|
||||||
|
ho.history_order_id as historyOrderId,
|
||||||
|
ho.serial_number as serialNumber,
|
||||||
|
ho.type as type,
|
||||||
|
cs.name as chargingStationName,
|
||||||
|
te.name as terminalName,
|
||||||
|
ho.act_price as actPrice,
|
||||||
|
ho.act_power_price as actPowerPrice,
|
||||||
|
(select charging_time from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as chargingTime
|
||||||
|
(select charging_degree from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as chargingDegree,
|
||||||
|
(select DATE_FORMAT(create_time,'%m月%d日') from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time asc LIMIT 1) as daysOne,
|
||||||
|
(select DATE_FORMAT(create_time,'%H:%m') from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time asc LIMIT 1) as timeOne,
|
||||||
|
(select DATE_FORMAT(create_time,'%m月%d日') from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as daysTwo,
|
||||||
|
(select DATE_FORMAT(create_time,'%H:%m') from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as timeTwo,
|
||||||
|
(select type from xhpc_real_time_order where charging_order_id=ho.charging_order_id ORDER BY create_time desc LIMIT 1) as type
|
||||||
|
FROM xhpc_history_order as ho
|
||||||
|
LEFT JOIN xhpc_charging_station as cs on cs.charging_station_id = ho.charging_station_id
|
||||||
|
LEFT JOIN xhpc_terminal as te on te.terminal_id = ho.terminal_id
|
||||||
|
where ho.status=0 and ho.del_flag=0 and ho.history_order_id =#{historyOrderId}
|
||||||
|
<if test="userId !=null">
|
||||||
|
and ho.user_id =#{userId}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user