feat(修复): 项目环境搭建,获取用户地址列表
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
579365293c
commit
b47bfeafb6
|
@ -0,0 +1,26 @@
|
|||
package com.atguigu.order.controller;
|
||||
|
||||
import com.atguigu.order.service.OrderInfoService;
|
||||
import com.atguigu.spzx.model.vo.h5.TradeVo;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Tag(name = "订单管理")
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/order/orderInfo")
|
||||
public class OrderInfoController {
|
||||
@Autowired
|
||||
private OrderInfoService orderInfoService;
|
||||
|
||||
@Operation(summary = "确认下单")
|
||||
@GetMapping("auth/trade")
|
||||
public Result<TradeVo> trade() {
|
||||
TradeVo tradeVo = orderInfoService.getTrade();
|
||||
return Result.success(tradeVo);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.atguigu.order.mapper;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface OrderInfoMapper {
|
||||
}
|
|
@ -0,0 +1,4 @@
|
|||
package com.atguigu.order.service;
|
||||
|
||||
public interface OrderInfoService {
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package com.atguigu.order.service.impl;
|
||||
|
||||
import com.atguigu.order.service.OrderInfoService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class OrderInfoServiceImpl implements OrderInfoService {
|
||||
}
|
|
@ -5,3 +5,9 @@ bunny:
|
|||
sqlData: db_spzx
|
||||
username: root
|
||||
password: "02120212"
|
||||
|
||||
redis:
|
||||
host: 47.120.65.66
|
||||
port: 6379
|
||||
database: 2
|
||||
password: "02120212"
|
|
@ -22,6 +22,13 @@ spring:
|
|||
username: ${bunny.datasource.username}
|
||||
password: "${bunny.datasource.password}"
|
||||
|
||||
data:
|
||||
redis:
|
||||
host: ${bunny.redis.host}
|
||||
port: ${bunny.redis.port}
|
||||
database: ${bunny.redis.database}
|
||||
password: ${bunny.redis.password}
|
||||
|
||||
logging:
|
||||
level:
|
||||
com.atguigu.spzx.order.mapper: debug
|
||||
|
|
|
@ -0,0 +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="com.atguigu.order.mapper.OrderInfoMapper">
|
||||
|
||||
</mapper>
|
|
@ -0,0 +1,30 @@
|
|||
package com.atguigu.user.controller;
|
||||
|
||||
import com.atguigu.spzx.model.entity.user.UserAddress;
|
||||
import com.atguigu.spzx.model.vo.result.Result;
|
||||
import com.atguigu.user.service.UserAddressService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Tag(name = "用户地址接口")
|
||||
@RestController
|
||||
@RequestMapping(value = "/api/user/userAddress")
|
||||
@Slf4j
|
||||
public class UserAddressController {
|
||||
@Autowired
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@Operation(summary = "获取用户地址列表")
|
||||
@GetMapping("auth/findUserAddressList")
|
||||
public Result<List<UserAddress>> findUserAddressList() {
|
||||
List<UserAddress> list = userAddressService.findUserAddressList();
|
||||
return Result.success(list);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
package com.atguigu.user.mapper;
|
||||
|
||||
import com.atguigu.spzx.model.entity.user.UserAddress;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserAddressMapper {
|
||||
/**
|
||||
* 查询用户地址栏
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return 地址列表
|
||||
*/
|
||||
List<UserAddress> selectByUserId(Long userId);
|
||||
}
|
|
@ -0,0 +1,14 @@
|
|||
package com.atguigu.user.service;
|
||||
|
||||
import com.atguigu.spzx.model.entity.user.UserAddress;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface UserAddressService {
|
||||
/**
|
||||
* 获取用户地址列表
|
||||
*
|
||||
* @return 用户地址列表
|
||||
*/
|
||||
List<UserAddress> findUserAddressList();
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
package com.atguigu.user.service.impl;
|
||||
|
||||
import com.atguigu.constant.MessageConstant;
|
||||
import com.atguigu.context.BaseContext;
|
||||
import com.atguigu.exception.BunnyException;
|
||||
import com.atguigu.spzx.model.entity.user.UserAddress;
|
||||
import com.atguigu.user.mapper.UserAddressMapper;
|
||||
import com.atguigu.user.service.UserAddressService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Slf4j
|
||||
public class UserAddressServiceImpl implements UserAddressService {
|
||||
@Autowired
|
||||
private UserAddressMapper userAddressMapper;
|
||||
|
||||
/**
|
||||
* 获取用户地址列表
|
||||
*
|
||||
* @return 用户地址列表
|
||||
*/
|
||||
@Override
|
||||
public List<UserAddress> findUserAddressList() {
|
||||
// 查询用户地址栏
|
||||
Long userId = BaseContext.getUserInfo().getId();
|
||||
if (userId != null) {
|
||||
return userAddressMapper.selectByUserId(userId);
|
||||
}
|
||||
throw new BunnyException(MessageConstant.FIND_ID_IS_NOT_EMPTY);
|
||||
}
|
||||
}
|
|
@ -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.atguigu.user.mapper.UserAddressMapper">
|
||||
|
||||
<!-- 查询用户地址栏 -->
|
||||
<select id="selectByUserId" resultType="com.atguigu.spzx.model.entity.user.UserAddress">
|
||||
select *
|
||||
from user_address
|
||||
where user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue