package com.storlead.sales.controller.customer;


import com.storlead.framework.common.result.Result;
import com.storlead.sales.pojo.dto.customer.WorkDynamicsSearchDTO;
import com.storlead.sales.pojo.entity.customer.WorkDynamicsEntity;
import com.storlead.sales.service.customer.WorkDynamicsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import javax.annotation.Resource;
import org.springframework.transaction.annotation.Transactional;
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;

/**
 * <p>
 * 工作动态表 前端控制器
 * </p>
 *
 * @author YPZ
 * @since 2025-05-28
 */
@RestController
@RequestMapping("/work-dynamics")
@Api(tags = "销售: 工作动态相关接口")
public class WorkDynamicsController {

    @Resource
    private WorkDynamicsService workDynamicsService;

    @PostMapping(value = "/add")
    @ApiOperation(value = "工作动态管理-新增/修改工作动态", notes = "工作动态管理-新增/修改工作动态")
    @Transactional(rollbackFor = Throwable.class)
    public Result<?> add(@RequestBody WorkDynamicsEntity workDynamics) {

        return workDynamicsService.addOrEdit(workDynamics);

    }

    @PostMapping(value = "/list")
    @ApiOperation(value = "工作动态查询-列表", notes = "工作动态查询-列表")
    @ApiResponses({
            @ApiResponse(code = 200, message = "", response = WorkDynamicsSearchDTO.class)
    })
    public Result<?> list(@RequestBody WorkDynamicsSearchDTO workDynamicsSearchDTO) {

        return workDynamicsService.selectListVO(workDynamicsSearchDTO);

    }

}
