kimi
2020-02-10 0433821d269c0c248174af1a39ed574763add165
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.highdatas.srs.web;
 
 
import com.highdatas.srs.entity.ProjectLog;
import com.highdatas.srs.pojo.CodeMsg;
import com.highdatas.srs.pojo.Result;
import com.highdatas.srs.service.IProjectLogService;
import com.highdatas.srs.util.DbUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
 
import javax.servlet.http.HttpServletRequest;
import java.util.Date;
 
/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author kimi
 * @since 2020-01-15
 */
@RestController
@RequestMapping("/projectLog")
public class ProjectLogController {
    @Autowired
    IProjectLogService projectLogService;
 
    @RequestMapping(value = "/get/{id}", method = RequestMethod.GET)
    public Result get(@PathVariable String id)  {
        ProjectLog projectLog = projectLogService.selectById(id);
        return Result.success(projectLog);
    }
    @RequestMapping(value = "/add", method = RequestMethod.GET)
    public Result add(HttpServletRequest request)  {
        String detailId = request.getParameter("detailId");
        if(StringUtils.isEmpty(detailId)) {
            return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED);
        }
        String desp = request.getParameter("desp");
        String userId = request.getParameter("userId");
        ProjectLog projectLog = new ProjectLog();
        projectLog.setCreateTime(new Date()).setId(DbUtils.getUUID()).setDesp(desp).setSchemeDeatilId(detailId).setUserId(userId).insert();
        return Result.success(projectLog);
    }
}