新增:ShopUserAddress表
This commit is contained in:
@@ -1,33 +1,33 @@
|
|||||||
package com.gxwebsoft.shop.controller;
|
package com.gxwebsoft.shop.controller;
|
||||||
|
|
||||||
import com.gxwebsoft.common.core.web.BaseController;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.gxwebsoft.shop.service.ShopUserAddressService;
|
import com.gxwebsoft.common.core.web.BaseController;
|
||||||
import com.gxwebsoft.shop.entity.ShopUserAddress;
|
import com.gxwebsoft.shop.service.ShopUserAddressService;
|
||||||
import com.gxwebsoft.shop.param.ShopUserAddressParam;
|
import com.gxwebsoft.shop.entity.ShopUserAddress;
|
||||||
import com.gxwebsoft.common.core.web.ApiResult;
|
import com.gxwebsoft.shop.param.ShopUserAddressParam;
|
||||||
import com.gxwebsoft.common.core.web.PageResult;
|
import com.gxwebsoft.common.core.web.ApiResult;
|
||||||
import com.gxwebsoft.common.core.web.PageParam;
|
import com.gxwebsoft.common.core.web.PageResult;
|
||||||
import com.gxwebsoft.common.core.web.BatchParam;
|
import com.gxwebsoft.common.core.web.BatchParam;
|
||||||
import com.gxwebsoft.common.core.annotation.OperationLog;
|
import com.gxwebsoft.common.core.annotation.OperationLog;
|
||||||
import com.gxwebsoft.common.system.entity.User;
|
import com.gxwebsoft.common.system.entity.User;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 收货地址控制器
|
* 收货地址控制器
|
||||||
*
|
*
|
||||||
* @author 科技小王子
|
* @author 科技小王子
|
||||||
* @since 2025-07-22 23:06:40
|
* @since 2025-07-22 23:06:40
|
||||||
*/
|
*/
|
||||||
@Api(tags = "收货地址管理")
|
@Api(tags = "收货地址管理")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api/shop/shop-user-address")
|
@RequestMapping("/api/shop/shop-user-address")
|
||||||
public class ShopUserAddressController extends BaseController {
|
public class ShopUserAddressController extends BaseController {
|
||||||
@Resource
|
@Resource
|
||||||
private ShopUserAddressService shopUserAddressService;
|
private ShopUserAddressService shopUserAddressService;
|
||||||
|
|
||||||
@@ -64,6 +64,9 @@ public class ShopUserAddressController extends BaseController {
|
|||||||
User loginUser = getLoginUser();
|
User loginUser = getLoginUser();
|
||||||
if (loginUser != null) {
|
if (loginUser != null) {
|
||||||
shopUserAddress.setUserId(loginUser.getUserId());
|
shopUserAddress.setUserId(loginUser.getUserId());
|
||||||
|
if (shopUserAddressService.count(new LambdaQueryWrapper<ShopUserAddress>().eq(ShopUserAddress::getUserId, loginUser.getUserId()).eq(ShopUserAddress::getAddress, shopUserAddress.getAddress())) > 0) {
|
||||||
|
return success("该地址已存在");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (shopUserAddressService.save(shopUserAddress)) {
|
if (shopUserAddressService.save(shopUserAddress)) {
|
||||||
return success("添加成功");
|
return success("添加成功");
|
||||||
@@ -126,4 +129,4 @@ public class ShopUserAddressController extends BaseController {
|
|||||||
return fail("删除失败");
|
return fail("删除失败");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -63,6 +63,9 @@ public class ShopUserAddress implements Serializable {
|
|||||||
@ApiModelProperty(value = "默认收货地址")
|
@ApiModelProperty(value = "默认收货地址")
|
||||||
private Boolean isDefault;
|
private Boolean isDefault;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|
||||||
|
|||||||
@@ -52,6 +52,9 @@
|
|||||||
<if test="param.userId != null">
|
<if test="param.userId != null">
|
||||||
AND a.user_id = #{param.userId}
|
AND a.user_id = #{param.userId}
|
||||||
</if>
|
</if>
|
||||||
|
<if test="param.sortNumber != null">
|
||||||
|
AND a.sort_number = #{param.sortNumber}
|
||||||
|
</if>
|
||||||
<if test="param.createTimeStart != null">
|
<if test="param.createTimeStart != null">
|
||||||
AND a.create_time >= #{param.createTimeStart}
|
AND a.create_time >= #{param.createTimeStart}
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -66,6 +66,10 @@ public class ShopUserAddressParam extends BaseParam {
|
|||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Boolean isDefault;
|
private Boolean isDefault;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "排序号")
|
||||||
|
@QueryField(type = QueryType.EQ)
|
||||||
|
private Integer sortNumber;
|
||||||
|
|
||||||
@ApiModelProperty(value = "用户ID")
|
@ApiModelProperty(value = "用户ID")
|
||||||
@QueryField(type = QueryType.EQ)
|
@QueryField(type = QueryType.EQ)
|
||||||
private Integer userId;
|
private Integer userId;
|
||||||
|
|||||||
@@ -21,6 +21,12 @@ logging:
|
|||||||
socketio:
|
socketio:
|
||||||
host: 0.0.0.0 #IP地址
|
host: 0.0.0.0 #IP地址
|
||||||
|
|
||||||
|
redis:
|
||||||
|
database: 0
|
||||||
|
host: 1Panel-redis-Q1LE
|
||||||
|
port: 6379
|
||||||
|
password: redis_WSDb88
|
||||||
|
|
||||||
# MQTT配置
|
# MQTT配置
|
||||||
mqtt:
|
mqtt:
|
||||||
enabled: false # 添加开关来禁用MQTT服务
|
enabled: false # 添加开关来禁用MQTT服务
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
# 端口
|
# 端口
|
||||||
server:
|
server:
|
||||||
port: 9003
|
port: 9000
|
||||||
# 多环境配置
|
# 多环境配置
|
||||||
spring:
|
spring:
|
||||||
profiles:
|
profiles:
|
||||||
@@ -46,7 +46,7 @@ spring:
|
|||||||
max-request-size: 100MB
|
max-request-size: 100MB
|
||||||
redis:
|
redis:
|
||||||
database: 0
|
database: 0
|
||||||
host: 1Panel-redis-5nN7
|
host: 127.0.0.1
|
||||||
port: 6379
|
port: 6379
|
||||||
password:
|
password:
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user