文档库--详情和编辑数据

This commit is contained in:
zhn
2022-01-24 14:50:31 +08:00
parent f7898fe070
commit 07078e5780
8 changed files with 53 additions and 46 deletions
@@ -209,15 +209,13 @@ public class BussDocumentLibraryEOController extends JeroController<BussDocument
/**
* 详情,编辑数据查询
* @param id
* @param flag 标识-->用于区分字段查询(根据表名)
* @return
*/
@AutoLog(value = "详情,编辑数据查询")
@ApiOperation(value="详情,编辑数据查询", notes="详情,编辑数据查询")
@GetMapping(value = "/getDocumentInfoById")
public Result<List<Map<String,Object>>> getDocumentInfoById(@RequestParam(name="id",required=true) String id,
@RequestParam(name="flag",required=true) String flag) {
List<Map<String, Object>> list = bussDocumentLibraryEOService.getDocumentInfoById(id,flag);
public Result<List<Map<String,Object>>> getDocumentInfoById(@RequestParam(name="id",required=true) String id) {
List<Map<String, Object>> list = bussDocumentLibraryEOService.getDocumentInfoById(id);
return Result.OK(list);
}
@@ -86,5 +86,5 @@ public interface IBussDocumentLibraryEOService extends IService<BussDocumentLibr
* @param id
* @return
*/
List<Map<String,Object>> getDocumentInfoById(String id,String flag);
List<Map<String,Object>> getDocumentInfoById(String id);
}
@@ -1,6 +1,7 @@
package com.jero.modules.document.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.constant.enums.ModuleEnum;
import com.jero.common.constant.enums.YesOrNo;
import com.jero.generater.modules.online.cgform.entity.OnlCgformField;
import com.jero.generater.modules.online.cgform.service.impl.OnlCgformFieldServiceImpl;
@@ -160,8 +161,10 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
*/
@Override
public List<Map<String,Object>> getAddForm(String flag) {
OnlCgformArea onlCgformArea = new OnlCgformArea();
onlCgformArea.setIsModel(ModuleEnum.DOCUMENT_LIBRARY.getValue());
//区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList();
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList(onlCgformArea);
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
@@ -192,41 +195,42 @@ public class BussDocumentLibraryEOServiceImpl extends ServiceImpl<BussDocumentLi
* @return
*/
@Override
public List<Map<String,Object>> getDocumentInfoById(String id,String flag) {
public List<Map<String,Object>> getDocumentInfoById(String id) {
LambdaQueryWrapper<BussDocumentLibraryEO> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(BussDocumentLibraryEO::getId,id);
//通过id查询数据
List<Map<String, Object>> dateList = bussDocumentLibraryEOMapper.selectMaps(queryWrapper);
//区域管理
List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList();
//字段属性
List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
return dateList;
// //区域管理
// List<OnlCgformArea> areaList = onlCgformAreaServiceImpl.queryList();
// //字段属性
// List<OnlCgformField> fieldList = onlCgformFieldService.getFieldList(flag);
//
// if(fieldList.size() != 0){
// //过滤出表单字段(is_show_form-->表单是否显示0否 1是)
// fieldList = fieldList.stream().filter(e-> YesOrNo.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList());
// }
// List<Map<String,Object>> result = new ArrayList<>();
// for (OnlCgformArea onlCgformAreaTemp : areaList) {
// fieldList = fieldList.stream().filter(e->onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList());
// for (OnlCgformField onlCgformField : fieldList) {
// Map<String,Object> map = new HashMap<>();
// if(dateList.size() != 0){
// dateList.get(0).entrySet().forEach(entry->{
// if(onlCgformField.getDbFieldName().equals(entry.getKey())){
// map.put("value",entry.getValue());
// }
// });
// }
// map.put("field_show_type",onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等)
// map.put("dict_field",onlCgformField.getDictField());
// map.put("db_field_name",onlCgformField.getDbFieldName());//字段
// map.put("db_field_txt",onlCgformField.getDbFieldTxt());//字段中文名
// map.put("db_field_en_name",onlCgformField.getDbFieldEnName());//字段英文名
// map.put("area",onlCgformAreaTemp.getShowArea());//区域
// result.add(map);
// }
// }
if(fieldList.size() != 0){
//过滤出表单字段(is_show_form-->表单是否显示0否 1是)
fieldList = fieldList.stream().filter(e-> YesOrNo.YES.getValue().equals(String.valueOf(e.getIsShowForm()))).collect(Collectors.toList());
}
List<Map<String,Object>> result = new ArrayList<>();
for (OnlCgformArea onlCgformAreaTemp : areaList) {
fieldList = fieldList.stream().filter(e->onlCgformAreaTemp.getId().equals(e.getShowArea())).collect(Collectors.toList());
for (OnlCgformField onlCgformField : fieldList) {
Map<String,Object> map = new HashMap<>();
if(dateList.size() != 0){
dateList.get(0).entrySet().forEach(entry->{
if(onlCgformField.getDbFieldName().equals(entry.getKey())){
map.put("value",entry.getValue());
}
});
}
map.put("field_show_type",onlCgformField.getFieldShowType());//类型(判断是下拉还是输入框,等等)
map.put("dict_field",onlCgformField.getDictField());
map.put("db_field_name",onlCgformField.getDbFieldName());//字段
map.put("db_field_txt",onlCgformField.getDbFieldTxt());//字段中文名
map.put("db_field_en_name",onlCgformField.getDbFieldEnName());//字段英文名
map.put("area",onlCgformAreaTemp.getShowArea());//区域
result.add(map);
}
}
return result;
}
}
@@ -35,7 +35,7 @@ import com.jero.common.aspect.annotation.AutoLog;
public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlCgformAreaService> {
@Autowired
private IOnlCgformAreaService onlCgformAreaService;
/**
* 分页列表查询
*
@@ -67,7 +67,8 @@ public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlC
@ApiOperation(value="区域管理表-列表查询", notes="区域管理表-列表查询")
@GetMapping(value = "/list")
public Result<List<OnlCgformArea>> queryList() {
List<OnlCgformArea> list = onlCgformAreaService.queryList();
OnlCgformArea onlCgformArea = new OnlCgformArea();
List<OnlCgformArea> list = onlCgformAreaService.queryList(onlCgformArea);
return Result.OK(list);
}
@@ -57,5 +57,5 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
*
* @return
*/
List<OnlCgformArea> queryList();
List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea);
}
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.mapper.OnlCgformAreaMapper;
import com.jero.modules.tag.service.IOnlCgformAreaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Date;
@@ -84,9 +85,12 @@ public class OnlCgformAreaServiceImpl extends ServiceImpl<OnlCgformAreaMapper, O
* @return
*/
@Override
public List<OnlCgformArea> queryList() {
public List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea) {
LambdaQueryWrapper<OnlCgformArea> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.orderByAsc(OnlCgformArea::getSort);
if(StringUtils.isNotBlank(onlCgformArea.getIsModel())){
lambdaQueryWrapper.eq(OnlCgformArea::getIsModel,onlCgformArea.getIsModel())
.orderByAsc(OnlCgformArea::getSort);
}
return list(lambdaQueryWrapper);
}
}