package com.dk.mdm.controller.mst;

import com.dk.common.model.pojo.PageList;
import com.dk.common.response.ResponseResultVO;
import com.dk.mdm.model.pojo.mst.DictionaryData;
import com.dk.common.service.BaseService;
import com.dk.mdm.model.query.mst.DictionaryDataQuery;
import com.dk.mdm.model.response.mst.DictionaryDataResponse;
import com.dk.mdm.model.vo.mst.DictionaryDataVO;
import com.dk.mdm.model.vo.mst.SaleChannelVO;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import io.swagger.annotations.Api;
import com.dk.mdm.service.mst.DictionaryDataService;

import java.util.List;
import java.util.Map;

@Api(tags = "数据字典API接口")
@RestController
@RequestMapping("/mst/dictionaryData")
public class DictionaryDataController{

    public BaseService<DictionaryData> getService() {
        return dictionaryDataService;
    }

    @Autowired
    private DictionaryDataService dictionaryDataService;




    /**
     * @desc : 条件查询
     * @author : 于继渤
     * @date : 2024/2/26 10:36
     */
    @ApiOperation(value = "分页、关联、条件查询", notes = "分页、关联、条件查询")
    @PostMapping({"list_by"})
    public ResponseResultVO<PageList<DictionaryDataResponse>> selectByCond(@RequestBody DictionaryDataQuery dictionaryDataQuery) {
        return dictionaryDataService.selectByCond(dictionaryDataQuery);
    }


    /**
     * @desc : 新建
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation(value = "新建", notes = "新建")
    @PostMapping({"insert"})
    public ResponseResultVO<?> insert(@RequestBody DictionaryDataVO dictionaryDataVO) {
        return dictionaryDataService.insert(dictionaryDataVO);
    }




    /**
     * @desc : 编辑
     * @author : 于继渤
     * @date : 2023/1/5 9:39
     */
    @ApiOperation( value = "编辑", notes = "编辑" )
    @PostMapping({"update"})
    public ResponseResultVO<?> update(@RequestBody DictionaryDataVO dictionaryDataVO) {
        return dictionaryDataService.update(dictionaryDataVO);
    }



    /**
     * @desc : 停用
     * @author : 于继渤
     * @date :  2023/1/4 9:39
     */
    @PostMapping("disable/{id}")
    public ResponseResultVO<Boolean> disable(@PathVariable String id) {
        return dictionaryDataService.disable(id);
    }

    @PostMapping("count_by_cond_money_account/{id}")
    public ResponseResultVO<Long> countByCondMoneyAccount(@PathVariable String id) {
        return dictionaryDataService.countByCondMoneyAccount(id);
    }


    /**
     * @desc : 启用
     * @author : 于继渤
     * @date :  2023/1/4 9:39
     */
    @PostMapping("enable/{id}")
    public ResponseResultVO<Boolean> enable(@PathVariable String id) {
        return dictionaryDataService.enable(id);
    }




    /**
     * @desc : 批量编辑序号
     * @author : 于继渤
     * @date :  2023/1/4 9:39
     */
    @ApiOperation( value = "批量编辑序号", notes = "批量编辑序号" )
    @PostMapping({"update_batch_dictionary_data_display_no"})
    public ResponseResultVO<?> updateBatchDictionaryDataDisplayNo(@RequestBody DictionaryDataVO dictionaryDataVO) {
        return dictionaryDataService.updateBatchDictionaryDataDisplayNo(dictionaryDataVO);
    }
}
