package com.crm.custom.controller;

import com.crm.custom.service.GoldenCustomBalanceRecordService;
import com.crm.rely.backend.core.dto.base.ResultWithPagerDto;
import com.crm.rely.backend.model.dto.golden.goods.GoldenCustomBalanceRecordListDto;
import com.crm.rely.backend.model.entity.custom.info.CustomInfoEntity;
import com.crm.rely.backend.model.entity.golden.order.GoldenBalanceSearchEntity;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/custom/balance/recoed")
public class GoldenCustomBalanceRecordController {

    @Autowired
    private GoldenCustomBalanceRecordService commonQuestionService;

    @PostMapping("/search/list")
    public ResultWithPagerDto<GoldenCustomBalanceRecordListDto> customPageList(@RequestBody GoldenBalanceSearchEntity entity, CustomInfoEntity infoEntity) throws Exception {
        if (infoEntity == null || infoEntity.getId() == null) {
            entity.setCustomId(-1l);
        }else {
            entity.setCustomId(infoEntity.getId());
        }
        return commonQuestionService.searchPageList(entity);
    }

}
