增加修改门店信息接口
This commit is contained in:
		| @ -3,14 +3,12 @@ package com.sczx.store.controller; | ||||
|  | ||||
| import com.sczx.store.common.Result; | ||||
| import com.sczx.store.dto.CompanyStoreDTO; | ||||
| import com.sczx.store.dto.req.StoreChangeReq; | ||||
| import com.sczx.store.service.StoreService; | ||||
| import io.swagger.annotations.Api; | ||||
| import io.swagger.annotations.ApiOperation; | ||||
| 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.RequestParam; | ||||
| import org.springframework.web.bind.annotation.RestController; | ||||
| import org.springframework.web.bind.annotation.*; | ||||
|  | ||||
| /** | ||||
|  * <p> | ||||
| @ -33,4 +31,10 @@ public class StorePubController { | ||||
|     public Result<CompanyStoreDTO> getStoreById(@RequestParam(name = "storeId") Integer storeId){ | ||||
|         return Result.ok(storeService.getStoreById(storeId)); | ||||
|     } | ||||
|  | ||||
|     @ApiOperation(value = "修改门店信息") | ||||
|     @PostMapping("/changeStoreInfo") | ||||
|     public Result<Boolean> changeStoreInfo(@RequestBody StoreChangeReq storeChangeReq){ | ||||
|         return Result.ok(storeService.changeStore(storeChangeReq)); | ||||
|     } | ||||
| } | ||||
|  | ||||
							
								
								
									
										34
									
								
								src/main/java/com/sczx/store/dto/req/StoreChangeReq.java
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								src/main/java/com/sczx/store/dto/req/StoreChangeReq.java
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,34 @@ | ||||
| package com.sczx.store.dto.req; | ||||
|  | ||||
| import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | ||||
| import lombok.Data; | ||||
|  | ||||
| /** | ||||
|  * @Author: 张黎 | ||||
|  * @Date: 2025/08/07/20:19 | ||||
|  * @Description: | ||||
|  */ | ||||
|  | ||||
| @Data | ||||
| @ApiModel(value = "门店信心修改请求") | ||||
| public class StoreChangeReq { | ||||
|  | ||||
|     @ApiModelProperty(value = "门店id") | ||||
|     private String id; | ||||
|  | ||||
|     @ApiModelProperty("每日营业开始时间") | ||||
|     private String startTime; | ||||
|  | ||||
|     @ApiModelProperty("每日营业结束时间") | ||||
|     private String endTime; | ||||
|  | ||||
|     @ApiModelProperty("每日营业开关时间") | ||||
|     private String dayTime; | ||||
|  | ||||
|     @ApiModelProperty("手机号码") | ||||
|     private String phone; | ||||
|  | ||||
|     @ApiModelProperty("门店logo") | ||||
|     private String image; | ||||
| } | ||||
| @ -2,6 +2,7 @@ package com.sczx.store.service; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.sczx.store.dto.CompanyStoreDTO; | ||||
| import com.sczx.store.dto.req.StoreChangeReq; | ||||
| import com.sczx.store.dto.req.StoreDistanceReq; | ||||
|  | ||||
| import java.util.List; | ||||
| @ -24,6 +25,13 @@ public interface StoreService { | ||||
|      */ | ||||
|     CompanyStoreDTO getStoreById(Integer id); | ||||
|  | ||||
|     /** | ||||
|      * 修改门店信息 | ||||
|      * @param storeChangeReq | ||||
|      * @return | ||||
|      */ | ||||
|     Boolean changeStore(StoreChangeReq storeChangeReq); | ||||
|  | ||||
|  | ||||
|     /** | ||||
|      * 根据管理员id获取门店信息 | ||||
|  | ||||
| @ -1,11 +1,13 @@ | ||||
| package com.sczx.store.service.impl; | ||||
|  | ||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||
| import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; | ||||
| import com.baomidou.mybatisplus.core.metadata.IPage; | ||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||
| import com.sczx.store.convert.StoreConvert; | ||||
| import com.sczx.store.dto.CompanyStoreDTO; | ||||
| import com.sczx.store.dto.SimpleUserInfoDTO; | ||||
| import com.sczx.store.dto.req.StoreChangeReq; | ||||
| import com.sczx.store.dto.req.StoreDistanceReq; | ||||
| import com.sczx.store.po.CompanyStorePO; | ||||
| import com.sczx.store.repository.CompanyStoreRepo; | ||||
| @ -31,13 +33,23 @@ public class StoreServiceImpl implements StoreService { | ||||
|  | ||||
|     @Override | ||||
|     public CompanyStoreDTO getStoreById(Integer id) { | ||||
| //        LambdaQueryWrapper<CompanyStorePO> wrapper = Wrappers.lambdaQuery(CompanyStorePO.class); | ||||
| //        wrapper.eq(CompanyStorePO::getId, id).orderByDesc(CompanyStorePO::getCreateTime).last("limit 1"); | ||||
|         CompanyStorePO companyStorePO = companyStoreRepo.getById(id); | ||||
|  | ||||
|         return StoreConvert.INSTANCE.poToDTO(companyStorePO); | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public Boolean changeStore(StoreChangeReq storeChangeReq) { | ||||
|         LambdaUpdateWrapper<CompanyStorePO> wrapper = Wrappers.lambdaUpdate(CompanyStorePO.class); | ||||
|         wrapper.set(CompanyStorePO::getDayTime, storeChangeReq.getDayTime()) | ||||
|                 .set(CompanyStorePO::getStartTime, storeChangeReq.getStartTime()) | ||||
|                 .set(CompanyStorePO::getEndTime, storeChangeReq.getEndTime()) | ||||
|                 .set(CompanyStorePO::getPhone, storeChangeReq.getPhone()) | ||||
|                 .eq(CompanyStorePO::getId, storeChangeReq.getId()); | ||||
|                 companyStoreRepo.update(wrapper); | ||||
|         return true; | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|     public List<CompanyStoreDTO> listStoresByManage(Integer managerId) { | ||||
|  | ||||
|  | ||||
		Reference in New Issue
	
	Block a user