From eca7fad7faafc150d776dd041c3523f7fb44c005 Mon Sep 17 00:00:00 2001
From: huangyw <1207046171@qq.com>
Date: Thu, 8 Aug 2024 17:00:59 +0800
Subject: [PATCH] =?UTF-8?q?release:=20=E6=96=B0=E7=94=A8=E6=88=B7=E9=82=80?=
=?UTF-8?q?=E8=AF=B7=E8=8E=B7=E5=BE=97=E7=A7=AF=E5=88=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
luoo_common/pom.xml | 14 ++++
luoo_user/pom.xml | 17 ++++
.../java/com/luoo/user/UserApplication.java | 6 ++
.../com/luoo/user/config/JPABasePojo.java | 71 +++++++++++++++++
.../luoo/user/controller/StoreController.java | 68 ++++++++++++++++
.../main/java/com/luoo/user/dao/StoreDao.java | 9 +++
.../com/luoo/user/dto/store/StoreAddDto.java | 57 +++++++++++++
.../luoo/user/dto/store/StoreSearchDto.java | 56 +++++++++++++
.../luoo/user/dto/store/StoreUpdateDto.java | 57 +++++++++++++
.../luoo/user/listener/JPAEntityListener.java | 77 ++++++++++++++++++
.../com/luoo/user/mapstruct/StoreMapper.java | 11 +++
.../main/java/com/luoo/user/pojo/Store.java | 79 +++++++++++++++++++
.../com/luoo/user/service/StoreService.java | 64 +++++++++++++++
.../com/luoo/user/vo/store/StoreAppVO.java | 57 +++++++++++++
14 files changed, 643 insertions(+)
create mode 100644 luoo_user/src/main/java/com/luoo/user/config/JPABasePojo.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/controller/StoreController.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/dao/StoreDao.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/dto/store/StoreSearchDto.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/mapstruct/StoreMapper.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/pojo/Store.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/service/StoreService.java
create mode 100644 luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java
diff --git a/luoo_common/pom.xml b/luoo_common/pom.xml
index 29f00aa..5ec1ed9 100644
--- a/luoo_common/pom.xml
+++ b/luoo_common/pom.xml
@@ -41,5 +41,19 @@
jedis
3.7.0
+
+
+ org.mapstruct
+ mapstruct
+ 1.4.2.Final
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.4.2.Final
+ provided
+
+
+
diff --git a/luoo_user/pom.xml b/luoo_user/pom.xml
index 3789860..2cfbc1a 100644
--- a/luoo_user/pom.xml
+++ b/luoo_user/pom.xml
@@ -203,6 +203,23 @@
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ 3.8.1
+
+
+ 1.8
+
+
+ org.mapstruct
+ mapstruct-processor
+ 1.4.2.Final
+
+
+
+
diff --git a/luoo_user/src/main/java/com/luoo/user/UserApplication.java b/luoo_user/src/main/java/com/luoo/user/UserApplication.java
index 4aaa3a4..402ffdb 100644
--- a/luoo_user/src/main/java/com/luoo/user/UserApplication.java
+++ b/luoo_user/src/main/java/com/luoo/user/UserApplication.java
@@ -1,5 +1,6 @@
package com.luoo.user;
+import com.luoo.user.listener.JPAEntityListener;
import com.spring4all.mongodb.EnableMongoPlus;
import org.mybatis.spring.annotation.MapperScan;
import org.slf4j.Logger;
@@ -47,6 +48,10 @@ public class UserApplication {
env.getProperty("server.port"));
}
+ @Bean
+ public JPAEntityListener jpaEntityListener() {
+ return new JPAEntityListener();
+ }
@Bean
public IdWorker idWorkker(){
return new IdWorker(1, 1);
@@ -66,4 +71,5 @@ public class UserApplication {
public RedisLockUtil redisLockUtil() {
return new RedisLockUtil();
}
+
}
diff --git a/luoo_user/src/main/java/com/luoo/user/config/JPABasePojo.java b/luoo_user/src/main/java/com/luoo/user/config/JPABasePojo.java
new file mode 100644
index 0000000..23cd54f
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/config/JPABasePojo.java
@@ -0,0 +1,71 @@
+package com.luoo.user.config;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.luoo.user.listener.JPAEntityListener;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+import org.hibernate.annotations.Where;
+import org.springframework.format.annotation.DateTimeFormat;
+
+import javax.persistence.Column;
+import javax.persistence.EntityListeners;
+import javax.persistence.Id;
+import javax.persistence.MappedSuperclass;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+import java.time.LocalDateTime;
+
+/**
+ * @program: luoo_parent
+ * @description: jpa默认基类
+ * @author: yawei.huang
+ * @create: 2024-08-08 13:29
+ **/
+@Getter
+@Setter
+@MappedSuperclass
+@EntityListeners(JPAEntityListener.class)
+public abstract class JPABasePojo implements Serializable {
+
+ private static final long serialVersionUID = -4451172429717455614L;
+
+ @Id
+ @Column(name = "id", nullable = false)
+ @ApiModelProperty(value = "id")
+ private String id;
+
+ @Size(max = 20)
+ @Column(name = "create_user", length = 20, updatable = false)
+ @ApiModelProperty(value = "创建人")
+ private String createUser;
+
+ @Size(max = 20)
+ @Column(name = "update_user", length = 20)
+ @ApiModelProperty(value = "更新人")
+ private String updateUser;
+
+ @Column(name = "create_user_name", updatable = false)
+ @ApiModelProperty(value = "创建人姓名")
+ private String createUserName;
+
+ @Column(name = "update_user_name")
+ @ApiModelProperty(value = "更新人姓名")
+ private String updateUserName;
+
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ @ApiModelProperty("创建时间")
+ @Column(name = "create_time", updatable = false)
+ private LocalDateTime createTime;
+
+ @ApiModelProperty("修改时间")
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+ @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+ private LocalDateTime updateTime;
+
+ @Column(name = "del_flag")
+ @ApiModelProperty(value = "是否删除 0-未删除 2-已删除")
+ private Integer delFlag;
+
+}
diff --git a/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java b/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java
new file mode 100644
index 0000000..31afbc1
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/controller/StoreController.java
@@ -0,0 +1,68 @@
+package com.luoo.user.controller;
+
+import annotation.GlobalInterceptor;
+import api.Result;
+import com.luoo.user.dto.store.StoreAddDto;
+import com.luoo.user.dto.store.StoreUpdateDto;
+import com.luoo.user.pojo.Store;
+import com.luoo.user.service.StoreService;
+import io.swagger.annotations.Api;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.CrossOrigin;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.List;
+
+/**
+ * @program: luoo_parent
+ * @description: 门店
+ * @author: yawei.huang
+ * @create: 2024-08-08 14:28
+ **/
+@Api(tags = "门店模块")
+@RestController
+@CrossOrigin
+@RequestMapping("/store")
+public class StoreController {
+
+ @Autowired
+ private StoreService storeService;
+
+ @RequestMapping("/list")
+ @GlobalInterceptor(checkAdminLogin = true)
+ public Result> getStoreList() {
+ return Result.success(storeService.findAll());
+ }
+
+ @RequestMapping("/get")
+ public Result getStore(String id) {
+ return Result.success(storeService.getOne(id));
+ }
+
+ @RequestMapping("/add")
+ @GlobalInterceptor(checkAdminLogin = true)
+ public Result addStore(StoreAddDto storeAddDto) {
+ Store store = new Store();
+ BeanUtils.copyProperties(storeAddDto, store);
+ storeService.add(store);
+ return Result.success();
+ }
+
+ @RequestMapping("/update")
+ @GlobalInterceptor(checkAdminLogin = true)
+ public Result updateStore(StoreUpdateDto storeUpdateDto) {
+
+ storeService.update(storeUpdateDto);
+ return Result.success();
+ }
+
+ @RequestMapping("/delete")
+ @GlobalInterceptor(checkAdminLogin = true)
+ public Result deleteStore(String id) {
+ storeService.delete(id);
+ return Result.success();
+ }
+
+}
diff --git a/luoo_user/src/main/java/com/luoo/user/dao/StoreDao.java b/luoo_user/src/main/java/com/luoo/user/dao/StoreDao.java
new file mode 100644
index 0000000..ea5e473
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/dao/StoreDao.java
@@ -0,0 +1,9 @@
+package com.luoo.user.dao;
+
+import com.luoo.user.pojo.Store;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+
+public interface StoreDao extends JpaRepository , JpaSpecificationExecutor {
+
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java
new file mode 100644
index 0000000..b64a6f5
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreAddDto.java
@@ -0,0 +1,57 @@
+package com.luoo.user.dto.store;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Value;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import javax.persistence.Lob;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+
+/**
+ * DTO for {@link com.luoo.user.pojo.Store}
+ */
+@Value
+public class StoreAddDto implements Serializable {
+
+
+ private static final long serialVersionUID = -7780230858811570880L;
+
+ @ApiModelProperty(value = "门店名称")
+ String name;
+
+ @ApiModelProperty(value = "区域id")
+ Integer regionId;
+
+ @ApiModelProperty(value = "门店地址")
+ String address;
+
+ @ApiModelProperty(value = "经度")
+ String lng;
+
+ @ApiModelProperty(value = "纬度")
+ String lat;
+
+ @ApiModelProperty(value = "门店联系人")
+ String contact;
+
+ @Column(name = "phone")
+ @ApiModelProperty(value = "门店电话")
+ String phone;
+
+ @Column(name = "tel")
+ @ApiModelProperty(value = "门店电话")
+ String tel;
+
+ @Column(name = "opening_hours")
+ @ApiModelProperty(value = "营业时间")
+ String openingHours;
+
+ @Column(name = "background")
+ @ApiModelProperty(value = "门店背景图")
+ String background;
+
+ @ApiModelProperty(value = "门店介绍")
+ String description;
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreSearchDto.java b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreSearchDto.java
new file mode 100644
index 0000000..bc01627
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreSearchDto.java
@@ -0,0 +1,56 @@
+package com.luoo.user.dto.store;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Value;
+
+import javax.persistence.Column;
+import java.io.Serializable;
+
+/**
+ * DTO for {@link com.luoo.user.pojo.Store}
+ */
+@Value
+public class StoreSearchDto implements Serializable {
+
+ private static final long serialVersionUID = -4348467275178028461L;
+
+ @ApiModelProperty(value = "id")
+ String id;
+
+ @ApiModelProperty(value = "门店名称")
+ String name;
+
+ @ApiModelProperty(value = "区域id")
+ Integer regionId;
+
+ @ApiModelProperty(value = "门店地址")
+ String address;
+
+ @ApiModelProperty(value = "经度")
+ String lng;
+
+ @ApiModelProperty(value = "纬度")
+ String lat;
+
+ @ApiModelProperty(value = "门店联系人")
+ String contact;
+
+ @Column(name = "phone")
+ @ApiModelProperty(value = "门店电话")
+ String phone;
+
+ @Column(name = "tel")
+ @ApiModelProperty(value = "门店电话")
+ String tel;
+
+ @Column(name = "opening_hours")
+ @ApiModelProperty(value = "营业时间")
+ String openingHours;
+
+ @Column(name = "background")
+ @ApiModelProperty(value = "门店背景图")
+ String background;
+
+ @ApiModelProperty(value = "门店介绍")
+ String description;
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java
new file mode 100644
index 0000000..71fc1cf
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/dto/store/StoreUpdateDto.java
@@ -0,0 +1,57 @@
+package com.luoo.user.dto.store;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Value;
+
+import javax.persistence.Column;
+import javax.persistence.Id;
+import java.io.Serializable;
+
+/**
+ * DTO for {@link com.luoo.user.pojo.Store}
+ */
+@Value
+public class StoreUpdateDto implements Serializable {
+
+ private static final long serialVersionUID = -4348467275178028461L;
+
+ @ApiModelProperty(value = "id")
+ String id;
+
+ @ApiModelProperty(value = "门店名称")
+ String name;
+
+ @ApiModelProperty(value = "区域id")
+ Integer regionId;
+
+ @ApiModelProperty(value = "门店地址")
+ String address;
+
+ @ApiModelProperty(value = "经度")
+ String lng;
+
+ @ApiModelProperty(value = "纬度")
+ String lat;
+
+ @ApiModelProperty(value = "门店联系人")
+ String contact;
+
+ @Column(name = "phone")
+ @ApiModelProperty(value = "门店电话")
+ String phone;
+
+ @Column(name = "tel")
+ @ApiModelProperty(value = "门店电话")
+ String tel;
+
+ @Column(name = "opening_hours")
+ @ApiModelProperty(value = "营业时间")
+ String openingHours;
+
+ @Column(name = "background")
+ @ApiModelProperty(value = "门店背景图")
+ String background;
+
+ @ApiModelProperty(value = "门店介绍")
+ String description;
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java b/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java
new file mode 100644
index 0000000..ceb27a4
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/listener/JPAEntityListener.java
@@ -0,0 +1,77 @@
+package com.luoo.user.listener;
+
+import com.luoo.user.config.JPABasePojo;
+import dto.UserLoginDto;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Configurable;
+import org.springframework.stereotype.Component;
+import util.IdWorker;
+import util.JwtUtil;
+
+import javax.annotation.PostConstruct;
+import javax.persistence.PrePersist;
+import javax.persistence.PreRemove;
+import javax.persistence.PreUpdate;
+import java.time.LocalDateTime;
+
+/**
+ * @program: luoo_parent
+ * @description: jpa监听
+ * @author: yawei.huang
+ * @create: 2024-08-08 13:35
+ **/
+@Configurable
+@Slf4j
+public class JPAEntityListener {
+
+ private static JwtUtil jwtUtilStatic;
+ private static IdWorker idWorkerStatic;
+
+ @Autowired
+ private JwtUtil jwtUtil;
+
+ @Autowired
+ private IdWorker idWorker;
+
+ @PostConstruct
+ public void init() {
+ jwtUtilStatic = this.jwtUtil;
+ idWorkerStatic = this.idWorker;
+ }
+
+
+ @PrePersist
+ public void setCreatedOn(JPABasePojo jpaBasePojo) {
+ log.info("Setting created on {}", jpaBasePojo);
+ jpaBasePojo.setCreateUser(getCurrentUser().getUserId());
+ jpaBasePojo.setUpdateUser(getCurrentUser().getUserId());
+ jpaBasePojo.setCreateUserName(getCurrentUser().getNickName());
+ jpaBasePojo.setUpdateUserName(getCurrentUser().getNickName());
+ jpaBasePojo.setCreateTime(LocalDateTime.now());
+ jpaBasePojo.setUpdateTime(LocalDateTime.now());
+ jpaBasePojo.setId(String.valueOf(idWorkerStatic.nextId()));
+ jpaBasePojo.setDelFlag(0); // 默认未删除
+ }
+
+ @PreUpdate
+ public void setUpdatedOn(JPABasePojo jpaBasePojo) {
+ log.info("Setting updated on {}", jpaBasePojo);
+ jpaBasePojo.setUpdateUser(getCurrentUser().getUserId());
+ jpaBasePojo.setUpdateUserName(getCurrentUser().getNickName());
+ jpaBasePojo.setUpdateTime(LocalDateTime.now());
+ }
+
+ @PreRemove
+ public void setDeletedOn(JPABasePojo jpaBasePojo) {
+ log.info("Setting deleted on {}", jpaBasePojo);
+ jpaBasePojo.setUpdateUser(getCurrentUser().getUserId());
+ jpaBasePojo.setUpdateUserName(getCurrentUser().getNickName());
+ jpaBasePojo.setUpdateTime(LocalDateTime.now());
+ jpaBasePojo.setDelFlag(2); // 默认已删除
+ }
+
+ private UserLoginDto getCurrentUser() {
+ return jwtUtilStatic.getUser();
+ }
+}
diff --git a/luoo_user/src/main/java/com/luoo/user/mapstruct/StoreMapper.java b/luoo_user/src/main/java/com/luoo/user/mapstruct/StoreMapper.java
new file mode 100644
index 0000000..679c504
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/mapstruct/StoreMapper.java
@@ -0,0 +1,11 @@
+package com.luoo.user.mapstruct;
+
+import com.luoo.user.dto.store.StoreUpdateDto;
+import com.luoo.user.pojo.Store;
+import org.mapstruct.*;
+
+@Mapper(componentModel = "spring")
+public interface StoreMapper {
+
+ void updateStoreFromDto(StoreUpdateDto dto, @MappingTarget Store entity);
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/pojo/Store.java b/luoo_user/src/main/java/com/luoo/user/pojo/Store.java
new file mode 100644
index 0000000..60c114f
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/pojo/Store.java
@@ -0,0 +1,79 @@
+package com.luoo.user.pojo;
+
+import com.luoo.user.config.JPABasePojo;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.*;
+import org.hibernate.annotations.DynamicUpdate;
+import org.hibernate.annotations.Where;
+
+import javax.persistence.*;
+import javax.validation.constraints.Size;
+
+
+@Data
+@NoArgsConstructor
+@AllArgsConstructor
+@Builder
+@Entity
+@DynamicUpdate
+@Where(clause = "del_flag = 0")
+@Table(name = "tb_store")
+public class Store extends JPABasePojo {
+
+ private static final long serialVersionUID = 1257837134734167416L;
+
+ @Size(max = 255)
+ @Column(name = "name")
+ @ApiModelProperty(value = "门店名称")
+ private String name;
+
+ @Column(name = "region_id")
+ @ApiModelProperty(value = "区域id")
+ private Integer regionId;
+
+ @Size(max = 255)
+ @Column(name = "address")
+ @ApiModelProperty(value = "门店地址")
+ private String address;
+
+ @Size(max = 100)
+ @Column(name = "lng", length = 100)
+ @ApiModelProperty(value = "经度")
+ private String lng;
+
+ @Size(max = 100)
+ @Column(name = "lat", length = 100)
+ @ApiModelProperty(value = "纬度")
+ private String lat;
+
+ @Size(max = 255)
+ @Column(name = "contact")
+ @ApiModelProperty(value = "门店联系人")
+ private String contact;
+
+ @Size(max = 255)
+ @Column(name = "phone")
+ @ApiModelProperty(value = "门店电话")
+ private String phone;
+
+ @Size(max = 255)
+ @Column(name = "tel")
+ @ApiModelProperty(value = "门店电话")
+ private String tel;
+
+ @Size(max = 255)
+ @Column(name = "opening_hours")
+ @ApiModelProperty(value = "营业时间")
+ private String openingHours;
+
+ @Size(max = 255)
+ @Column(name = "background")
+ @ApiModelProperty(value = "门店背景图")
+ private String background;
+
+ @Lob
+ @Column(name = "description")
+ @ApiModelProperty(value = "门店介绍")
+ private String description;
+
+}
\ No newline at end of file
diff --git a/luoo_user/src/main/java/com/luoo/user/service/StoreService.java b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java
new file mode 100644
index 0000000..d679858
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/service/StoreService.java
@@ -0,0 +1,64 @@
+package com.luoo.user.service;
+
+import com.luoo.user.dao.StoreDao;
+import com.luoo.user.dto.store.StoreUpdateDto;
+import com.luoo.user.mapstruct.StoreMapper;
+import com.luoo.user.pojo.Store;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import util.IdWorker;
+
+import java.util.List;
+
+/**
+ * @program: luoo_parent
+ * @description: 门店业务
+ * @author: yawei.huang
+ * @create: 2024-08-08 14:20
+ **/
+@Service
+@Slf4j
+public class StoreService {
+
+ private final StoreDao storeDao;
+
+ private final StoreMapper storeMapper;
+
+ public StoreService(StoreDao storeDao, StoreMapper storeMapper) {
+ this.storeDao = storeDao;
+ this.storeMapper = storeMapper;
+ }
+
+ // 增删改查
+ @Transactional(rollbackFor = Exception.class)
+ public void add(Store store) {
+ storeDao.save(store);
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public void delete(String id) {
+ Store store = storeDao.findById(id).orElse(null);
+ store.setDelFlag(2);
+
+ storeDao.save(store);
+ }
+
+ @Transactional(rollbackFor = Exception.class)
+ public void update(StoreUpdateDto storeUpdateDto) {
+ Store oldStore = storeDao.findById(storeUpdateDto.getId()).orElseThrow(() -> new RuntimeException("Store not found"));
+ storeMapper.updateStoreFromDto(storeUpdateDto, oldStore);
+ storeDao.save(oldStore);
+ }
+ public Store getOne(String id) {
+ return storeDao.findById(id).orElse(null);
+ }
+
+ // 列表页
+ public List findAll() {
+ return storeDao.findAll();
+ }
+
+}
diff --git a/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java
new file mode 100644
index 0000000..b9ce9d8
--- /dev/null
+++ b/luoo_user/src/main/java/com/luoo/user/vo/store/StoreAppVO.java
@@ -0,0 +1,57 @@
+package com.luoo.user.vo.store;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Value;
+
+import javax.persistence.Column;
+import javax.validation.constraints.Size;
+import java.io.Serializable;
+
+/**
+ * DTO for {@link com.luoo.user.pojo.Store}
+ */
+@Value
+public class StoreAppVO implements Serializable {
+
+ private static final long serialVersionUID = -8286907101582384522L;
+
+ @ApiModelProperty(value = "id")
+ String id;
+
+ @ApiModelProperty(value = "门店名称")
+ String name;
+
+ @ApiModelProperty(value = "区域id")
+ Integer regionId;
+
+ @ApiModelProperty(value = "门店地址")
+ String address;
+
+ @ApiModelProperty(value = "经度")
+ String lng;
+
+ @ApiModelProperty(value = "纬度")
+ String lat;
+
+ @ApiModelProperty(value = "门店联系人")
+ String contact;
+
+ @Column(name = "phone")
+ @ApiModelProperty(value = "门店电话")
+ String phone;
+
+ @Column(name = "tel")
+ @ApiModelProperty(value = "门店电话")
+ String tel;
+
+ @Column(name = "opening_hours")
+ @ApiModelProperty(value = "营业时间")
+ String openingHours;
+
+ @Column(name = "background")
+ @ApiModelProperty(value = "门店背景图")
+ String background;
+
+ @ApiModelProperty(value = "门店介绍")
+ String description;
+}
\ No newline at end of file