From e8ec83cee59d80d71d7350110d9f1cd10f8dafeb Mon Sep 17 00:00:00 2001 From: dongsk Date: Tue, 30 Apr 2024 13:20:50 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B8=83=E5=B1=80CRUD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../athena/app/infra/entity/LayoutConfig.java | 40 +++++++++++++++++++ .../repository/LayoutConfigRepository.java | 20 ++++++++++ .../service/Impl/LayoutConfigServiceImpl.java | 16 ++++++++ .../infra/service/LayoutConfigService.java | 7 ++++ .../athena/app/provider/BasicApiService.java | 7 ++++ .../provider/impl/BasicApiServiceImpl.java | 24 +++++++++++ 6 files changed, 114 insertions(+) create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/LayoutConfig.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/LayoutConfigRepository.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/LayoutConfigServiceImpl.java create mode 100644 demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/LayoutConfigService.java diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/LayoutConfig.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/LayoutConfig.java new file mode 100644 index 0000000..7f7f2ee --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/entity/LayoutConfig.java @@ -0,0 +1,40 @@ +/* + * Author: DONGSK + * Datetime: 2024/4/25 16:43 + * Description: + * History: + * 作者姓名 --修改时间 --版本号--描述 + */ +package com.digiwin.athena.app.infra.entity; + +import com.baomidou.mybatisplus.annotation.TableField; +import com.baomidou.mybatisplus.annotation.TableName; +import com.baomidou.mybatisplus.extension.activerecord.Model; +import lombok.Data; + +import java.io.Serializable; + +/** + * DigiwinSummit + * + * @author DONGSK 2024/4/25 16:43 + * @since 1.0.0 + */ +@Data +@TableName(value = "layout_config", autoResultMap = true) +public class LayoutConfig extends Model implements Serializable { + @TableField(value = "sys_id") + String sysId; + @TableField(value = "user_id") + String userId; + @TableField(value = "tenant_id") + String tenantId; + @TableField(value = "top") + String top; + @TableField(value = "left") + String left; + @TableField(value = "height") + String height; + @TableField(value = "width") + String width; +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/LayoutConfigRepository.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/LayoutConfigRepository.java new file mode 100644 index 0000000..e05ebc6 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/repository/LayoutConfigRepository.java @@ -0,0 +1,20 @@ +/* + * Author: DONGSK + * Datetime: 2024/4/25 16:49 + * Description: + * History: + * 作者姓名 --修改时间 --版本号--描述 + */ +package com.digiwin.athena.app.infra.repository; + +import com.digiwin.athena.app.infra.entity.LayoutConfig; +import com.digiwin.athena.opt.persistence.repository.BaseRepository; + +/** + * DigiwinSummitRepository + * + * @author DONGSK 2024/4/25 16:49 + * @since 1.0.0 + */ +public interface LayoutConfigRepository extends BaseRepository { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/LayoutConfigServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/LayoutConfigServiceImpl.java new file mode 100644 index 0000000..7158a33 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/Impl/LayoutConfigServiceImpl.java @@ -0,0 +1,16 @@ +package com.digiwin.athena.app.infra.service.Impl; + +import com.digiwin.athena.app.infra.entity.LayoutConfig; +import com.digiwin.athena.app.infra.repository.LayoutConfigRepository; +import com.digiwin.athena.app.infra.service.LayoutConfigService; +import com.digiwin.athena.opt.persistence.service.impl.AbsBaseService; +import org.springframework.stereotype.Service; + +/** + * @author zhenggl + * create: 2023-04-28 + * Description: + */ +@Service +public class LayoutConfigServiceImpl extends AbsBaseService implements LayoutConfigService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/LayoutConfigService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/LayoutConfigService.java new file mode 100644 index 0000000..212cfa3 --- /dev/null +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/infra/service/LayoutConfigService.java @@ -0,0 +1,7 @@ +package com.digiwin.athena.app.infra.service; + +import com.digiwin.athena.app.infra.entity.LayoutConfig; +import com.digiwin.athena.opt.persistence.service.IBaseService; + +public interface LayoutConfigService extends IBaseService { +} diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/BasicApiService.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/BasicApiService.java index 97e773b..deb5fc3 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/BasicApiService.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/BasicApiService.java @@ -13,6 +13,7 @@ import com.digiwin.app.service.restful.DWPathVariable; import com.digiwin.app.service.restful.DWRequestMapping; import com.digiwin.app.service.restful.DWRequestMethod; import com.digiwin.app.service.restful.DWRestfulService; +import com.digiwin.athena.app.infra.entity.LayoutConfig; import java.util.Map; @@ -41,6 +42,12 @@ public interface BasicApiService extends DWService { @DWRequestMapping(path = "/api/clear/login", method = DWRequestMethod.GET) Object clearLogin() throws Exception; + @AllowAnonymous + @DWRequestMapping(path = "/api/517/config/save", method = DWRequestMethod.POST) + Object layoutConfig(LayoutConfig layoutConfig) throws Exception; + @AllowAnonymous + @DWRequestMapping(path = "/api/517/config/list", method = DWRequestMethod.GET) + Object layoutConfig(String userId, String tenantId, String sysId) throws Exception; } \ No newline at end of file diff --git a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java index d7a1f88..99f5e66 100644 --- a/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java +++ b/demo-athenaopt_backend/develop/src/main/java/com/digiwin/athena/app/provider/impl/BasicApiServiceImpl.java @@ -9,10 +9,14 @@ package com.digiwin.athena.app.provider.impl; import com.alibaba.fastjson.JSON; +import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper; import com.digiwin.app.service.DWServiceContext; +import com.digiwin.athena.app.infra.entity.LayoutConfig; +import com.digiwin.athena.app.infra.service.LayoutConfigService; import com.digiwin.athena.app.provider.BasicApiService; import com.digiwin.athena.app.service.basic.LoginService; import com.digiwin.athena.opt.common.eai.service.EAIServiceContext; +import org.apache.commons.lang.StringUtils; import javax.annotation.Resource; import java.util.HashMap; @@ -32,6 +36,9 @@ public class BasicApiServiceImpl implements BasicApiService { @Resource LoginService loginService; + @Resource + LayoutConfigService layoutConfigService; + @Override public String helloWord(String name) throws Exception { return "hello ," + name; @@ -63,4 +70,21 @@ public class BasicApiServiceImpl implements BasicApiService { return "ok"; } + @Override + public Object layoutConfig(LayoutConfig layoutConfig) throws Exception { + return layoutConfigService.saveOrUpdate(layoutConfig); + } + + @Override + public Object layoutConfig(String userId, String tenantId, String sysId) throws Exception { + + LambdaQueryChainWrapper lambdaQuery = layoutConfigService.lambdaQuery(); + lambdaQuery.eq(LayoutConfig::getUserId, userId); + lambdaQuery.eq(LayoutConfig::getTenantId, tenantId); + if (StringUtils.isNotBlank(sysId)) { + lambdaQuery.eq(LayoutConfig::getSysId, sysId); + } + return lambdaQuery.list(); + } + }