标签列表+新增页+展示区域-中英切换修改

This commit is contained in:
xiejunyu
2022-03-06 22:20:25 +08:00
parent 70ab065524
commit eb8febe825
10 changed files with 165 additions and 53 deletions
@@ -200,13 +200,13 @@ public class SysDictServiceImpl extends ServiceImpl<SysDictMapper, SysDict> impl
QueryWrapper<SysDict> queryWrapper = new QueryWrapper<>();
if (CutEnum.CN.getValue().equals(cut)) {
queryWrapper.select("id", "dict_name","dict_en_name", "attribute_type").eq("is_tag_dict", 1);
return list(queryWrapper);
}else{
queryWrapper.select("id", "dict_name","dict_en_name", "attribute_type").eq("is_tag_dict", 1);
List<SysDict> resetlist = list(queryWrapper);
resetlist.stream().forEach(f->f.setDictName(f.getDictEnName()));
return resetlist;
List<SysDict> resetList = list(queryWrapper);
resetList.stream().forEach(f->f.setDictName(f.getDictEnName()));
return resetList;
}
return list(queryWrapper);
}
/**
@@ -1,10 +1,11 @@
package com.jero.modules.tag.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.system.service.ISysDictItemService;
@@ -56,7 +57,8 @@ public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlC
@AutoLog(value = "区域管理表-分页列表查询")
@ApiOperation(value="区域管理表-分页列表查询", notes="区域管理表-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(OnlCgformArea onlCgformArea,
public Result<?> queryPageList(@RequestParam(name = "cut") String cut,
OnlCgformArea onlCgformArea,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
@@ -65,8 +67,17 @@ public class OnlCgformAreaController extends JeroController<OnlCgformArea, IOnlC
if(StringUtils.isNotBlank("create_time")) {
queryWrapper.orderByDesc("create_time");
}
IPage<OnlCgformArea> pageList = onlCgformAreaService.page(page, queryWrapper);
return Result.OK(pageList);
//中英切换-所属模块列
List<Map<String, Object>> pageList = onlCgformAreaService.selectPageInfo(page, queryWrapper);
if (CutEnum.CN.getValue().equals(cut)) {
return Result.OK(pageList);
} else {
JSONArray jsonArray = new JSONArray();
jsonArray.addAll(pageList);
List<OnlCgformArea> list = jsonArray.toJavaList(OnlCgformArea.class);
list.stream().forEach(f -> f.setIsModel(f.getEnName()));
return Result.OK(list);
}
}
/**
@@ -1,17 +1,20 @@
package com.jero.modules.tag.controller;
import com.alibaba.fastjson.JSONArray;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.common.api.vo.Result;
import com.jero.common.aspect.annotation.AutoLog;
import com.jero.common.constant.CommonConstant;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.system.base.controller.JeroController;
import com.jero.common.system.query.QueryGenerator;
import com.jero.modules.enums.FixedFieldEnum;
import com.jero.modules.system.service.impl.SysDictItemServiceImpl;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.entity.OnlCgformTag;
import com.jero.modules.tag.service.IOnlCgformTagService;
import com.jero.modules.utils.HanYuPinYinUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
@@ -45,7 +48,8 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@Autowired
private OnlCgformTagController onlCgformAreaService;
@Autowired
private SysDictItemServiceImpl sysDictItemService;
/**
* 分页列表查询
*
@@ -58,18 +62,30 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@AutoLog(value = "标签管理-分页列表查询")
@ApiOperation(value="标签管理-分页列表查询", notes="标签管理-分页列表查询")
@GetMapping(value = "/page")
public Result<?> queryPageList(OnlCgformTag onlCgformTag,
public Result<?> queryPageList(@RequestParam(name = "cut") String cut,
OnlCgformTag onlCgformTag,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
HttpServletRequest req) {
QueryWrapper<OnlCgformTag> queryWrapper = QueryGenerator.initQueryWrapper(onlCgformTag, req.getParameterMap());
Page<OnlCgformTag> page = new Page<OnlCgformTag>(pageNo, pageSize);
if(StringUtils.isNotBlank("create_time")) {
queryWrapper.orderByDesc("create_time")
.eq("cgform_head_id","48308196e7b04761b533dc31bc899707");//筛选文档库数据
if (StringUtils.isNotBlank("create_time")) {
queryWrapper.orderByDesc("create_time").eq("is_show_list", 1)
.eq("cgform_head_id", "48308196e7b04761b533dc31bc899707");//筛选文档库数据
}
//中英切换-属性类型列
List<Map<String, Object>> pageList = onlCgformTagService.selectPageInfo(page, queryWrapper);
if (CutEnum.CN.getValue().equals(cut)) {
return Result.OK(pageList);
} else {
JSONArray jsonArray = new JSONArray();
jsonArray.addAll(pageList);
List<OnlCgformTag> list = jsonArray.toJavaList(OnlCgformTag.class);
list.stream().forEach(f -> f.setFieldShowType(f.getFieldShowTypeEnName()));
list.stream().forEach(s->s.setShowArea(s.getShowAreaEnName()));
return Result.OK(list);
}
IPage<OnlCgformTag> pageList = onlCgformTagService.page(page, queryWrapper);
return Result.OK(pageList);
}
/**
@@ -80,9 +96,9 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@AutoLog(value = "标签管理-表头中英文切换")
@ApiOperation(value="标签管理-表头中英文切换", notes="标签管理-表头中英文切换")
@GetMapping(value = "/getHeader")
public Result<List<Map<String,String>>> getHeader(@RequestParam(name = "flag") String flag,
@RequestParam(name = "cut") String cut) {
List<Map<String,String>> list =onlCgformTagService.getHeader(flag,cut);
public Result<List<Map<String,Object>>> getHeader(@RequestParam(name = "flag") String flag,
@RequestParam(name = "cut") String cut) {
List<Map<String,Object>> list =onlCgformTagService.getHeader(flag,cut);
return Result.OK(list);
}
@@ -94,9 +110,9 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
@AutoLog(value = "标签管理-查询条件中英文切换")
@ApiOperation(value="标签管理-查询条件中英文切换", notes="标签管理-查询条件中英文切换")
@GetMapping(value = "/queryCondition")
public Result<List<Map<String, String>>> queryCondition(@RequestParam(name = "flag") String flag,
public Result<List<Map<String, Object>>> queryCondition(@RequestParam(name = "flag") String flag,
@RequestParam(name = "cut") String cut) {
List<Map<String,String>> list = onlCgformTagService.queryCondition(flag,cut);
List<Map<String,Object>> list = onlCgformTagService.queryCondition(flag,cut);
return Result.OK(list);
}
@@ -130,6 +146,12 @@ public class OnlCgformTagController extends JeroController<OnlCgformTag, IOnlCgf
onlCgformTag.setCreateTime(new Date());
onlCgformTag.setIsDelete(CommonConstant.DEL_FLAG_0);
onlCgformTag.setCgformHeadId("48308196e7b04761b533dc31bc899707");//设置文档库-表id
onlCgformTag.setDbIsKey(0);
onlCgformTag.setDbIsNull(1);
onlCgformTag.setDbPointLength(0);
String pinYin = HanYuPinYinUtil.changeToNumberPinYin(onlCgformTag.getDbFieldTxt());
pinYin.replace(" ","_");
onlCgformTag.setDbFieldName(pinYin);
if(onlCgformTag.getFieldShowType()=="2"){
onlCgformTag.setDbType("int");
}else if(onlCgformTag.getFieldShowType()=="5" && onlCgformTag.getFieldShowType()=="6"){
@@ -87,12 +87,18 @@ public class OnlCgformTag implements Serializable {
private java.lang.String dbFieldEnName;
/**表单控件类型*/
@Excel(name = "表单控件类型", width = 15,dicCode ="field_show_type")
@Dict(dicCode ="field_show_type")
@ApiModelProperty(value = "表单控件类型")
private java.lang.String fieldShowType;
/**数据字典英文名-属性类型英文名*/
@TableField(exist = false)
@Excel(name = "属性类型英文名", width = 15,dictTable = "sys_dict_item", dicText = "en_name", dicCode ="en_name")
@Dict(dictTable = "sys_dict_item", dicText = "en_name", dicCode ="en_name")
@ApiModelProperty(value = "属性类型英文名")
private java.lang.String fieldShowTypeEnName;
/**字典id*/
@Excel(name = "字典id", width = 15, dictTable = "onl_cgform_field", dicText = "dict_id", dicCode = "dict_id")
@Dict(dictTable = "onl_cgform_field", dicText = "dict_id", dicCode = "dict_id")
@@ -141,6 +147,13 @@ public class OnlCgformTag implements Serializable {
@ApiModelProperty(value = "展示区域")
private java.lang.String showArea;
/**展示区域-英文名称*/
@TableField(exist = false)
@Excel(name = "展示区域英文名", width = 15, dictTable = "onl_cgform_area", dicText = "en_name", dicCode = "en_name")
@Dict(dictTable = "onl_cgform_area", dicText = "en_name", dicCode = "en_name")
@ApiModelProperty(value = "展示区域英文名")
private java.lang.String showAreaEnName;
/**是否查询条件0否 1是*/
@Excel(name = "是否查询条件0否 1是", width = 15, dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query")
@Dict(dictTable = "onl_cgform_field", dicText = "is_query", dicCode = "is_query")
@@ -1,8 +1,14 @@
package com.jero.modules.tag.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.tag.entity.OnlCgformArea;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/**
* @Description: 区域管理表
@@ -11,5 +17,10 @@ import com.jero.modules.tag.entity.OnlCgformArea;
* @Version: V1.0
*/
public interface OnlCgformAreaMapper extends BaseMapper<OnlCgformArea> {
@Select("select a.id,a.create_by,a.create_time,a.update_by,\n" +
"a.update_time,a.en_name,i.en_name as model_en_name\n" +
"from onl_cgform_area as a left join sys_dict_item as i \n" +
"on a.is_model=i.item_value \n" +
"where i.dict_id=1493096744092102657 order by a.create_time desc")
IPage<Map<String,Object>> selectPageInfo(Page page, Wrapper<OnlCgformArea> queryWrapper);
}
@@ -1,7 +1,13 @@
package com.jero.modules.tag.mapper;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.jero.modules.tag.entity.OnlCgformTag;
import org.apache.ibatis.annotations.Select;
import java.util.Map;
/**
* @Description: 标签管理
@@ -11,4 +17,17 @@ import com.jero.modules.tag.entity.OnlCgformTag;
*/
public interface OnlCgformTagMapper extends BaseMapper<OnlCgformTag> {
@Select("select f.id,f.create_by,f.create_time,f.update_by,f.update_time,f.cgform_head_id,\n" +
"f.is_model,f.db_field_txt,f.db_field_en_name,f.field_show_type,f.dict_id,f.db_length,\n" +
"f.order_num,f.field_must_input,f.is_show_form,f.is_show_list,\n" +
"f.is_read_only,f.show_area,f.is_query,f.is_show_laws_list,f.is_show_search,f.is_delete,\n" +
"f.db_field_name,f.db_is_key,f.db_is_null,f.db_point_length,f.db_type,\n" +
"i.en_name as field_show_type_en_name,a.en_name as show_area_en_name\n" +
"from onl_cgform_field as f \n" +
"left join sys_dict_item as i on f.field_show_type=i.item_value\n" +
"left join onl_cgform_area as a on f.show_area=a.id\n" +
"where f.cgform_head_id=\"48308196e7b04761b533dc31bc899707\"\n" +
"and i.dict_id=1493098515761917954 order by f.create_time desc")
IPage<Map<String,Object>> selectPageInfo(Page page, Wrapper<OnlCgformTag> queryWrapper);
}
@@ -1,5 +1,7 @@
package com.jero.modules.tag.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.tag.entity.OnlCgformArea;
@@ -20,7 +22,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
* @param onlCgformArea
* @return
*/
void add(OnlCgformArea onlCgformArea);
void add(OnlCgformArea onlCgformArea);
/**
* 更新
@@ -28,7 +30,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
* @param onlCgformArea
* @return
*/
void editById(OnlCgformArea onlCgformArea);
void editById(OnlCgformArea onlCgformArea);
/**
* 通过id删除
@@ -36,7 +38,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
* @param id
* @return
*/
void deleteById(String id);
void deleteById(String id);
/**
* 批量删除
@@ -44,7 +46,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
void deleteByIds(List<String> ids);
/**
* 通过id查询
@@ -52,14 +54,14 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
* @param id
* @return
*/
OnlCgformArea queryById(String id);
OnlCgformArea queryById(String id);
/**
/**
* 列表查询
*
* @return
*/
List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea);
List<OnlCgformArea> queryList(OnlCgformArea onlCgformArea);
/**
* 查询展示区域
@@ -68,7 +70,7 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
*/
List<OnlCgformArea> queryShowArea(String cut, OnlCgformArea onlCgformArea);
/**
/**
* 展示区域查询
*
* @param id
@@ -84,4 +86,5 @@ public interface IOnlCgformAreaService extends IService<OnlCgformArea> {
*/
public List<Map<String, Object>> getHeader(String flag, String cut);
List<Map<String, Object>> selectPageInfo(Page page, Wrapper<OnlCgformArea> queryWrapper);
}
@@ -1,5 +1,7 @@
package com.jero.modules.tag.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.jero.modules.tag.entity.OnlCgformArea;
import com.jero.modules.tag.entity.OnlCgformTag;
@@ -21,7 +23,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param onlCgformTag
* @return
*/
void add(OnlCgformTag onlCgformTag);
void add(OnlCgformTag onlCgformTag);
/**
* 更新
@@ -29,7 +31,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param onlCgformTag
* @return
*/
void editById(OnlCgformTag onlCgformTag);
void editById(OnlCgformTag onlCgformTag);
/**
* 通过id删除
@@ -37,7 +39,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param id
* @return
*/
void deleteById(String id);
void deleteById(String id);
/**
* 批量删除
@@ -45,7 +47,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param ids
* @return
*/
void deleteByIds(List<String> ids);
void deleteByIds(List<String> ids);
/**
* 通过id查询
@@ -53,7 +55,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param id
* @return
*/
OnlCgformTag queryById(String id);
OnlCgformTag queryById(String id);
/**
@@ -61,7 +63,7 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
*
* @return
*/
List<OnlCgformTag> queryList(OnlCgformArea onlCgformArea);
List<OnlCgformTag> queryList(OnlCgformArea onlCgformArea);
/**
* 根据所属模块、属性名称、英文名称是否一致还原数据
@@ -77,12 +79,15 @@ public interface IOnlCgformTagService extends IService<OnlCgformTag> {
* @param cut
* @return
*/
List<Map<String,String>> getHeader(String flag,String cut);
List<Map<String,Object>> getHeader(String flag, String cut);
/**
* 查询条件中英文切换
* @param cut
* @return
*/
List<Map<String,String>> queryCondition(String flag,String cut);
List<Map<String,Object>> queryCondition(String flag,String cut);
List<Map<String, Object>> selectPageInfo(Page page, Wrapper<OnlCgformTag> queryWrapper);
}
@@ -1,7 +1,10 @@
package com.jero.modules.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.YesOrNoEnum;
@@ -28,6 +31,9 @@ import java.util.stream.Collectors;
public class OnlCgformAreaServiceImpl extends ServiceImpl<OnlCgformAreaMapper, OnlCgformArea> implements IOnlCgformAreaService {
@Autowired
private OnlCgformFieldServiceImpl onlCgformFieldService;
@Autowired
private OnlCgformAreaServiceImpl onlCgformAreaMapper;
/**
* 保存
*
@@ -164,4 +170,12 @@ public class OnlCgformAreaServiceImpl extends ServiceImpl<OnlCgformAreaMapper, O
}
return list;
}
@Override
public List<Map<String, Object>> selectPageInfo(Page page, Wrapper<OnlCgformArea> queryWrapper) {
IPage<Map<String, Object>> info= (IPage<Map<String, Object>>) onlCgformAreaMapper.selectPageInfo(page, queryWrapper);
List<Map<String, Object>> list = info.getRecords().stream().collect(Collectors.toList());
System.out.println("这里这里"+list);
return list;
}
}
@@ -1,7 +1,10 @@
package com.jero.modules.tag.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jero.common.constant.enums.CutEnum;
import com.jero.common.constant.enums.ModuleEnum;
@@ -15,6 +18,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
import java.util.stream.Collectors;
/**
* @Description: 标签管理
@@ -141,14 +145,14 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return
*/
@Override
public List<Map<String, String>> getHeader(String flag,String cut) {
List<Map<String, String>> list = new ArrayList<>();
Map<String, String> map1 = new HashMap<>();
Map<String, String> map2 = new HashMap<>();
Map<String, String> map3 = new HashMap<>();
Map<String, String> map4 = new HashMap<>();
Map<String, String> map5 = new HashMap<>();
Map<String, String> map6 = new HashMap<>();
public List<Map<String,Object>> getHeader(String flag, String cut) {
List<Map<String,Object>> list = new ArrayList<>();
Map<String,Object> map1 = new HashMap<>();
Map<String,Object> map2 = new HashMap<>();
Map<String,Object> map3 = new HashMap<>();
Map<String,Object> map4 = new HashMap<>();
Map<String,Object> map5 = new HashMap<>();
Map<String,Object> map6 = new HashMap<>();
if (ModuleEnum.ONL_CGFORM_TAG.getValue().equals(flag)) {
System.out.println("走的flag=3");
if (CutEnum.CN.getValue().equals(cut)) {
@@ -214,12 +218,12 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
* @return
*/
@Override
public List<Map<String,String>> queryCondition(String flag, String cut) {
List<Map<String,String>> list = new ArrayList<>();
Map<String, String> map1 = new HashMap<>();
Map<String, String> map2 = new HashMap<>();
public List<Map<String,Object>> queryCondition(String flag, String cut) {
List<Map<String,Object>> list = new ArrayList<>();
Map<String,Object> map1 = new HashMap<>();
Map<String,Object> map2 = new HashMap<>();
if (CutEnum.CN.getValue().equals(cut)) {
map2= (Map<String, String>) onlCgformAreaService.queryShowArea(cut,onlCgformArea);
// map2= (Map<String, Object>) onlCgformAreaService.queryShowArea(cut,onlCgformArea);
map1.put("db_field_name", "show_area");//字段
map1.put("db_field_txt", "展示区域");//字段中文名
map1.put("value", String.valueOf(map2));
@@ -227,7 +231,7 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
list.add(map1);
} else {
map2= (Map<String, String>) onlCgformAreaService.queryShowArea(cut,onlCgformArea);
//map2= (Map<String, Object>) onlCgformAreaService.queryShowArea(cut,onlCgformArea);
map1.put("db_field_name", "show_area");//字段
map1.put("db_field_txt", "display area");//字段英文名
map1.put("value", String.valueOf(map2));
@@ -236,4 +240,14 @@ public class OnlCgformTagServiceImpl extends ServiceImpl<OnlCgformTagMapper, Onl
}
return list;
}
@Override
public List<Map<String, Object>> selectPageInfo(Page page, Wrapper<OnlCgformTag> queryWrapper) {
IPage<Map<String, Object>> info= onlCgformTagMapper.selectPageInfo(page, queryWrapper);
List<Map<String, Object>> list = info.getRecords().stream().collect(Collectors.toList());
System.out.println("这里这里"+list);
return list;
}
}