快捷搜索自定义接口BUG修复
This commit is contained in:
parent
53e96cafe5
commit
55a22e8038
|
|
@ -0,0 +1,21 @@
|
|||
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 QuickSearchField {
|
||||
private String fieldHtmlType;
|
||||
private String type;
|
||||
private String fieldDbType;
|
||||
}
|
||||
|
|
@ -1,9 +1,6 @@
|
|||
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.*;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.Collection;
|
||||
|
|
@ -103,4 +100,36 @@ public interface QuickSearchMapper {
|
|||
*/
|
||||
List<QuickSearchDetail> getQuickSearchDetailByCid(@Param("cId") String cId);
|
||||
|
||||
/**
|
||||
* 按条件Id获取快速搜索字段列表
|
||||
*
|
||||
* @param id 条件Id
|
||||
* @return return
|
||||
*/
|
||||
List<QuickSearchField> getQuickSearchFieldListByConditionId(@Param("id") String id);
|
||||
|
||||
/**
|
||||
* 更新快速搜索详细信息
|
||||
*
|
||||
* @param quickSearchDetail 详细信息实体
|
||||
* @return return
|
||||
*/
|
||||
int updateQuickSearchDetail(@Param("quickSearchDetail") QuickSearchDetail quickSearchDetail);
|
||||
|
||||
/**
|
||||
* 插入快速搜索详细信息
|
||||
*
|
||||
* @param quickSearchDetail 详细信息实体
|
||||
* @return return
|
||||
*/
|
||||
int insertQuickSearchDetail(@Param("quickSearchDetail") QuickSearchDetail quickSearchDetail);
|
||||
|
||||
/**
|
||||
* 按ID删除快速搜索详细信息
|
||||
*
|
||||
* @param ids id
|
||||
* @return return
|
||||
*/
|
||||
int deleteQuickSearchDetailByIds(@Param("ids") Collection<Integer> ids);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -36,6 +36,13 @@
|
|||
where cid = #{cId}
|
||||
order by orderid, id
|
||||
</select>
|
||||
<select id="getQuickSearchFieldListByConditionId"
|
||||
resultType="com.engine.organization.entity.search.QuickSearchField">
|
||||
select b.fieldhtmltype, b.type, b.fielddbtype
|
||||
from jcl_quicksearch_condition c
|
||||
left join hrm_formfield b on b.fieldid = c.fieldid
|
||||
where c.id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertQuickSearchSetting">
|
||||
insert into jcl_quicksearch_setting(belongto,
|
||||
|
|
@ -68,6 +75,13 @@
|
|||
#{quickSearchCondition.type}, #{quickSearchCondition.orderId}, #{quickSearchCondition.showModel})
|
||||
</insert>
|
||||
|
||||
<insert id="insertQuickSearchDetail">
|
||||
insert into jcl_quicksearch_detail(cid, customname, minnum, maxnum, type, orderid, fieldid, belongto)
|
||||
values (#{quickSearchDetail.cId}, #{quickSearchDetail.customName}, #{quickSearchDetail.minNum},
|
||||
#{quickSearchDetail.maxNum}, #{quickSearchDetail.type}, #{quickSearchDetail.orderId},
|
||||
#{quickSearchDetail.fieldId}, #{quickSearchDetail.belongTo})
|
||||
</insert>
|
||||
|
||||
<update id="updateQuickSearchCondition">
|
||||
update jcl_quicksearch_condition
|
||||
set belongto=#{quickSearchCondition.belongTo},
|
||||
|
|
@ -79,24 +93,44 @@
|
|||
where id = #{quickSearchCondition.id}
|
||||
</update>
|
||||
|
||||
<update id="updateQuickSearchDetail">
|
||||
update jcl_quicksearch_detail
|
||||
set cid=#{quickSearchDetail.cId},
|
||||
customname=#{quickSearchDetail.customName},
|
||||
minnum=#{quickSearchDetail.minNum},
|
||||
maxnum=#{quickSearchDetail.maxNum},
|
||||
type=#{quickSearchDetail.type},
|
||||
orderid=#{quickSearchDetail.orderId},
|
||||
fieldid=#{quickSearchDetail.fieldId},
|
||||
belongto=#{quickSearchDetail.belongTo}
|
||||
where id = #{quickSearchDetail.id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteQuickSearchDetailByCid">
|
||||
delete
|
||||
from jcl_quicksearch_detail
|
||||
where cid = #{cId}
|
||||
</delete>
|
||||
<delete id="deleteQuickSearchDetailByCids">
|
||||
<delete id="deleteQuickSearchConditionByIds">
|
||||
delete from jcl_quicksearch_condition where id in
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteQuickSearchDetailByCIds">
|
||||
<delete id="deleteQuickSearchDetailByCids">
|
||||
delete from jcl_quicksearch_detail where cid in
|
||||
<foreach collection="cIds" open="(" item="cid" separator="," close=")">
|
||||
#{cid}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<delete id="deleteQuickSearchDetailByIds">
|
||||
delete from jcl_quicksearch_detail where id in
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -4,17 +4,12 @@ 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.entity.search.*;
|
||||
import com.engine.organization.mapper.condition.QuickSearchMapper;
|
||||
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;
|
||||
import weaver.formmode.exttools.impexp.common.DateUtils;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
|
|
@ -22,7 +17,6 @@ import weaver.hrm.User;
|
|||
import weaver.hrm.resource.ResourceComInfo;
|
||||
import weaver.systeminfo.SystemEnv;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -67,7 +61,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
//条件字段查询
|
||||
List<QuickSearchCondition> quickSearchConditionList = getQuickSearchMapper().getQuickSearchConditionList(user.getUID());
|
||||
JSONArray datas = new JSONArray();
|
||||
if(CollectionUtils.isNotEmpty(quickSearchConditionList)) {
|
||||
if (CollectionUtils.isNotEmpty(quickSearchConditionList)) {
|
||||
for (QuickSearchCondition quickSearchCondition : quickSearchConditionList) {
|
||||
JSONObject obj = new JSONObject();
|
||||
String id = Util.null2String(quickSearchCondition.getId());
|
||||
|
|
@ -75,7 +69,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
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";
|
||||
String showModel = null != quickSearchCondition.getShowModel() ? quickSearchCondition.getShowModel().toString() : "0";
|
||||
obj.put("cid", id);
|
||||
obj.put("key", id);
|
||||
obj.put("fieldid", fieldId);
|
||||
|
|
@ -93,7 +87,7 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
//字段下拉框查询
|
||||
List<QuickSearchOption> quickSearchOptionList = getQuickSearchMapper().getQuickSearchOptionList();
|
||||
JSONArray options = new JSONArray();
|
||||
if(CollectionUtils.isNotEmpty(quickSearchOptionList)) {
|
||||
if (CollectionUtils.isNotEmpty(quickSearchOptionList)) {
|
||||
for (QuickSearchOption quickSearchOption : quickSearchOptionList) {
|
||||
JSONObject obj = new JSONObject();
|
||||
String fieldHtmlType = Util.null2String(quickSearchOption.getFieldHtmlType());
|
||||
|
|
@ -181,20 +175,22 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
|
||||
@Override
|
||||
public Map<String, Object> saveQuickSearchInfo(Map<String, Object> params) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
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);
|
||||
Map<String, Object> apiDatas = new HashMap<>(16);
|
||||
String isQuickSearch = Util.null2String(params.get("isquicksearch"));
|
||||
String isShowType = Util.null2String(params.get("isshowtype"));
|
||||
isShowType = StringUtils.isBlank(isShowType) ? "0" : isShowType;
|
||||
String isHideName = Util.null2String(params.get("ishidename"));
|
||||
isHideName = StringUtils.isBlank(isHideName) ? "0" : isHideName;
|
||||
String id = Util.null2String(params.get("id"));
|
||||
String data = Util.null2String(params.get("data"));
|
||||
JSONArray datas = JSONArray.parseArray(data);
|
||||
//配置信息更新
|
||||
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))
|
||||
.isQuickSearch(Integer.parseInt(isQuickSearch))
|
||||
.isShowType(Integer.parseInt(isShowType))
|
||||
.isHideName(Integer.parseInt(isHideName))
|
||||
.updateTor(user.getUID())
|
||||
.updateDate(DateUtils.getCurrentDate())
|
||||
.updateTime(DateUtils.getCurrentTime())
|
||||
|
|
@ -203,10 +199,10 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
getQuickSearchMapper().insertQuickSearchSetting(quickSearchSetting);
|
||||
} else {
|
||||
QuickSearchSetting quickSearchSetting = QuickSearchSetting.builder()
|
||||
.id(Integer.parseInt(_id))
|
||||
.isQuickSearch(Integer.parseInt(isquicksearch))
|
||||
.isShowType(Integer.parseInt(isshowtype))
|
||||
.isHideName(Integer.parseInt(ishidename))
|
||||
.id(Integer.parseInt(id))
|
||||
.isQuickSearch(Integer.parseInt(isQuickSearch))
|
||||
.isShowType(Integer.parseInt(isShowType))
|
||||
.isHideName(Integer.parseInt(isHideName))
|
||||
.build();
|
||||
getQuickSearchMapper().updateQuickSearchSetting(quickSearchSetting);
|
||||
}
|
||||
|
|
@ -216,41 +212,40 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
|
||||
for (int i = 0; i < datas.size(); i++) {
|
||||
JSONObject obj = (JSONObject) datas.get(i);
|
||||
String fieldid = obj.getString("fieldid");
|
||||
String orifieldid = obj.getString("orifieldid");
|
||||
int cid = Util.getIntValue(obj.getString("cid"));
|
||||
String customname = obj.getString("customname");
|
||||
String fieldId = obj.getString("fieldid");
|
||||
String oriFieldId = obj.getString("orifieldid");
|
||||
Integer cid = Util.getIntValue(obj.getString("cid"));
|
||||
String customName = obj.getString("customname");
|
||||
String type = obj.getString("type");
|
||||
String orderid = obj.getString("orderid");
|
||||
String showmodel = obj.getString("showmodel");
|
||||
String orderId = obj.getString("orderid");
|
||||
String showModel = obj.getString("showmodel");
|
||||
if (cid > 0) {
|
||||
list.remove(cid);
|
||||
QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder()
|
||||
.belongTo(user.getUID())
|
||||
.fieldId(fieldid)
|
||||
.customName(customname)
|
||||
.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))
|
||||
.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)) {
|
||||
//改变了字段,将原先字段的明细删除
|
||||
getQuickSearchMapper().deleteQuickSearchDetailByCid(cid);
|
||||
}
|
||||
} else {
|
||||
QuickSearchCondition quickSearchCondition = QuickSearchCondition.builder()
|
||||
.belongTo(user.getUID())
|
||||
.fieldId(fieldid)
|
||||
.customName(customname)
|
||||
.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))
|
||||
.orderId(StringUtils.isBlank(orderId) ? null : Integer.parseInt(orderId))
|
||||
.showModel(StringUtils.isBlank(showModel) ? null : Integer.parseInt(showModel))
|
||||
.build();
|
||||
getQuickSearchMapper().insertQuickSearchCondition(quickSearchCondition);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
|
|
@ -258,113 +253,105 @@ public class QuickSearchServiceImpl extends Service implements QuickSearchServic
|
|||
getQuickSearchMapper().deleteQuickSearchDetailByCids(list);
|
||||
}
|
||||
|
||||
|
||||
return apidatas;
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getQuickSearchDetailInfo(Map<String, Object> params) {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
Map<String, Object> apiDatas = new HashMap<>(16);
|
||||
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);
|
||||
List<QuickSearchDetail> quickSearchDetailList = getQuickSearchMapper().getQuickSearchDetailByCid(cid);
|
||||
JSONArray datas = new JSONArray();
|
||||
while (rs.next()) {
|
||||
for (QuickSearchDetail quickSearchDetail : quickSearchDetailList) {
|
||||
JSONObject obj = new JSONObject();
|
||||
String id = Util.null2String(rs.getString("id"));
|
||||
String customname = Util.null2String(rs.getString("customname"));
|
||||
String minnum = Util.null2String(rs.getString("minnum"));
|
||||
minnum = minnum.startsWith("0E") ? "0" : minnum;
|
||||
String maxnum = Util.null2String(rs.getString("maxnum"));
|
||||
maxnum = maxnum.startsWith("0E") ? "0" : maxnum;
|
||||
String type = Util.null2String(rs.getString("typeTemp"));
|
||||
String orderid = Util.null2String(rs.getString("orderid"));
|
||||
String fieldid = Util.null2String(rs.getString("fieldid"));
|
||||
String belongto = Util.null2String(rs.getString("belongto"));
|
||||
String id = Util.null2String(quickSearchDetail.getId());
|
||||
String customName = Util.null2String(quickSearchDetail.getCustomName());
|
||||
String minNum = Util.null2String(quickSearchDetail.getMinNum());
|
||||
minNum = minNum.startsWith("0E") ? "0" : minNum;
|
||||
String maxNum = Util.null2String(quickSearchDetail.getMaxNum());
|
||||
maxNum = maxNum.startsWith("0E") ? "0" : maxNum;
|
||||
String type = Util.null2String(quickSearchDetail.getType());
|
||||
String orderId = Util.null2String(quickSearchDetail.getOrderId());
|
||||
String fieldId = Util.null2String(quickSearchDetail.getFieldId());
|
||||
String belongTo = Util.null2String(quickSearchDetail.getBelongTo());
|
||||
obj.put("id", id);
|
||||
obj.put("cid", cid);
|
||||
obj.put("key", id);
|
||||
obj.put("customname", customname);
|
||||
obj.put("minnum", minnum);
|
||||
obj.put("maxnum", maxnum);
|
||||
obj.put("customname", customName);
|
||||
obj.put("minnum", minNum);
|
||||
obj.put("maxnum", maxNum);
|
||||
obj.put("type", type);
|
||||
obj.put("fieldid", fieldid);
|
||||
obj.put("belongto", belongto);
|
||||
obj.put("orderid", orderid);
|
||||
obj.put("fieldid", fieldId);
|
||||
obj.put("belongto", belongTo);
|
||||
obj.put("orderid", orderId);
|
||||
datas.add(obj);
|
||||
}
|
||||
sql = "select b.fieldhtmltype,b.type typeTemp,b.fielddbtype from jcl_quicksearch_condition c left join hrm_formfield b on b.fieldid =c.fieldid where c.id= ? ";
|
||||
rs.executeQuery(sql, cid);
|
||||
List<QuickSearchField> quickSearchFieldList = getQuickSearchMapper().getQuickSearchFieldListByConditionId(cid);
|
||||
int precision = 0;
|
||||
while (rs.next()) {
|
||||
String fieldhtmltype = rs.getString("fieldhtmltype");
|
||||
String type = rs.getString("typeTemp");
|
||||
String dbtype = rs.getString("fielddbtype");
|
||||
if ("1".equals(fieldhtmltype) && !"1".equals(type)) {
|
||||
int digitsIndex = dbtype.indexOf(",");
|
||||
precision = Util.getIntValue(dbtype.substring(digitsIndex + 1, dbtype.length() - 1), 0);
|
||||
for (QuickSearchField quickSearchField : quickSearchFieldList) {
|
||||
String fieldHtmlType = quickSearchField.getFieldHtmlType();
|
||||
String type = quickSearchField.getType();
|
||||
String fieldDbType = quickSearchField.getFieldDbType();
|
||||
if ("1".equals(fieldHtmlType) && !"1".equals(type)) {
|
||||
int digitsIndex = fieldDbType.indexOf(",");
|
||||
precision = Util.getIntValue(fieldDbType.substring(digitsIndex + 1, fieldDbType.length() - 1), 0);
|
||||
}
|
||||
//if ("1".equals(fieldhtmltype) && "5".equals(type)) {
|
||||
// precision = Util.getIntValue(rs.getString("qfws"),2);
|
||||
//}
|
||||
}
|
||||
apidatas.put("datas", datas);
|
||||
apidatas.put("precision", precision);
|
||||
return apidatas;
|
||||
apiDatas.put("datas", datas);
|
||||
apiDatas.put("precision", precision);
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> saveQuickSearchDetailInfo(Map<String, Object> params) {
|
||||
Map<String, Object> apidatas = new HashMap<>(16);
|
||||
RecordSet rs = new RecordSet();
|
||||
Map<String, Object> apiDatas = new HashMap<>(16);
|
||||
String cid = Util.null2String(params.get("cid"));
|
||||
String _data = Util.null2String(params.get("data"));
|
||||
JSONArray datas = JSONArray.parseArray(_data);
|
||||
String sql = "";
|
||||
//条件字段更新
|
||||
RecordSetTrans rst = new RecordSetTrans();
|
||||
sql = "select id from jcl_quicksearch_detail where cid=? ";
|
||||
rs.executeQuery(sql, cid);
|
||||
List<String> list = new ArrayList<>();
|
||||
while (rs.next()) {
|
||||
list.add(rs.getString("id"));
|
||||
}
|
||||
String data = Util.null2String(params.get("data"));
|
||||
JSONArray datas = JSONArray.parseArray(data);
|
||||
List<Integer> list = getQuickSearchMapper().getQuickSearchDetailByCid(cid).stream().map(QuickSearchDetail::getId).collect(Collectors.toList());
|
||||
|
||||
try {
|
||||
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");
|
||||
minnum = "".equals(minnum) ? null : minnum;
|
||||
String maxnum = obj.getString("maxnum");
|
||||
maxnum = "".equals(maxnum) ? null : maxnum;
|
||||
String customName = obj.getString("customname");
|
||||
String fieldId = obj.getString("fieldid");
|
||||
String minNum = obj.getString("minnum");
|
||||
minNum = "".equals(minNum) ? null : minNum;
|
||||
String maxNum = obj.getString("maxnum");
|
||||
maxNum = "".equals(maxNum) ? null : maxNum;
|
||||
String type = obj.getString("type");
|
||||
String orderid = obj.getString("orderid");
|
||||
int id = Util.getIntValue(obj.getString("id"));
|
||||
String orderId = obj.getString("orderid");
|
||||
Integer id = Util.getIntValue(obj.getString("id"));
|
||||
|
||||
QuickSearchDetail quickSearchDetail = QuickSearchDetail.builder()
|
||||
.cId(StringUtils.isBlank(cid) ? null : Integer.parseInt(cid))
|
||||
.customName(customName)
|
||||
.minNum(StringUtils.isBlank(minNum) ? null : Integer.parseInt(minNum))
|
||||
.maxNum(StringUtils.isBlank(maxNum) ? null : Integer.parseInt(maxNum))
|
||||
.type(StringUtils.isBlank(type) ? null : Integer.parseInt(type))
|
||||
.orderId(StringUtils.isBlank(orderId) ? null : Integer.parseInt(orderId))
|
||||
.fieldId(fieldId)
|
||||
.belongTo(user.getUID())
|
||||
.build();
|
||||
|
||||
if (id > 0) {
|
||||
list.remove(id + "");
|
||||
sql = "update jcl_quicksearch_detail set cid=?,customname=?,minnum=?,maxnum=?,type=?,orderid=?,fieldid=?,belongto=? where id=?";
|
||||
rst.executeUpdate(sql, cid, customname, minnum, maxnum, type, orderid, fieldid, user.getUID(), id);
|
||||
list.remove(id);
|
||||
quickSearchDetail.setId(id);
|
||||
getQuickSearchMapper().updateQuickSearchDetail(quickSearchDetail);
|
||||
} else {
|
||||
sql = "insert into jcl_quicksearch_detail(cid,customname,minnum,maxnum,type,orderid,fieldid,belongto) values(?,?,?,?,?,?,?,?)";
|
||||
rst.executeUpdate(sql, cid, customname, minnum, maxnum, type, orderid, fieldid, user.getUID());
|
||||
getQuickSearchMapper().insertQuickSearchDetail(quickSearchDetail);
|
||||
}
|
||||
}
|
||||
rst.commit();
|
||||
if (list.size() > 0) {
|
||||
String ids = StringUtils.join(list.toArray(), ",");
|
||||
rs.executeUpdate("delete from jcl_quicksearch_detail where id in (" + ids + ")");
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
getQuickSearchMapper().deleteQuickSearchDetailByIds(list);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
rst.rollback();
|
||||
new BaseBean().writeLog(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return apidatas;
|
||||
return apiDatas;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue