列表查询

pull/1/head
chaiyapeng 2024-08-22 11:25:39 +08:00
parent a0d4a53459
commit 1a778306d8
16 changed files with 255 additions and 208 deletions

View File

@ -0,0 +1,52 @@
package com.muyu.domain;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.checkerframework.checker.units.qual.N;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.domain
* @Projectcloud-mart
* @nameMarket
* @Date2024/8/21 21:00
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Market {
private String name;
private String cardno;
private String descriot;
private String ctfTp;
private String ctfId;
private String gender;
private String birthday;
private String address;
private String zip;
private String dirty;
private String district1;
private String district2;
private String district3;
private String district4;
private String district5;
private String district6;
private String firstnm;
private String lastnm;
private String duty;
private String mobile;
private String tel;
private String fax;
private String email;
private String nation;
private String taste;
private String education;
private String company;
private String ctel;
private String caddress;
private String czip;
private String family;
private String version;
private String id;
}

View File

@ -1,19 +0,0 @@
package com.muyu.cloud.etl.service;
import com.muyu.domain.AssetImpower;
import javax.xml.transform.Result;
import java.util.List;
/**
* @Authorqdm
* @Packagecom.muyu.service
* @Projectcloud-etl
* @nameEtlService
* @Date2024/8/20 20:46
*/
public interface EtlService {
List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower);
Result deleteAssetImpowerByIds(Long[] ids);
}

View File

@ -1,16 +0,0 @@
package com.muyu.cloud.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.Source;
import com.muyu.domain.req.SourceReq;
import java.util.List;
public interface SourceService extends IService<Source> {
List<Source> selectSourceList(SourceReq sourceReq);
Source getInfo(Long id);
int insertBasicConfigInfo(Source sourceReq);
}

View File

@ -1,11 +0,0 @@
package com.muyu.cloud.etl.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.SourceType;
import java.util.List;
public interface SourceTypeService extends IService<SourceType> {
List<SourceType> findSourceType();
}

View File

@ -1,37 +0,0 @@
package com.muyu.cloud.etl.service.impl;
import com.muyu.domain.AssetImpower;
import com.muyu.cloud.etl.mapper.EtlMapper;
import com.muyu.cloud.etl.service.EtlService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.xml.transform.Result;
import java.util.List;
/**
* @Authorqdm
* @Packagecom.muyu.service.serviceImpl
* @Projectcloud-etl
* @nameEtlService
* @Date2024/8/20 20:46
*/
@Service
public class EtlServiceImpl implements EtlService {
@Autowired
private EtlMapper etlMapper;
@Override
public List<AssetImpower> selectAssetImpowerList(AssetImpower assetImpower) {
List<AssetImpower> assetImpowers = etlMapper.list(assetImpower);
return assetImpowers;
}
@Override
public Result deleteAssetImpowerByIds(Long[] ids) {
return etlMapper.deleteAssetImpowerByIds(ids);
}
}

View File

@ -1,37 +0,0 @@
package com.muyu.cloud.etl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.cloud.etl.service.SourceService;
import com.muyu.domain.Source;
import com.muyu.domain.req.SourceReq;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SourceServiceImpl extends ServiceImpl<SourceMapper, Source> implements SourceService {
@Autowired
private SourceMapper sourceMapper;
@Override
public List<Source> selectSourceList(SourceReq sourceReq) {
return sourceMapper.selectSourceList(sourceReq);
}
@Override
public Source getInfo(Long id) {
LambdaQueryWrapper<Source> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(Source::getId, id);
return this.sourceMapper.selectOne(lambdaQueryWrapper);
}
//新增
@Override
public int insertBasicConfigInfo(Source sourceReq) {
int insert = sourceMapper.insert(sourceReq);
return insert;
}
}

View File

@ -1,19 +0,0 @@
package com.muyu.cloud.etl.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.cloud.etl.service.SourceTypeService;
import com.muyu.domain.SourceType;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SourceTypeServiceImpl extends ServiceImpl<SourceTypeMapper, SourceType> implements SourceTypeService {
@Override
public List<SourceType> findSourceType() {
LambdaQueryWrapper<SourceType> sourceTypeLambdaQueryWrapper = new LambdaQueryWrapper<>();
return this.list(sourceTypeLambdaQueryWrapper);
}
}

View File

