更新桩运行日志增加查询参数

This commit is contained in:
panshuling321 2022-02-25 11:21:06 +08:00
parent 4fb0e210e5
commit a5323c7df4
5 changed files with 47 additions and 10 deletions

View File

@ -1,4 +1,4 @@
package com.xhpc.log;
package com.xhpc;
import com.xhpc.common.security.annotation.EnableCustomConfig;
import com.xhpc.common.security.annotation.EnableRyFeignClients;

View File

@ -4,11 +4,14 @@ import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.log.service.OrderLogService;
import com.xhpc.system.api.model.LoginUser;
import lombok.extern.java.Log;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@ -24,20 +27,29 @@ public class OrderLogController extends BaseController {
@Resource
OrderLogService orderLogService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getOrderPage(
HttpServletRequest request,
@RequestParam(required = false) String orderId,
@RequestParam(required = false) String phone,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) Integer number){
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("orderId", orderId);
params.put("phone", phone);
params.put("startTime", startTime);
params.put("endTime", endTime);
params.put("operatorId", SecurityUtils.getUserId());
params.put("number", number);
params.put("tenantId", tenantId);
params.put("tenantId", loginUser.getTenantId());
return getDataTable(orderLogService.getOrderPage(params));
}

View File

@ -5,10 +5,13 @@ import com.xhpc.common.core.utils.SecurityUtils;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.page.TableDataInfo;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.common.util.LogUserUtils;
import com.xhpc.log.service.PileLogService;
import com.xhpc.system.api.model.LoginUser;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
@ -24,42 +27,51 @@ public class PileLogController extends BaseController {
@Resource
PileLogService pileLogService;
@Resource
LogUserUtils logUserUtils;
@GetMapping("/getPage")
public TableDataInfo getPilePage(
HttpServletRequest request,
@RequestParam(required = false) String stationName,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) Integer number) {
@RequestParam(required = false) String pileName,
@RequestParam(required = false) String pileSerialNumber,
@RequestParam(required = false) Integer number) {
LoginUser loginUser = logUserUtils.getLogUser(request);
startPage();
Map<String, Object> params = new HashMap<>();
params.put("stationName", stationName);
params.put("pileName", pileName);
params.put("operatorId", SecurityUtils.getUserId());
params.put("number", number);
params.put("tenantId", tenantId);
params.put("pileSerialNumber", pileSerialNumber);
params.put("tenantId", loginUser.getTenantId());
return getDataTable(pileLogService.getPilePage(params));
}
@GetMapping("/detail")
public TableDataInfo getPileDetailPage(@RequestParam("pileId") String pileId,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime) {
startPage();
return getDataTable(pileLogService.getPileRunLogPage(pileId, startTime, endTime));
}
@PostMapping("/export")
public void export(HttpServletResponse response,
@RequestParam("pileId") String pileId,
@RequestParam(required = false) String tenantId,
@RequestParam(required = false) Integer number,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String startTime,
@RequestParam(required = false) String endTime,
@RequestParam(required = false) String serialNumber) throws Exception {
@RequestParam(required = false) String serialNumber) throws Exception {
Map<String, Object> params = new HashMap<>();
params.put("operatorId", SecurityUtils.getUserId());

View File

@ -98,6 +98,12 @@
<!-- <if test="chargingStationId !=null and chargingStationId!=''">-->
<!-- and cp.charging_station_id=#{chargingStationId}-->
<!-- </if>-->
<if test="params.pileSerialNumber!=null and params.pileSerialNumber!=''">
and cp.serial_number = #{params.pileSerialNumber}
</if>
<if test="params.pileName!=null and params.pileName!=''">
and concat(cp.name,'号桩') like concat ('%', #{params.pileName},'%')
</if>
<if test="params.stationName!=null and params.stationName!=''">
and st.name like CONCAT('%',#{params.stationName},'%')
</if>

View File

@ -27,6 +27,13 @@
<if test="params.tenantId != null and params.tenantId != ''">
and co.tenant_id = #{params.tenantId}
</if>
<if test="params.startTime!=null and params.startTime!=''">
and co.start_time <![CDATA[ >= ]]> #{params.startTime}
</if>
<if test="params.endTime !=null and params.endTime!=''">
and co.create_time <![CDATA[ <= ]]> #{params.endTime}
</if>
order by co.create_time desc
</select>