CZT
2023-10-24 62b592d65a8c84114b2240ee7ba78c6ae2fe93e6
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
package com.fzzy.otherview.whhpjl.pr;
 
import com.bstek.dorado.annotation.DataProvider;
import com.bstek.dorado.annotation.DataResolver;
import com.bstek.dorado.annotation.Expose;
import com.fzzy.api.entity.ApiList;
import com.fzzy.api.entity.ApiTrigger;
import com.fzzy.otherview.whhpjl.WhjlConstant;
import com.fzzy.otherview.whhpjl.repository.ApiListWhjlRep;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
 
/**
 * 
 * 接口列表
 * @author czt
 */
@Component
public class ApiListWhjlPR {
 
    @Autowired
    private ApiListWhjlRep apiListWhjlRep;
 
    /**
     * apiListWhjlPR#listAll
     *
     * @return
     */
    @DataProvider
    public List<ApiList> listAll() {
        return apiListWhjlRep.findAllByBizType(WhjlConstant.API_BIZ_TYPE);
    }
 
    /**
     * apiListWhjlPR#updateSave
     *
     * @param entity
     */
    @DataResolver
    public void updateSave(ApiList entity) {
 
        // 手动将doradoEntity对象转换为标准Bean对象
        ApiList data = new ApiList();
        BeanUtils.copyProperties(entity, data);
 
        data.setBizType(WhjlConstant.API_BIZ_TYPE);
        apiListWhjlRep.save(data);
    }
 
    /**
     * apiListWhjlPR#delData
     *
     * @param data
     */
    @Expose
    public String delData(ApiList data) {
 
        apiListWhjlRep.deleteById(data.getId());
 
        return null;
    }
 
 
    /**
     *
     * 接口分类下来框
     *
     * ${dorado.getDataProvider("apiListWhjlPR#triggerCategory").getResult()}
     *
     * @return
     */
    @DataProvider
    public List<ApiTrigger> triggerCategory() {
        List<ApiTrigger> list = new ArrayList<ApiTrigger>();
        list.add(new ApiTrigger(WhjlConstant.API_CATEGORY_11,"基础信息(军粮企业、仓储设施设备)"));
        list.add(new ApiTrigger(WhjlConstant.API_CATEGORY_12,"粮食购销(产品信息、经营管理、出入库业务)"));
        list.add(new ApiTrigger(WhjlConstant.API_CATEGORY_13,"粮食管理(质量管理、储运环境)"));
        list.add(new ApiTrigger(WhjlConstant.API_CATEGORY_14,"行政管理(动员企业、生产加工、应急指挥)"));
        return list;
    }
}