package org.springblade.modules.app.web;


import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.common.auth.permission.DisableLoginVerify;
import com.wn.common.controller.BaseController;
import com.wn.common.datamodel.ResultDTO;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.modules.app.aspect.ClientLogin;
import org.springblade.modules.app.common.dto.ProblemBackDTO;
import org.springblade.modules.app.common.dto.ProblemBackInsertDTO;
import org.springblade.modules.app.common.dto.UserDTO;
import org.springblade.modules.app.common.query.ProblemBackQuery;
import org.springblade.modules.app.manager.ProblemBackManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springblade.modules.app.manager.UserManager;
import org.springblade.modules.resource.vo.SmsVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;

/**
 * <p>
 * 问题反馈表 前端控制器
 * </p>
 *
 * @author zhangK
 * @since 2022-01-13
 */
@RestController
@RequestMapping("app/problem")
@Api(value = "问题反馈", tags = "问题反馈")
public class AppProblemBackController extends BaseController {

    @Autowired
    private ProblemBackManager problemBackManager;

//    @Autowired
//    private UserManager userManager;

    //@ApiOperation(value = "新增问题反馈")
    @PostMapping("/insert")
    @DisableLoginVerify
    @ClientLogin
    public ResponseEntity<ResultDTO<Boolean>> insert(@RequestBody ProblemBackInsertDTO dto, @ApiIgnore UserDTO userDTO) {
        return success(problemBackManager.insert(dto, userDTO));
    }

    @GetMapping("/page")
	//@ApiOperationSupport(order = 3)
	//@ApiOperation(value = "分页", notes = "传入sms")
	public R<IPage<ProblemBackDTO>> page(ProblemBackQuery query) {
		IPage<ProblemBackDTO> pages = problemBackManager.page(query);
		return R.data(pages);
	}

	@GetMapping("/{id}")
	//@ApiOperationSupport(order = 3)
	//@ApiOperation(value = "分页", notes = "传入sms")
	public R<ProblemBackDTO> detail(@PathVariable("id") Long id) {
		ProblemBackDTO problemBackDTO = problemBackManager.info(id);
		return R.data(problemBackDTO);
	}

}

