zm
2020-05-18 a18bfacbf56b401f6e0fdae8710fbca4df8cff77
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
package com.changhong.autoform.rest.define;
 
import java.util.List;
import javax.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.changhong.autoform.constant.data.DataUrl;
import com.changhong.autoform.entity.CodeAndValueBean;
import com.changhong.autoform.entity.MasterData;
import com.changhong.autoform.entity.MasterDefineEntity;
import com.changhong.autoform.entity.MasterElementEntity;
import com.changhong.autoform.entity.MasterValue;
import com.changhong.autoform.entity.MasterValueEntity;
import com.changhong.autoform.entity.system.RestResult;
import com.changhong.autoform.entity.system.RestResultGenerator;
import com.changhong.autoform.service.define.DefineService;
 
@RestController
@RequestMapping(method=RequestMethod.POST)
public class DefineRest implements DataUrl{
 
    @Resource
    private DefineService defineService;
 
    //在创建表单数据时查询主数据定义
    @RequestMapping(MAINDATA_DEFINE)
    public RestResult<List<MasterDefineEntity>> selectAllMainDefData(@RequestBody MasterData materData){
        return RestResultGenerator.ok(defineService.selectAllMainDef(materData));
    }
 
    //在创建表单数据时搜索框中查询主数据元素
    @RequestMapping(SEARCHMAINDATA_DEFINE)
    public RestResult<List<MasterElementEntity>> searchMainElement(@RequestBody MasterData materData){
        return RestResultGenerator.ok(defineService.searchMainElement(materData));
    }
 
    //在新建数据时查询主数据元素
    @RequestMapping(SELECT_MAINELEMENTS)
    public RestResult<List<CodeAndValueBean>> selectCreateMainValue(@RequestBody MasterValue masterValue){
        return RestResultGenerator.ok(defineService.selectCreateMainValue(masterValue));
    }
    
    //根据主数据值的code TO NAME
    @RequestMapping(MASTER_VALUE_CODE_TO_NAME)
    public RestResult<CodeAndValueBean> masterValueCodeToName(@RequestBody MasterValue masterValue){
        return RestResultGenerator.ok(defineService.masterValueCodeToName(masterValue));
    }
}