refactor(server): 更新bootstrap.yml配置并优化ConnectorController接口
- 注释更新,反映Nacos地址和Spring框架ID。 - 在ConnectorController中添加新接口findApiById,优化API小卡片列表接口。 - 更新ConnectorMapper,添加findApiById方法。 - 在ConnectorMappers.xml中添加对应的SQL查询。 - 更新ConnectorService接口,添加findApiById方法。 - 在ConnectorServiceImpl中实现findApiById方法。 -调整MarketController中的接口,规范化请求映射。 feat(server): 添加Mart相关组件 - 创建MartController,MartMapper,MartService及其实现类MartServiceImpl。 - 在pom.xml中添加cloud-modules-system依赖。- 在mapper目录下添加MartUserMapper.xml文件。 - 在src/main/java/com/muyu/cloud/mart/domain/pojo下创建User.java。 BREAKING CHANGE: 在bootstrap.yml中修改Nacos地址和Spring ID注释可能导致环境特定配置发生变化。请检查这些更改并根据需要调整环境配置。master
parent
a4174d8af6
commit
f16e4f5cea
|
@ -1,6 +1,12 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="FindBugsConfigurable">
|
||||
<option name="make" value="true" />
|
||||
<option name="effort" value="default" />
|
||||
<option name="priority" value="Medium" />
|
||||
<option name="excludeFilter" value="" />
|
||||
</component>
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
|
@ -8,5 +14,10 @@
|
|||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17 (2)" project-jdk-type="JavaSDK" />
|
||||
</project>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="17 (2)" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SuppressionsComponent">
|
||||
<option name="suppComments" value="[]" />
|
||||
</component>
|
||||
</project>
|
||||
|
|
|
@ -0,0 +1,11 @@
|
|||
package com.muyu.cloud.mart.domain.pojo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/21 下午9:34
|
||||
*/
|
||||
@TableName(value = "user")
|
||||
public class User {
|
||||
}
|
|
@ -20,6 +20,14 @@
|
|||
</properties>
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
<artifactId>cloud-modules-system</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<!-- SpringCloud Alibaba Nacos -->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
|
@ -56,6 +64,10 @@
|
|||
<artifactId>cloud-common-datasource</artifactId>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- MuYu Common DataScope -->
|
||||
<dependency>
|
||||
<groupId>com.muyu</groupId>
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package com.muyu.cloud.mart.controller;
|
||||
|
||||
import cn.hutool.db.PageResult;
|
||||
import com.dtflys.forest.annotation.Post;
|
||||
import com.muyu.cloud.mart.service.ConnectorService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.domain.Connector;
|
||||
|
@ -10,7 +8,6 @@ import com.muyu.domain.req.ConnectorSortGroupBy;
|
|||
import com.muyu.domain.req.ConnectorUserReq;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -22,7 +19,7 @@ import java.util.List;
|
|||
* @Date:2024/8/26 10:22
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("connector")
|
||||
@RequestMapping("/connector")
|
||||
public class ConnectorController {
|
||||
@Autowired
|
||||
private ConnectorService connectorService;
|
||||
|
@ -32,49 +29,56 @@ public class ConnectorController {
|
|||
* @param connector
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("findConnectorList")
|
||||
@PostMapping("/findConnectorList")
|
||||
public Result findConnectorList(@RequestBody Connector connector){
|
||||
return connectorService.findConnectorList(connector);
|
||||
}
|
||||
/**
|
||||
* API小卡片列表
|
||||
*/
|
||||
@PostMapping("findApiList")
|
||||
@PostMapping("/findApiList")
|
||||
public Result findApiList(@RequestBody Connector connector){
|
||||
return connectorService.findApiList(connector);
|
||||
}
|
||||
|
||||
//TODO 根据id查询
|
||||
@GetMapping("/findApiById/{id}")
|
||||
public Result<Connector> findApiById(@PathVariable(value = "id") Long id){
|
||||
return Result.success(connectorService.findApiById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 资产列表
|
||||
*/
|
||||
@PostMapping("findConnectorUserList")
|
||||
@PostMapping("/findConnectorUserList")
|
||||
public Result<List<ConnectorUser>> findConnectorUserList(@RequestBody ConnectorUserReq connectorUserReq){
|
||||
return connectorService.findConnectorUserList(connectorUserReq);
|
||||
}
|
||||
/**
|
||||
* API页面类型分类
|
||||
*/
|
||||
@GetMapping("findConnectSort")
|
||||
@GetMapping("/findConnectSort")
|
||||
public Result<List<ConnectorSortGroupBy>> findConnectSort (){
|
||||
return connectorService.findConnectSort();
|
||||
}
|
||||
/**
|
||||
* 接口添加
|
||||
*/
|
||||
@PostMapping("addConnector")
|
||||
@PostMapping("/addConnector")
|
||||
public Result addConnector(@RequestBody Connector connector){
|
||||
return connectorService.addConnector(connector);
|
||||
}
|
||||
/**
|
||||
* 接口修改
|
||||
*/
|
||||
@PostMapping("updateConnector")
|
||||
@PostMapping("/updateConnector")
|
||||
public Result updateConnector(@RequestBody Connector connector){
|
||||
return connectorService.updateConnector(connector);
|
||||
}
|
||||
/**
|
||||
* 接口删除
|
||||
*/
|
||||
@GetMapping("getDeleteConnector")
|
||||
@GetMapping("/getDeleteConnector")
|
||||
public Result getDeleteConnector(@RequestParam(name = "connectorId") Long connectorId){
|
||||
return connectorService.getDeleteConnector(connectorId);
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Map;
|
|||
* @Date:2024/8/21 21:53
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("list")
|
||||
@RequestMapping("/list")
|
||||
public class MarketController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
|
@ -40,7 +40,7 @@ public class MarketController extends BaseController {
|
|||
* 两千万条数据查询
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("findMarketList")
|
||||
@GetMapping("/findMarketList")
|
||||
public Result<TableDataInfo<Market>> findMarketList(){
|
||||
List<Market> list = marketService.findMarketList();
|
||||
return getDataTable(list);
|
||||
|
@ -49,42 +49,42 @@ public class MarketController extends BaseController {
|
|||
/**
|
||||
* 手机号查询归属地
|
||||
*/
|
||||
@GetMapping("getPhonePlace")
|
||||
@GetMapping("/getPhonePlace")
|
||||
public Result getPhonePlace(@RequestParam(name = "tel") String tel){
|
||||
return marketService.getPhonePlace(tel);
|
||||
}
|
||||
/**
|
||||
* IP查询归属地
|
||||
*/
|
||||
@GetMapping("getIpPlace")
|
||||
@GetMapping("/getIpPlace")
|
||||
public Result getIpPlace(@RequestParam(name = "ip") String ip){
|
||||
return marketService.getIpPlace(ip);
|
||||
}
|
||||
/**
|
||||
* 新闻头条
|
||||
*/
|
||||
@GetMapping("getHeadlines")
|
||||
@GetMapping("/getHeadlines")
|
||||
public Result getHeadlines(){
|
||||
return marketService.getHeadlines();
|
||||
}
|
||||
/**
|
||||
* 气象预警
|
||||
*/
|
||||
@GetMapping("getWeather")
|
||||
@GetMapping("/getWeather")
|
||||
public Result getWeather(){
|
||||
return marketService.getWeather();
|
||||
}
|
||||
/**
|
||||
* 生辰助手
|
||||
*/
|
||||
@PostMapping("getBirthday")
|
||||
@PostMapping("/getBirthday")
|
||||
public Result getBirthday(@RequestBody Birthday birthday){
|
||||
return marketService.getBirthday(birthday);
|
||||
}
|
||||
/**
|
||||
* 邮编查询
|
||||
*/
|
||||
@PostMapping("getPostcode")
|
||||
@PostMapping("/getPostcode")
|
||||
public Result getPostcode(@RequestBody Postcode postcode){
|
||||
return marketService.getPostcode(postcode);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.muyu.cloud.mart.controller;
|
||||
|
||||
//import com.muyu.system.service.SysUserService;
|
||||
import com.alipay.api.AlipayApiException;
|
||||
import com.muyu.cloud.mart.service.MartService;
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.common.security.annotation.RequiresPermissions;
|
||||
import com.muyu.common.system.domain.PaymentParam;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/21 下午9:32
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/mart")
|
||||
public class MartController {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MartService martService;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -32,4 +32,7 @@ public interface ConnectorMapper extends BaseMapper<Connector> {
|
|||
|
||||
|
||||
List<ConnectorSortGroupBy> findConnectSort();
|
||||
|
||||
|
||||
Connector findApiById(Long id);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
package com.muyu.cloud.mart.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.muyu.cloud.mart.domain.pojo.User;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/21 下午9:32
|
||||
*/
|
||||
@Mapper
|
||||
public interface MartMapper extends BaseMapper<User> {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -32,5 +32,7 @@ public interface ConnectorService extends IService<Connector> {
|
|||
|
||||
Result<List<ConnectorSortGroupBy>> findConnectSort();
|
||||
|
||||
Connector findApiById(Long id);
|
||||
|
||||
// Result upload(MultipartFile file);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
package com.muyu.cloud.mart.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.cloud.mart.domain.pojo.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/21 下午9:34
|
||||
*/
|
||||
public interface MartService extends IService<User> {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -101,6 +101,11 @@ public class ConnectorServiceImpl extends ServiceImpl<ConnectorMapper, Connector
|
|||
return Result.success(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connector findApiById(Long id) {
|
||||
return connectorMapper.findApiById(id);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Result upload(MultipartFile file) {
|
||||
// try {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.muyu.cloud.mart.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.muyu.cloud.mart.domain.pojo.User;
|
||||
import com.muyu.cloud.mart.mapper.MartMapper;
|
||||
import com.muyu.cloud.mart.service.MartService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @Author: wangxinyuan
|
||||
* @Date: 2024/8/21 下午9:34
|
||||
*/
|
||||
@Service
|
||||
public class MartServiceImpl extends ServiceImpl<MartMapper, User>
|
||||
implements MartService {
|
||||
|
||||
|
||||
@Autowired
|
||||
private MartMapper martMapper;
|
||||
|
||||
}
|
|
@ -2,13 +2,13 @@
|
|||
server:
|
||||
port: 10005
|
||||
|
||||
# nacos线上地址
|
||||
# nacos线上地址 49.235.174.95:8848
|
||||
nacos:
|
||||
addr: 47.116.184.54:8848
|
||||
user-name: nacos
|
||||
password: nacos
|
||||
namespace: cloud-2112
|
||||
# Spring
|
||||
# Spring a72d4b95-5f82-4ada-87e0-0cc42053ea39
|
||||
spring:
|
||||
|
||||
application:
|
||||
|
|
|
@ -53,6 +53,9 @@
|
|||
<select id="findConnectSort" resultType="com.muyu.domain.req.ConnectorSortGroupBy">
|
||||
SELECT connector_sort,COUNT(connector_sort) AS count FROM connector GROUP BY connector_sort
|
||||
</select>
|
||||
<select id="findApiById" resultType="com.muyu.domain.Connector">
|
||||
select * from connector where connector_id = #{connectorId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
<?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.MartMapper">
|
||||
|
||||
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue