【无标题】rest

2022/2/21 23:26:42

本文主要是介绍【无标题】rest,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

@RestController
public class FieldTemplateController{
    @Getter(AccessLevel.NONE)
    protected FieldTemplateCommon fieldTemplateCommon;

    @Autowired
    private FieldTemplateService fieldTemplateService;

    @GetMapping(value = "qoeQueryFieldTemplate", produces = MediaType.APPLICATION_JSON_VALUE)
    public Map<String, Object> queryFieldTemplate(FieldTemplateParamQuery fieldQuery) {
        PageInfo pageInfo = fieldTemplateService.queryByCond(fieldQuery);
        return ImmutableMap.of("totalCount", pageInfo.getTotal(), "data", pageInfo.getResults());
    }

    @PostMapping(value = "qoeAddFieldTemplate", produces = MediaType.APPLICATION_JSON_VALUE)
    public FieldTemplateCommon addFieldTemplate(FieldTemplateVo fieTplVo) {
            fieldTemplateCommon.addFieldTemplate(fieTplVo);
        return fieldTemplateCommon;

public void queryFieldTemplate() {
    FieldTemplateParamQuery fieldQuery = new FieldTemplateParamQuery();
    fieldQuery.setStart(start);
    fieldQuery.setLimit(limit);
    fieldQuery.setXdrId(xdrId);
    fieldQuery.setFieldTemplateName(fieldTemplateName);
    fieldQuery.setBusType(busType);
    PageInfo pageInfo = fieldTemplateCommon.queryByCond(fieldQuery);
    Map<String, Object> bean = new HashMap<>();
    bean.put("totalCount", pageInfo.getTotal());
    bean.put("data", pageInfo.getResults());
    responseResult(SaUtil.bean2Json(bean));
}

/**
 * 添加字段模板
 */
public void addFieldTemplate() {
    try {
        FieldTemplateVo fieTplVo = new FieldTemplateVo();
        fieTplVo.setXdrId(xdrId);
        fieTplVo.setFieldTemplateName(fieldTemplateName);
        fieTplVo.setFieldIdSeq(fieldIdSeq);
        fieTplVo.setDesc(desc);
        fieldTemplateCommon.addFieldTemplate(fieTplVo);
    } catch (Exception e) {
        throwException(e);
    }
}


这篇关于【无标题】rest的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程