lgh
This commit is contained in:
@@ -0,0 +1,89 @@
|
||||
package com.mt.wms.basic.controller;
|
||||
|
||||
import com.mt.wms.basic.params.AlarmBaseParam;
|
||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
|
||||
import com.mt.wms.basic.params.CraftInfoParam;
|
||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
|
||||
import com.mt.wms.basic.service.AlarmBaseService;
|
||||
import com.mt.wms.basic.service.CraftInfoService;
|
||||
import com.mt.wms.basic.vo.AlarmBaseVo;
|
||||
import com.mt.wms.basic.vo.CraftInfoVo;
|
||||
import com.mt.wms.core.base.BaseController;
|
||||
import com.mt.wms.core.constants.CommonConstant;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.utils.IDGenerator;
|
||||
import com.mt.wms.core.validator.groups.AddGroup;
|
||||
import com.mt.wms.core.validator.groups.PageGroup;
|
||||
import com.mt.wms.core.validator.groups.UpdateGroup;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.validation.groups.Default;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/10/9 11:09
|
||||
* @Version 1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping(CommonConstant.API_MODULE_BASE + "craftInfo")
|
||||
@Slf4j
|
||||
@Api(value = "工艺基础信息管理", tags = "工艺基础信息管理", hidden = false)
|
||||
public class CraftInfoController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private CraftInfoService craftInfoService;
|
||||
|
||||
@PostMapping(value = "get")
|
||||
@ApiOperation(value = "获取报警基础信息")
|
||||
private R<CraftInfoVo> get(@Validated @RequestBody IdParam idParam) {
|
||||
return craftInfoService.get(idParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "list")
|
||||
@ApiOperation(value = "获取报警基础信息列表")
|
||||
private R<List<CraftInfoVo>> list(@Validated({Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
|
||||
return craftInfoService.list(craftInfoQueryParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "page")
|
||||
@ApiOperation(value = "获取分页报警基础信息")
|
||||
private R<PageVo<CraftInfoVo>> page(@Validated({PageGroup.class, Default.class}) @RequestBody CraftInfoQueryParam craftInfoQueryParam) {
|
||||
return craftInfoService.page(craftInfoQueryParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "add")
|
||||
@ApiOperation(value = "新增")
|
||||
private R<IdVo> add(@Validated({AddGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
|
||||
return craftInfoService.add(craftInfoParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "update")
|
||||
@ApiOperation(value = "更新")
|
||||
private R<IdVo> update(@Validated({UpdateGroup.class, Default.class}) @RequestBody CraftInfoParam craftInfoParam) {
|
||||
return craftInfoService.update(craftInfoParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "delete")
|
||||
@ApiOperation(value = "删除报警基础信息")
|
||||
private R<IdVo> delete(@Validated @RequestBody IdParam idParam) {
|
||||
return craftInfoService.delete(idParam);
|
||||
}
|
||||
|
||||
@PostMapping(value = "codeGenerator")
|
||||
@ApiOperation(value = "编码生成")
|
||||
private R<String> codeGenerator() {
|
||||
return successful(IDGenerator.gen("GY", "yyyyMMddHHmm", 2, "CRAFTINFO_CODE"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mt.wms.basic.params;
|
||||
|
||||
import com.mt.wms.core.base.BaseParam;
|
||||
import com.mt.wms.core.validator.groups.UpdateGroup;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2022/1/25 21:34
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "工艺基础信息参数对象", description = "用于新增和更新工艺基础信息")
|
||||
public class CraftInfoParam extends BaseParam {
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键",required = false, example = "1")
|
||||
@NotNull(message = "xxID不能为空", groups = {UpdateGroup.class})
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码", example = "1")
|
||||
private String code;
|
||||
/**
|
||||
* 工艺号
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺号", example = "1")
|
||||
@NotNull(message = "工艺号不能为空")
|
||||
private String craftCode;
|
||||
/**
|
||||
* plc值
|
||||
*/
|
||||
@ApiModelProperty(value = "plc值", example = "1")
|
||||
@NotNull(message = "plc值不能为空")
|
||||
private Integer plcValue;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@ApiModelProperty(value = "说明", example = "1")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.mt.wms.basic.params;
|
||||
|
||||
import com.mt.wms.core.params.BasePageParam;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2022/1/25 21:37
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value = "报警基础信息查询参数", description = "用于查询报警基础信息")
|
||||
public class CraftInfoQueryParam extends BasePageParam {
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键",required = false, example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 工艺号
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺号",required = false, example = "1")
|
||||
private String craftCode;
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.mt.wms.basic.service;
|
||||
|
||||
import com.mt.wms.basic.params.AlarmBaseParam;
|
||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
|
||||
import com.mt.wms.basic.params.CraftInfoParam;
|
||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
|
||||
import com.mt.wms.basic.vo.AlarmBaseVo;
|
||||
import com.mt.wms.basic.vo.CraftInfoVo;
|
||||
import com.mt.wms.core.dal.entity.CraftInfo;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/10/9 10:46
|
||||
* @Version 1.0
|
||||
*/
|
||||
public interface CraftInfoService {
|
||||
|
||||
/**
|
||||
* 获取xx
|
||||
*
|
||||
* @param idParam 主键参数
|
||||
* @return xx
|
||||
*/
|
||||
R<CraftInfoVo> get(IdParam idParam);
|
||||
|
||||
/**
|
||||
* 获取xx列表
|
||||
*
|
||||
* @param craftInfoQueryParam xx查询参数
|
||||
* @return xx列表
|
||||
*/
|
||||
R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam);
|
||||
|
||||
/**
|
||||
* 获取xx分页列表
|
||||
*
|
||||
* @param craftInfoQueryParam xx查询参数
|
||||
* @return xx分页列表
|
||||
*/
|
||||
R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam);
|
||||
|
||||
|
||||
/**
|
||||
* 新增xx
|
||||
*
|
||||
* @param craftInfoParam xx参数
|
||||
* @return 主键
|
||||
*/
|
||||
R<IdVo> add(CraftInfoParam craftInfoParam);
|
||||
|
||||
/**
|
||||
* 更新xx
|
||||
*
|
||||
* @param craftInfoParam xx参数
|
||||
* @return 主键
|
||||
*/
|
||||
R<IdVo> update(CraftInfoParam craftInfoParam);
|
||||
|
||||
|
||||
/**
|
||||
* 删除xx
|
||||
*
|
||||
* @param idParam 主键参数
|
||||
* @return 主键
|
||||
*/
|
||||
R<IdVo> delete(IdParam idParam);
|
||||
}
|
||||
@@ -0,0 +1,97 @@
|
||||
package com.mt.wms.basic.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.mt.wms.basic.params.AlarmBaseParam;
|
||||
import com.mt.wms.basic.params.AlarmBaseQueryParam;
|
||||
import com.mt.wms.basic.params.CraftInfoParam;
|
||||
import com.mt.wms.basic.params.CraftInfoQueryParam;
|
||||
import com.mt.wms.basic.service.AlarmBaseService;
|
||||
import com.mt.wms.basic.service.CraftInfoService;
|
||||
import com.mt.wms.basic.vo.AlarmBaseVo;
|
||||
import com.mt.wms.basic.vo.CraftInfoVo;
|
||||
import com.mt.wms.core.api.Assert;
|
||||
import com.mt.wms.core.base.BaseService;
|
||||
import com.mt.wms.core.dal.entity.AlarmBase;
|
||||
import com.mt.wms.core.dal.entity.CraftInfo;
|
||||
import com.mt.wms.core.dal.service.AlarmBaseServiceBiz;
|
||||
import com.mt.wms.core.dal.service.CraftInfoServiceBiz;
|
||||
import com.mt.wms.core.errorcode.ApiErrorCode;
|
||||
import com.mt.wms.core.params.IdParam;
|
||||
import com.mt.wms.core.vo.IdVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import com.mt.wms.core.vo.R;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2021/10/9 10:49
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Service
|
||||
@Transactional
|
||||
public class CraftInfoServiceImpl extends BaseService implements CraftInfoService {
|
||||
|
||||
@Resource
|
||||
private CraftInfoServiceBiz craftInfoServiceBiz;
|
||||
|
||||
@Override
|
||||
public R<CraftInfoVo> get(IdParam idParam) {
|
||||
Assert.notNull(ApiErrorCode.INVALID_PARAMETER,idParam.getId());
|
||||
CraftInfo craftInfo = craftInfoServiceBiz.getById(idParam.getId());
|
||||
CraftInfoVo craftInfoVo = CraftInfoVo.builder().build();
|
||||
BeanUtils.copyProperties(craftInfo,craftInfoVo);
|
||||
return successful(craftInfoVo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<List<CraftInfoVo>> list(CraftInfoQueryParam craftInfoQueryParam) {
|
||||
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
|
||||
wrapper.eq(CraftInfo.VALID,1);
|
||||
List<CraftInfo> craftInfoList = craftInfoServiceBiz.list(wrapper);
|
||||
List<CraftInfoVo> craftInfoVoList = com.mt.wms.core.utils.BeanUtils.copyList(craftInfoList, CraftInfoVo.class);
|
||||
return successful(craftInfoVoList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<PageVo<CraftInfoVo>> page(CraftInfoQueryParam craftInfoQueryParam) {
|
||||
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
|
||||
wrapper.like(StringUtils.isNotBlank(craftInfoQueryParam.getCraftCode()),CraftInfo.CRAFT_CODE,craftInfoQueryParam.getCraftCode())
|
||||
.orderByDesc(CraftInfo.CREATE_TIME);
|
||||
Page<CraftInfo> page = craftInfoServiceBiz.page(new Page<>(craftInfoQueryParam.getCurrent(), craftInfoQueryParam.getSize()), wrapper);
|
||||
return successful(new PageVo<>(page,CraftInfoVo.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<IdVo> add(CraftInfoParam craftInfoParam) {
|
||||
QueryWrapper<CraftInfo> wrapper=new QueryWrapper<>();
|
||||
|
||||
CraftInfo craftInfo=new CraftInfo();
|
||||
BeanUtils.copyProperties(craftInfoParam,craftInfo);
|
||||
setCommonField(craftInfo);
|
||||
craftInfoServiceBiz.save(craftInfo);
|
||||
return successful(IdVo.builder().id(craftInfo.getId()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<IdVo> update(CraftInfoParam craftInfoParam) {
|
||||
CraftInfo craftInfo = craftInfoServiceBiz.getById(craftInfoParam.getId());
|
||||
CraftInfo updateCraftInfo=new CraftInfo();
|
||||
BeanUtils.copyProperties(craftInfoParam,updateCraftInfo);
|
||||
setUpdateCommonField(updateCraftInfo);
|
||||
craftInfoServiceBiz.updateById(updateCraftInfo);
|
||||
return successful(IdVo.builder().id(updateCraftInfo.getId()).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R<IdVo> delete(IdParam idParam) {
|
||||
craftInfoServiceBiz.removeById(idParam.getId());
|
||||
return successful(IdVo.builder().id(idParam.getId()).build());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.mt.wms.basic.vo;
|
||||
|
||||
import com.mt.wms.core.base.BaseVo;
|
||||
import com.mt.wms.core.vo.PageVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* @Author: liguanghao
|
||||
* @Date: 2022/1/25 21:27
|
||||
* @Version 1.0
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@Builder
|
||||
@ApiModel(value = "工艺信息视图对象", description = "用于查询工艺信息信息")
|
||||
public class CraftInfoVo extends BaseVo implements PageVo.ConvertVo{
|
||||
/**
|
||||
* 主键,自增
|
||||
*/
|
||||
@ApiModelProperty(value = "主键,更新时需要填写", example = "1")
|
||||
private Long id;
|
||||
|
||||
/**
|
||||
* 编码
|
||||
*/
|
||||
@ApiModelProperty(value = "编码", example = "1")
|
||||
private String code;
|
||||
/**
|
||||
* 工艺号
|
||||
*/
|
||||
@ApiModelProperty(value = "工艺号", example = "1")
|
||||
private String craftCode;
|
||||
/**
|
||||
* plc值
|
||||
*/
|
||||
@ApiModelProperty(value = "plc值", example = "1")
|
||||
private Integer plcValue;
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@ApiModelProperty(value = "状态", example = "1")
|
||||
private Integer status;
|
||||
/**
|
||||
* 说明
|
||||
*/
|
||||
@ApiModelProperty(value = "说明", example = "1")
|
||||
private String content;
|
||||
}
|
||||
Reference in New Issue
Block a user