|
@@ -0,0 +1,67 @@
|
|
|
+package com.ym.mec.web.controller.school;
|
|
|
+
|
|
|
+import com.ym.mec.auth.api.entity.SysUser;
|
|
|
+import com.ym.mec.biz.dal.entity.SysSuggestion;
|
|
|
+import com.ym.mec.biz.dal.entity.SysSuggestionType;
|
|
|
+import com.ym.mec.biz.dal.page.SysSuggestionQueryInfo;
|
|
|
+import com.ym.mec.biz.service.SysSuggestionService;
|
|
|
+import com.ym.mec.biz.service.SysSuggestionTypeService;
|
|
|
+import com.ym.mec.biz.service.SysUserService;
|
|
|
+import com.ym.mec.common.controller.BaseController;
|
|
|
+import com.ym.mec.common.entity.HttpResponseResult;
|
|
|
+import com.ym.mec.common.tenant.TenantContextHolder;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+@Api(tags = "意见反馈")
|
|
|
+@RestController
|
|
|
+@RequestMapping("${app-config.url.web:}/suggestion")
|
|
|
+public class SchoolSysSuggestionController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private SysSuggestionService suggestionService;
|
|
|
+ @Autowired
|
|
|
+ private SysSuggestionTypeService sysSuggestionTypeService;
|
|
|
+ @Autowired
|
|
|
+ private SysUserService sysUserService;
|
|
|
+
|
|
|
+ @ApiOperation(value = "新增建议")
|
|
|
+ @PostMapping("add")
|
|
|
+ public Object add(SysSuggestion sysSuggestion) {
|
|
|
+ SysUser sysUser = sysUserService.getUser();
|
|
|
+ sysSuggestion.setClientType("SYSTEM");
|
|
|
+ sysSuggestion.setUserId(sysUser.getId().longValue());
|
|
|
+ if(StringUtils.isEmpty(sysSuggestion.getMobileNo())){
|
|
|
+ sysSuggestion.setMobileNo(sysUser.getPhone());
|
|
|
+ }
|
|
|
+ suggestionService.insert(sysSuggestion);
|
|
|
+ return succeed();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页查询")
|
|
|
+ @PostMapping("queryPage")
|
|
|
+ public Object queryPage(@RequestBody SysSuggestionQueryInfo queryInfo) {
|
|
|
+ queryInfo.setUserId(sysUserService.getUserId());
|
|
|
+ return succeed(suggestionService.queryPage(queryInfo));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "获取详情")
|
|
|
+ @GetMapping("detail")
|
|
|
+ public HttpResponseResult<SysSuggestion> detail(Long id) {
|
|
|
+ return succeed(suggestionService.getDetail(id));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "分页查询")
|
|
|
+ @PostMapping("queryAll")
|
|
|
+ public HttpResponseResult<List<SysSuggestionType>> queryAll() {
|
|
|
+ return succeed(sysSuggestionTypeService.lambdaQuery()
|
|
|
+ .eq(SysSuggestionType::getTenantId, TenantContextHolder.getTenantId())
|
|
|
+ .orderByDesc(SysSuggestionType::getId).list());
|
|
|
+ }
|
|
|
+
|
|
|
+}
|