| | |
| | | User byId1 = userMapper.selectById(byId.getStoreStaffId()); |
| | | model.addAttribute("city",byId1); |
| | | model.addAttribute("managerName", byId1 == null ? "" : byId1.getName()); |
| | | // 历史门店的手机号可能只保存在店长账号中,编辑页需与列表保持一致地回填可用手机号。 |
| | | model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1)); |
| | | model.addAttribute("type",1); |
| | | // 如果当前登陆人是运营商 |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | |
| | | User byId1 = userMapper.selectById(byId.getStoreStaffId()); |
| | | model.addAttribute("city",byId1); |
| | | model.addAttribute("managerName", byId1 == null ? "" : byId1.getName()); |
| | | model.addAttribute("managerPhone", resolveStoreManagerPhone(byId, byId1)); |
| | | model.addAttribute("type",0); |
| | | |
| | | return PREFIX + "TShop_edit.html"; |
| | |
| | | @ResponseBody |
| | | public Object listTwo1(Integer id) { |
| | | Page<TStoreOtherConfigTrue> page = new PageFactory<TStoreOtherConfigTrue>().defaultPage(); |
| | | List<TStoreOtherConfigTrue> list = tStoreOtherConfigTrueService.page(page,new LambdaQueryWrapper<TStoreOtherConfigTrue>().eq(TStoreOtherConfigTrue::getPid, id).eq(TStoreOtherConfigTrue::getState,1)).getRecords(); |
| | | List<TStoreOtherConfigTrue> list = tStoreOtherConfigTrueService.page(page,new LambdaQueryWrapper<TStoreOtherConfigTrue>().eq(TStoreOtherConfigTrue::getPid, id).eq(TStoreOtherConfigTrue::getState,1).orderByDesc(TStoreOtherConfigTrue::getId)).getRecords(); |
| | | page.setRecords(list); |
| | | return super.packForBT(page); |
| | | } |
| | |
| | | } |
| | | } |
| | | }else { |
| | | TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getProvinceCode())); |
| | | // 编辑页提交的是行政区划编码;按 id 查询会导致查不到省、市,随后访问名称时抛出 NPE。 |
| | | TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getProvinceCode())); |
| | | if (one == null) { |
| | | return ERROR; |
| | | } |
| | | tStore.setProvince(one.getName()); |
| | | tStore.setProvinceCode(one.getCode()); |
| | | TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getCityCode())); |
| | | TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getCityCode())); |
| | | if (one1 == null) { |
| | | return ERROR; |
| | | } |
| | | tStore.setCity(one1.getName()); |
| | | tStore.setCityCode(one1.getCode()); |
| | | } |
| | |
| | | user.setCreatetime(new Date()); |
| | | return user; |
| | | } |
| | | |
| | | private String resolveStoreManagerPhone(TStore store, User storeManager) { |
| | | if (ToolUtil.isNotEmpty(store.getPhone())) { |
| | | return store.getPhone(); |
| | | } |
| | | return storeManager == null ? "" : storeManager.getPhone(); |
| | | } |
| | | @RequestMapping(value = "/onChange") |
| | | @ResponseBody |
| | | public Object onChange(Integer oneId) { |