package com.february.merchant.controller; import com.alibaba.fastjson.JSONObject; import com.february.common.core.domain.Result; import com.february.merchant.service.AddCarService; import com.february.system.domain.Tadmin; import com.february.system.domain.Tcar; import com.february.system.domain.Tuser; import lombok.extern.log4j.Log4j2; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @RestController @RequestMapping("/add") @Log4j2 public class AddCarController { @Autowired private AddCarService addCarService; @Autowired private HttpServletRequest request; @PostMapping("addCar") public Result addCar(@RequestBody Tcar tcar){ log.info("功能名称:添加车辆,请求URI:{},请求方式:{},请求结果:{}" ,request.getRequestURI(),request.getMethod(), JSONObject.toJSONString(tcar)); addCarService.addCar(tcar); Result result = Result.success(); log.info("功能名称:添加车辆,响应URI:{},相应方式:{},响应结果:{}" ,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result)); return result; } /** * 根据用户名获取用户信息 */ @PostMapping("/findByadminName/{adminName}") public Result findByadminName(@PathVariable String adminName){ log.info("功能名称:根据用户名获取用户信息,请求URI:{},请求方式:{},请求参数:{}" ,request.getRequestURI(),request.getMethod(),adminName); Tadmin tadmin=addCarService.findByadminName(adminName); Result result = Result.success(tadmin); log.info("功能名称:根据用户名获取用户信息,响应URI:{},相应方式:{},响应结果:{}" ,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result)); return result; } /** * 根据客户名获取用户信息 */ @PostMapping("/findByuserName/{userName}") public Result findByuserName(@PathVariable String userName){ log.info("功能名称:根据客户名获取用户信息,请求URI:{},请求方式:{},请求参数:{}" ,request.getRequestURI(),request.getMethod(),userName); Tuser tuser= addCarService.findByuserName(userName); Result result = Result.success(tuser); log.info("功能名称:根据客户名获取用户信息,响应URI:{},响应方式:{},响应结果:{}" ,request.getRequestURI(),request.getMethod(),JSONObject.toJSONString(result)); return result; } }