recordSet调整成MyBatis

pull/200/head
dxfeng 2 years ago
parent dacd9b180e
commit 53e96cafe5

@ -0,0 +1,23 @@
package com.engine.organization.entity.search;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author:dxfeng
* @createTime: 2023/08/09
* @version: 1.0
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class QuickSearchOption {
private String fieldId;
private String fieldLabel;
private String fieldName;
private String fieldHtmlType;
private String type;
}

@ -20,4 +20,7 @@ public class QuickSearchSetting {
private Integer isQuickSearch; private Integer isQuickSearch;
private Integer isShowType; private Integer isShowType;
private Integer isHideName; private Integer isHideName;
private Integer updateTor;
private String updateDate;
private String updateTime;
} }

@ -1,8 +1,14 @@
package com.engine.organization.mapper.condition; package com.engine.organization.mapper.condition;
import com.engine.organization.entity.search.QuickSearchCondition;
import com.engine.organization.entity.search.QuickSearchDetail;
import com.engine.organization.entity.search.QuickSearchOption;
import com.engine.organization.entity.search.QuickSearchSetting; import com.engine.organization.entity.search.QuickSearchSetting;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.List;
/** /**
* @author:dxfeng * @author:dxfeng
* @createTime: 2023/08/09 * @createTime: 2023/08/09
@ -14,7 +20,87 @@ public interface QuickSearchMapper {
* *
* *
* @param belongTo ID * @param belongTo ID
* @return * @return
*/ */
QuickSearchSetting getQuickSearchSetting(@Param("belongTo") Integer belongTo); QuickSearchSetting getQuickSearchSetting(@Param("belongTo") Integer belongTo);
/**
*
*
* @param belongTo ID
* @return
*/
List<QuickSearchCondition> getQuickSearchConditionList(@Param("belongTo") Integer belongTo);
/**
*
*
* @return
*/
List<QuickSearchOption> getQuickSearchOptionList();
/**
*
*
* @param quickSearchSetting
* @return return
*/
int insertQuickSearchSetting(@Param("quickSearchSetting") QuickSearchSetting quickSearchSetting);
/**
*
*
* @param quickSearchSetting
* @return return
*/
int updateQuickSearchSetting(@Param("quickSearchSetting") QuickSearchSetting quickSearchSetting);
/**
*
*
* @param quickSearchCondition
* @return return
*/
int insertQuickSearchCondition(@Param("quickSearchCondition") QuickSearchCondition quickSearchCondition);
/**
*
*
* @param quickSearchCondition
* @return return
*/
int updateQuickSearchCondition(@Param("quickSearchCondition") QuickSearchCondition quickSearchCondition);
/**
* Cid
*
* @param cId condition
* @return return
*/
int deleteQuickSearchDetailByCid(@Param("cId") Integer cId);
/**
* ID
*
* @param ids ids
* @return return
*/
int deleteQuickSearchConditionByIds(@Param("ids") Collection<Integer> ids);
/**
* Cids
*
* @param cIds cIds
* @return return
*/
int deleteQuickSearchDetailByCids(@Param("cIds") Collection<Integer> cIds);
/**
* Cid
*
* @param cId cId
* @return return
*/
List<QuickSearchDetail> getQuickSearchDetailByCid(@Param("cId") String cId);
} }

