快捷搜索条件表单
This commit is contained in:
parent
17b9c57649
commit
4438f3937a
|
|
@ -0,0 +1,21 @@
|
|||
package com.engine.organization.entity.search.condition;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/08/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class ConditionOption {
|
||||
private String key;
|
||||
private String showname;
|
||||
private Boolean selected;
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.engine.organization.entity.search.condition;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/08/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RangeCondition {
|
||||
private String label;
|
||||
private List<ConditionOption> options;
|
||||
private List<String> domkey;
|
||||
private List<Map<String, Object>> selectLinkageDatas;
|
||||
private Integer labelcol;
|
||||
private Integer fieldcol;
|
||||
|
||||
public Integer getLabelcol() {
|
||||
if (null == labelcol) {
|
||||
return 6;
|
||||
}
|
||||
return labelcol;
|
||||
}
|
||||
|
||||
public Integer getFieldcol() {
|
||||
if (null == fieldcol) {
|
||||
return 18;
|
||||
}
|
||||
return fieldcol;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
package com.engine.organization.enums;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2023/08/14
|
||||
* @version: 1.0
|
||||
*/
|
||||
public enum QuickSearchConditionEnum {
|
||||
|
||||
/**
|
||||
* 字段类型
|
||||
*/
|
||||
SELECT("5"), DATETIME("3"),NUMBER("1"),RESOURCE("-1"),MEETING("-3"),WAREHOUSE("-5");
|
||||
|
||||
private String value;
|
||||
|
||||
QuickSearchConditionEnum(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public static QuickSearchConditionEnum getByValue(String value) {
|
||||
for (QuickSearchConditionEnum conditionEnum : values()) {
|
||||
if (conditionEnum.getValue().equals(value)) {
|
||||
return conditionEnum;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,7 @@
|
|||
package com.engine.organization.mapper.condition;
|
||||
|
||||
import com.engine.organization.entity.jclimport.po.HrmFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclSelectItem;
|
||||
import com.engine.organization.entity.search.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
|
|
@ -132,4 +134,8 @@ public interface QuickSearchMapper {
|
|||
*/
|
||||
int deleteQuickSearchDetailByIds(@Param("ids") Collection<Integer> ids);
|
||||
|
||||
HrmFormFieldPO getHrmFormFieldByFieldId(@Param("fieldId") String fieldId);
|
||||
|
||||
List<JclSelectItem> getSelectItemListByFieldId(@Param("fieldId") String fieldId);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,27 @@
|
|||
left join hrm_formfield b on b.fieldid = c.fieldid
|
||||
where c.id = #{id}
|
||||
</select>
|
||||
<select id="getHrmFormFieldByFieldId"
|
||||
resultType="com.engine.organization.entity.jclimport.po.HrmFormFieldPO">
|
||||
select a.fieldid,
|
||||
a.fieldname,
|
||||
a.issystem,
|
||||
a.fieldlabel labelname,
|
||||
a.ismand,
|
||||
a.fielddbtype,
|
||||
a.fieldhtmltype,
|
||||
a.type,
|
||||
a.dmlurl
|
||||
from hrm_formfield a
|
||||
where a.fieldhtmltype != '6'
|
||||
and a.fieldid = #{fieldId}
|
||||
</select>
|
||||
<select id="getSelectItemListByFieldId"
|
||||
resultType="com.engine.organization.entity.jclimport.po.JclSelectItem">
|
||||
select selectvalue, selectname
|
||||
from hrm_selectitem
|
||||
where fieldid = #{fieldId}
|
||||
</select>
|
||||
|
||||
<insert id="insertQuickSearchSetting">
|
||||
insert into jcl_quicksearch_setting(belongto,
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ import java.util.Map;
|
|||
*/
|
||||
public interface QuickSearchService {
|
||||
/**
|
||||
* 保存快速搜索条件
|
||||
* 获取快速搜索条件
|
||||
*
|
||||
* @param params 前端参数
|
||||
* @return return
|
||||
*/
|
||||
Map<String, Object> saveQuickSearchCondition(Map<String, Object> params);
|
||||
Map<String, Object> getQuickSearchCondition(Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 获取快速搜索信息
|
||||
|
|
|
|||
|
|
@ -4,7 +4,11 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.cloudstore.dev.api.util.TextUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.organization.entity.jclimport.po.HrmFormFieldPO;
|
||||
import com.engine.organization.entity.jclimport.po.JclSelectItem;
|
||||
import com.engine.organization.entity.search.*;
|
||||
import com.engine.organization.entity.search.condition.ConditionOption;
|
||||
import com.engine.organization.entity.search.condition.RangeCondition;
|
||||
import com.engine.organization.enums.LogModuleNameEnum;
|
||||
import com.engine.organization.mapper.condition.QuickSearchMapper;
|
||||
import com.engine.organization.service.QuickSearchService;
|
||||
|
|
@ -18,9 +22,7 @@ import weaver.hrm.User;
|
|||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
|
|
@ -36,8 +38,65 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
|
||||
|
||||
@Override
|
||||
public Map<String, Object> saveQuickSearchCondition(Map<String, Object> params) {
|
||||
return null;
|
||||
public Map<String, Object> getQuickSearchCondition(Map<String, Object> params) {
|
||||
Map<String, Object> apiDatas = new HashMap<>(16);
|
||||
List<RangeCondition> rangeConditions = new ArrayList<>();
|
||||
|
||||
List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID(), LogModuleNameEnum.RESOURCE.getValue());
|
||||
for (QuickSearchCondition quickSearchCondition : quickSearchConditionList) {
|
||||
|
||||
HrmFormFieldPO formField = getQuickSearchMapper().getHrmFormFieldByFieldId(quickSearchCondition.getFieldId());
|
||||
|
||||
RangeCondition condition = new RangeCondition();
|
||||
condition.setLabel(quickSearchCondition.getCustomName());
|
||||
condition.setDomkey(Collections.singletonList(formField.getFieldName()));
|
||||
// 根据条件字段类型,组装展示样式
|
||||
switch (quickSearchCondition.getType()) {
|
||||
case 5:
|
||||
// 字段本身值、判断有无下拉框选项
|
||||
if ("4".equals(formField.getFieldHtmlType()) || "5".equals(formField.getFieldHtmlType())) {
|
||||
List<JclSelectItem> selectItemListByFieldId = getQuickSearchMapper().getSelectItemListByFieldId(quickSearchCondition.getFieldId());
|
||||
condition.setOptions(selectItemListByFieldId.stream().map(item -> ConditionOption.builder().key(item.getSelectValue()).showname(item.getSelectName()).build()).collect(Collectors.toList()));
|
||||
} else {
|
||||
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
// 日期类型数据
|
||||
List<ConditionOption> options = new ArrayList<>();
|
||||
options.add(ConditionOption.builder().key("0").showname(SystemEnv.getHtmlLabelName(332, user.getLanguage())).selected(true).build());
|
||||
options.add(ConditionOption.builder().key("1").showname(SystemEnv.getHtmlLabelName(15537, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("2").showname(SystemEnv.getHtmlLabelName(15539, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("3").showname(SystemEnv.getHtmlLabelName(15541, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("7").showname(SystemEnv.getHtmlLabelName(27347, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("4").showname(SystemEnv.getHtmlLabelName(21904, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("5").showname(SystemEnv.getHtmlLabelName(15384, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("8").showname(SystemEnv.getHtmlLabelName(81716, user.getLanguage())).build());
|
||||
options.add(ConditionOption.builder().key("6").showname(SystemEnv.getHtmlLabelName(32530, user.getLanguage())).build());
|
||||
condition.setOptions(options);
|
||||
Map<String, Object> selectLinkageDataMap = new HashMap<>(1);
|
||||
Map<String, Object> map = new HashMap<>(2);
|
||||
map.put("conditionType", "RANGEPICKER");
|
||||
map.put("domkey", Arrays.asList("start", "end"));
|
||||
selectLinkageDataMap.put("1", map);
|
||||
condition.setSelectLinkageDatas(Collections.singletonList(selectLinkageDataMap));
|
||||
break;
|
||||
case 1:
|
||||
break;
|
||||
case -1:
|
||||
break;
|
||||
case -3:
|
||||
break;
|
||||
case -4:
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
apiDatas.put("rangeConditions", rangeConditions);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -122,7 +181,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
//选择框多选框
|
||||
fieldType = "5";
|
||||
isShowModel = true;
|
||||
} else if ("5".equals(fieldHtmlType) && "1".equals(type)) {
|
||||
} else if ("5".equals(fieldHtmlType) && "0".equals(type)) {
|
||||
//选择框
|
||||
fieldType = "5";
|
||||
isShowModel = true;
|
||||
|
|
@ -208,7 +267,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
getQuickSearchMapper().updateQuickSearchSetting(quickSearchSetting);
|
||||
}
|
||||
|
||||
List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID(),LogModuleNameEnum.RESOURCE.getValue());
|
||||
List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID(), LogModuleNameEnum.RESOURCE.getValue());
|
||||
List<Integer> list = quickSearchConditionList.stream().map(QuickSearchCondition::getId).collect(Collectors.toList());
|
||||
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,19 @@ public class QuickSearchController {
|
|||
return ServiceUtil.getService(QuickSearchWrapper.class, user);
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getQuickSearchCondition")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public ReturnResult getQuickSearchCondition(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
return ReturnResult.successed(getQuickSearchWrapper(user).getQuickSearchCondition(map));
|
||||
} catch (Exception e) {
|
||||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/getQuickSearchInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
@ -65,6 +78,7 @@ public class QuickSearchController {
|
|||
return ReturnResult.exceptionHandle(e);
|
||||
}
|
||||
}
|
||||
|
||||
@POST
|
||||
@Path("/saveQuickSearchDetailInfo")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ public class QuickSearchWrapper extends Service {
|
|||
return ServiceUtil.getService(QuickSearchServiceImpl.class, user);
|
||||
}
|
||||
|
||||
public Map<String, Object> getQuickSearchCondition(Map<String, Object> params) {
|
||||
return getQuickSearchService(user).getQuickSearchCondition(params);
|
||||
}
|
||||
|
||||
public Map<String, Object> getQuickSearchInfo(Map<String, Object> params) {
|
||||
return getQuickSearchService(user).getQuickSearchInfo(params);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue