bug修复

This commit is contained in:
attiya 2025-09-01 10:44:05 +08:00
parent 66e1298d2a
commit e3ea282568
4 changed files with 13 additions and 15 deletions

View File

@ -953,7 +953,7 @@ public class EbikeBikeInfoController {
* @param dto 车辆id
* @return 结果
*/
@GetMapping("getRegionIdsByBikes")
@PostMapping("getRegionIdsByBikes")
JsonResult<?> getRegionIdsByBikes(@RequestBody ReqBatchRegionDto dto) {
QueryWrapper queryWrapper = QueryWrapper.create()
.select(EBIKE_BIKE_INFO.REGIN_ID)

View File

@ -1,5 +1,6 @@
package com.cdzy.user.component;
import cn.dev33.satoken.stp.StpUtil;
import com.mybatisflex.core.tenant.TenantFactory;
import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder;
@ -7,13 +8,14 @@ import org.springframework.web.context.request.RequestContextHolder;
public class MyTenantFactory implements TenantFactory {
public Object[] getTenantIds() {
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
Object attribute = attributes.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST);
if (attribute != null) {
Long tenantId = Long.valueOf(attribute.toString());
return new Object[]{tenantId};
} else {
return new Object[]{};
if (StpUtil.isLogin()) {
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
Object attribute = attributes.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST);
if (attribute != null) {
Long tenantId = Long.valueOf(attribute.toString());
return new Object[]{tenantId};
}
}
return null;
}
}

View File

@ -30,11 +30,4 @@ public class TenantInterceptor implements HandlerInterceptor {
StaffDto staffDto = (StaffDto) StpUtil.getSessionByLoginId(id).get(id);
return staffDto.getOrgId();
}
// List<Long> getAllTenantIdByReuqest(HttpServletRequest request) {
// String token = request.getHeader("Authorization");
// String id = (String) StpUtil.getLoginIdByToken(token);
// StaffDto staffDto = (StaffDto) StpUtil.getSessionByLoginId(id).get(id);
// return staffDto.getOrgId();
// }
}

View File

@ -12,6 +12,7 @@ import com.cdzy.user.service.PermissionsService;
import com.cdzy.user.service.StaffService;
import com.cdzy.user.utils.AESUtils;
import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.tenant.TenantManager;
import jakarta.annotation.Resource;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.PostMapping;
@ -48,10 +49,12 @@ public class AuthController {
* @param loginVo 道路信息
* @return {@code 200} 添加成功{@code 500} 添加失败
*/
@PostMapping("loginByPwd")
public JsonResult<?> loginByPwd(@RequestBody PwdLoginVo loginVo) {
QueryWrapper queryWrapper = QueryWrapper.create()
.where(STAFF.USERNAME.eq(loginVo.getUsername()));
TenantManager.ignoreTenantCondition();
Staff staff = staffService.getOne(queryWrapper);
if (staff == null) {
return JsonResult.failed(Message.USERNAME_WRONG);