【8.0】【expand】删除expand模块

pull/57/head
fengshuonan 2023-07-11 18:35:31 +08:00
parent 91f3d46534
commit edff1cde65
45 changed files with 0 additions and 2280 deletions

View File

@ -1,40 +0,0 @@
*.class
# Package Files #
*.jar
*.war
*.ear
target/
# eclipse
.settings/
.classpath
.project
logs/
# idea
.idea/
*.iml
*velocity.log*
### STS ###
.apt_generated
.factorypath
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.ipr
### NetBeans ###
nbproject/private/
build/
nbbuild/
dist/
nbdist/
.nb-gradle/
*.log
tmp/

View File

@ -1 +0,0 @@
# 拓展字段

View File

@ -1 +0,0 @@
# api模块存放接口、常量、异常、枚举等模块规则相关类

View File

@ -1,37 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-s-expand</artifactId>
<version>8.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>expand-api</artifactId>
<packaging>jar</packaging>
<dependencies>
<!--config模块的api-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>config-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--参数校验模块-->
<!--用在控制器,参数校验-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>validator-api</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,65 +0,0 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.expand.modular.api;
import cn.stylefeng.roses.kernel.expand.modular.api.pojo.ExpandDataInfo;
import cn.stylefeng.roses.kernel.expand.modular.api.pojo.ExpandFieldInfo;
import java.util.List;
import java.util.Map;
/**
* Api
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
public interface ExpandApi {
/**
*
*
* @author fengshuonan
* @since 2022/3/31 21:20
*/
void saveOrUpdateExpandData(ExpandDataInfo expandDataInfo);
/**
*
*
* @author fengshuonan
* @since 2022/4/1 9:48
*/
List<ExpandFieldInfo> getPageListExpandFieldList(String expandCode);
/**
*
*
* @author fengshuonan
* @since 2022/4/1 9:55
*/
Map<String, Object> getExpandDataInfo(String expandCode, Long primaryFieldValue);
}

View File

@ -1,45 +0,0 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.expand.modular.api.constants;
/**
*
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
public interface ExpandConstants {
/**
*
*/
String EXPAND_MODULE_NAME = "kernel-s-expand";
/**
*
*/
String EXPAND_EXCEPTION_STEP_CODE = "99";
}

View File

@ -1,33 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.api.enums;
import lombok.Getter;
/**
*
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
@Getter
public enum DemoEnum {
/**
* markdown
*/
MARKDOWN(1, "markdown格式"),
/**
*
*/
TEXT(2, "富文本格式");
private final Integer code;
private final String message;
DemoEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
}

View File

@ -1,35 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.api.enums;
import lombok.Getter;
/**
*
*
* @author fengshuonan
* @since 2022/4/1 10:34
*/
@Getter
public enum FieldTypeEnum {
/**
*
*/
STR(1),
/**
*
*/
NUM(2),
/**
*
*/
DICT(3);
private final Integer code;
FieldTypeEnum(Integer code) {
this.code = code;
}
}

View File

@ -1,48 +0,0 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.expand.modular.api.exception;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.expand.modular.api.constants.ExpandConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
/**
*
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
public class ExpandException extends ServiceException {
public ExpandException(AbstractExceptionEnum exception, Object... params) {
super(ExpandConstants.EXPAND_MODULE_NAME, exception.getErrorCode(), StrUtil.format(exception.getUserTip(), params));
}
public ExpandException(AbstractExceptionEnum exception) {
super(ExpandConstants.EXPAND_MODULE_NAME, exception);
}
}

View File

@ -1,61 +0,0 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.expand.modular.api.exception.enums;
import cn.stylefeng.roses.kernel.expand.modular.api.constants.ExpandConstants;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;
/**
*
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
@Getter
public enum ExpandExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
CANT_FIND_EXPAND(RuleConstants.BUSINESS_ERROR_TYPE_CODE + ExpandConstants.EXPAND_EXCEPTION_STEP_CODE + "01", "查询不到对应拓展字段,具体信息:{}");
/**
*
*/
private final String errorCode;
/**
*
*/
private final String userTip;
ExpandExceptionEnum(String errorCode, String userTip) {
this.errorCode = errorCode;
this.userTip = userTip;
}
}

View File

@ -1,31 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.api.pojo;
import lombok.Data;
import java.util.Map;
/**
*
*
* @author fengshuonan
* @since 2022/3/31 21:25
*/
@Data
public class ExpandDataInfo {
/**
* id
*/
private Long expandId;
/**
*
*/
private Map<String, Object> expandData;
/**
*
*/
private Long primaryFieldValue;
}

View File

@ -1,29 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.api.pojo;
import lombok.Data;
/**
*
*
* @author fengshuonan
* @since 2022/4/1 9:46
*/
@Data
public class ExpandFieldInfo {
/**
* id
*/
private Long expandId;
/**
*
*/
private String fieldName;
/**
*
*/
private String fieldCode;
}

View File

@ -1 +0,0 @@
# 业务模块-存放CRUD相关业务

View File

