| | |
| | | |
| | | import com.moral.api.entity.Version; |
| | | import com.moral.api.mapper.VersionMapper; |
| | | import com.moral.api.pojo.dto.version.VersionDTO; |
| | | import com.moral.api.pojo.dto.version.VersionQueryDTO; |
| | | import com.moral.api.pojo.form.version.VersionInsertForm; |
| | | import com.moral.api.pojo.form.version.VersionQueryForm; |
| | | import com.moral.api.pojo.form.version.VersionUpdateForm; |
| | | import com.moral.api.pojo.vo.Version.VersionQueryVO; |
| | | import com.moral.api.pojo.vo.Version.VersionVO; |
| | | import com.moral.api.service.VersionService; |
| | |
| | | import io.swagger.annotations.Api; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.Arrays; |
| | | import java.util.List; |
| | |
| | | VersionQueryVO vo = VersionQueryVO.convert(dto); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), vo); |
| | | } |
| | | |
| | | @PostMapping("update") |
| | | public ResultMessage update(@RequestBody VersionUpdateForm form){ |
| | | //判断是否缺少参数 |
| | | if (!form.valid()) |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | |
| | | //处理更新业务 |
| | | VersionDTO dto = versionService.update(form); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), null); |
| | | } |
| | | |
| | | @PostMapping("insert") |
| | | public ResultMessage insert(@RequestBody VersionInsertForm form){ |
| | | //判断是否缺少参数 |
| | | if (!form.valid()) |
| | | return ResultMessage.fail(ResponseCodeEnum.PARAMETERS_IS_MISSING.getCode(), |
| | | ResponseCodeEnum.PARAMETERS_IS_MISSING.getMsg()); |
| | | |
| | | //处理插入业务 |
| | | VersionDTO dto = versionService.insert(form); |
| | | |
| | | return new ResultMessage(dto.getCode(), dto.getMsg(), null); |
| | | } |
| | | } |