2
0

feat: update cdr info

This commit is contained in:
caiyuchao
2024-12-13 18:53:00 +08:00
parent 65a42dfcaf
commit 7865018df5
27 changed files with 400 additions and 103 deletions

View File

@@ -5,8 +5,15 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.domain.R;
import org.wfc.common.core.web.controller.BaseController;
import org.wfc.common.core.web.page.TableDataInfo;
import org.wfc.user.domain.bo.UCdrClientBo;
import org.wfc.user.domain.vo.UCdrClientVo;
import org.wfc.user.domain.vo.UCdrUserVo;
import org.wfc.user.service.IUCdrService;
import java.util.List;
/**
* <p>
* 用户平台_用户话单表 前端控制器
@@ -16,8 +23,8 @@ import org.wfc.user.service.IUCdrService;
* @since 2024-12-09
*/
@RestController
@RequestMapping("/user/uCdr")
public class UCdrController {
@RequestMapping("/cdr")
public class UCdrController extends BaseController {
@Autowired
private IUCdrService cdrService;
@@ -31,4 +38,27 @@ public class UCdrController {
return R.ok(true);
}
/**
* 根据用户查询话单
*
* @return 结果
*/
@GetMapping("/getByUser")
public R<UCdrUserVo> getByUser() {
UCdrUserVo result = cdrService.getByUser();
return R.ok(result);
}
/**
* 根据设备查询话单
*
* @return 结果
*/
@GetMapping("/getByClient")
public TableDataInfo getByClient(UCdrClientBo clientBo) {
startPage();
List<UCdrClientVo> result = cdrService.getByClient(clientBo);
return getDataTable(result);
}
}

View File

@@ -9,10 +9,10 @@ import org.springframework.web.bind.annotation.RestController;
* </p>
*
* @author cyc
* @since 2024-12-09
* @since 2024-12-12
*/
@RestController
@RequestMapping("/user/uCdrDetail")
public class UCdrDetailController {
@RequestMapping("/user/uCdrHistory")
public class UCdrHistoryController {
}

View File

@@ -1,7 +1,13 @@
package org.wfc.user.controller;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.wfc.common.core.domain.R;
import org.wfc.user.api.domain.bo.UClientBo;
import org.wfc.user.service.IUClientService;
/**
* <p>
@@ -15,4 +21,16 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping("/user/uClient")
public class UClientController {
@Autowired
private IUClientService clientService;
/**
* 根据设备mac保存或更新
*/
@PostMapping("/recordClientUser")
public R<Boolean> recordClientUser(@RequestBody UClientBo clientBo) {
boolean result = clientService.recordClientUser(clientBo);
return R.ok(result);
}
}

View File

@@ -2,9 +2,11 @@ package org.wfc.user.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.wfc.common.mybatis.domain.BaseData;
/**
@@ -17,6 +19,8 @@ import org.wfc.common.mybatis.domain.BaseData;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("u_cdr")
@Schema(name = "UCdr", description = "用户平台_用户话单表")

View File

@@ -2,27 +2,29 @@ package org.wfc.user.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.wfc.common.mybatis.domain.BaseData;
import java.util.Date;
/**
* <p>
* 用户平台_话单明细表
* </p>
*
* @author cyc
* @since 2024-12-09
* @since 2024-12-12
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("u_cdr_detail")
@Schema(name = "UCdrDetail", description = "用户平台_话单明细表")
public class UCdrDetail extends BaseData {
@TableName("u_cdr_history")
@Schema(name = "UCdrHistory", description = "用户平台_话单明细表")
public class UCdrHistory extends BaseData {
private static final long serialVersionUID = 1L;
@@ -36,10 +38,10 @@ public class UCdrDetail extends BaseData {
private Long trafficUp;
@Schema(description = "Start time")
private Date startTime;
private Long startTime;
@Schema(description = "End time")
private Date endTime;
private Long endTime;
@Schema(description = "Duration(s)")
private Long duration;

View File

@@ -2,9 +2,11 @@ package org.wfc.user.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.wfc.common.mybatis.domain.BaseData;
/**
@@ -17,6 +19,8 @@ import org.wfc.common.mybatis.domain.BaseData;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("u_client")
@Schema(name = "UClient", description = "用户平台_用户设备表")

View File

@@ -2,9 +2,11 @@ package org.wfc.user.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.wfc.common.mybatis.domain.BaseData;
/**
@@ -17,6 +19,8 @@ import org.wfc.common.mybatis.domain.BaseData;
*/
@Data
@EqualsAndHashCode(callSuper = true)
@NoArgsConstructor
@AllArgsConstructor
@Builder
@TableName("u_device")
@Schema(name = "UDevice", description = "用户平台_AP设备表")
@@ -24,9 +28,6 @@ public class UDevice extends BaseData {
private static final long serialVersionUID = 1L;
@Schema(description = "User ID link to u_user")
private Long userId;
@Schema(description = "Device Name")
private String deviceName;

View File

@@ -0,0 +1,14 @@
package org.wfc.user.domain.bo;
import lombok.Data;
/**
* @description: 话单设备bo
* @author: cyc
* @since: 2024-12-13
*/
@Data
public class UCdrClientBo {
private String clientName;
private String clientMac;
}

View File

@@ -0,0 +1,22 @@
package org.wfc.user.domain.vo;
import lombok.Data;
/**
* @description: 话单设备vo
* @author: cyc
* @since: 2024-12-13
*/
@Data
public class UCdrClientVo {
private Long id;
private String clientName;
private String clientMac;
private String clientDeviceType;
private Long userId;
private Long startTime;
private Long endTime;
private Long duration;
private Long trafficDown;
private Long trafficUp;
}

View File

@@ -0,0 +1,18 @@
package org.wfc.user.domain.vo;
import lombok.Data;
/**
* @description: 话单用户vo
* @author: cyc
* @since: 2024-12-13
*/
@Data
public class UCdrUserVo {
private Long id;
private Long startTime;
private Long endTime;
private Long duration;
private Long trafficDown;
private Long trafficUp;
}

View File

@@ -1,7 +1,7 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.UCdrDetail;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.wfc.user.domain.UCdrHistory;
/**
* <p>
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* </p>
*
* @author cyc
* @since 2024-12-09
* @since 2024-12-12
*/
public interface UCdrDetailMapper extends BaseMapper<UCdrDetail> {
public interface UCdrHistoryMapper extends BaseMapper<UCdrHistory> {
}

View File

@@ -1,7 +1,13 @@
package org.wfc.user.mapper;
import org.wfc.user.domain.UCdr;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.wfc.user.domain.UCdr;
import org.wfc.user.domain.bo.UCdrClientBo;
import org.wfc.user.domain.vo.UCdrClientVo;
import org.wfc.user.domain.vo.UCdrUserVo;
import java.util.List;
/**
* <p>
@@ -13,4 +19,8 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
*/
public interface UCdrMapper extends BaseMapper<UCdr> {
List<UCdrUserVo> getByUser(@Param("userId") Long userId);
List<UCdrClientVo> getByClient(@Param("client") UCdrClientBo client);
}

View File

@@ -1,7 +1,7 @@
package org.wfc.user.service;
import org.wfc.user.domain.UCdrDetail;
import com.baomidou.mybatisplus.extension.service.IService;
import org.wfc.user.domain.UCdrHistory;
/**
* <p>
@@ -9,8 +9,8 @@ import com.baomidou.mybatisplus.extension.service.IService;
* </p>
*
* @author cyc
* @since 2024-12-09
* @since 2024-12-12
*/
public interface IUCdrDetailService extends IService<UCdrDetail> {
public interface IUCdrHistoryService extends IService<UCdrHistory> {
}

View File

@@ -1,7 +1,12 @@
package org.wfc.user.service;
import org.wfc.user.domain.UCdr;
import com.baomidou.mybatisplus.extension.service.IService;
import org.wfc.user.domain.UCdr;
import org.wfc.user.domain.bo.UCdrClientBo;
import org.wfc.user.domain.vo.UCdrClientVo;
import org.wfc.user.domain.vo.UCdrUserVo;
import java.util.List;
/**
* <p>
@@ -13,6 +18,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IUCdrService extends IService<UCdr> {
UCdrUserVo getByUser();
List<UCdrClientVo> getByClient(UCdrClientBo client);
void addCdrInfoByOmadaApi();
}

View File

@@ -1,7 +1,8 @@
package org.wfc.user.service;
import org.wfc.user.domain.UClient;
import com.baomidou.mybatisplus.extension.service.IService;
import org.wfc.user.api.domain.bo.UClientBo;
import org.wfc.user.domain.UClient;
/**
* <p>
@@ -13,4 +14,6 @@ import com.baomidou.mybatisplus.extension.service.IService;
*/
public interface IUClientService extends IService<UClient> {
boolean recordClientUser(UClientBo uClientBo);
}

View File

@@ -1,20 +0,0 @@
package org.wfc.user.service.impl;
import org.wfc.user.domain.UCdrDetail;
import org.wfc.user.mapper.UCdrDetailMapper;
import org.wfc.user.service.IUCdrDetailService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
* 用户平台_话单明细表 服务实现类
* </p>
*
* @author cyc
* @since 2024-12-09
*/
@Service
public class UCdrDetailServiceImpl extends ServiceImpl<UCdrDetailMapper, UCdrDetail> implements IUCdrDetailService {
}

View File

@@ -0,0 +1,20 @@
package org.wfc.user.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.wfc.user.domain.UCdrHistory;
import org.wfc.user.mapper.UCdrHistoryMapper;
import org.wfc.user.service.IUCdrHistoryService;
/**
* <p>
* 用户平台_话单明细表 服务实现类
* </p>
*
* @author cyc
* @since 2024-12-12
*/
@Service
public class UCdrHistoryServiceImpl extends ServiceImpl<UCdrHistoryMapper, UCdrHistory> implements IUCdrHistoryService {
}

View File

@@ -6,6 +6,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.wfc.common.core.domain.LoginUser;
import org.wfc.common.security.utils.SecurityUtils;
import org.wfc.omada.api.client.OmadaClientApi;
import org.wfc.omada.api.client.OmadaClientInsightApi;
import org.wfc.omada.api.client.model.ClientHistoryInfo;
@@ -19,16 +21,18 @@ import org.wfc.omada.api.organization.OmadaSiteApi;
import org.wfc.omada.api.organization.model.OperationResponseGridVoSiteSummaryInfo;
import org.wfc.omada.api.organization.model.SiteSummaryInfo;
import org.wfc.user.domain.UCdr;
import org.wfc.user.domain.UCdrDetail;
import org.wfc.user.domain.UCdrHistory;
import org.wfc.user.domain.UClient;
import org.wfc.user.domain.UDevice;
import org.wfc.user.domain.bo.UCdrClientBo;
import org.wfc.user.domain.vo.UCdrClientVo;
import org.wfc.user.domain.vo.UCdrUserVo;
import org.wfc.user.mapper.UCdrMapper;
import org.wfc.user.service.IUCdrDetailService;
import org.wfc.user.service.IUCdrHistoryService;
import org.wfc.user.service.IUCdrService;
import org.wfc.user.service.IUClientService;
import org.wfc.user.service.IUDeviceService;
import java.util.Date;
import java.util.List;
/**
@@ -61,7 +65,19 @@ public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IU
private IUClientService clientService;
@Autowired
private IUCdrDetailService cdrDetailService;
private IUCdrHistoryService cdrHistoryService;
@Override
public UCdrUserVo getByUser() {
LoginUser<Object> loginUser = SecurityUtils.getLoginUser();
List<UCdrUserVo> cdrUsers = this.baseMapper.getByUser(loginUser.getUserid());
return cdrUsers.stream().findFirst().orElse(null);
}
@Override
public List<UCdrClientVo> getByClient(UCdrClientBo client) {
return this.baseMapper.getByClient(client);
}
@Override
public void addCdrInfoByOmadaApi() {
@@ -80,78 +96,82 @@ public class UCdrServiceImpl extends ServiceImpl<UCdrMapper, UCdr> implements IU
List<ClientInfo> clients = clientResp.getBody().getResult().getData();
for (ClientInfo client : clients) {
// 添加用户设备
Long clientId = addClient(client);
UClient hasClient = addClient(client);
// 添加话单
Long cdrId = addCdr(client, clientId);
// 添加话单明细
addCdrDetail(site, client, cdrId);
Long cdrId = addCdr(client, hasClient);
// 添加话单历史
addCdrHistory(site, client, cdrId);
}
}
}
private void addCdrDetail(SiteSummaryInfo site, ClientInfo client, Long cdrId) {
// 话单明细
private void addCdrHistory(SiteSummaryInfo site, ClientInfo client, Long cdrId) {
// 话单历史
ResponseEntity<OperationResponseGridVoClientHistoryInfo> pastConnResp = omadaClientInsightApi.getGridPastConnections(site.getSiteId(), 1, 1000, client.getMac());
if (ObjectUtil.isNull(pastConnResp.getBody())) {
return;
}
List<ClientHistoryInfo> pastConns = pastConnResp.getBody().getResult().getData();
for (ClientHistoryInfo pastConn : pastConns) {
UCdrDetail uCdrDetail = cdrDetailService.getOne(Wrappers.<UCdrDetail>lambdaQuery().eq(UCdrDetail::getCdrId, cdrId).eq(UCdrDetail::getStartTime, pastConn.getFirstSeen()), false);
if (ObjectUtil.isNotNull(uCdrDetail)) {
UCdrHistory hasCdrHistory = cdrHistoryService.getOne(Wrappers.<UCdrHistory>lambdaQuery().eq(UCdrHistory::getCdrId, cdrId).eq(UCdrHistory::getStartTime, pastConn.getFirstSeen()), false);
if (ObjectUtil.isNotNull(hasCdrHistory)) {
continue;
}
UCdrDetail uCdrDetail1 = UCdrDetail.builder().cdrId(cdrId).startTime(new Date(pastConn.getFirstSeen()))
.endTime(new Date(pastConn.getLastSeen()))
UCdrHistory uCdrHistory = UCdrHistory.builder().cdrId(cdrId).startTime(pastConn.getFirstSeen())
.endTime(pastConn.getLastSeen())
.trafficUp(pastConn.getUpload())
.trafficDown(pastConn.getDownload())
.duration(pastConn.getDuration())
.build();
cdrDetailService.save(uCdrDetail1);
cdrHistoryService.save(uCdrHistory);
}
}
private Long addCdr(ClientInfo client, Long clientId) {
private Long addCdr(ClientInfo client, UClient hasClient) {
// 话单
UCdr hasUCdr = this.getOne(Wrappers.<UCdr>lambdaQuery().eq(UCdr::getClientId, clientId), false);
Long cdrId;
if (ObjectUtil.isNull(hasUCdr)) {
UDevice hasDevice = deviceService.getOne(Wrappers.<UDevice>lambdaQuery().eq(UDevice::getDeviceMac, client.getApMac()), false);
UCdr uCdr = UCdr.builder().clientId(clientId)
.deviceId(hasDevice.getId())
.ssid(client.getSsid())
.rxRate(client.getRxRate())
.txRate(client.getTxRate())
.lastSeenTime(client.getLastSeen())
.upTime(client.getUptime())
.upPacket(client.getUpPacket())
.downPacket(client.getDownPacket())
.trafficDown(client.getTrafficDown())
.trafficUp(client.getTrafficUp())
.build();
this.save(uCdr);
cdrId = uCdr.getId();
} else {
UCdr hasUCdr = this.getOne(Wrappers.<UCdr>lambdaQuery()
.eq(ObjectUtil.isNotNull(hasClient.getUserId()), UCdr::getUserId, hasClient.getUserId())
.eq(UCdr::getClientId, hasClient.getId()), false);
Long cdrId = null;
if (ObjectUtil.isNotNull(hasUCdr)) {
cdrId = hasUCdr.getId();
}
return cdrId;
UDevice hasDevice = deviceService.getOne(Wrappers.<UDevice>lambdaQuery().eq(UDevice::getDeviceMac, client.getApMac()), false);
UCdr uCdr = UCdr.builder().clientId(hasClient.getId())
.userId(hasClient.getUserId())
.deviceId(hasDevice.getId())
.ssid(client.getSsid())
.rxRate(client.getRxRate())
.txRate(client.getTxRate())
.lastSeenTime(client.getLastSeen())
.upTime(client.getUptime())
.upPacket(client.getUpPacket())
.downPacket(client.getDownPacket())
.trafficDown(client.getTrafficDown())
.trafficUp(client.getTrafficUp())
.build();
uCdr.setId(cdrId);
this.saveOrUpdate(uCdr);
return uCdr.getId();
}
private Long addClient(ClientInfo client) {
private UClient addClient(ClientInfo client) {
// 用户设备
UClient hasClient = clientService.getOne(Wrappers.<UClient>lambdaQuery().eq(UClient::getClientMac, client.getMac()), false);
Long clientId;
if (ObjectUtil.isNull(hasClient)) {
UClient uClient = UClient.builder().clientMac(client.getMac())
.clientName(client.getName())
.clientDeviceType(client.getDeviceType())
.build();
clientService.save(uClient);
clientId = uClient.getId();
} else {
Long clientId = null;
Long userId = null;
if (ObjectUtil.isNotNull(hasClient)) {
clientId = hasClient.getId();
userId = hasClient.getUserId();
}
return clientId;
UClient uClient = UClient.builder().clientMac(client.getMac())
.userId(userId)
.clientName(client.getName())
.clientDeviceType(client.getDeviceType())
.build();
uClient.setId(clientId);
clientService.saveOrUpdate(uClient);
return uClient;
}
private void addDevices(List<SiteSummaryInfo> sites) {

View File

@@ -1,10 +1,14 @@
package org.wfc.user.service.impl;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.wfc.user.api.domain.bo.UClientBo;
import org.wfc.user.domain.UClient;
import org.wfc.user.mapper.UClientMapper;
import org.wfc.user.service.IUClientService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
/**
* <p>
@@ -17,4 +21,18 @@ import org.springframework.stereotype.Service;
@Service
public class UClientServiceImpl extends ServiceImpl<UClientMapper, UClient> implements IUClientService {
@Override
public boolean recordClientUser(UClientBo uClientBo) {
if (StrUtil.isBlank(uClientBo.getClientMac())) {
return false;
}
UClient hasUClient = this.getOne(Wrappers.<UClient>lambdaQuery()
.eq(UClient::getClientMac, uClientBo.getClientMac()), false);
UClient uClient = new UClient();
BeanUtils.copyProperties(uClientBo, uClient);
if (hasUClient != null) {
uClient.setId(hasUClient.getId());
}
return this.saveOrUpdate(uClient);
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UCdrDetailMapper">
<mapper namespace="org.wfc.user.mapper.UCdrHistoryMapper">
</mapper>

View File

@@ -2,4 +2,74 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.wfc.user.mapper.UCdrMapper">
<select id="getByUser" resultType="org.wfc.user.domain.vo.UCdrUserVo">
SELECT
cdr.user_id id,
min( ch.start_time ) start_time,
max( cdr.last_seen_time ) end_time,
sum(
ifnull( cdr.up_time, 0 ))+ sum(
ifnull( ch.duration, 0 )) duration,
sum(
ifnull( cdr.traffic_down, 0 )) + sum(
ifnull( ch.traffic_down, 0 )) traffic_down,
sum(
ifnull( cdr.traffic_up, 0 )) + sum(
ifnull( ch.traffic_up, 0 )) traffic_up
FROM
u_cdr cdr
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
AND ch.del_flag = 0
WHERE
cdr.del_flag = 0
AND cdr.last_seen_time != ifnull( ch.end_time, 0 )
<if test="userId != null and userId != ''">
AND cdr.user_id = #{userId}
</if>
GROUP BY
cdr.user_id
</select>
<select id="getByClient" resultType="org.wfc.user.domain.vo.UCdrClientVo">
SELECT
c.id,
c.client_mac,
c.client_name,
c.client_device_type,
h.*
FROM
u_client c
LEFT JOIN (
SELECT
cdr.client_id,
min( ch.start_time ) start_time,
max( cdr.last_seen_time ) end_time,
sum(
ifnull( cdr.up_time, 0 ))+ sum(
ifnull( ch.duration, 0 )) duration,
sum(
ifnull( cdr.traffic_down, 0 )) + sum(
ifnull( ch.traffic_down, 0 )) traffic_down,
sum(
ifnull( cdr.traffic_up, 0 )) + sum(
ifnull( ch.traffic_up, 0 )) traffic_up
FROM
u_cdr cdr
LEFT JOIN u_cdr_history ch ON cdr.id = ch.cdr_id
AND ch.del_flag = 0
WHERE
cdr.del_flag = 0
AND cdr.last_seen_time != ifnull( ch.end_time, 0 )
GROUP BY
cdr.client_id
) h ON c.id = h.client_id
WHERE
c.del_flag = 0
<if test="client.clientName != null and client.clientName != ''">
AND c.client_name like concat('%', #{client.clientName}, '%')
</if>
<if test="client.clientMac != null and client.clientMac != ''">
AND c.client_mac = like concat('%', #{client.clientMac}, '%')
</if>
</select>
</mapper>

View File

@@ -18,6 +18,6 @@ public class UClientTest {
@Test
public void test() {
cdrService.addCdrInfoByOmadaApi();
}
}