bug修复
This commit is contained in:
parent
66e1298d2a
commit
e3ea282568
@ -953,7 +953,7 @@ public class EbikeBikeInfoController {
|
|||||||
* @param dto 车辆id
|
* @param dto 车辆id
|
||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
@GetMapping("getRegionIdsByBikes")
|
@PostMapping("getRegionIdsByBikes")
|
||||||
JsonResult<?> getRegionIdsByBikes(@RequestBody ReqBatchRegionDto dto) {
|
JsonResult<?> getRegionIdsByBikes(@RequestBody ReqBatchRegionDto dto) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.select(EBIKE_BIKE_INFO.REGIN_ID)
|
.select(EBIKE_BIKE_INFO.REGIN_ID)
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.cdzy.user.component;
|
package com.cdzy.user.component;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.stp.StpUtil;
|
||||||
import com.mybatisflex.core.tenant.TenantFactory;
|
import com.mybatisflex.core.tenant.TenantFactory;
|
||||||
import org.springframework.web.context.request.RequestAttributes;
|
import org.springframework.web.context.request.RequestAttributes;
|
||||||
import org.springframework.web.context.request.RequestContextHolder;
|
import org.springframework.web.context.request.RequestContextHolder;
|
||||||
@ -7,13 +8,14 @@ import org.springframework.web.context.request.RequestContextHolder;
|
|||||||
public class MyTenantFactory implements TenantFactory {
|
public class MyTenantFactory implements TenantFactory {
|
||||||
|
|
||||||
public Object[] getTenantIds() {
|
public Object[] getTenantIds() {
|
||||||
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
if (StpUtil.isLogin()) {
|
||||||
Object attribute = attributes.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST);
|
RequestAttributes attributes = RequestContextHolder.getRequestAttributes();
|
||||||
if (attribute != null) {
|
Object attribute = attributes.getAttribute("tenantId", RequestAttributes.SCOPE_REQUEST);
|
||||||
Long tenantId = Long.valueOf(attribute.toString());
|
if (attribute != null) {
|
||||||
return new Object[]{tenantId};
|
Long tenantId = Long.valueOf(attribute.toString());
|
||||||
} else {
|
return new Object[]{tenantId};
|
||||||
return new Object[]{};
|
}
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -30,11 +30,4 @@ public class TenantInterceptor implements HandlerInterceptor {
|
|||||||
StaffDto staffDto = (StaffDto) StpUtil.getSessionByLoginId(id).get(id);
|
StaffDto staffDto = (StaffDto) StpUtil.getSessionByLoginId(id).get(id);
|
||||||
return staffDto.getOrgId();
|
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();
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
@ -12,6 +12,7 @@ import com.cdzy.user.service.PermissionsService;
|
|||||||
import com.cdzy.user.service.StaffService;
|
import com.cdzy.user.service.StaffService;
|
||||||
import com.cdzy.user.utils.AESUtils;
|
import com.cdzy.user.utils.AESUtils;
|
||||||
import com.mybatisflex.core.query.QueryWrapper;
|
import com.mybatisflex.core.query.QueryWrapper;
|
||||||
|
import com.mybatisflex.core.tenant.TenantManager;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
@ -48,10 +49,12 @@ public class AuthController {
|
|||||||
* @param loginVo 道路信息
|
* @param loginVo 道路信息
|
||||||
* @return {@code 200} 添加成功,{@code 500} 添加失败
|
* @return {@code 200} 添加成功,{@code 500} 添加失败
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@PostMapping("loginByPwd")
|
@PostMapping("loginByPwd")
|
||||||
public JsonResult<?> loginByPwd(@RequestBody PwdLoginVo loginVo) {
|
public JsonResult<?> loginByPwd(@RequestBody PwdLoginVo loginVo) {
|
||||||
QueryWrapper queryWrapper = QueryWrapper.create()
|
QueryWrapper queryWrapper = QueryWrapper.create()
|
||||||
.where(STAFF.USERNAME.eq(loginVo.getUsername()));
|
.where(STAFF.USERNAME.eq(loginVo.getUsername()));
|
||||||
|
TenantManager.ignoreTenantCondition();
|
||||||
Staff staff = staffService.getOne(queryWrapper);
|
Staff staff = staffService.getOne(queryWrapper);
|
||||||
if (staff == null) {
|
if (staff == null) {
|
||||||
return JsonResult.failed(Message.USERNAME_WRONG);
|
return JsonResult.failed(Message.USERNAME_WRONG);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user