@ApiOperation(value = "单例新增")
  @RequestMapping(value = "create", method = RequestMethod.POST)
  @ResponseBody
  public void create(@ModelAttribute @Valid ChannelTextFilter ctf) throws Exception {

    if (ctfService.findOne(ctf.getId()) == null) ctfService.create(ctf);
    else throw new Exception("该ID已存在!");
  }
  @ApiOperation(value = "单例查询")
  @RequestMapping(value = "get", method = RequestMethod.GET)
  @ResponseBody
  public ChannelTextFilter get(@ModelAttribute @Valid ChannelTextFilterPK id) {

    return ctfService.findOne(id);
  }
  @ApiOperation(value = "(批量)删除")
  @RequestMapping(value = "delete", method = RequestMethod.DELETE)
  @ResponseBody
  public void delete(@RequestBody @Valid List<ChannelTextFilter> list) {

    ctfService.delete(list);
  }
  @ApiOperation(value = "带条件及翻页查询")
  @RequestMapping(value = "page", method = RequestMethod.GET)
  @ResponseBody
  public AjaxPage data(@ModelAttribute @Valid PageParam param) {
    List<SpecificationCondition> conditions = new ArrayList<SpecificationCondition>();
    if (StringUtils.isNotBlank(param.channelName))
      conditions.add(SpecificationCondition.eq("id.channelId", param.channelName.split("-")[0]));
    if (StringUtils.isNotBlank(param.categoryName))
      conditions.add(SpecificationCondition.eq("id.text", param.categoryName.split("-")[0]));
    if (StringUtils.isNotBlank(param.textType))
      conditions.add(SpecificationCondition.eq("textType", param.textType));
    if (StringUtils.isNotBlank(param.text))
      conditions.add(
          SpecificationCondition.equalOrLikeIgnoreCase("id.text", "%" + param.text.trim() + "%"));
    if (StringUtils.isNotBlank(param.textState))
      conditions.add(SpecificationCondition.eq("textState", param.textState));

    List<String> sortNames = new ArrayList<String>();
    if ("id.spId".equals(param.getSortName()) || "id.spServiceCode".equals(param.getSortName())) {
      sortNames.add("id.spId");
      sortNames.add("id.spServiceCode");
    } else sortNames.add(param.getSortName());

    SpecificationHelper<ChannelTextFilter> sh =
        new SpecificationHelper<ChannelTextFilter>(conditions, param.getSortOrder(), sortNames);
    Page<ChannelTextFilter> p = ctfService.page(new PageRequest(param), sh.createSpecification());
    List<ChannelTextFilter> list = p.getContent();
    Integer category = FiltrationType.CATEGORY.getValue().intValue();
    for (ChannelTextFilter ctf : list) {
      ctf.getId().setChannelId(channelService.findOneMatch(ctf.getId().getChannelId()));
      if (category.equals(ctf.getTextType()))
        ctf.getId().setText(tftypeService.findOneMatch(ctf.getId().getText()));
    }
    return AjaxPageUtil.toAjaxPage(p.getTotalElements(), list);
  }
  @ApiOperation(value = "单例修改")
  @RequestMapping(value = "update", method = RequestMethod.PUT)
  @ResponseBody
  public void update(@ModelAttribute @Valid ChannelTextFilter ctf) {

    ctfService.update(ctf);
  }