main
黄海 2 years ago
parent 228b373adf
commit 30e14a52cd

@ -283,12 +283,10 @@ public class CollectController extends Controller {
List<Record> listJobSheet = cm.getSheets(job_id); List<Record> listJobSheet = cm.getSheets(job_id);
//检查是不是某张表中存在字段名称重复的情况 //检查是不是某张表中存在字段名称重复的情况
for (int i = 0; i < listJobSheet.size(); i++) { for (int i = 0; i < listJobSheet.size(); i++) {
List<Record> list = cm.checkColumnNameDuplicate(job_id, i); if (cm.checkColumnNameDuplicate(job_id, i)) {
if (list.size() > 0) {
Map map = new HashMap(); Map map = new HashMap();
map.put("success", false); map.put("success", false);
map.put("message", "第" + (i + 1) + "个Sheet表中存在字段名称重复的情况请检查后重新保存"); map.put("message", "第" + (i + 1) + "个Sheet表中存在字段名称重复的情况请检查后重新保存");
map.put("list", list);
renderJson(map); renderJson(map);
return; return;
} }

@ -291,7 +291,7 @@ public class CollectModel {
* @param sheet_index * @param sheet_index
* @return * @return
*/ */
public List<Record> checkColumnNameDuplicate(int job_id, int sheet_index) { public boolean checkColumnNameDuplicate(int job_id, int sheet_index) {
Set<String> blzList = getBlzColumn();//检查是不是与保留字重复 Set<String> blzList = getBlzColumn();//检查是不是与保留字重复
String sql = "select column_name,count(1) as c from t_collect_job_sheet_col where job_id=? and sheet_index=? group by column_name having count(1)>1"; String sql = "select column_name,count(1) as c from t_collect_job_sheet_col where job_id=? and sheet_index=? group by column_name having count(1)>1";
List<Record> list = Db.find(sql, job_id, sheet_index); List<Record> list = Db.find(sql, job_id, sheet_index);
@ -300,7 +300,7 @@ public class CollectModel {
int c = record.getInt("c"); int c = record.getInt("c");
if (blzList.contains(column_name)) record.set(column_name, c + 1); if (blzList.contains(column_name)) record.set(column_name, c + 1);
} }
return list; return list.size() > 0;
} }
public boolean checkColumnNameDuplicate(String json) { public boolean checkColumnNameDuplicate(String json) {

Loading…
Cancel
Save