Commit e833b407 authored by 赵啸非's avatar 赵啸非

修正循环依赖

parent e23ed62e
package com.mortals.xhx.annotation;
import java.lang.annotation.*;
/**
*
* @author: zxfei
* @date: 2024/5/15 16:09
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
public @interface DataPermission {
/**
* 数据权限类型
* 1 上下级授权 2 数据范围授权
*/
String permissionType() default "2";
/**
* 配置菜单的组件路径,用于数据权限
*/
String componentRoute() default "";
}
......@@ -4,6 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.annotation.UnAuth;
import com.mortals.framework.common.Rest;
import com.mortals.framework.service.IAuthTokenService;
import com.mortals.framework.service.ICacheService;
import com.mortals.framework.service.IUser;
import com.mortals.framework.util.AESUtil;
import com.mortals.framework.utils.ServletUtils;
......@@ -33,6 +34,8 @@ public class AuthUserInterceptor extends BaseInterceptor {
private InterceptorConfig config;
@Autowired
private IAuthTokenService authTokenService;
@Autowired
private ICacheService cacheService;
@Override
public int getOrder() {
......
......@@ -5,21 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.common.IBaseEnum;
import com.mortals.framework.common.code.UserType;
import com.mortals.framework.model.Context;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.framework.web.BasePhpCRUDJsonMappingController;
import com.mortals.xhx.base.system.role.model.RoleQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.base.system.role.model.RoleEntity;
import com.mortals.xhx.base.system.role.model.RoleUserEntity;
import com.mortals.xhx.base.system.role.service.RoleService;
import com.mortals.xhx.base.system.role.service.RoleUserService;
import com.mortals.xhx.common.code.RoleType;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
......
......@@ -50,6 +50,7 @@ import org.springframework.amqp.rabbit.listener.DirectMessageListenerContainer;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -74,6 +75,7 @@ import static java.math.BigDecimal.ROUND_HALF_DOWN;
public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, DeviceEntity, Long> implements DeviceService {
@Autowired
@Lazy
private ProductService productService;
@Autowired
private PlatformService platformService;
......@@ -81,7 +83,6 @@ public class DeviceServiceImpl extends AbstractCRUDCacheServiceImpl<DeviceDao, D
private ISiteFeign siteFeign;
@Autowired
private DeviceLogService deviceLogService;
@Autowired
private MessageProducer messageProducer;
@Autowired
......
......@@ -10,6 +10,7 @@ import com.mortals.framework.model.Context;
import com.mortals.framework.model.OrderCol;
import com.mortals.framework.util.FileUtil;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.annotation.DataPermission;
import com.mortals.xhx.base.system.param.service.ParamService;
import com.mortals.xhx.base.system.upload.service.UploadService;
import com.mortals.xhx.common.code.*;
......@@ -119,6 +120,12 @@ public class DeviceController extends BaseCRUDJsonBodyMappingController<DeviceSe
super.init(model, context);
}
@Override
@DataPermission
public Rest<Object> list(@RequestBody DeviceEntity query) {
return super.list(query);
}
@Override
protected void doListBefore(DeviceEntity query, Map<String, Object> model, Context context) throws AppException {
if (ObjectUtils.isEmpty(query.getOrderColList())) {
......
......@@ -18,7 +18,6 @@ import com.mortals.xhx.common.key.QueueKey;
import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.utils.BeanUtil;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
......@@ -39,6 +38,7 @@ import com.mortals.xhx.queue.TbQueueMsgHeaders;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
......@@ -65,8 +65,10 @@ import static com.mortals.xhx.common.key.ErrorCode.DEVICE_VERSION_UNEXIST_CONTEN
public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao, ProductEntity, Long> implements ProductService {
@Autowired
@Lazy
private ProductVersionService productVersionService;
@Autowired
@Lazy
private DeviceService deviceService;
@Autowired
private PlatformService platformService;
......@@ -74,8 +76,7 @@ public class ProductServiceImpl extends AbstractCRUDCacheServiceImpl<ProductDao,
private DeviceLogService deviceLogService;
@Autowired
private MessageProducer messageProducer;
@Autowired
private ISiteFeign siteFeign;
@Override
protected String getExtKey(ProductEntity data) {
......
......@@ -20,7 +20,9 @@ import com.mortals.xhx.common.model.DefaultTbQueueMsgHeaders;
import com.mortals.xhx.common.model.MessageHeader;
import com.mortals.xhx.common.pdu.site.SitePdu;
import com.mortals.xhx.feign.site.ISiteFeign;
import com.mortals.xhx.module.device.model.*;
import com.mortals.xhx.module.device.model.DeviceEntity;
import com.mortals.xhx.module.device.model.DeviceLogEntity;
import com.mortals.xhx.module.device.model.DeviceQuery;
import com.mortals.xhx.module.device.service.DeviceLogService;
import com.mortals.xhx.module.device.service.DeviceService;
import com.mortals.xhx.module.product.dao.ProductVersionDao;
......
......@@ -17,9 +17,9 @@
<property name="showSql" value="MySql" />
</plugin>
<!-- <plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<plugin interceptor="com.mortals.framework.thirty.mybatis.LogInterceptor">
<property name="enableExecutorTime" value="true" />
<property name="showSql" value="false" />
</plugin>-->
<property name="showSql" value="true" />
</plugin>
</plugins>
</configuration>
\ No newline at end of file
......@@ -1067,6 +1067,10 @@
<!-- 条件映射-代参数 -->
<sql id="_condition_param_">
<bind name="conditionParamRef" value="${_conditionParam_}"/>
<if test="permissionSql != null and permissionSql != ''">
${permissionSql}
</if>
<if test="conditionParamRef.containsKey('id')">
<if test="conditionParamRef.id != null">
${_conditionType_} a.id=#{${_conditionParam_}.id}
......
......@@ -4,9 +4,8 @@ POST {{baseUrl}}/login/login
Content-Type: application/json
{
"loginName":"admin",
"password":"admin",
"securityCode":"8888"
"loginName":"xinhx",
"password":"xhxADMIN8@a"
}
> {%
......@@ -15,6 +14,17 @@ client.global.set("authToken", JSON.parse(response.body).data.token);
%}
###设备列表
POST {{baseUrl}}/device/list
Authorization: {{authToken}}
Content-Type: application/json
{
"page": 1,
"size": 10,
"source": 1
}
###首页
POST {{baseUrl}}/login/index
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment