File was renamed from ycl-platform/src/main/java/com/ycl/controller/store/UmsStoreInfoController.java |
| | |
| | | import com.ycl.api.CommonPage; |
| | | import com.ycl.api.CommonResult; |
| | | import com.ycl.dto.UmsStoreInfoParam; |
| | | import com.ycl.entity.store.UmsStoreInfo; |
| | | import com.ycl.enums.common.ResultCode; |
| | | import com.ycl.exception.ApiException; |
| | | import com.ycl.service.store.UmsStoreInfoService; |
| | | import com.ycl.entity.store.StoreInfo; |
| | | import com.ycl.service.store.StoreInfoService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.ByteArrayInputStream; |
| | | import java.io.InputStream; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RestController |
| | | @RequestMapping("/store/storeinfo") |
| | | @Api(tags = "门店管理") |
| | | public class UmsStoreInfoController { |
| | | private UmsStoreInfoService umsStoreInfoService; |
| | | public class StoreInfoController { |
| | | private StoreInfoService storeInfoService; |
| | | |
| | | @Autowired |
| | | public void setUmsStoreInfoService(UmsStoreInfoService umsStoreInfoService) { |
| | | this.umsStoreInfoService = umsStoreInfoService; |
| | | public void setUmsStoreInfoService(StoreInfoService umsStoreInfoService) { |
| | | this.storeInfoService = umsStoreInfoService; |
| | | } |
| | | |
| | | @ApiOperation("根据门店名称分页获取门店列表列表") |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public CommonResult<CommonPage<UmsStoreInfo>> list(@RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, |
| | | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { |
| | | Page<UmsStoreInfo> storeInfoPage = umsStoreInfoService.list(keyword, pageSize, pageNum); |
| | | public CommonResult<CommonPage<StoreInfo>> list(@RequestParam(value = "keyword", required = false) String keyword, |
| | | @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize, |
| | | @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) { |
| | | Page<StoreInfo> storeInfoPage = storeInfoService.list(keyword, pageSize, pageNum); |
| | | return CommonResult.success(CommonPage.restPage(storeInfoPage)); |
| | | } |
| | | |
| | | @ApiOperation("根据id获取门店信息") |
| | | @RequestMapping(value = "/{id}", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public CommonResult<UmsStoreInfo> getItem(@PathVariable Long id) { |
| | | UmsStoreInfo umsStoreInfo = umsStoreInfoService.getById(id); |
| | | return CommonResult.success(umsStoreInfo); |
| | | public CommonResult<StoreInfo> getItem(@PathVariable Long id) { |
| | | StoreInfo storeInfo = storeInfoService.getById(id); |
| | | return CommonResult.success(storeInfo); |
| | | } |
| | | |
| | | @ApiOperation(value = "添加门店信息") |
| | | @RequestMapping(value = "/add", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult<UmsStoreInfo> add(@Validated @RequestBody UmsStoreInfoParam umsStoreInfoParam) { |
| | | UmsStoreInfo umsStoreInfo = UmsStoreInfo.builder() |
| | | public CommonResult<StoreInfo> add(@Validated @RequestBody UmsStoreInfoParam umsStoreInfoParam) { |
| | | StoreInfo storeInfo = StoreInfo.builder() |
| | | .owner(umsStoreInfoParam.getOwner()) |
| | | .storename(umsStoreInfoParam.getStorename()) |
| | | .contact(umsStoreInfoParam.getContact()) |
| | |
| | | .storephoto(umsStoreInfoParam.getStorephoto()) |
| | | .idcardinfo(umsStoreInfoParam.getIdcardinfo()) |
| | | .storescore(umsStoreInfoParam.getStorescore()).build(); |
| | | boolean success = umsStoreInfoService.save(umsStoreInfo); |
| | | boolean success = storeInfoService.save(storeInfo); |
| | | if (success) { |
| | | return CommonResult.success(null); |
| | | } else { |
| | |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public CommonResult delete(@PathVariable Long id) { |
| | | boolean success = umsStoreInfoService.removeById(id); |
| | | boolean success = storeInfoService.removeById(id); |
| | | if (success) { |
| | | return CommonResult.success(null); |
| | | } else { |
| | |
| | | @ApiOperation(value = "修改门店信息") |
| | | @RequestMapping(value = "/update", method = RequestMethod.GET) |
| | | @ResponseBody |
| | | public CommonResult update(@RequestBody UmsStoreInfo umsStoreInfo) { |
| | | boolean success = umsStoreInfoService.updateById(umsStoreInfo); |
| | | public CommonResult update(@RequestBody StoreInfo storeInfo) { |
| | | boolean success = storeInfoService.updateById(storeInfo); |
| | | if (success) { |
| | | return CommonResult.success(null); |
| | | } else { |
| | |
| | | @RequestMapping(value = "/add/excel", method = RequestMethod.POST) |
| | | @ResponseBody |
| | | public CommonResult addByExcel(MultipartFile file) { |
| | | boolean success = umsStoreInfoService.addByExcel(file); |
| | | boolean success = storeInfoService.addByExcel(file); |
| | | if (success) { |
| | | return CommonResult.success(null); |
| | | } else { |