Commit 7424b565 authored by Shen's avatar Shen

1.修改用户地址实体类

2.添加根据用户id查询收货地址接口
3.添加本人收货地址查询接口
parent ffaaac0a
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
......@@ -19,6 +22,8 @@ import java.util.Date;
public class PensionConsigneeEntity extends BaseEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 用户ID
*/
......@@ -63,6 +68,11 @@ public class PensionConsigneeEntity extends BaseEntity {
* 备注
*/
private String remark;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 更新时间
*/
......
......@@ -42,6 +42,7 @@ public class WebMvcConfig implements WebMvcConfigurer {
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/api/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionorder/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionservicetype/**");
registry.addInterceptor(authorizationInterceptor).addPathPatterns("/serviceOrder/pensionconsignee/**");
}
@Override
......
package io.hmit.modules.serviceOrder.controller;
import io.hmit.annotation.Login;
import io.hmit.annotation.LoginUser;
import io.hmit.common.constant.Constant;
import io.hmit.common.page.PageData;
import io.hmit.common.utils.Result;
......@@ -8,12 +10,14 @@ import io.hmit.common.validator.ValidatorUtils;
import io.hmit.common.validator.group.AddGroup;
import io.hmit.common.validator.group.DefaultGroup;
import io.hmit.common.validator.group.UpdateGroup;
import io.hmit.entity.UserEntity;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
......@@ -29,6 +33,7 @@ import java.util.Map;
* @author zsh 408538940@qq.com
* @since 1.0.0 2021-05-06
*/
@Slf4j
@RestController
@RequestMapping("serviceOrder/pensionconsignee")
@Api(tags="用户地址")
......@@ -91,4 +96,20 @@ public class PensionConsigneeController {
return new Result();
}
@GetMapping("findByUserId")
@ApiOperation("根据用户id查询用户收货地址")
public Result<List<PensionConsigneeDTO>> findAddressByUserId(@RequestParam("userId") Long userId){
List<PensionConsigneeDTO> pensionConsigneeDTOList = pensionConsigneeService.findByUserId(userId);
return new Result<List<PensionConsigneeDTO>>().ok(pensionConsigneeDTOList);
}
@Login
@GetMapping("findMyAddress")
@ApiOperation("查询本人收货地址")
public Result<List<PensionConsigneeDTO>> findMyAddress(@ApiIgnore @LoginUser UserEntity user){
log.info("user={}", user);
List<PensionConsigneeDTO> pensionConsigneeDTOList = pensionConsigneeService.findByUserId(user.getId());
return new Result<List<PensionConsigneeDTO>>().ok(pensionConsigneeDTOList);
}
}
\ No newline at end of file
package io.hmit.modules.serviceOrder.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.hmit.common.entity.BaseEntity;
import lombok.Data;
......@@ -16,9 +19,11 @@ import java.util.Date;
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("pension_consignee")
public class PensionConsigneeEntity extends BaseEntity {
public class PensionConsigneeEntity {
private static final long serialVersionUID = 1L;
@TableId
private Long id;
/**
* 用户ID
*/
......@@ -63,6 +68,11 @@ public class PensionConsigneeEntity extends BaseEntity {
* 备注
*/
private String remark;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
private Date createDate;
/**
* 更新时间
*/
......
......@@ -4,6 +4,8 @@ import io.hmit.common.service.CrudService;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import java.util.List;
/**
*
*
......@@ -12,4 +14,6 @@ import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
*/
public interface PensionConsigneeService extends CrudService<PensionConsigneeEntity, PensionConsigneeDTO> {
List<PensionConsigneeDTO> findByUserId(Long userId);
}
\ No newline at end of file
......@@ -2,13 +2,16 @@ package io.hmit.modules.serviceOrder.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.hmit.common.service.impl.CrudServiceImpl;
import io.hmit.common.utils.ConvertUtils;
import io.hmit.modules.serviceOrder.dao.PensionConsigneeDao;
import io.hmit.modules.serviceOrder.dto.PensionConsigneeDTO;
import io.hmit.modules.serviceOrder.entity.PensionConsigneeEntity;
import io.hmit.modules.serviceOrder.service.PensionConsigneeService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
......@@ -30,5 +33,14 @@ public class PensionConsigneeServiceImpl extends CrudServiceImpl<PensionConsigne
return wrapper;
}
@Autowired
private PensionConsigneeDao pensionConsigneeDao;
@Override
public List<PensionConsigneeDTO> findByUserId(Long userId) {
QueryWrapper<PensionConsigneeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("user_id", userId);
List<PensionConsigneeEntity> platformPayInfoEntityList = pensionConsigneeDao.selectList(queryWrapper);
return ConvertUtils.sourceToTarget(platformPayInfoEntityList, PensionConsigneeDTO.class);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment