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