parent
48f03f1bbe
commit
390e17e137
@ -0,0 +1,227 @@
|
||||
package com.mashibing.test.entity;
|
||||
|
||||
|
||||
public class Channel {
|
||||
|
||||
private long id;
|
||||
private String channelName;
|
||||
private long channelType;
|
||||
private String channelArea;
|
||||
private String channelAreaCode;
|
||||
private long channelPrice;
|
||||
private long channelProtocal;
|
||||
private String channelIp;
|
||||
private long channelPort;
|
||||
private String channelUsername;
|
||||
private String channelPassword;
|
||||
private String channelNumber;
|
||||
private long isAvailable;
|
||||
private java.sql.Timestamp created;
|
||||
private long createId;
|
||||
private java.sql.Timestamp updated;
|
||||
private long updateId;
|
||||
private long isDelete;
|
||||
private String extend1;
|
||||
private String extend2;
|
||||
private String extend3;
|
||||
private String extend4;
|
||||
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelName() {
|
||||
return channelName;
|
||||
}
|
||||
|
||||
public void setChannelName(String channelName) {
|
||||
this.channelName = channelName;
|
||||
}
|
||||
|
||||
|
||||
public long getChannelType() {
|
||||
return channelType;
|
||||
}
|
||||
|
||||
public void setChannelType(long channelType) {
|
||||
this.channelType = channelType;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelArea() {
|
||||
return channelArea;
|
||||
}
|
||||
|
||||
public void setChannelArea(String channelArea) {
|
||||
this.channelArea = channelArea;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelAreaCode() {
|
||||
return channelAreaCode;
|
||||
}
|
||||
|
||||
public void setChannelAreaCode(String channelAreaCode) {
|
||||
this.channelAreaCode = channelAreaCode;
|
||||
}
|
||||
|
||||
|
||||
public long getChannelPrice() {
|
||||
return channelPrice;
|
||||
}
|
||||
|
||||
public void setChannelPrice(long channelPrice) {
|
||||
this.channelPrice = channelPrice;
|
||||
}
|
||||
|
||||
|
||||
public long getChannelProtocal() {
|
||||
return channelProtocal;
|
||||
}
|
||||
|
||||
public void setChannelProtocal(long channelProtocal) {
|
||||
this.channelProtocal = channelProtocal;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelIp() {
|
||||
return channelIp;
|
||||
}
|
||||
|
||||
public void setChannelIp(String channelIp) {
|
||||
this.channelIp = channelIp;
|
||||
}
|
||||
|
||||
|
||||
public long getChannelPort() {
|
||||
return channelPort;
|
||||
}
|
||||
|
||||
public void setChannelPort(long channelPort) {
|
||||
this.channelPort = channelPort;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelUsername() {
|
||||
return channelUsername;
|
||||
}
|
||||
|
||||
public void setChannelUsername(String channelUsername) {
|
||||
this.channelUsername = channelUsername;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelPassword() {
|
||||
return channelPassword;
|
||||
}
|
||||
|
||||
public void setChannelPassword(String channelPassword) {
|
||||
this.channelPassword = channelPassword;
|
||||
}
|
||||
|
||||
|
||||
public String getChannelNumber() {
|
||||
return channelNumber;
|
||||
}
|
||||
|
||||
public void setChannelNumber(String channelNumber) {
|
||||
this.channelNumber = channelNumber;
|
||||
}
|
||||
|
||||
|
||||
public long getIsAvailable() {
|
||||
return isAvailable;
|
||||
}
|
||||
|
||||
public void setIsAvailable(long isAvailable) {
|
||||
this.isAvailable = isAvailable;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getCreated() {
|
||||
return created;
|
||||
}
|
||||
|
||||
public void setCreated(java.sql.Timestamp created) {
|
||||
this.created = created;
|
||||
}
|
||||
|
||||
|
||||
public long getCreateId() {
|
||||
return createId;
|
||||
}
|
||||
|
||||
public void setCreateId(long createId) {
|
||||
this.createId = createId;
|
||||
}
|
||||
|
||||
|
||||
public java.sql.Timestamp getUpdated() {
|
||||
return updated;
|
||||
}
|
||||
|
||||
public void setUpdated(java.sql.Timestamp updated) {
|
||||
this.updated = updated;
|
||||
}
|
||||
|
||||
|
||||
public long getUpdateId() {
|
||||
return updateId;
|
||||
}
|
||||
|
||||
public void setUpdateId(long updateId) {
|
||||
this.updateId = updateId;
|
||||
}
|
||||
|
||||
|
||||
public long getIsDelete() {
|
||||
return isDelete;
|
||||
}
|
||||
|
||||
public void setIsDelete(long isDelete) {
|
||||
this.isDelete = isDelete;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend1() {
|
||||
return extend1;
|
||||
}
|
||||
|
||||
public void setExtend1(String extend1) {
|
||||
this.extend1 = extend1;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend2() {
|
||||
return extend2;
|
||||
}
|
||||
|
||||
public void setExtend2(String extend2) {
|
||||
this.extend2 = extend2;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend3() {
|
||||
return extend3;
|
||||
}
|
||||
|
||||
public void setExtend3(String extend3) {
|
||||
this.extend3 = extend3;
|
||||
}
|
||||
|
||||
|
||||
public String getExtend4() {
|
||||
return extend4;
|
||||
}
|
||||
|
||||
public void setExtend4(String extend4) {
|
||||
this.extend4 = extend4;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import com.mashibing.test.entity.ClientBalance;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author heqijun
|
||||
* @ClassName: ChannelMapper
|
||||
* @Description: TODO(这里用一句话描述这个类的作用)
|
||||
* @date 2025/6/11 18:11
|
||||
*/
|
||||
|
||||
public interface ChannelMapper {
|
||||
|
||||
@Select("select * from channel where is_delete = 0")
|
||||
List<Channel> findAll();
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package com.mashibing.test.mapper;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.mashibing.test.entity.Channel;
|
||||
import com.mashibing.test.feignClient.CacheClient;
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.*;
|
||||
|
||||
@SpringBootTest
|
||||
@RunWith(SpringRunner.class)
|
||||
class ChannelMapperTest {
|
||||
|
||||
@Autowired
|
||||
CacheClient cacheClient;
|
||||
|
||||
@Autowired
|
||||
ChannelMapper mapper;
|
||||
|
||||
@Test
|
||||
void findAll() throws JsonProcessingException {
|
||||
List<Channel> channelList = mapper.findAll();
|
||||
ObjectMapper objectMapper = new ObjectMapper
|
||||
for (Channel channel : channelList) {
|
||||
Map map = objectMapper.readValue(objectMapper.writeValueAsString(channel), Map.class);
|
||||
cacheClient.hset("channel:" + channel.getId(), map);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue