package com.consum.base.core.data;
|
|
import com.consum.model.po.BaseCategory;
|
import com.walker.infrastructure.utils.NumberGenerator;
|
import com.walker.jdbc.service.BaseServiceImpl;
|
import org.springframework.stereotype.Service;
|
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service
|
public class Base_CategoryService extends BaseServiceImpl {
|
|
|
public void addFirstCategory(long fid){
|
String[] classifications = new String[]{"A","B","C","A","B","C","A","B","C","A","B","C","A","B","C"};
|
for (int i=0;i<5;i++){
|
int j = 0;
|
j++;
|
if (j == 4) {
|
j = 0;
|
}
|
BaseCategory category = new BaseCategory();
|
category.setId(NumberGenerator.getLongSequenceNumber());
|
category.setCategoryName("电子产品"+i);
|
category.setLevels(1);
|
category.setFatherCategoryId(fid);
|
category.setClassification(classifications[j]);
|
category.setOrderNumber(j);
|
insert(category);
|
}
|
}
|
|
public void addSecondCategory(long firstid){
|
|
String sql = "select ID from base_category where LEVELS=1";
|
|
List<Map<String,Object>> list = select(sql,new HashMap<>());
|
for (Map map : list){
|
|
String[] classifications = new String[]{"A","B","C","A","B","C","A","B","C","A","B","C","A","B","C"};
|
for (int i=0;i<50;i++){
|
int j = 0;
|
j++;
|
if (j == 4) {
|
j = 0;
|
}
|
BaseCategory category = new BaseCategory();
|
category.setId(NumberGenerator.getLongSequenceNumber());
|
category.setCategoryName("手机"+i);
|
category.setLevels(2);
|
category.setFatherCategoryId(Long.valueOf(map.get("ID").toString()));
|
category.setClassification(classifications[j]);
|
category.setStates(1);
|
category.setOrderNumber(j);
|
insert(category);
|
}
|
}
|
}
|
|
public void addThirdCategory(long secondid){
|
String sql = "select ID from base_category where LEVELS=2";
|
|
List<Map<String,Object>> list = select(sql,new HashMap<>());
|
for (Map map : list){
|
|
String[] classifications = new String[]{"A","B","C","A","B","C","A","B","C","A","B","C","A","B","C"};
|
for (int i=0;i<50;i++){
|
int j = 0;
|
j++;
|
if (j == 4) {
|
j = 0;
|
}
|
BaseCategory category = new BaseCategory();
|
category.setId(NumberGenerator.getLongSequenceNumber());
|
category.setCategoryName("手机"+i);
|
category.setLevels(3);
|
category.setFatherCategoryId(Long.valueOf(map.get("ID").toString()));
|
category.setClassification(classifications[j]);
|
category.setStates(1);
|
category.setOrderNumber(j);
|
insert(category);
|
}
|
}
|
}
|
|
}
|