1.例如:
package com.model.user; import com.model.PageEntity;import lombok.Getter;import lombok.Setter;import lombok.ToString; import javax.validation.constraints.Size;import java.util.Date;import java.util.List; /** * @description: 分组管理实体层 * @author: 123 * @date: Create in 2019/4/25 11:17 * @company: xingyunliushui */@Getter@Setter@ToStringpublic class GroupManage extends PageEntity { /** * 分组名称 */ @Size(min = 2, max = 300, message = "分组名称字符需要在2和300之间") private String name; /** * 分组描述 */ @Size(max = 300, message = "分组描述字符不能超过300") private String description; /** * 创建时间 */ private Date createTime; /** * 修改时间 */ private Date updateTime; /** * 真正分组ID */ private Long groupId; /** * 上级分组/项目ID */ private Long projectId; /** * 项目名称 */ private String projectName; /** * 设备数量 */ private Long deviceNum; /** * 场所数量 */ private Long placeNum; /** * 多个项目集合 */ private List<Long> projectIds; }
@ApiOperation("新增分组") @ApiImplicitParams({ @ApiImplicitParam(name = "projectId", value = "上级分组/项目ID", required = true, dataType = "Long", paramType = "query"), @ApiImplicitParam(name = "name", value = "分组名称", required = true, dataType = "String", paramType = "query"), @ApiImplicitParam(name = "description", value = "分组描述", dataType = "String", paramType = "query") }) @PostMapping("/saveGroupManage") public JsonResult saveGroupManage(@Valid GroupManage groupManage, BindingResult bindingResult) { // 校验参数 if (bindingResult.hasErrors()) { FieldError fieldError = (FieldError) bindingResult.getAllErrors().get(0); return JsonResult.error(fieldError.getDefaultMessage()); } 以下代码省略