@ -1,66 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-s-expand</artifactId>
<version>8.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>expand-business</artifactId>
<packaging>jar</packaging>
<dependencies>
<!--拓展字段api-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>expand-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--system业务api-->
<!--调用用户相关业务-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>sys-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--资源api模块-->
<!--用在资源控制器,资源扫描上-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>scanner-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--字典api模块-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>dict-api</artifactId>
<version>${roses.version}</version>
</dependency>
<!--数据库sdk-->
<!--数据库dao框架-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>db-sdk-mp</artifactId>
<version>${roses.version}</version>
</dependency>
<!--web模块-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -1,143 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.api.ExpandApi;
import cn.stylefeng.roses.kernel.expand.modular.api.pojo.ExpandFieldInfo;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpand;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandService;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@RestController
@ApiResource(name = "业务拓展", resBizType = ResBizTypeEnum.SYSTEM)
public class SysExpandController {
@Resource
private SysExpandService sysExpandService;
@Resource
private ExpandApi expandApi;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "添加", path = "/sysExpand/add")
public ResponseData<SysExpand> add(@RequestBody @Validated(SysExpandRequest.add.class) SysExpandRequest sysExpandRequest) {
sysExpandService.add(sysExpandRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "删除", path = "/sysExpand/delete")
public ResponseData<?> delete(@RequestBody @Validated(SysExpandRequest.delete.class) SysExpandRequest sysExpandRequest) {
sysExpandService.del(sysExpandRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "编辑", path = "/sysExpand/edit")
public ResponseData<?> edit(@RequestBody @Validated(SysExpandRequest.edit.class) SysExpandRequest sysExpandRequest) {
sysExpandService.edit(sysExpandRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "修改业务状态", path = "/sysExpand/updateStatus")
public ResponseData<?> updateStatus(@RequestBody @Validated(BaseRequest.updateStatus.class) SysExpandRequest sysExpandRequest) {
sysExpandService.updateStatus(sysExpandRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "查看详情", path = "/sysExpand/detail")
public ResponseData<SysExpand> detail(@Validated(SysExpandRequest.detail.class) SysExpandRequest sysExpandRequest) {
return new SuccessResponseData<>(sysExpandService.detail(sysExpandRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "根据业务编码获取业务数据详情", path = "/sysExpand/getByExpandCode")
public ResponseData<SysExpandData> getByExpandCode(@Validated(SysExpandRequest.getByExpandCode.class) SysExpandRequest sysExpandRequest) {
return new SuccessResponseData<>(sysExpandService.getByExpandCode(sysExpandRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "获取列表", path = "/sysExpand/list")
public ResponseData<List<SysExpand>> list(SysExpandRequest sysExpandRequest) {
return new SuccessResponseData<>(sysExpandService.findList(sysExpandRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "分页查询", path = "/sysExpand/page")
public ResponseData<PageResult<SysExpand>> page(SysExpandRequest sysExpandRequest) {
return new SuccessResponseData<>(sysExpandService.findPage(sysExpandRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "获取某个业务,需要列表展示的拓展字段", path = "/sysExpand/getListFields")
public ResponseData<List<ExpandFieldInfo>> getListFields(@Validated(SysExpandRequest.getByExpandCode.class) SysExpandRequest sysExpandRequest) {
return new SuccessResponseData<>(expandApi.getPageListExpandFieldList(sysExpandRequest.getExpandCode()));
}
}

View File

@ -1,78 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandDataRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandDataService;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@RestController
@ApiResource(name = "业务拓展-具体数据", resBizType = ResBizTypeEnum.SYSTEM)
public class SysExpandDataController {
@Resource
private SysExpandDataService sysExpandDataService;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "删除", path = "/sysExpandData/delete")
public ResponseData<?> delete(@RequestBody @Validated(SysExpandDataRequest.delete.class) SysExpandDataRequest sysExpandDataRequest) {
sysExpandDataService.del(sysExpandDataRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "查看详情", path = "/sysExpandData/detail")
public ResponseData<SysExpandData> detail(@Validated(SysExpandDataRequest.detail.class) SysExpandDataRequest sysExpandDataRequest) {
return new SuccessResponseData<>(sysExpandDataService.detail(sysExpandDataRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "获取列表", path = "/sysExpandData/list")
public ResponseData<List<SysExpandData>> list(SysExpandDataRequest sysExpandDataRequest) {
return new SuccessResponseData<>(sysExpandDataService.findList(sysExpandDataRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "分页查询", path = "/sysExpandData/page")
public ResponseData<PageResult<SysExpandData>> page(SysExpandDataRequest sysExpandDataRequest) {
return new SuccessResponseData<>(sysExpandDataService.findPage(sysExpandDataRequest));
}
}

View File

@ -1,102 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.controller;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandFieldRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandFieldService;
import cn.stylefeng.roses.kernel.rule.enums.ResBizTypeEnum;
import cn.stylefeng.roses.kernel.rule.pojo.response.ResponseData;
import cn.stylefeng.roses.kernel.rule.pojo.response.SuccessResponseData;
import cn.stylefeng.roses.kernel.scanner.api.annotation.ApiResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.GetResource;
import cn.stylefeng.roses.kernel.scanner.api.annotation.PostResource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@RestController
@ApiResource(name = "业务拓展-字段信息", resBizType = ResBizTypeEnum.SYSTEM)
public class SysExpandFieldController {
@Resource
private SysExpandFieldService sysExpandFieldService;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "添加", path = "/sysExpandField/add")
public ResponseData<SysExpandField> add(@RequestBody @Validated(SysExpandFieldRequest.add.class) SysExpandFieldRequest sysExpandFieldRequest) {
sysExpandFieldService.add(sysExpandFieldRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "删除", path = "/sysExpandField/delete")
public ResponseData<?> delete(@RequestBody @Validated(SysExpandFieldRequest.delete.class) SysExpandFieldRequest sysExpandFieldRequest) {
sysExpandFieldService.del(sysExpandFieldRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@PostResource(name = "编辑", path = "/sysExpandField/edit")
public ResponseData<?> edit(@RequestBody @Validated(SysExpandFieldRequest.edit.class) SysExpandFieldRequest sysExpandFieldRequest) {
sysExpandFieldService.edit(sysExpandFieldRequest);
return new SuccessResponseData<>();
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "查看详情", path = "/sysExpandField/detail")
public ResponseData<SysExpandField> detail(@Validated(SysExpandFieldRequest.detail.class) SysExpandFieldRequest sysExpandFieldRequest) {
return new SuccessResponseData<>(sysExpandFieldService.detail(sysExpandFieldRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "获取列表", path = "/sysExpandField/list")
public ResponseData<List<SysExpandField>> list(SysExpandFieldRequest sysExpandFieldRequest) {
return new SuccessResponseData<>(sysExpandFieldService.findList(sysExpandFieldRequest));
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@GetResource(name = "分页查询", path = "/sysExpandField/page")
public ResponseData<PageResult<SysExpandField>> page(SysExpandFieldRequest sysExpandFieldRequest) {
return new SuccessResponseData<>(sysExpandFieldService.findPage(sysExpandFieldRequest));
}
}

View File

@ -1,73 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@TableName("sys_expand")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysExpand extends BaseEntity {
/**
* id
*/
@TableId(value = "expand_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long expandId;
/**
*
*/
@TableField("expand_name")
@ChineseDescription("拓展业务名称")
private String expandName;
/**
*
*/
@TableField("expand_code")
@ChineseDescription("拓展业务唯一编码")
private String expandCode;
/**
* 1-2-
*/
@TableField("expand_status")
@ChineseDescription("状态1-启用2-禁用")
private Integer expandStatus;
/**
* sys_user
*/
@TableField("primary_table_name")
@ChineseDescription("主业务表例如sys_user")
private String primaryTableName;
/**
* iduser_id
*/
@TableField("primary_field_name")
@ChineseDescription("业务主键id字段名例如user_id")
private String primaryFieldName;
/**
* iduserId
*/
@TableField("primary_field_camel")
@ChineseDescription("业务主键id字段名驼峰法例如userId")
private String primaryFieldCamel;
}

View File

@ -1,65 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@TableName("sys_expand_data")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysExpandData extends BaseEntity {
/**
* id
*/
@TableId(value = "expand_data_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long expandDataId;
/**
* id
*/
@TableField("expand_id")
@ChineseDescription("拓展业务id")
private Long expandId;
/**
* id
*/
@TableField("primary_field_value")
@ChineseDescription("业务主键id")
private Long primaryFieldValue;
/**
*
*/
@TableField("expand_data")
@ChineseDescription("拓展业务具体数据")
private String expandData;
/**
*
*/
@ChineseDescription("拓展业务信息")
private transient SysExpand expandInfo;
/**
*
*/
@ChineseDescription("字段元数据信息列表")
private transient List<SysExpandField> fieldInfoList;
}

View File

@ -1,86 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.entity;
import cn.stylefeng.roses.kernel.db.api.pojo.entity.BaseEntity;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@TableName("sys_expand_field")
@Data
@EqualsAndHashCode(callSuper = true)
public class SysExpandField extends BaseEntity {
/**
* id
*/
@TableId(value = "field_id", type = IdType.ASSIGN_ID)
@ChineseDescription("主键id")
private Long fieldId;
/**
* id
*/
@TableField("expand_id")
@ChineseDescription("对应拓展业务的主键id")
private Long expandId;
/**
*
*/
@TableField("field_name")
@ChineseDescription("字段中文名称,例如:身份证号")
private String fieldName;
/**
* idCard
*/
@TableField("field_code")
@ChineseDescription("字段英文名称例如idCard")
private String fieldCode;
/**
* 1-2-3-
*/
@TableField("field_type")
@ChineseDescription("字段类型1-字符串类型2-数字类型3-字典类型")
private Integer fieldType;
/**
* Y-N-
*/
@TableField("field_required")
@ChineseDescription("是否必填Y-必填N-非必填")
private String fieldRequired;
/**
*
*/
@TableField("field_length")
@ChineseDescription("属性值长度,用于数字类型")
private Integer fieldLength;
/**
*
*/
@TableField("field_dict_type_code")
@ChineseDescription("字典类型编码,用于字典类型")
private String fieldDictTypeCode;
/**
* Y-N-
*/
@TableField("list_show_flag")
@ChineseDescription("列表是否显示Y-显示N-不显示")
private String listShowFlag;
}

View File

@ -1,36 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.enums;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Getter
public enum SysExpandDataExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
SYS_EXPAND_DATA_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
/**
*
*/
private final String errorCode;
/**
*
*/
private final String userTip;
SysExpandDataExceptionEnum(String errorCode, String userTip) {
this.errorCode = errorCode;
this.userTip = userTip;
}
}

View File

@ -1,36 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.enums;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Getter
public enum SysExpandExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
SYS_EXPAND_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
/**
*
*/
private final String errorCode;
/**
*
*/
private final String userTip;
SysExpandExceptionEnum(String errorCode, String userTip) {
this.errorCode = errorCode;
this.userTip = userTip;
}
}

View File

@ -1,36 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.enums;
import cn.stylefeng.roses.kernel.rule.constants.RuleConstants;
import cn.stylefeng.roses.kernel.rule.exception.AbstractExceptionEnum;
import lombok.Getter;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Getter
public enum SysExpandFieldExceptionEnum implements AbstractExceptionEnum {
/**
*
*/
SYS_EXPAND_FIELD_NOT_EXISTED(RuleConstants.USER_OPERATION_ERROR_TYPE_CODE + "10001", "查询结果不存在");
/**
*
*/
private final String errorCode;
/**
*
*/
private final String userTip;
SysExpandFieldExceptionEnum(String errorCode, String userTip) {
this.errorCode = errorCode;
this.userTip = userTip;
}
}

View File

@ -1,14 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.mapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* - Mapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandDataMapper extends BaseMapper<SysExpandData> {
}

View File

@ -1,14 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.mapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* - Mapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandFieldMapper extends BaseMapper<SysExpandField> {
}

View File

@ -1,14 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.mapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpand;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* Mapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandMapper extends BaseMapper<SysExpand> {
}

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandDataMapper">
</mapper>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandFieldMapper">
</mapper>

View File

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandMapper">
</mapper>

View File

@ -1,45 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotNull;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysExpandDataRequest extends BaseRequest {
/**
* id
*/
@NotNull(message = "主键id不能为空", groups = {edit.class, delete.class, detail.class})
@ChineseDescription("主键id")
private Long expandDataId;
/**
* id
*/
@ChineseDescription("拓展业务id")
private Long expandId;
/**
* id
*/
@ChineseDescription("业务主键id")
private Long primaryFieldValue;
/**
*
*/
@ChineseDescription("拓展业务具体数据")
private String expandData;
}

View File

@ -1,82 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysExpandFieldRequest extends BaseRequest {
/**
* id
*/
@NotNull(message = "主键id不能为空", groups = {edit.class, delete.class})
@ChineseDescription("主键id")
private Long fieldId;
/**
* id
*/
@NotNull(message = "对应拓展业务的主键id不能为空", groups = {add.class, edit.class, page.class})
@ChineseDescription("对应拓展业务的主键id")
private Long expandId;
/**
*
*/
@NotBlank(message = "字段中文名称,例如:身份证号不能为空", groups = {add.class, edit.class})
@ChineseDescription("字段中文名称,例如:身份证号")
private String fieldName;
/**
* idCard
*/
@NotBlank(message = "字段英文名称例如idCard不能为空", groups = {add.class, edit.class})
@ChineseDescription("字段英文名称例如idCard")
private String fieldCode;
/**
* 1-2-3-
*/
@ChineseDescription("字段类型1-字符串类型2-数字类型3-字典类型")
@NotNull(message = "字典类型不能为空", groups = {add.class, edit.class})
private Integer fieldType;
/**
* Y-N-
*/
@ChineseDescription("是否必填Y-必填N-非必填")
@NotBlank(message = "是否必填不能为空", groups = {add.class, edit.class})
private String fieldRequired;
/**
*
*/
@ChineseDescription("属性值长度,用于数字类型")
private Integer fieldLength;
/**
*
*/
@ChineseDescription("字典类型编码,用于字典类型")
private String fieldDictTypeCode;
/**
* Y-N-
*/
@ChineseDescription("列表是否显示Y-显示N-不显示")
@NotBlank(message = "列表是否显示不能为空", groups = {add.class, edit.class})
private String listShowFlag;
}

View File

@ -1,84 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request;
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
import cn.stylefeng.roses.kernel.rule.pojo.request.BaseRequest;
import cn.stylefeng.roses.kernel.validator.api.validators.status.StatusValue;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@EqualsAndHashCode(callSuper = true)
@Data
public class SysExpandRequest extends BaseRequest {
/**
* id
*/
@NotNull(message = "主键id不能为空", groups = {edit.class, delete.class, updateStatus.class})
@ChineseDescription("主键id")
private Long expandId;
/**
*
*/
@ChineseDescription("拓展业务名称")
private String expandName;
/**
*
*/
@ChineseDescription("拓展业务唯一编码")
@NotBlank(message = "拓展编码不能为空", groups = getByExpandCode.class)
private String expandCode;
/**
* 1-2-
*/
@ChineseDescription("状态1-启用2-禁用")
@NotNull(message = "状态不能为空", groups = {updateStatus.class})
@StatusValue(groups = updateStatus.class)
private Integer expandStatus;
/**
* sys_user
*/
@ChineseDescription("主业务表例如sys_user")
private String primaryTableName;
/**
* iduser_id
*/
@ChineseDescription("业务主键id字段名例如user_id")
private String primaryFieldName;
/**
* iduserId
*/
@ChineseDescription("业务主键id字段名驼峰法例如userId")
private String primaryFieldCamel;
/**
* id
*/
@ChineseDescription("业务主键id的值")
private Long primaryFieldValue;
/**
*
*
* @author fengshuonan
* @since 2022/3/31 15:25
*/
public @interface getByExpandCode {
}
}

View File

@ -1,82 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandDataRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandDataService extends IService<SysExpandData> {
/**
*
*
* @param sysExpandDataRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void add(SysExpandDataRequest sysExpandDataRequest);
/**
*
*
* @param sysExpandDataRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void del(SysExpandDataRequest sysExpandDataRequest);
/**
*
*
* @param sysExpandDataRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void edit(SysExpandDataRequest sysExpandDataRequest);
/**
*
*
* @param sysExpandDataRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
SysExpandData detail(SysExpandDataRequest sysExpandDataRequest);
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
SysExpandData detailByPrimaryFieldValue(Long primaryFieldValue);
/**
*
*
* @param sysExpandDataRequest
* @return List<SysExpandData>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
List<SysExpandData> findList(SysExpandDataRequest sysExpandDataRequest);
/**
*
*
* @param sysExpandDataRequest
* @return PageResult<SysExpandData>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
PageResult<SysExpandData> findPage(SysExpandDataRequest sysExpandDataRequest);
}

View File

@ -1,74 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandFieldRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandFieldService extends IService<SysExpandField> {
/**
*
*
* @param sysExpandFieldRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void add(SysExpandFieldRequest sysExpandFieldRequest);
/**
*
*
* @param sysExpandFieldRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void del(SysExpandFieldRequest sysExpandFieldRequest);
/**
*
*
* @param sysExpandFieldRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void edit(SysExpandFieldRequest sysExpandFieldRequest);
/**
*
*
* @param sysExpandFieldRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
SysExpandField detail(SysExpandFieldRequest sysExpandFieldRequest);
/**
*
*
* @param sysExpandFieldRequest
* @return List<SysExpandField>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
List<SysExpandField> findList(SysExpandFieldRequest sysExpandFieldRequest);
/**
*
*
* @param sysExpandFieldRequest
* @return PageResult<SysExpandField>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
PageResult<SysExpandField> findPage(SysExpandFieldRequest sysExpandFieldRequest);
}

View File

@ -1,91 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.api.ExpandApi;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpand;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandRequest;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
public interface SysExpandService extends IService<SysExpand>, ExpandApi {
/**
*
*
* @param sysExpandRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void add(SysExpandRequest sysExpandRequest);
/**
*
*
* @param sysExpandRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void del(SysExpandRequest sysExpandRequest);
/**
*
*
* @param sysExpandRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
void edit(SysExpandRequest sysExpandRequest);
/**
*
*
* @param sysExpandRequest
* @author fengshuonan
* @since 2022/03/29 23:47
*/
SysExpand detail(SysExpandRequest sysExpandRequest);
/**
*
*
* @param sysExpandRequest
* @return List<SysExpand>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
List<SysExpand> findList(SysExpandRequest sysExpandRequest);
/**
*
*
* @param sysExpandRequest
* @return PageResult<SysExpand>
* @author fengshuonan
* @since 2022/03/29 23:47
*/
PageResult<SysExpand> findPage(SysExpandRequest sysExpandRequest);
/**
*
*
* @author fengshuonan
* @since 2022/3/30 10:37
*/
void updateStatus(SysExpandRequest sysExpandRequest);
/**
*
*
* @author fengshuonan
* @since 2022/3/31 15:26
*/
SysExpandData getByExpandCode(SysExpandRequest sysExpandRequest);
}

View File

@ -1,140 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpand;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import cn.stylefeng.roses.kernel.expand.modular.modular.enums.SysExpandDataExceptionEnum;
import cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandDataMapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandDataRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandFieldRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandDataService;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandFieldService;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandService;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Service
public class SysExpandDataServiceImpl extends ServiceImpl<SysExpandDataMapper, SysExpandData> implements SysExpandDataService {
@Resource
private SysExpandService sysExpandService;
@Resource
private SysExpandFieldService sysExpandFieldService;
@Override
public void add(SysExpandDataRequest sysExpandDataRequest) {
SysExpandData sysExpandData = new SysExpandData();
BeanUtil.copyProperties(sysExpandDataRequest, sysExpandData);
this.save(sysExpandData);
}
@Override
public void del(SysExpandDataRequest sysExpandDataRequest) {
SysExpandData sysExpandData = this.querySysExpandData(sysExpandDataRequest);
this.removeById(sysExpandData.getExpandDataId());
}
@Override
public void edit(SysExpandDataRequest sysExpandDataRequest) {
SysExpandData sysExpandData = this.querySysExpandData(sysExpandDataRequest);
BeanUtil.copyProperties(sysExpandDataRequest, sysExpandData);
this.updateById(sysExpandData);
}
@Override
public SysExpandData detail(SysExpandDataRequest sysExpandDataRequest) {
// 获取拓展数据详情
SysExpandData sysExpandData = this.querySysExpandData(sysExpandDataRequest);
// 获取拓展业务信息
SysExpandRequest sysExpandRequest = new SysExpandRequest();
sysExpandRequest.setExpandId(sysExpandData.getExpandId());
SysExpand detail = sysExpandService.detail(sysExpandRequest);
// 获取拓展业务的字段信息
SysExpandFieldRequest sysExpandFieldRequest = new SysExpandFieldRequest();
sysExpandFieldRequest.setExpandId(sysExpandData.getExpandId());
List<SysExpandField> list = sysExpandFieldService.findList(sysExpandFieldRequest);
// 设置返回结果的元数据字段信息
sysExpandData.setExpandInfo(detail);
sysExpandData.setFieldInfoList(list);
return sysExpandData;
}
@Override
public SysExpandData detailByPrimaryFieldValue(Long primaryFieldValue) {
LambdaQueryWrapper<SysExpandData> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysExpandData::getPrimaryFieldValue, primaryFieldValue);
return this.getOne(wrapper, false);
}
@Override
public PageResult<SysExpandData> findPage(SysExpandDataRequest sysExpandDataRequest) {
LambdaQueryWrapper<SysExpandData> wrapper = createWrapper(sysExpandDataRequest);
Page<SysExpandData> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
return PageResultFactory.createPageResult(sysRolePage);
}
@Override
public List<SysExpandData> findList(SysExpandDataRequest sysExpandDataRequest) {
LambdaQueryWrapper<SysExpandData> wrapper = this.createWrapper(sysExpandDataRequest);
return this.list(wrapper);
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private SysExpandData querySysExpandData(SysExpandDataRequest sysExpandDataRequest) {
SysExpandData sysExpandData = this.getById(sysExpandDataRequest.getExpandDataId());
if (ObjectUtil.isEmpty(sysExpandData)) {
throw new ServiceException(SysExpandDataExceptionEnum.SYS_EXPAND_DATA_NOT_EXISTED);
}
return sysExpandData;
}
/**
* wrapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private LambdaQueryWrapper<SysExpandData> createWrapper(SysExpandDataRequest sysExpandDataRequest) {
LambdaQueryWrapper<SysExpandData> queryWrapper = new LambdaQueryWrapper<>();
Long expandDataId = sysExpandDataRequest.getExpandDataId();
Long expandId = sysExpandDataRequest.getExpandId();
Long primaryFieldValue = sysExpandDataRequest.getPrimaryFieldValue();
String expandData = sysExpandDataRequest.getExpandData();
queryWrapper.eq(ObjectUtil.isNotNull(expandDataId), SysExpandData::getExpandDataId, expandDataId);
queryWrapper.eq(ObjectUtil.isNotNull(expandId), SysExpandData::getExpandId, expandId);
queryWrapper.eq(ObjectUtil.isNotNull(primaryFieldValue), SysExpandData::getPrimaryFieldValue, primaryFieldValue);
queryWrapper.like(ObjectUtil.isNotEmpty(expandData), SysExpandData::getExpandData, expandData);
return queryWrapper;
}
}

View File

@ -1,98 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import cn.stylefeng.roses.kernel.expand.modular.modular.enums.SysExpandFieldExceptionEnum;
import cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandFieldMapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandFieldRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandFieldService;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* -
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Service
public class SysExpandFieldServiceImpl extends ServiceImpl<SysExpandFieldMapper, SysExpandField> implements SysExpandFieldService {
@Override
public void add(SysExpandFieldRequest sysExpandFieldRequest) {
SysExpandField sysExpandField = new SysExpandField();
BeanUtil.copyProperties(sysExpandFieldRequest, sysExpandField);
this.save(sysExpandField);
}
@Override
public void del(SysExpandFieldRequest sysExpandFieldRequest) {
SysExpandField sysExpandField = this.querySysExpandField(sysExpandFieldRequest);
this.removeById(sysExpandField.getFieldId());
}
@Override
public void edit(SysExpandFieldRequest sysExpandFieldRequest) {
SysExpandField sysExpandField = this.querySysExpandField(sysExpandFieldRequest);
BeanUtil.copyProperties(sysExpandFieldRequest, sysExpandField);
this.updateById(sysExpandField);
}
@Override
public SysExpandField detail(SysExpandFieldRequest sysExpandFieldRequest) {
return this.querySysExpandField(sysExpandFieldRequest);
}
@Override
public PageResult<SysExpandField> findPage(SysExpandFieldRequest sysExpandFieldRequest) {
LambdaQueryWrapper<SysExpandField> wrapper = createWrapper(sysExpandFieldRequest);
Page<SysExpandField> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
return PageResultFactory.createPageResult(sysRolePage);
}
@Override
public List<SysExpandField> findList(SysExpandFieldRequest sysExpandFieldRequest) {
LambdaQueryWrapper<SysExpandField> wrapper = this.createWrapper(sysExpandFieldRequest);
return this.list(wrapper);
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private SysExpandField querySysExpandField(SysExpandFieldRequest sysExpandFieldRequest) {
SysExpandField sysExpandField = this.getById(sysExpandFieldRequest.getFieldId());
if (ObjectUtil.isEmpty(sysExpandField)) {
throw new ServiceException(SysExpandFieldExceptionEnum.SYS_EXPAND_FIELD_NOT_EXISTED);
}
return sysExpandField;
}
/**
* wrapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private LambdaQueryWrapper<SysExpandField> createWrapper(SysExpandFieldRequest sysExpandFieldRequest) {
LambdaQueryWrapper<SysExpandField> queryWrapper = new LambdaQueryWrapper<>();
Long expandId = sysExpandFieldRequest.getExpandId();
queryWrapper.eq(ObjectUtil.isNotNull(expandId), SysExpandField::getExpandId, expandId);
return queryWrapper;
}
}

View File

@ -1,263 +0,0 @@
package cn.stylefeng.roses.kernel.expand.modular.modular.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.stylefeng.roses.kernel.db.api.factory.PageFactory;
import cn.stylefeng.roses.kernel.db.api.factory.PageResultFactory;
import cn.stylefeng.roses.kernel.db.api.pojo.page.PageResult;
import cn.stylefeng.roses.kernel.dict.api.DictApi;
import cn.stylefeng.roses.kernel.expand.modular.api.enums.FieldTypeEnum;
import cn.stylefeng.roses.kernel.expand.modular.api.pojo.ExpandDataInfo;
import cn.stylefeng.roses.kernel.expand.modular.api.pojo.ExpandFieldInfo;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpand;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandData;
import cn.stylefeng.roses.kernel.expand.modular.modular.entity.SysExpandField;
import cn.stylefeng.roses.kernel.expand.modular.modular.enums.SysExpandExceptionEnum;
import cn.stylefeng.roses.kernel.expand.modular.modular.mapper.SysExpandMapper;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandFieldRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.pojo.request.SysExpandRequest;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandDataService;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandFieldService;
import cn.stylefeng.roses.kernel.expand.modular.modular.service.SysExpandService;
import cn.stylefeng.roses.kernel.rule.enums.StatusEnum;
import cn.stylefeng.roses.kernel.rule.enums.YesOrNotEnum;
import cn.stylefeng.roses.kernel.rule.exception.base.ServiceException;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
@Service
public class SysExpandServiceImpl extends ServiceImpl<SysExpandMapper, SysExpand> implements SysExpandService {
@Resource
private SysExpandFieldService sysExpandFieldService;
@Resource
private SysExpandDataService sysExpandDataService;
@Resource
private DictApi dictApi;
@Override
public void add(SysExpandRequest sysExpandRequest) {
SysExpand sysExpand = new SysExpand();
BeanUtil.copyProperties(sysExpandRequest, sysExpand);
// 设置启用状态
sysExpand.setExpandStatus(StatusEnum.ENABLE.getCode());
this.save(sysExpand);
}
@Override
public void del(SysExpandRequest sysExpandRequest) {
SysExpand sysExpand = this.querySysExpand(sysExpandRequest);
this.removeById(sysExpand.getExpandId());
}
@Override
public void edit(SysExpandRequest sysExpandRequest) {
SysExpand sysExpand = this.querySysExpand(sysExpandRequest);
BeanUtil.copyProperties(sysExpandRequest, sysExpand);
this.updateById(sysExpand);
}
@Override
public SysExpand detail(SysExpandRequest sysExpandRequest) {
return this.querySysExpand(sysExpandRequest);
}
@Override
public PageResult<SysExpand> findPage(SysExpandRequest sysExpandRequest) {
LambdaQueryWrapper<SysExpand> wrapper = createWrapper(sysExpandRequest);
Page<SysExpand> sysRolePage = this.page(PageFactory.defaultPage(), wrapper);
return PageResultFactory.createPageResult(sysRolePage);
}
@Override
public void updateStatus(SysExpandRequest sysExpandRequest) {
SysExpand sysExpand = this.querySysExpand(sysExpandRequest);
sysExpand.setExpandStatus(sysExpandRequest.getExpandStatus());
this.updateById(sysExpand);
}
@Override
public SysExpandData getByExpandCode(SysExpandRequest sysExpandRequest) {
// 根据编码获取拓展信息
LambdaQueryWrapper<SysExpand> sysExpandLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysExpandLambdaQueryWrapper.eq(SysExpand::getExpandCode, sysExpandRequest.getExpandCode());
SysExpand sysExpand = this.getOne(sysExpandLambdaQueryWrapper, false);
if (sysExpand == null) {
throw new ServiceException(SysExpandExceptionEnum.SYS_EXPAND_NOT_EXISTED);
}
// 获取拓展业务的字段信息
SysExpandFieldRequest sysExpandFieldRequest = new SysExpandFieldRequest();
sysExpandFieldRequest.setExpandId(sysExpand.getExpandId());
List<SysExpandField> list = sysExpandFieldService.findList(sysExpandFieldRequest);
// 如果传了主键id则查询一下业务表单的数据
SysExpandData sysExpandData = new SysExpandData();
if (sysExpandRequest.getPrimaryFieldValue() != null) {
sysExpandData = sysExpandDataService.detailByPrimaryFieldValue(sysExpandRequest.getPrimaryFieldValue());
if (sysExpandData == null) {
sysExpandData = new SysExpandData();
}
}
// 设置返回信息
sysExpandData.setExpandId(sysExpand.getExpandId());
sysExpandData.setFieldInfoList(list);
sysExpandData.setExpandInfo(sysExpand);
return sysExpandData;
}
@Override
public List<SysExpand> findList(SysExpandRequest sysExpandRequest) {
LambdaQueryWrapper<SysExpand> wrapper = this.createWrapper(sysExpandRequest);
wrapper.select(SysExpand::getExpandId, SysExpand::getExpandName, SysExpand::getExpandCode);
wrapper.eq(SysExpand::getExpandStatus, StatusEnum.ENABLE.getCode());
return this.list(wrapper);
}
@Override
public void saveOrUpdateExpandData(ExpandDataInfo expandDataInfo) {
if (expandDataInfo == null) {
return;
}
Map<String, Object> dynamicFormData = expandDataInfo.getExpandData();
if (dynamicFormData == null || dynamicFormData.size() <= 0) {
return;
}
// 具体数据转化为json
String dynamicData = JSON.toJSONString(dynamicFormData);
SysExpandData saveData = new SysExpandData();
saveData.setExpandId(expandDataInfo.getExpandId());
saveData.setPrimaryFieldValue(expandDataInfo.getPrimaryFieldValue());
saveData.setExpandData(dynamicData);
// 查询数据有没有在库中存在
LambdaQueryWrapper<SysExpandData> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(SysExpandData::getExpandId, expandDataInfo.getExpandId());
wrapper.eq(SysExpandData::getPrimaryFieldValue, expandDataInfo.getPrimaryFieldValue());
SysExpandData sysExpandData = this.sysExpandDataService.getOne(wrapper, false);
// 数据库中不存在,则保存
if (sysExpandData == null) {
this.sysExpandDataService.save(saveData);
} else {
saveData.setExpandDataId(sysExpandData.getExpandDataId());
this.sysExpandDataService.updateById(saveData);
}
}
@Override
public List<ExpandFieldInfo> getPageListExpandFieldList(String expandCode) {
SysExpandRequest sysExpandRequest = new SysExpandRequest();
sysExpandRequest.setExpandCode(expandCode);
SysExpandData sysExpandData = this.getByExpandCode(sysExpandRequest);
List<SysExpandField> fieldInfoList = sysExpandData.getFieldInfoList();
ArrayList<ExpandFieldInfo> expandFieldInfos = new ArrayList<>();
for (SysExpandField sysExpandField : fieldInfoList) {
// 获取是否需要列表展示
String listShowFlag = sysExpandField.getListShowFlag();
if (YesOrNotEnum.Y.getCode().equals(listShowFlag)) {
ExpandFieldInfo expandFieldInfo = new ExpandFieldInfo();
expandFieldInfo.setExpandId(sysExpandField.getExpandId());
expandFieldInfo.setFieldName(sysExpandField.getFieldName());
expandFieldInfo.setFieldCode(sysExpandField.getFieldCode());
expandFieldInfos.add(expandFieldInfo);
}
}
return expandFieldInfos;
}
@Override
public Map<String, Object> getExpandDataInfo(String expandCode, Long primaryFieldValue) {
SysExpandRequest sysExpandRequest = new SysExpandRequest();
sysExpandRequest.setExpandCode(expandCode);
sysExpandRequest.setPrimaryFieldValue(primaryFieldValue);
SysExpandData sysExpandData = this.getByExpandCode(sysExpandRequest);
// 获取对应数据
HashMap<String, Object> result = new HashMap<>();
String expandData = sysExpandData.getExpandData();
if (StrUtil.isEmpty(expandData)) {
return result;
}
// 将json转化为Map
JSONObject jsonObject = JSON.parseObject(expandData);
// 获取字段元数据,将需要进行字典转化的,转化为字典中文名称
List<SysExpandField> fieldInfoList = sysExpandData.getFieldInfoList();
for (SysExpandField sysExpandField : fieldInfoList) {
if (FieldTypeEnum.DICT.getCode().equals(sysExpandField.getFieldType())) {
String dictTypeCode = sysExpandField.getFieldDictTypeCode();
String dictValue = jsonObject.getString(sysExpandField.getFieldCode());
String dictName = dictApi.getDictName(dictTypeCode, dictValue);
jsonObject.put(sysExpandField.getFieldCode(), dictName);
}
}
return jsonObject;
}
/**
*
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private SysExpand querySysExpand(SysExpandRequest sysExpandRequest) {
SysExpand sysExpand = this.getById(sysExpandRequest.getExpandId());
if (ObjectUtil.isEmpty(sysExpand)) {
throw new ServiceException(SysExpandExceptionEnum.SYS_EXPAND_NOT_EXISTED);
}
return sysExpand;
}
/**
* wrapper
*
* @author fengshuonan
* @since 2022/03/29 23:47
*/
private LambdaQueryWrapper<SysExpand> createWrapper(SysExpandRequest sysExpandRequest) {
LambdaQueryWrapper<SysExpand> queryWrapper = new LambdaQueryWrapper<>();
Long expandId = sysExpandRequest.getExpandId();
String expandName = sysExpandRequest.getExpandName();
String expandCode = sysExpandRequest.getExpandCode();
queryWrapper.eq(ObjectUtil.isNotNull(expandId), SysExpand::getExpandId, expandId);
queryWrapper.like(ObjectUtil.isNotEmpty(expandName), SysExpand::getExpandName, expandName);
queryWrapper.like(ObjectUtil.isNotEmpty(expandCode), SysExpand::getExpandCode, expandCode);
return queryWrapper;
}
}

View File

@ -1,2 +0,0 @@
# Spring Boot自动装配

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-s-expand</artifactId>
<version>8.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>expand-spring-boot-starter</artifactId>
<packaging>jar</packaging>
<dependencies>
<!--拓展字段业务模块-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>expand-business</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -1,38 +0,0 @@
/*
* Copyright [2020-2030] [https://www.stylefeng.cn]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* GunsAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Guns
* 3.
* 4. https://gitee.com/stylefeng/guns
* 5. https://gitee.com/stylefeng/guns
* 6.
*/
package cn.stylefeng.roses.kernel.expand.modular.starter;
import org.springframework.context.annotation.Configuration;
/**
*
*
* @author fengshuonan
* @since 2022-03-29 23:14:31
*/
@Configuration
public class ExpandAutoConfiguration {
}

View File

@ -1,2 +0,0 @@
org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
cn.stylefeng.roses.kernel.expand.modular.starter.ExpandAutoConfiguration

View File

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>roses-kernel</artifactId>
<version>8.0.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>kernel-s-expand</artifactId>
<packaging>pom</packaging>
<modules>
<module>expand-api</module>
<module>expand-business</module>
<module>expand-spring-boot-starter</module>
</modules>
<dependencies>
<!-- 开发规则 -->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>kernel-a-rule</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -145,13 +145,6 @@
<version>${roses.version}</version>
</dependency>
<!--字段拓展信息-->
<dependency>
<groupId>cn.stylefeng.roses</groupId>
<artifactId>expand-spring-boot-starter</artifactId>
<version>${roses.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -94,9 +94,6 @@
<!--字典业务模块-->
<module>kernel-s-dict</module>
<!--字段拓展业务-->
<module>kernel-s-expand</module>
<!--分组业务-->
<module>kernel-s-group</module>