|
@@ -0,0 +1,120 @@
|
|
|
|
+package com.gis.web.controller;
|
|
|
|
+
|
|
|
|
+import com.gis.common.util.Result;
|
|
|
|
+import com.gis.domain.dto.SpiritPageDateDto;
|
|
|
|
+import com.gis.domain.po.SpiritEntity;
|
|
|
|
+import com.gis.domain.dto.SpiritRequest;
|
|
|
|
+import com.gis.domain.vo.SpiritVo;
|
|
|
|
+import com.gis.service.SpiritService;
|
|
|
|
+import com.github.pagehelper.PageInfo;
|
|
|
|
+import io.swagger.annotations.Api;
|
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
|
+import lombok.extern.log4j.Log4j2;
|
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+
|
|
|
|
+import javax.validation.Valid;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Created by owen on 2020/5/8 0008 9:54
|
|
|
|
+ */
|
|
|
|
+@Log4j2
|
|
|
|
+@Api(tags = "特有精神")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("manage/spirit")
|
|
|
|
+public class SpiritController extends BaseController {
|
|
|
|
+
|
|
|
|
+ @Autowired
|
|
|
|
+ private SpiritService spiritService;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation("列表")
|
|
|
|
+ @PostMapping("list")
|
|
|
|
+ public Result<SpiritVo> list(@RequestBody SpiritPageDateDto param) {
|
|
|
|
+
|
|
|
|
+ Long userId = getTokenUserId();
|
|
|
|
+
|
|
|
|
+ startPage(param);
|
|
|
|
+ PageInfo<SpiritVo> page = new PageInfo<>(spiritService.search(param));
|
|
|
|
+ return Result.success(page);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @ApiOperation("新增/修改部信息")
|
|
|
|
+ @PostMapping("save")
|
|
|
|
+ public Result save(@Valid @RequestBody SpiritRequest param) {
|
|
|
|
+
|
|
|
|
+ SpiritEntity entity = null;
|
|
|
|
+ if (param.getId() == null) {
|
|
|
|
+ entity = new SpiritEntity();
|
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
|
+ entity.setSubmitId(getTokenUserId());
|
|
|
|
+ entity.setStatus(1);
|
|
|
|
+ spiritService.save(entity);
|
|
|
|
+ } else {
|
|
|
|
+ entity = spiritService.findById(param.getId());
|
|
|
|
+ if (entity == null) {
|
|
|
|
+ return Result.failure("对象id不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ BeanUtils.copyProperties(param, entity);
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
|
+ spiritService.update(entity);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 软删除,db保留记录
|
|
|
|
+ */
|
|
|
|
+ @ApiOperation("删除")
|
|
|
|
+ @GetMapping("removes/{ids}")
|
|
|
|
+ public Result detail(@PathVariable String ids) {
|
|
|
|
+
|
|
|
|
+ List<SpiritEntity> entities = spiritService.findByIds(ids);
|
|
|
|
+ for (SpiritEntity entity: entities) {
|
|
|
|
+ entity.setRecStatus("I");
|
|
|
|
+ entity.setUpdateTime(new Date());
|
|
|
|
+ spiritService.update(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation("审核")
|
|
|
|
+ @GetMapping("audit/{id}/{status}")
|
|
|
|
+ public Result audit(@PathVariable Long id, @PathVariable Integer status) {
|
|
|
|
+ SpiritEntity entity = spiritService.findById(id);
|
|
|
|
+ if (entity == null) {
|
|
|
|
+ log.error("对象id不存在 : {}", id);
|
|
|
|
+ return Result.failure("对象id不存在");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ entity.setStatus(status);
|
|
|
|
+ entity.setAuditId(getTokenUserId());
|
|
|
|
+ spiritService.update(entity);
|
|
|
|
+ return Result.success();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ @ApiOperation("详情")
|
|
|
|
+ @GetMapping("detail/{id}")
|
|
|
|
+ public Result detail(@PathVariable Long id) {
|
|
|
|
+ SpiritEntity entity = spiritService.findById(id);
|
|
|
|
+ if (entity == null) {
|
|
|
|
+ log.error("对象id不存在 : {}", id);
|
|
|
|
+ return Result.failure("对象id不存在");
|
|
|
|
+ }
|
|
|
|
+ return Result.success(entity);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+}
|