package com.mortals.xhx.module.one.web;

import com.alibaba.fastjson.JSONObject;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.mortals.framework.web.BaseCRUDJsonMappingController;
import com.mortals.xhx.module.one.model.OneClassifyTopicalEntity;
import com.mortals.xhx.module.one.service.OneClassifyTopicalService;


/**
* <p>Title: 分类引导主题中间表</p>
* <p>Description: OneClassifyTopicalController  </p>
* <p>Copyright: Copyright &reg;  </p>
* <p>Company: </p>
* @author zxfei
* @version 1.0.0
*/
@RestController
@RequestMapping("one/classify/topical")
public class OneClassifyTopicalController extends BaseCRUDJsonMappingController<OneClassifyTopicalService,OneClassifyTopicalForm,OneClassifyTopicalEntity,Long> {

    public OneClassifyTopicalController(){
        super.setFormClass(OneClassifyTopicalForm.class);
        super.setModuleDesc("分类引导主题中间表");
    }


    /**
     * 更换排序
     */
    @PostMapping(value = "upOrDownTopicList")
    public String upOrDownTopicList(@RequestParam(value = "id") Long id, @RequestParam(value = "type") Integer type) {
        JSONObject ret = new JSONObject();
        ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
        try {
            this.service.upOrDownTopicList(id,type);
        } catch (Exception e) {
            log.error("更新错误", e);
            ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
            ret.put(KEY_RESULT_MSG, e.getMessage());
        }
        return ret.toJSONString();
    }


}