@ -0,0 +1,22 @@
package com.muyu.cloud.mart;
import com.muyu.common.security.annotation.EnableCustomConfig;
import com.muyu.common.security.annotation.EnableMyFeignClients;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.cloud.mart
* @Projectcloud-mart
* @nameMarketApplication
* @Date2024/8/21 22:14
*/
@EnableCustomConfig
@EnableMyFeignClients
@SpringBootApplication
public class MarketApplication {
public static void main(String[] args) {
SpringApplication.run(MarketApplication.class,args);
}
}

View File

@ -0,0 +1,102 @@
package com.muyu.cloud.mart.controller;
import com.alibaba.fastjson.JSON;
import com.muyu.cloud.mart.service.MarketService;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.controller.BaseController;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.common.security.annotation.RequiresPermissions;
import com.muyu.domain.Market;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.io.InputStream;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
import java.util.List;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.cloud.etl.controller
* @Projectcloud-mart
* @nameMarketController
* @Date2024/8/21 21:53
*/
@RestController
@RequestMapping("list")
public class MarketController extends BaseController {
@Autowired
private MarketService marketService;
@Autowired
private RedisTemplate<String,String>redisTemplate;
// @RequiresPermissions("mart:info:list")
@GetMapping("findMarketList")
public Result<TableDataInfo<Market>> findMarketList(Market market){
if (redisTemplate.hasKey("list")){
List<String> list = redisTemplate.opsForList().range("list", 0, -1);
ArrayList<Market> markets = new ArrayList<>();
for (String s : list) {
markets.add(JSON.parseObject(s, Market.class));
}
redisTemplate.delete("list");
return getDataTable(markets);
}
startPage();
List<Market> list = marketService.findMarketList(market);
for (Market market1 : list) {
redisTemplate.opsForList().rightPush("list", JSON.toJSONString(market1));
}
return getDataTable(list);
}
@GetMapping("selectMobileAddress")
//查询手机号码所属地区
public static String getMobileAddress(String mobile) throws Exception
{
String address = "";
try
{
mobile = mobile.trim();
if (mobile.matches("^(13|15|18)\\d{9}$") || mobile.matches("^(013|015|018)\\d{9}$")) //以131518开头后面九位全为数字
{
String url = "http://172.13.1.1:8080/datamart?action=mobile&mobile=" + mobile;
URLConnection connection = (URLConnection) new URL(url).openConnection();
connection.setDoOutput(true);
InputStream os = connection.getInputStream();
Thread.sleep(100);
int length = os.available();
byte[] buff = new byte[length];
os.read(buff);
String s = new String(buff, "gbk");
int len = s.indexOf("卡号归属地");
s = s.substring(len, len+100);
len = s.lastIndexOf("</TD>");
address = s.substring(0, len);
len = address.lastIndexOf(">");
address = address.substring(len+1, address.length());
address = address.replace(" ", ",");
address = address.replace("d> -->", "");
address = address.replace(" -->", "");
address = address.replace("-->", "");
s = null;
buff = null;
os.close();
connection = null;
}
}
catch(Exception e)
{
address = "未知";
System.out.println("手机所属地查询失败====================");
}
return address;
}
}

View File

@ -0,0 +1,19 @@
package com.muyu.cloud.mart.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.muyu.domain.Market;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.cloud.etl.mapper
* @Projectcloud-mart
* @nameMarketMapper
* @Date2024/8/21 21:54
*/
@Mapper
public interface MarketMapper extends BaseMapper<Market> {
List<Market> mybatisplus(Market market);
}

View File

@ -0,0 +1,17 @@
package com.muyu.cloud.mart.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.muyu.domain.Market;
import java.util.List;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.cloud.etl.service
* @Projectcloud-mart
* @nameMarketService
* @Date2024/8/21 21:54
*/
public interface MarketService extends IService<Market> {
List<Market> findMarketList(Market market);
}

View File

@ -0,0 +1,29 @@
package com.muyu.cloud.mart.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.muyu.cloud.mart.mapper.MarketMapper;
import com.muyu.cloud.mart.service.MarketService;
import com.muyu.domain.Market;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Authorchaiyapeng
* @Packagecom.muyu.cloud.etl.service.impl
* @Projectcloud-mart
* @nameMarketServiceImpl
* @Date2024/8/21 21:54
*/
@Service
public class MarketServiceImpl extends ServiceImpl<MarketMapper, Market> implements MarketService {
@Autowired
private MarketMapper marketMapper;
@Override
public List<Market> findMarketList(Market market) {
return marketMapper.mybatisplus(market);
}
}

