mirror of https://gitee.com/stylefeng/roses
【7.2.2】【expand】更新获取拓展数据详情接口
parent
8b3d0eb865
commit
ba6fe12f3b
|
@ -2,6 +2,7 @@ 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.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.pojo.request.BaseRequest;
|
||||
|
@ -89,6 +90,17 @@ public class SysExpandController {
|
|||
return new SuccessResponseData<>(sysExpandService.detail(sysExpandRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据业务编码获取业务数据详情
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 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));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
|
|
|
@ -6,6 +6,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -35,6 +36,7 @@ public class SysExpandRequest extends BaseRequest {
|
|||
* 拓展业务唯一编码
|
||||
*/
|
||||
@ChineseDescription("拓展业务唯一编码")
|
||||
@NotBlank(message = "拓展编码不能为空", groups = getByExpandCode.class)
|
||||
private String expandCode;
|
||||
|
||||
/**
|
||||
|
@ -63,4 +65,20 @@ public class SysExpandRequest extends BaseRequest {
|
|||
@ChineseDescription("业务主键id字段名驼峰法,例如:userId")
|
||||
private String primaryFieldCamel;
|
||||
|
||||
/**
|
||||
* 业务主键id的值
|
||||
*/
|
||||
@ChineseDescription("业务主键id的值")
|
||||
private String primaryFieldValue;
|
||||
|
||||
/**
|
||||
* 获取业务元数据信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/3/31 15:25
|
||||
*/
|
||||
public @interface getByExpandCode {
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ import java.util.List;
|
|||
*/
|
||||
public interface SysExpandDataService extends IService<SysExpandData> {
|
||||
|
||||
/**
|
||||
/**
|
||||
* 新增
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
|
@ -24,7 +24,7 @@ public interface SysExpandDataService extends IService<SysExpandData> {
|
|||
*/
|
||||
void add(SysExpandDataRequest sysExpandDataRequest);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 删除
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
|
@ -33,7 +33,7 @@ public interface SysExpandDataService extends IService<SysExpandData> {
|
|||
*/
|
||||
void del(SysExpandDataRequest sysExpandDataRequest);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 编辑
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
|
@ -42,7 +42,7 @@ public interface SysExpandDataService extends IService<SysExpandData> {
|
|||
*/
|
||||
void edit(SysExpandDataRequest sysExpandDataRequest);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
|
@ -51,20 +51,28 @@ public interface SysExpandDataService extends IService<SysExpandData> {
|
|||
*/
|
||||
SysExpandData detail(SysExpandDataRequest sysExpandDataRequest);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 查询详情
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/03/29 23:47
|
||||
*/
|
||||
SysExpandData detailByPrimaryFieldValue(String primaryFieldValue);
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
* @return List<SysExpandData> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2022/03/29 23:47
|
||||
*/
|
||||
List<SysExpandData> findList(SysExpandDataRequest sysExpandDataRequest);
|
||||
|
||||
/**
|
||||
/**
|
||||
* 获取列表(带分页)
|
||||
*
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
* @param sysExpandDataRequest 请求参数
|
||||
* @return PageResult<SysExpandData> 返回结果
|
||||
* @author fengshuonan
|
||||
* @date 2022/03/29 23:47
|
||||
|
|
|
@ -2,6 +2,7 @@ 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.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;
|
||||
|
||||
|
@ -78,4 +79,12 @@ public interface SysExpandService extends IService<SysExpand> {
|
|||
* @date 2022/3/30 10:37
|
||||
*/
|
||||
void updateStatus(SysExpandRequest sysExpandRequest);
|
||||
|
||||
/**
|
||||
* 获取业务元数据信息
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @date 2022/3/31 15:26
|
||||
*/
|
||||
SysExpandData getByExpandCode(SysExpandRequest sysExpandRequest);
|
||||
}
|
||||
|
|
|
@ -81,6 +81,13 @@ public class SysExpandDataServiceImpl extends ServiceImpl<SysExpandDataMapper, S
|
|||
return sysExpandData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SysExpandData detailByPrimaryFieldValue(String 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);
|
||||
|
|
|
@ -2,13 +2,19 @@ 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.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.exception.base.ServiceException;
|
||||
|
@ -17,6 +23,7 @@ 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;
|
||||
|
||||
/**
|
||||
|
@ -28,6 +35,12 @@ import java.util.List;
|
|||
@Service
|
||||
public class SysExpandServiceImpl extends ServiceImpl<SysExpandMapper, SysExpand> implements SysExpandService {
|
||||
|
||||
@Resource
|
||||
private SysExpandFieldService sysExpandFieldService;
|
||||
|
||||
@Resource
|
||||
private SysExpandDataService sysExpandDataService;
|
||||
|
||||
@Override
|
||||
public void add(SysExpandRequest sysExpandRequest) {
|
||||
SysExpand sysExpand = new SysExpand();
|
||||
|
@ -71,6 +84,34 @@ public class SysExpandServiceImpl extends ServiceImpl<SysExpandMapper, SysExpand
|
|||
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 (StrUtil.isNotBlank(sysExpandRequest.getPrimaryFieldValue())) {
|
||||
sysExpandData = sysExpandDataService.detailByPrimaryFieldValue(sysExpandRequest.getPrimaryFieldValue());
|
||||
}
|
||||
|
||||
// 设置返回信息
|
||||
sysExpandData.setFieldInfoList(list);
|
||||
sysExpandData.setExpandInfo(sysExpand);
|
||||
|
||||
return sysExpandData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SysExpand> findList(SysExpandRequest sysExpandRequest) {
|
||||
LambdaQueryWrapper<SysExpand> wrapper = this.createWrapper(sysExpandRequest);
|
||||
|
|
Loading…
Reference in New Issue