杨凯
2023-10-17 e7c9fc40786f387f2c0d65e10294317480b0f621
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
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);
            }
        }
    }
 
}