View File

@ -7,7 +7,7 @@ nacos:
addr: 47.116.184.54:8848
user-name: nacos
password: nacos
namespace: text
namespace: cloud-2112
# Spring
spring:
@ -58,4 +58,5 @@ mybatis-plus:
id-type: auto # 主键生成策略,这里设置为自动增长
logic-delete-value: 1 # 逻辑删除标记值,例如设置为 1 表示已删除
logic-not-delete-value: 0 # 逻辑未删除标记值,例如设置为 0 表示未删除
banner: false # 关闭控制台打印的 MyBatis-Plus Banner
banner: false # 关闭控制台打印的 MyBatis-Plus Banne

View File

@ -1,20 +0,0 @@
<?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="com.muyu.cloud.etl.mapper.EtlMapper">
<sql id="selectAssetDataDictVo">
select id, basic_id, dict_name, dict_type, remark, create_by, create_time, update_by, update_time from asset_data_dict
</sql>
<sql id="list">
select id, basic_id, dict_name, dict_type, remark, create_by, create_time, update_by, update_time from asset_data_dict
</sql>
<delete id="deleteAssetImpowerByIds">
<include refid="selectAssetDataDictVo"/>
where id = #{id}
</delete>
<select id="list" resultType="com.muyu.domain.AssetImpower">
<include refid="list"/>
where id = #{id}
</select>
</mapper>

View File

@ -0,0 +1,11 @@
<?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="com.muyu.cloud.mart.mapper.MarketMapper">
<select id="mybatisplus" resultType="com.muyu.domain.Market">
select name,ctfId,birthday,address from market
</select>
</mapper>

View File

@ -1,47 +0,0 @@
<?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="com.muyu.cloud.etl.mapper.SourceMapper">
<resultMap type="com.muyu.domain.Source" id="SourceMapper">
<result property="id" column="id" />
<result property="dataResourceName" column="data_resource_name" />
<result property="dataSourcesSystemName" column="data_sources_system_name" />
<result property="host" column="host" />
<result property="port" column="port" />
<result property="databaseType" column="database_type" />
<result property="databaseName" column="database_name" />
<result property="initLinkNum" column="init_link_num" />
<result property="maxLinkNum" column="max_link_num" />
<result property="maxWaitTime" column="max_wait_time" />
<result property="maxWaitTimes" column="max_wait_times" />
<result property="connectionParams" column="connection_params" />
<result property="remark" column="remark" />
</resultMap>
<sql id="selectSourceList">
select id, data_resource_name,username,password, data_sources_system_name, host, port, database_type, database_name, init_link_num, max_link_num, max_wait_time, max_wait_times,connection_params, remark from source
</sql>
<!-- <select id="selectSourceList" resultType="com.muyu.domain.Source">-->
<!-- -->
<!-- </select>-->
<select id="selectSourceList" parameterType="com.muyu.domain.Source" resultMap="SourceMapper">
<include refid="selectSourceList"/>
<where>
<if test="dataResourceName != null and dataResourceName != ''"> and data_resource_name like concat('%', #{dataResourceName}, '%')</if>
<if test="dataSourcesSystemName != null and dataSourcesSystemName != ''"> and data_sources_system_name like concat('%', #{dataSourcesSystemName}, '%')</if>
<if test="host != null and host != ''"> and host = #{host}</if>
<if test="port != null and port != ''"> and port = #{port}</if>
<if test="databaseType != null and databaseType != ''"> and database_type = #{databaseType}</if>
<if test="databaseName != null and databaseName != ''"> and database_name like concat('%', #{databaseName}, '%')</if>
<if test="username != null "> and username = #{username}</if>
<if test="password != null "> and password = #{password}</if>
<if test="initLinkNum != null "> and init_link_num = #{initLinkNum}</if>
<if test="maxLinkNum != null "> and max_link_num = #{maxLinkNum}</if>
<if test="maxWaitTime != null "> and max_wait_time = #{maxWaitTime}</if>
<if test="maxWaitTimes != null "> and max_wait_times = #{maxWaitTimes}</if>
</where>
</select>
</mapper>