@ -8,4 +8,95 @@
from jcl_quicksearch_setting from jcl_quicksearch_setting
where belongto = #{belongTo} where belongto = #{belongTo}
</select> </select>
<select id="getQuickSearchConditionList"
resultType="com.engine.organization.entity.search.QuickSearchCondition">
select c.id, fieldid, c.customname, c.type, c.orderid, c.showmodel
from jcl_quicksearch_condition c
where belongto = #{belongTo}
order by c.orderid, c.id
</select>
<select id="getQuickSearchOptionList" resultType="com.engine.organization.entity.search.QuickSearchOption">
select b.fieldid, b.fieldlabel, b.fieldname, fieldhtmltype, b.type
from hrm_formfield b
inner join hrm_fieldgroup c on c.id = b.groupid and c.grouptype in (-1, 1, 3)
</select>
<select id="getQuickSearchDetailByCid"
resultType="com.engine.organization.entity.search.QuickSearchDetail">
select id,
customname,
minnum,
maxnum,
type,
orderid,
fieldid,
belongto
from jcl_quicksearch_detail
where cid = #{cId}
order by orderid, id
</select>
<insert id="insertQuickSearchSetting">
insert into jcl_quicksearch_setting(belongto,
isquicksearch,
isshowtype,
ishidename,
updatetor,
updatedate,
updatetime)
values (#{quickSearchSetting.belongTo},
#{quickSearchSetting.isQuickSearch},
#{quickSearchSetting.isShowType},
#{quickSearchSetting.isHideName},
#{quickSearchSetting.updateTor},
#{quickSearchSetting.updateDate},
#{quickSearchSetting.updateTime})
</insert>
<update id="updateQuickSearchSetting">
update jcl_quicksearch_setting
set isquicksearch=#{quickSearchSetting.isQuickSearch},
isshowtype=#{quickSearchSetting.isShowType},
ishidename=#{quickSearchSetting.isHideName}
where id = #{quickSearchSetting.id}
</update>
<insert id="insertQuickSearchCondition">
insert into jcl_quicksearch_condition(belongto, fieldid, customname, type, orderid, showmodel)
values (#{quickSearchCondition.belongTo}, #{quickSearchCondition.fieldId}, #{quickSearchCondition.customName},
#{quickSearchCondition.type}, #{quickSearchCondition.orderId}, #{quickSearchCondition.showModel})
</insert>
<update id="updateQuickSearchCondition">
update jcl_quicksearch_condition
set belongto=#{quickSearchCondition.belongTo},
fieldid=#{quickSearchCondition.fieldId},
customname=#{quickSearchCondition.customName},
type=#{quickSearchCondition.type},
orderid=#{quickSearchCondition.orderId},
showmodel=#{quickSearchCondition.showModel}
where id = #{quickSearchCondition.id}
</update>
<delete id="deleteQuickSearchDetailByCid">
delete
from jcl_quicksearch_detail
where cid = #{cId}
</delete>
<delete id="deleteQuickSearchDetailByCids">
delete from jcl_quicksearch_condition where id in
<foreach collection="ids" open="(" item="id" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteQuickSearchDetailByCIds">
delete from jcl_quicksearch_detail where cid in
<foreach collection="cIds" open="(" item="cid" separator="," close=")">
#{cid}
</foreach>
</delete>
</mapper> </mapper>

@ -4,11 +4,14 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cloudstore.dev.api.util.TextUtil; import com.cloudstore.dev.api.util.TextUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.organization.entity.search.QuickSearchCondition;
import com.engine.organization.entity.search.QuickSearchDetail;
import com.engine.organization.entity.search.QuickSearchOption;
import com.engine.organization.entity.search.QuickSearchSetting; import com.engine.organization.entity.search.QuickSearchSetting;
import com.engine.organization.mapper.condition.QuickSearchMapper; import com.engine.organization.mapper.condition.QuickSearchMapper;
import com.engine.organization.mapper.post.PostMapper;
import com.engine.organization.service.QuickSearchService; import com.engine.organization.service.QuickSearchService;
import com.engine.organization.util.db.MapperProxyFactory; import com.engine.organization.util.db.MapperProxyFactory;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import weaver.conn.RecordSet; import weaver.conn.RecordSet;
import weaver.conn.RecordSetTrans; import weaver.conn.RecordSetTrans;
@ -23,6 +26,7 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors;
/** /**
@ -44,16 +48,14 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
@Override @Override
public Map<String, Object> getQuickSearchInfo(Map<String, Object> params) { public Map<String, Object> getQuickSearchInfo(Map<String, Object> params) {
Map<String, Object> apiDatas = new HashMap<>(16); Map<String, Object> apiDatas = new HashMap<>(16);
RecordSet rs = new RecordSet();
//开关查询 //开关查询
String sql = "select id,isquicksearch,isshowtype,ishidename from jcl_quicksearch_setting where belongto=?"; QuickSearchSetting quickSearchSetting = getQuickSearchMapper().getQuickSearchSetting(user.getUID());
rs.executeQuery(sql, user.getUID());
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
if (rs.next()) { if (null != quickSearchSetting) {
json.put("isquicksearch", Util.null2String(rs.getString("isquicksearch"))); json.put("isquicksearch", Util.null2String(quickSearchSetting.getIsQuickSearch()));
json.put("isshowtype", Util.null2s(rs.getString("isshowtype"), "1")); json.put("isshowtype", null != quickSearchSetting.getIsShowType() ? quickSearchSetting.getIsShowType() : "1");
json.put("ishidename", Util.null2o(rs.getString("ishidename"))); json.put("ishidename", null != quickSearchSetting.getIsHideName() ? quickSearchSetting.getIsHideName() : "0");
json.put("id", Util.null2String(rs.getString("id"))); json.put("id", Util.null2String(quickSearchSetting.getId()));
} else { } else {
json.put("isquicksearch", "0"); json.put("isquicksearch", "0");
json.put("isshowtype", "0"); json.put("isshowtype", "0");
@ -63,143 +65,154 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
apiDatas.put("setting", json); apiDatas.put("setting", json);
//条件字段查询 //条件字段查询
sql = " select c.id, fieldid, c.customname, c.type typeTemp, c.orderid, c.showmodel from jcl_quicksearch_condition c where belongto = ? order by c.orderid asc, c.id asc"; List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID());
rs.executeQuery(sql, user.getUID());
JSONArray datas = new JSONArray(); JSONArray datas = new JSONArray();
while (rs.next()) { if(CollectionUtils.isNotEmpty(quickSearchConditionList)) {
JSONObject obj = new JSONObject(); for (QuickSearchCondition quickSearchCondition : quickSearchConditionList) {
String id = Util.null2String(rs.getString("id")); JSONObject obj = new JSONObject();
String fieldid = Util.null2String(rs.getString("fieldid")); String id = Util.null2String(quickSearchCondition.getId());
String customname = Util.null2String(rs.getString("customname")); String fieldId = Util.null2String(quickSearchCondition.getFieldId());
String type = Util.null2String(rs.getString("typeTemp")); String customName = Util.null2String(quickSearchCondition.getCustomName());
String orderid = Util.null2String(rs.getString("orderid")); String type = Util.null2String(quickSearchCondition.getType());
String showmodel = Util.null2o(rs.getString("showmodel")); String orderId = Util.null2String(quickSearchCondition.getOrderId());
obj.put("cid", id); String showModel = null!=quickSearchCondition.getShowModel()?quickSearchCondition.getShowModel().toString():"0";
obj.put("key", id); obj.put("cid", id);
obj.put("fieldid", fieldid); obj.put("key", id);
obj.put("orifieldid", fieldid); obj.put("fieldid", fieldId);
obj.put("customname", TextUtil.toBase64ForMultilang(customname)); obj.put("orifieldid", fieldId);
obj.put("type", type); obj.put("customname", TextUtil.toBase64ForMultilang(customName));
obj.put("orderid", orderid); obj.put("type", type);
obj.put("groupid", ""); obj.put("orderid", orderId);
obj.put("showmodel", showmodel); obj.put("groupid", "");
datas.add(obj); obj.put("showmodel", showModel);
datas.add(obj);
}
} }
apiDatas.put("datas", datas); apiDatas.put("datas", datas);
//字段下拉框查询 //字段下拉框查询
sql = "select b.fieldid,b.fieldlabel,b.fieldname,fieldhtmltype,b.type typeTemp from hrm_formfield b inner join hrm_fieldgroup c on c.id=b.GROUPID and c.GROUPTYPE in(-1,1,3)"; List<QuickSearchOption> quickSearchOptionList = getQuickSearchMapper().getQuickSearchOptionList();
rs.executeQuery(sql);
JSONArray options = new JSONArray(); JSONArray options = new JSONArray();
while (rs.next()) { if(CollectionUtils.isNotEmpty(quickSearchOptionList)) {
JSONObject obj = new JSONObject(); for (QuickSearchOption quickSearchOption : quickSearchOptionList) {
String fieldhtmltype = Util.null2String(rs.getString("fieldhtmltype")); JSONObject obj = new JSONObject();
String fieldid = Util.null2String(rs.getString("fieldid")); String fieldHtmlType = Util.null2String(quickSearchOption.getFieldHtmlType());
String fieldname = Util.null2String(rs.getString("fieldname")); String fieldId = Util.null2String(quickSearchOption.getFieldId());
// String fieldName = Util.null2String(quickSearchOption.getFieldName());
String type = Util.null2String(quickSearchOption.getType());
String type = Util.null2String(rs.getString("typeTemp")); int fieldLabel = Util.getIntValue(quickSearchOption.getFieldLabel(), 0);
int fieldlabel = Util.getIntValue(rs.getString("fieldlabel"), 0); String labelName = SystemEnv.getHtmlLabelName(Util.getIntValue(quickSearchOption.getFieldLabel()), user.getLanguage());
String labelname = SystemEnv.getHtmlLabelName(Util.getIntValue(rs.getString("fieldlabel")), user.getLanguage()); String fieldType = "2";
String fieldtype = "2"; boolean isShowModel = false;
boolean isShowModel = false; if ("1".equals(fieldHtmlType)) {
if ("1".equals(fieldhtmltype)) { if ("1".equals(type)) {
if ("1".equals(type)) { //单行文本
//单行文本 fieldType = "5";
fieldtype = "5"; } else {
} else { //整数或浮点数
//整数或浮点数 fieldType = "1";
fieldtype = "1"; isShowModel = true;
}
} else if ("2".equals(fieldHtmlType) && "1".equals(type)) {
//多行文本
fieldType = "5";
} else if ("2".equals(fieldHtmlType) && "2".equals(type)) {
//多行文本html
fieldType = "5";
} else if ("5".equals(fieldHtmlType) && "3".equals(type)) {
//选择框单选框
fieldType = "5";
isShowModel = true; isShowModel = true;
} } else if ("5".equals(fieldHtmlType) && "2".equals(type)) {
} else if ("2".equals(fieldhtmltype) && "1".equals(type)) { //选择框多选框
//多行文本 fieldType = "5";
fieldtype = "5"; isShowModel = true;
} else if ("2".equals(fieldhtmltype) && "2".equals(type)) { } else if ("5".equals(fieldHtmlType) && "1".equals(type)) {
//多行文本html //选择框
fieldtype = "5"; fieldType = "5";
} else if ("5".equals(fieldhtmltype) && "3".equals(type)) { isShowModel = true;
//选择框单选框 } else if ("4".equals(fieldHtmlType) && "1".equals(type)) {
fieldtype = "5"; //check框
isShowModel = true; fieldType = "5";
} else if ("5".equals(fieldhtmltype) && "2".equals(type)) { isShowModel = true;
//选择框多选框 } else if ("3".equals(fieldHtmlType)) {
fieldtype = "5"; switch (type) {
isShowModel = true; case "2":
} else if ("5".equals(fieldhtmltype) && "1".equals(type)) { //日期
//选择框 fieldType = "3";
fieldtype = "5"; break;
isShowModel = true; case "1":
} else if ("4".equals(fieldhtmltype) && "1".equals(type)) { //人力资源 1已被占用,重新换一个
//check框 fieldType = "-1";
fieldtype = "5"; break;
isShowModel = true; case "3":
} else if ("3".equals(fieldhtmltype)) { //会议室联系单 3已被占用,重新换一个
if ("2".equals(type)) { fieldType = "-3";
//日期 break;
fieldtype = "3"; case "5":
} else if ("1".equals(type)) { //仓库5已被占用,重新换一个
//人力资源 1已被占用,重新换一个 fieldType = "-5";
fieldtype = "-1"; break;
} else if ("3".equals(type)) { default:
//会议室联系单 3已被占用,重新换一个 fieldType = type;
fieldtype = "-3"; break;
} else if ("5".equals(type)) { }
//仓库5已被占用,重新换一个
fieldtype = "-5";
} else { } else {
fieldtype = type; continue;
} }
} else {
continue;
}
if ("".equals(labelname)) { if ("".equals(labelName)) {
labelname = SystemEnv.getHtmlLabelName(fieldlabel, user.getLanguage()); labelName = SystemEnv.getHtmlLabelName(fieldLabel, user.getLanguage());
} }
obj.put("key", fieldid); obj.put("key", fieldId);
obj.put("fieldid", fieldid); obj.put("fieldid", fieldId);
obj.put("showname", labelname); obj.put("showname", labelName);
obj.put("isdetailtable", "0"); obj.put("isdetailtable", "0");
obj.put("type", fieldtype); obj.put("type", fieldType);
obj.put("isShowModel", isShowModel); obj.put("isShowModel", isShowModel);
options.add(obj); options.add(obj);
}
} }
apiDatas.put("options", options); apiDatas.put("options", options);
JSONArray groupidOptions = new JSONArray(); apiDatas.put("groupidOptions", new JSONArray());
apiDatas.put("groupidOptions", groupidOptions);
return apiDatas; return apiDatas;
} }
@Override @Override
public Map<String, Object> saveQuickSearchInfo(Map<String, Object> params) { public Map<String, Object> saveQuickSearchInfo(Map<String, Object> params) {
Map<String, Object> apidatas = new HashMap<>(); Map<String, Object> apidatas = new HashMap<>();
RecordSet rs = new RecordSet();
String isquicksearch = Util.null2String(params.get("isquicksearch")); String isquicksearch = Util.null2String(params.get("isquicksearch"));
String isshowtype = Util.null2String(params.get("isshowtype")); String isshowtype = Util.null2String(params.get("isshowtype"));
String ishidename = Util.null2String(params.get("ishidename")); String ishidename = Util.null2String(params.get("ishidename"));
String _id = Util.null2String(params.get("id")); String _id = Util.null2String(params.get("id"));
String _data = Util.null2String(params.get("data")); String _data = Util.null2String(params.get("data"));
JSONArray datas = JSONArray.parseArray(_data); JSONArray datas = JSONArray.parseArray(_data);
String sql = "";
//配置信息更新 //配置信息更新
if ("0".equals(_id) || "".equals(_id)) { if ("0".equals(_id) || "".equals(_id)) {
QuickSearchSetting quickSearchSetting = QuickSearchSetting.builder()
.belongTo(user.getUID())
.isQuickSearch(Integer.parseInt(isquicksearch))
.isShowType(Integer.parseInt(isshowtype))
.isHideName(Integer.parseInt(ishidename))
.updateTor(user.getUID())
.updateDate(DateUtils.getCurrentDate())
.updateTime(DateUtils.getCurrentTime())
.build();
//第一次修改配置 //第一次修改配置
sql = "insert into jcl_quicksearch_setting(belongto,isquicksearch,isshowtype,ishidename,updatetor,updatedate,updatetime) values(?,?,?,?,?,?,?)"; getQuickSearchMapper().insertQuickSearchSetting(quickSearchSetting);
rs.executeUpdate(sql, user.getUID(), isquicksearch, isshowtype, ishidename, user.getUID(), DateUtils.getCurrentDate(), DateUtils.getCurrentTime());
} else { } else {
sql = "update jcl_quicksearch_setting set isquicksearch=?,isshowtype=?,ishidename=? where id=?"; QuickSearchSetting quickSearchSetting = QuickSearchSetting.builder()
rs.executeUpdate(sql, isquicksearch, isshowtype, ishidename, _id); .id(Integer.parseInt(_id))
.isQuickSearch(Integer.parseInt(isquicksearch))
.isShowType(Integer.parseInt(isshowtype))
.isHideName(Integer.parseInt(ishidename))
.build();
getQuickSearchMapper().updateQuickSearchSetting(quickSearchSetting);
} }
List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID());
sql = "select id from jcl_quicksearch_condition where belongto=? "; List<Integer> list = quickSearchConditionList.stream().map(QuickSearchCondition::getId).collect(Collectors.toList());
rs.executeQuery(sql, user.getUID());
List<String> list = new ArrayList<>();
while (rs.next()) {
list.add(rs.getString("id"));
}
for (int i = 0; i < datas.size(); i++) { for (int i = 0; i < datas.size(); i++) {
JSONObject obj = (JSONObject) datas.get(i); JSONObject obj = (JSONObject) datas.get(i);
@ -210,34 +223,39 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
String type = obj.getString("type"); String type = obj.getString("type");
String orderid = obj.getString("orderid"); String orderid = obj.getString("orderid");
String showmodel = obj.getString("showmodel"); String showmodel = obj.getString("showmodel");
String id = "";
if (cid > 0) { if (cid > 0) {
list.remove(cid + ""); list.remove(cid);
sql = "update jcl_quicksearch_condition set belongto=?,fieldid=?,customname=?,type=?,orderid=?,showmodel=? where id=" + cid; QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder()
rs.executeUpdate(sql, user.getUID(), fieldid, customname, type, orderid, showmodel); .belongTo(user.getUID())
id = cid + ""; .fieldId(fieldid)
.customName(customname)
.type(StringUtils.isBlank(type) ? null : Integer.parseInt(type))
.orderId(StringUtils.isBlank(orderid) ? null : Integer.parseInt(orderid))
.showModel(StringUtils.isBlank(showmodel) ? null : Integer.parseInt(showmodel))
.id(cid)
.build();
getQuickSearchMapper().updateQuickSearchCondition(quickSearchCondition);
if (!fieldid.equals(orifieldid)) { if (!fieldid.equals(orifieldid)) {
//改变了字段,将原先字段的明细删除 //改变了字段,将原先字段的明细删除
sql = "delete from jcl_quicksearch_detail where cid=?"; getQuickSearchMapper().deleteQuickSearchDetailByCid(cid);
rs.executeUpdate(sql, id);
} }
} else { } else {
sql = "insert into jcl_quicksearch_condition(belongto,fieldid,customname,type,orderid,showmodel) values(?,?,?,?,?,?)"; QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder()
rs.executeUpdate(sql, user.getUID(), fieldid, customname, type, orderid, showmodel); .belongTo(user.getUID())
sql = "select max(id) id from jcl_quicksearch_condition where belongto=?"; .fieldId(fieldid)
rs.executeQuery(sql, user.getUID()); .customName(customname)
if (rs.next()) { .type(StringUtils.isBlank(type) ? null : Integer.parseInt(type))
id = Util.null2String(rs.getString("id")); .orderId(StringUtils.isBlank(orderid) ? null : Integer.parseInt(orderid))
} .showModel(StringUtils.isBlank(showmodel) ? null : Integer.parseInt(showmodel))
.build();
getQuickSearchMapper().insertQuickSearchCondition(quickSearchCondition);
} }
} }
if (list.size() > 0) { if (CollectionUtils.isNotEmpty(list)) {
String ids = StringUtils.join(list.toArray(), ","); getQuickSearchMapper().deleteQuickSearchConditionByIds(list);
rs.executeUpdate("delete from jcl_quicksearch_condition where id in (" + ids + ")"); getQuickSearchMapper().deleteQuickSearchDetailByCids(list);
sql = "delete from jcl_quicksearch_detail where cid in (" + ids + ")";
rs.executeUpdate(sql);
} }
@ -250,6 +268,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
String cid = weaver.formmode.exttools.impexp.common.StringUtils.null2String(params.get("cid")); String cid = weaver.formmode.exttools.impexp.common.StringUtils.null2String(params.get("cid"));
RecordSet rs = new RecordSet(); RecordSet rs = new RecordSet();
//开关查询 //开关查询
List<QuickSearchDetail> quickSearchDetailByCid = getQuickSearchMapper().getQuickSearchDetailByCid(cid);
String sql = "select id,customname,minnum,maxnum,type typeTemp,orderid,fieldid,belongto from jcl_quicksearch_detail where cid=? order by orderid asc,id asc"; String sql = "select id,customname,minnum,maxnum,type typeTemp,orderid,fieldid,belongto from jcl_quicksearch_detail where cid=? order by orderid asc,id asc";
rs.executeQuery(sql, cid); rs.executeQuery(sql, cid);
JSONArray datas = new JSONArray(); JSONArray datas = new JSONArray();
@ -288,9 +307,9 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
int digitsIndex = dbtype.indexOf(","); int digitsIndex = dbtype.indexOf(",");
precision = Util.getIntValue(dbtype.substring(digitsIndex + 1, dbtype.length() - 1), 0); precision = Util.getIntValue(dbtype.substring(digitsIndex + 1, dbtype.length() - 1), 0);
} }
if ("1".equals(fieldhtmltype) && "5".equals(type)) { //if ("1".equals(fieldhtmltype) && "5".equals(type)) {
//precision = Util.getIntValue(rs.getString("qfws"),2); // precision = Util.getIntValue(rs.getString("qfws"),2);
} //}
} }
apidatas.put("datas", datas); apidatas.put("datas", datas);
apidatas.put("precision", precision); apidatas.put("precision", precision);
@ -314,8 +333,8 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
list.add(rs.getString("id")); list.add(rs.getString("id"));
} }
try { try {
for (Object object : datas) { for (int i = 0; i < datas.size(); i++) {
JSONObject obj = (JSONObject) object; JSONObject obj = (JSONObject) datas.get(i);
String customname = obj.getString("customname"); String customname = obj.getString("customname");
String fieldid = obj.getString("fieldid"); String fieldid = obj.getString("fieldid");
String minnum = obj.getString("minnum"); String minnum = obj.getString("minnum");

Loading…
Cancel
Save