You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
89 lines
3.5 KiB
89 lines
3.5 KiB
package com.xmomen.module.advice.controller;
|
|
|
|
import com.xmomen.framework.exception.BusinessException;
|
|
import com.xmomen.framework.mybatis.page.Page;
|
|
import com.xmomen.module.logger.Log;
|
|
import com.xmomen.module.advice.model.AdviceQuery;
|
|
import com.xmomen.module.advice.model.AdviceModel;
|
|
import com.xmomen.module.advice.service.AdviceService;
|
|
|
|
import org.apache.commons.io.IOUtils;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ImportParams;
|
|
import org.jeecgframework.poi.excel.entity.result.ExcelImportResult;
|
|
import org.jeecgframework.poi.excel.entity.vo.NormalExcelConstants;
|
|
import org.jeecgframework.poi.exception.excel.ExcelImportException;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.validation.BindingResult;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
import javax.validation.Valid;
|
|
import java.io.Serializable;
|
|
import java.io.IOException;
|
|
import java.io.InputStream;
|
|
import java.util.List;
|
|
|
|
@RestController
|
|
@RequestMapping(value = "/advice")
|
|
public class AdviceController {
|
|
|
|
@Autowired
|
|
AdviceService adviceService;
|
|
// 查询快报列表
|
|
@RequestMapping(method = RequestMethod.GET)
|
|
@Log(actionName = "查询快报列表")
|
|
public Page<AdviceModel> getAdviceList(@RequestParam(value = "limit") Integer limit,
|
|
@RequestParam(value = "offset") Integer offset,
|
|
@RequestParam(value = "id", required = false) String id,
|
|
@RequestParam(value = "ids", required = false) String[] ids,
|
|
@RequestParam(value = "excludeIds", required = false) String[] excludeIds) {
|
|
AdviceQuery adviceQuery = new AdviceQuery();
|
|
adviceQuery.setId(id);
|
|
adviceQuery.setExcludeIds(excludeIds);
|
|
adviceQuery.setIds(ids);
|
|
return adviceService.getAdviceModelPage(limit, offset, adviceQuery);
|
|
}
|
|
|
|
// 查询单个快报
|
|
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
|
|
@Log(actionName = "查询快报")
|
|
public AdviceModel getAdviceById(@PathVariable(value = "id") String id) {
|
|
return adviceService.getOneAdviceModel(id);
|
|
}
|
|
|
|
// 新增快报
|
|
@RequestMapping(method = RequestMethod.POST)
|
|
@Log(actionName = "新增快报")
|
|
public AdviceModel createAdvice(@RequestBody @Valid AdviceModel adviceModel) {
|
|
return adviceService.createAdvice(adviceModel);
|
|
}
|
|
|
|
// 更新快报
|
|
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
|
|
@Log(actionName = "更新快报")
|
|
public void updateAdvice(@PathVariable(value = "id") String id,
|
|
@RequestBody @Valid AdviceModel adviceModel) {
|
|
adviceService.updateAdvice(adviceModel);
|
|
}
|
|
|
|
// 删除单个快报
|
|
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
|
|
@Log(actionName = "删除单个快报")
|
|
public void deleteAdvice(@PathVariable(value = "id") String id) {
|
|
adviceService.deleteAdvice(id);
|
|
}
|
|
|
|
// 批量删除快报
|
|
@RequestMapping(method = RequestMethod.DELETE)
|
|
@Log(actionName = "批量删除快报")
|
|
public void deleteAdvices(@RequestParam(value = "ids") String[] ids) {
|
|
adviceService.deleteAdvice(ids);
|
|
}
|
|
|
|
|
|
}
|