二维码标准箱APP接口开发
This commit is contained in:
parent
1904789a0f
commit
0fcb6fec5d
|
|
@ -0,0 +1,29 @@
|
|||
package com.bonus.common.biz.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* @author : 阮世耀
|
||||
* @version : 1.0
|
||||
* @PackagePath: com.bonus.common.biz.enums
|
||||
* @CreateTime: 2024-12-19 09:57
|
||||
* @Description: 二维码标准型状态枚举
|
||||
*/
|
||||
@Getter
|
||||
public enum QrBoxStatusEnum {
|
||||
|
||||
QR_BOX_STATUS_WAIT_CREATE(0, "待创建"),
|
||||
QR_BOX_STATUS_WAIT_BIND(1, "待录入"),
|
||||
QR_BOX_STATUS_WAIT_TRANSFER(2, "待移交"),
|
||||
QR_BOX_STATUS_WAIT_RECEIVE(3, "待接收"),
|
||||
QR_BOX_STATUS_ON_RECEIVE(4, "已接收"),
|
||||
QR_BOX_STATUS_REJECT(5, "移交被驳回");
|
||||
|
||||
private final Integer status;
|
||||
private final String statusName;
|
||||
|
||||
QrBoxStatusEnum(Integer status, String statusName) {
|
||||
this.status = status;
|
||||
this.statusName = statusName;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,19 +9,25 @@ import com.bonus.common.security.annotation.RequiresPermissions;
|
|||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||
import com.bonus.material.basic.service.BmQrBoxService;
|
||||
import com.bonus.material.common.annotation.PreventRepeatSubmit;
|
||||
import com.bonus.material.ma.domain.TypeKeeper;
|
||||
import com.bonus.material.ma.service.ITypeKeeperService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @author ma_sh
|
||||
* @create 2024/12/11 17:25
|
||||
*/
|
||||
@Api(tags = "二维码标准箱管理接口")
|
||||
@Validated
|
||||
@RestController
|
||||
@RequestMapping("/bm_qrcode_box")
|
||||
public class BmQrBoxController extends BaseController {
|
||||
|
|
@ -29,40 +35,46 @@ public class BmQrBoxController extends BaseController {
|
|||
@Resource
|
||||
private BmQrBoxService qrBoxService;
|
||||
|
||||
@Resource
|
||||
private ITypeKeeperService typeKeeperService;
|
||||
|
||||
/**
|
||||
* 查询二维码管理列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询二维码标准箱管理列表")
|
||||
//@RequiresPermissions("basic:qrBox:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BmQrBoxInfo bmQrBoxInfo)
|
||||
{
|
||||
public AjaxResult list(BmQrBoxInfo bmQrBoxInfo) {
|
||||
startPage();
|
||||
List<BmQrBoxInfo> list = qrBoxService.selectBmQrBoxInfoList(bmQrBoxInfo);
|
||||
return getDataTable(list);
|
||||
return AjaxResult.success(getDataTable(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱绑定详情列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询二维码标准箱绑定详情列表")
|
||||
//@RequiresPermissions("basic:qrBox:list")
|
||||
@GetMapping("/getList")
|
||||
public TableDataInfo getList(BmQrBoxInfo bmQrBoxInfo)
|
||||
{
|
||||
public TableDataInfo getList(BmQrBoxInfo bmQrBoxInfo) {
|
||||
startPage();
|
||||
List<BmQrBoxInfo> list = qrBoxService.getList(bmQrBoxInfo);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 查询二维码标准箱绑定列表 -- 不分页
|
||||
* @param boxId 标准箱ID
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 查询二维码标准箱绑定列表")
|
||||
//@RequiresPermissions("basic:qrBox:list")
|
||||
@GetMapping("/app_box_bind_list")
|
||||
public AjaxResult getBoxBindList(Long boxId) {
|
||||
return AjaxResult.success(getDataTable(qrBoxService.getBoxBindList(boxId)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "新增二维码标准箱管理")
|
||||
//@PreventRepeatSubmit
|
||||
|
|
@ -76,23 +88,89 @@ public class BmQrBoxController extends BaseController {
|
|||
|
||||
/**
|
||||
* 修改二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "二维码标准箱管理")
|
||||
@ApiOperation(value = "修改二维码标准箱管理")
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:qrBox:edit")
|
||||
@SysLog(title = "二维码标准箱管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->修改二维码标准箱")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody BmQrBoxInfo bmQrBoxInfo)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.updateBmQrcodeInfo(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 扫码创建标准箱
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 扫码创建标准箱")
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:qrBox:edit")
|
||||
@SysLog(title = "APP-二维码标准箱管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->APP扫码创建标准箱")
|
||||
@PostMapping("/app_create")
|
||||
public AjaxResult appCreate(@RequestBody @NotNull(message = "参数不能为空") BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.updateBmQrcodeInfoByCode(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 扫码绑定机具
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 扫码绑定机具")
|
||||
@PreventRepeatSubmit
|
||||
//@RequiresPermissions("basic:qrBox:edit")
|
||||
@SysLog(title = "APP-二维码标准箱管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->APP扫码绑定机具")
|
||||
@PostMapping("/app_bind_ma")
|
||||
public AjaxResult addQrcodeBoxBind(@RequestBody @NotNull(message = "参数不能为空") BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.addQrcodeBoxBind(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 标准箱移交
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 标准箱移交")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/app_transfer")
|
||||
public AjaxResult appTransfer(@RequestBody @NotNull @Valid BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.appTransfer(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 标准箱移交驳回
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 标准箱移交驳回")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/app_transfer_reject")
|
||||
public AjaxResult appTransferReject(@RequestBody @NotNull @Valid BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.appTransferReject(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 标准箱接收
|
||||
*/
|
||||
@ApiOperation(value = "APP -- 标准箱接收")
|
||||
@PreventRepeatSubmit
|
||||
@PostMapping("/app_receive")
|
||||
public AjaxResult appReceive(@RequestBody @NotNull @Valid BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.appReceive(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 解绑二维码标准箱
|
||||
*/
|
||||
@ApiOperation(value = "解绑二维码标准箱")
|
||||
@PreventRepeatSubmit
|
||||
@SysLog(title = "APP--二维码标准箱管理", businessType = OperaType.UPDATE, logType = 1,module = "仓储管理->解绑二维码标准箱")
|
||||
@PostMapping("/unbind")
|
||||
public AjaxResult unBindQrcodeBox(@RequestBody BmQrBoxInfo bmQrBoxInfo) {
|
||||
return qrBoxService.unBindQrcodeBox(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "查询移交库管员列表")
|
||||
@GetMapping("/app_transfer_keeps")
|
||||
public AjaxResult getTransferUserList(BmQrBoxInfo bmQrBoxInfo) {
|
||||
return AjaxResult.success(typeKeeperService.selectTypeKeeperListAndUserName(new TypeKeeper(bmQrBoxInfo.getMaTypeId(), null)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "删除二维码标准箱")
|
||||
@PreventRepeatSubmit
|
||||
|
|
@ -106,9 +184,6 @@ public class BmQrBoxController extends BaseController {
|
|||
|
||||
/**
|
||||
* 下载二维码标准箱
|
||||
* @param bmQrBoxInfo
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "下载二维码标准箱")
|
||||
@PreventRepeatSubmit
|
||||
|
|
|
|||
|
|
@ -4,7 +4,13 @@ import com.bonus.common.core.web.domain.BaseEntity;
|
|||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 二维码管理对象 bm_qrcode_info
|
||||
|
|
@ -12,9 +18,9 @@ import lombok.ToString;
|
|||
* @author xsheng
|
||||
* @date 2024-09-26
|
||||
*/
|
||||
|
||||
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@ToString
|
||||
public class BmQrBoxInfo extends BaseEntity
|
||||
{
|
||||
|
|
@ -24,13 +30,16 @@ public class BmQrBoxInfo extends BaseEntity
|
|||
private Long id;
|
||||
|
||||
/** 标准箱ID */
|
||||
@ApiModelProperty(value = "标准箱ID")
|
||||
@NotNull(message = "标准箱ID不能为空")
|
||||
@Min(value = 1, message = "标准箱ID不能为0")
|
||||
private Long boxId;
|
||||
|
||||
@ApiModelProperty(value = "二维码标准箱名称")
|
||||
private String boxName;
|
||||
|
||||
/** 二维码 */
|
||||
@ApiModelProperty(value = "二维码")
|
||||
/** 二维码标准箱编码 */
|
||||
@ApiModelProperty(value = "二维码标准箱编码")
|
||||
private String boxCode;
|
||||
|
||||
@ApiModelProperty(value = "二维码路径")
|
||||
|
|
@ -45,9 +54,11 @@ public class BmQrBoxInfo extends BaseEntity
|
|||
private Integer devNum;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@ApiModelProperty(value = "截至时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "关键字")
|
||||
|
|
@ -59,7 +70,31 @@ public class BmQrBoxInfo extends BaseEntity
|
|||
@ApiModelProperty(value = "规格类型")
|
||||
private String typeModelName;
|
||||
|
||||
@ApiModelProperty(value = "二维码编码")
|
||||
private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "机具ID")
|
||||
private Long maId;
|
||||
|
||||
@ApiModelProperty(value = "机具编号")
|
||||
private String maCode;
|
||||
|
||||
@ApiModelProperty(value = "机具类型ID")
|
||||
private Long maTypeId;
|
||||
|
||||
@ApiModelProperty(value = "机具状态")
|
||||
private String maStatus;
|
||||
|
||||
@ApiModelProperty(value = "状态--DTO请求参数,用作多状态查询拼接")
|
||||
private String status;
|
||||
|
||||
@ApiModelProperty(value = "移交人用户ID,")
|
||||
private Long transferUser;
|
||||
|
||||
@ApiModelProperty(value = "接收人用户ID")
|
||||
private Long inputUser;
|
||||
|
||||
@ApiModelProperty(value = "状态集合")
|
||||
private List<String> statusList;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,55 +1,79 @@
|
|||
package com.bonus.material.basic.mapper;
|
||||
|
||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||
import com.bonus.material.basic.domain.BmQrcodeInfo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
* @author ma_sh
|
||||
* @create 2024/12/10 17:27
|
||||
*/
|
||||
public interface BmQrBoxMapper {
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
List<BmQrBoxInfo> find(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 新增二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
int insertBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 修改二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* 修改二维码标准箱信息 -- byID
|
||||
*/
|
||||
int updateBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo);
|
||||
int updateBmQrcodeInfoById(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* 修改二维码标准箱信息 -- 根据box_code
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
int updateBmQrcodeInfoByCode(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 修改标准箱状态 -- 增加绑定编码时调用
|
||||
*/
|
||||
int updateBmQrcodeStatus(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 查询标准箱已绑定的物资机具类型
|
||||
*/
|
||||
List<Long> getBoxMaTypeList(Long boxId);
|
||||
|
||||
/**
|
||||
* 查询此机具是否已经被标准箱绑定过
|
||||
*/
|
||||
int existsMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 解除二维码标准箱绑定关系
|
||||
*/
|
||||
int unBindQrcodeBox(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 增加二维码标准箱绑定关系
|
||||
*/
|
||||
int addQrcodeBoxBind(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱
|
||||
*/
|
||||
int deleteById(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 根据二维码标准箱ID查询二维码数量
|
||||
* @param boxId
|
||||
* @return
|
||||
* @param boxId 标准箱ID
|
||||
*/
|
||||
int countBmQrcodeInfoByBoxId(Long boxId);
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理绑定详情列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* 查询二维码标准箱--绑定详情details
|
||||
*/
|
||||
List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 根据二维码标准箱编码查询绑定详情
|
||||
*/
|
||||
List<BmQrBoxInfo> getBoxBindList(Long boxId);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -14,44 +14,68 @@ public interface BmQrBoxService {
|
|||
|
||||
/**
|
||||
* 查询二维码标准箱管理列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
List<BmQrBoxInfo> selectBmQrBoxInfoList(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 新增二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
AjaxResult insertBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 下载二维码标准箱
|
||||
* @param bmQrBoxInfo
|
||||
* @param response
|
||||
* @return
|
||||
*/
|
||||
void download(BmQrBoxInfo bmQrBoxInfo, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 修改二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
AjaxResult updateBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP - 移交标准箱
|
||||
*/
|
||||
AjaxResult appTransfer(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP -- 移交驳回
|
||||
*/
|
||||
AjaxResult appTransferReject(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP - 接收标准箱
|
||||
*/
|
||||
AjaxResult appReceive(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP - 扫码创建标准箱
|
||||
*/
|
||||
AjaxResult updateBmQrcodeInfoByCode(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP - 扫码绑定物资
|
||||
*/
|
||||
AjaxResult addQrcodeBoxBind(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* APP - 获取绑定物资列表
|
||||
*/
|
||||
List<BmQrBoxInfo> getBoxBindList(Long boxId);
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
AjaxResult deleteById(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* 解除二维码标准箱绑定关系
|
||||
*/
|
||||
AjaxResult unBindQrcodeBox(BmQrBoxInfo bmQrBoxInfo);
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱详情列表
|
||||
*/
|
||||
List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,12 +4,16 @@ import com.bonus.common.biz.config.BackstageApplication;
|
|||
import com.bonus.common.biz.config.DateTimeHelper;
|
||||
import com.bonus.common.biz.config.QrCodeUtils;
|
||||
import com.bonus.common.biz.enums.HttpCodeEnum;
|
||||
import com.bonus.common.biz.enums.MaMachineStatusEnum;
|
||||
import com.bonus.common.biz.enums.QrBoxStatusEnum;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
import com.bonus.material.basic.domain.BmQrBoxInfo;
|
||||
import com.bonus.material.basic.mapper.BmQrBoxMapper;
|
||||
import com.bonus.material.basic.service.BmQrBoxService;
|
||||
import com.bonus.material.ma.domain.vo.MachineVo;
|
||||
import com.bonus.material.ma.mapper.MachineMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
|
@ -19,7 +23,9 @@ import javax.servlet.http.HttpServletResponse;
|
|||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @Author ma_sh
|
||||
|
|
@ -32,20 +38,22 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
@Resource
|
||||
private BmQrBoxMapper bmQrBoxMapper;
|
||||
|
||||
@Resource
|
||||
private MachineMapper machineMapper;
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BmQrBoxInfo> selectBmQrBoxInfoList(BmQrBoxInfo bmQrBoxInfo) {
|
||||
if (bmQrBoxInfo.getStatus() != null) {
|
||||
bmQrBoxInfo.setStatusList(Arrays.asList(bmQrBoxInfo.getStatus().split(",")));
|
||||
}
|
||||
return bmQrBoxMapper.find(bmQrBoxInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult insertBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo) {
|
||||
|
|
@ -60,9 +68,7 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
|
||||
/**
|
||||
* 下载二维码标准箱
|
||||
* @param bmQrBoxInfo
|
||||
* @param response
|
||||
* @return
|
||||
* @param response 响应对象
|
||||
*/
|
||||
@Override
|
||||
public void download(BmQrBoxInfo bmQrBoxInfo, HttpServletResponse response) {
|
||||
|
|
@ -116,21 +122,159 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
|
||||
/**
|
||||
* 修改二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateBmQrcodeInfo(BmQrBoxInfo bmQrBoxInfo) {
|
||||
bmQrBoxInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
bmQrBoxInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
int result = bmQrBoxMapper.updateBmQrcodeInfo(bmQrBoxInfo);
|
||||
int result = bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo);
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱管理
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* APP - 移交标准箱
|
||||
*
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult appTransfer(BmQrBoxInfo bmQrBoxInfo) {
|
||||
if (bmQrBoxInfo.getTransferUser() == null || bmQrBoxInfo.getTransferUser() <= 0) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "请选择移交人");
|
||||
}
|
||||
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_RECEIVE.getStatus().toString());
|
||||
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
|
||||
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* APP -- 移交驳回
|
||||
*
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult appTransferReject(BmQrBoxInfo bmQrBoxInfo) {
|
||||
List<BmQrBoxInfo> bmQrBoxInfos = bmQrBoxMapper.find(new BmQrBoxInfo().setBoxId(bmQrBoxInfo.getBoxId()));
|
||||
if (!bmQrBoxInfos.isEmpty()) {
|
||||
BmQrBoxInfo item = bmQrBoxInfos.get(0);
|
||||
if (item.getTransferUser() == null || !Objects.equals(item.getTransferUser(), SecurityUtils.getUserId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "驳回失败,您并非接收人,无法操作驳回!");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "驳回失败,无此标准箱信息!");
|
||||
}
|
||||
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setStatus(QrBoxStatusEnum.QR_BOX_STATUS_REJECT.getStatus().toString());
|
||||
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
|
||||
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* APP - 接收标准箱
|
||||
*
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult appReceive(BmQrBoxInfo bmQrBoxInfo) {
|
||||
List<BmQrBoxInfo> bmQrBoxInfos = bmQrBoxMapper.find(new BmQrBoxInfo().setBoxId(bmQrBoxInfo.getBoxId()));
|
||||
if (!bmQrBoxInfos.isEmpty()) {
|
||||
BmQrBoxInfo item = bmQrBoxInfos.get(0);
|
||||
if (item.getTransferUser() == null || !Objects.equals(item.getTransferUser(), SecurityUtils.getUserId())) {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "接收失败,当前操作非移交人,无法接收!");
|
||||
}
|
||||
} else {
|
||||
return AjaxResult.error(HttpCodeEnum.FAIL.getCode(), "接收失败,无此标准箱信息!");
|
||||
}
|
||||
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setInputUser(SecurityUtils.getUserId())
|
||||
.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_ON_RECEIVE.getStatus().toString());
|
||||
return bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo) > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) :
|
||||
AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* APP - 扫码创建标准箱
|
||||
*
|
||||
* @param bmQrBoxInfo 标准箱信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult updateBmQrcodeInfoByCode(BmQrBoxInfo bmQrBoxInfo) {
|
||||
bmQrBoxInfo.setUpdateBy(SecurityUtils.getUsername());
|
||||
bmQrBoxInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
bmQrBoxInfo.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_BIND.getStatus().toString());
|
||||
int result = bmQrBoxMapper.updateBmQrcodeInfoByCode(bmQrBoxInfo);
|
||||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* APP - 扫码绑定物资
|
||||
*
|
||||
* @param bmQrBoxInfo 扫码信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult addQrcodeBoxBind(BmQrBoxInfo bmQrBoxInfo) {
|
||||
if (bmQrBoxInfo.getBoxId() == null || bmQrBoxInfo.getQrCode() == null) {
|
||||
return AjaxResult.error("标准箱ID或QR编码为空,请完善后重试!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 物资状态要求是待入库、在库状态
|
||||
MachineVo machineVo = machineMapper.selectMachineByMaCode(bmQrBoxInfo.getQrCode());
|
||||
if (machineVo == null || machineVo.getMaId() == null) {
|
||||
return AjaxResult.error("物资信息不存在!");
|
||||
}
|
||||
if (machineVo.getMaStatus() == null) {
|
||||
return AjaxResult.error("物资状态异常,请完善后重试!");
|
||||
}
|
||||
if (!Objects.equals(machineVo.getMaStatus(), MaMachineStatusEnum.NEW_PURCHASE.getStatus().toString()) &&
|
||||
!Objects.equals(machineVo.getMaStatus(), MaMachineStatusEnum.IN_STORE.getStatus().toString())
|
||||
) {
|
||||
return AjaxResult.error("物资状态非在库或待入库状态,无法操作:" + machineVo.getMaStatus());
|
||||
}
|
||||
|
||||
// 此物资未在其他标准型入过库,才可以绑定
|
||||
if (bmQrBoxMapper.existsMaId(machineVo.getMaId()) > 0) {
|
||||
return AjaxResult.error("该物资已绑定其他标准箱,无法再次绑定!");
|
||||
}
|
||||
|
||||
// 一个标准型只有1种类型
|
||||
List<Long> boxMaTypeList = bmQrBoxMapper.getBoxMaTypeList(bmQrBoxInfo.getBoxId());
|
||||
if (!boxMaTypeList.isEmpty()) {
|
||||
if (boxMaTypeList.size() > 1) {
|
||||
return AjaxResult.error("该标准箱已绑定多种物资,无法进行操作,请联系运维人员处理!");
|
||||
}
|
||||
if (!Objects.equals(boxMaTypeList.get(0), machineVo.getTypeId())) {
|
||||
return AjaxResult.error("该标准箱已绑定其他类型物资,无法绑定此类型!");
|
||||
}
|
||||
}
|
||||
|
||||
// 验证通过,进行数据处理
|
||||
bmQrBoxInfo.setMaId(machineVo.getMaId());
|
||||
bmQrBoxInfo.setCreateBy(SecurityUtils.getUsername());
|
||||
bmQrBoxInfo.setCreateTime(DateUtils.getNowDate());
|
||||
if (bmQrBoxMapper.addQrcodeBoxBind(bmQrBoxInfo) > 0) {
|
||||
// 修改标准箱状态为已完成
|
||||
bmQrBoxInfo.setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_TRANSFER.getStatus().toString());
|
||||
bmQrBoxMapper.updateBmQrcodeStatus(bmQrBoxInfo);
|
||||
return AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg());
|
||||
}
|
||||
return AjaxResult.error("绑定失败:成功绑定0条");
|
||||
} catch (Exception e) {
|
||||
System.err.println("绑定失败,SQL执行异常:" + e.getMessage());
|
||||
return AjaxResult.error("绑定失败,SQL执行异常:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取绑定物资列表
|
||||
*
|
||||
* @param boxId 标准箱ID
|
||||
*/
|
||||
@Override
|
||||
public List<BmQrBoxInfo> getBoxBindList(Long boxId) {
|
||||
return bmQrBoxMapper.getBoxBindList(boxId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除二维码标准箱
|
||||
* @param bmQrBoxInfo 主键
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult deleteById(BmQrBoxInfo bmQrBoxInfo) {
|
||||
|
|
@ -142,10 +286,25 @@ public class BmQrBoxServiceImpl implements BmQrBoxService {
|
|||
return result > 0 ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 解除二维码标准箱绑定关系
|
||||
*
|
||||
* @param bmQrBoxInfo 解绑信息
|
||||
*/
|
||||
@Override
|
||||
public AjaxResult unBindQrcodeBox(BmQrBoxInfo bmQrBoxInfo) {
|
||||
boolean unResult = bmQrBoxMapper.unBindQrcodeBox(bmQrBoxInfo) > 0;
|
||||
if (bmQrBoxMapper.countBmQrcodeInfoByBoxId(bmQrBoxInfo.getBoxId()) == 0) {
|
||||
bmQrBoxInfo.setBoxCode(null).setBoxName(null).setBoxType(null).setStatus(QrBoxStatusEnum.QR_BOX_STATUS_WAIT_BIND.getStatus().toString());
|
||||
bmQrBoxMapper.updateBmQrcodeInfoById(bmQrBoxInfo);
|
||||
}
|
||||
return unResult ? AjaxResult.success(HttpCodeEnum.SUCCESS.getMsg()) : AjaxResult.error(HttpCodeEnum.FAIL.getCode(), HttpCodeEnum.FAIL.getMsg());
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询二维码标准箱管理绑定详情列表
|
||||
* @param bmQrBoxInfo
|
||||
* @return
|
||||
* @param bmQrBoxInfo 查询条件
|
||||
* @return list列表
|
||||
*/
|
||||
@Override
|
||||
public List<BmQrBoxInfo> getList(BmQrBoxInfo bmQrBoxInfo) {
|
||||
|
|
|
|||
|
|
@ -22,7 +22,15 @@ public interface MachineMapper
|
|||
* @param maId 机具设备管理主键
|
||||
* @return 机具设备管理
|
||||
*/
|
||||
public MachineVo selectMachineByMaId(Long maId);
|
||||
MachineVo selectMachineByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 查询机具设备编码信息
|
||||
*
|
||||
* @param qrCode QR编码
|
||||
* @return 机具设备管理
|
||||
*/
|
||||
MachineVo selectMachineByMaCode(String qrCode);
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
|
|
@ -30,7 +38,7 @@ public interface MachineMapper
|
|||
* @param machine 机具设备管理
|
||||
* @return 机具设备管理集合
|
||||
*/
|
||||
public List<MachineVo> selectMachineList(Machine machine);
|
||||
List<MachineVo> selectMachineList(Machine machine);
|
||||
|
||||
/**
|
||||
* 新增机具设备管理
|
||||
|
|
@ -38,7 +46,7 @@ public interface MachineMapper
|
|||
* @param machine 机具设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertMachine(Machine machine);
|
||||
int insertMachine(Machine machine);
|
||||
|
||||
/**
|
||||
* 修改机具设备管理
|
||||
|
|
@ -46,7 +54,7 @@ public interface MachineMapper
|
|||
* @param machine 机具设备管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateMachine(Machine machine);
|
||||
int updateMachine(Machine machine);
|
||||
|
||||
/**
|
||||
* 删除机具设备管理
|
||||
|
|
@ -54,7 +62,7 @@ public interface MachineMapper
|
|||
* @param maId 机具设备管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMachineByMaId(Long maId);
|
||||
int deleteMachineByMaId(Long maId);
|
||||
|
||||
/**
|
||||
* 批量删除机具设备管理
|
||||
|
|
@ -62,12 +70,10 @@ public interface MachineMapper
|
|||
* @param maIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteMachineByMaIds(Long[] maIds);
|
||||
int deleteMachineByMaIds(Long[] maIds);
|
||||
|
||||
/**
|
||||
* 查询机具设备管理列表
|
||||
* @param type
|
||||
* @return
|
||||
*/
|
||||
List<Type> selectByTypeList(Type type);
|
||||
|
||||
|
|
@ -80,9 +86,9 @@ public interface MachineMapper
|
|||
|
||||
/**
|
||||
* 修改机具设备(ma_machine表)的状态
|
||||
* @param maId
|
||||
* @param status
|
||||
* @return
|
||||
* @param maId 机具设备主键
|
||||
* @param status 机具设备状态
|
||||
* @return 影响条数
|
||||
*/
|
||||
int updateStatus(@Param("maId") Long maId, @Param("status") Integer status);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,17 +6,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<select id="find" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
select
|
||||
bqb.box_id as boxId,
|
||||
bqb.box_name as boxName,
|
||||
bqb.box_code as boxCode,
|
||||
bqb.box_type as boxType,
|
||||
bqb.create_by as createBy,
|
||||
bqb.create_time as createTime,
|
||||
bqb.update_by as updateBy,
|
||||
bqb.update_time as updateTime,
|
||||
COUNT(qbb.box_id) as devNum
|
||||
bqb.box_id as boxId,
|
||||
bqb.box_name as boxName,
|
||||
bqb.box_code as boxCode,
|
||||
bqb.box_type as boxType,
|
||||
bqb.box_status as status,
|
||||
bqb.create_by as createBy,
|
||||
bqb.create_time as createTime,
|
||||
bqb.update_by as updateBy,
|
||||
bqb.update_time as updateTime,
|
||||
bqb.transfer_user,bqb.input_user,
|
||||
mm.type_id as maTypeId,
|
||||
COUNT(qbb.box_id) as devNum
|
||||
from bm_qrcode_box bqb
|
||||
left join qrcode_box_bind qbb on bqb.box_id = qbb.box_id
|
||||
left join bm_qrcode_box_bind qbb on bqb.box_id = qbb.box_id
|
||||
left join ma_machine mm on qbb.ma_id = mm.ma_id
|
||||
<where>
|
||||
<if test="boxId != null">and bqb.box_id = #{boxId}</if>
|
||||
<if test="boxName != null and boxName != ''">and bqb.box_name like concat('%',#{boxName},'%')</if>
|
||||
|
|
@ -26,10 +30,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<![CDATA[ AND DATE_FORMAT( bqb.create_time, '%Y-%m-%d' ) BETWEEN #{startTime} AND #{endTime} ]]>
|
||||
</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
bqb.box_name like concat('%',#{keyWord},'%')
|
||||
OR bqb.box_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
AND (
|
||||
bqb.box_name like concat('%',#{keyWord},'%')
|
||||
OR bqb.box_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
<if test="statusList != null and statusList != ''">
|
||||
AND bqb.box_status in
|
||||
<foreach item="key" collection="statusList" open="(" separator="," close=")">
|
||||
#{key}
|
||||
</foreach>
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY bqb.box_id
|
||||
|
|
@ -37,33 +47,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</select>
|
||||
|
||||
<select id="countBmQrcodeInfoByBoxId" resultType="java.lang.Integer">
|
||||
select count(1) from qrcode_box_bind where box_id = #{boxId}
|
||||
select count(1) from bm_qrcode_box_bind where box_id = #{boxId}
|
||||
</select>
|
||||
|
||||
<select id="getList" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
SELECT
|
||||
qb.id as id,
|
||||
qb.box_id as boxId,
|
||||
qb.id as id,qb.box_id as boxId,qb.create_by as createBy,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as typeModelName,
|
||||
mm.ma_code as maCode,
|
||||
qb.create_by as createBy
|
||||
mm.ma_id as maId,mm.ma_code as maCode,mm.type_id as maTypeId
|
||||
FROM
|
||||
qrcode_box_bind qb
|
||||
LEFT JOIN ma_machine mm ON qb.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id
|
||||
AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id
|
||||
AND mt1.del_flag = '0'
|
||||
WHERE
|
||||
1 = 1
|
||||
bm_qrcode_box_bind qb
|
||||
LEFT JOIN ma_machine mm ON qb.ma_id = mm.ma_id
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
|
||||
<where>
|
||||
<if test="boxId != null">and qb.box_id = #{boxId}</if>
|
||||
<if test="keyWord != null and keyWord != ''">
|
||||
AND (
|
||||
mt1.type_name like concat('%',#{keyWord},'%')
|
||||
OR mt.type_name like concat('%',#{keyWord},'%')
|
||||
OR mm.ma_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
AND (
|
||||
mt1.type_name like concat('%',#{keyWord},'%')
|
||||
OR mt.type_name like concat('%',#{keyWord},'%')
|
||||
OR mm.ma_code like concat('%',#{keyWord},'%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo" useGeneratedKeys="true" keyProperty="boxId">
|
||||
|
|
@ -84,22 +91,94 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmQrcodeInfo" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
<update id="updateBmQrcodeInfoById" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
update bm_qrcode_box
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="boxCode != null">box_code = #{boxCode},</if>
|
||||
<if test="boxType != null">box_type = #{boxType},</if>
|
||||
<if test="boxName != null and boxName != ''">box_name = #{boxName},</if>
|
||||
<if test="status != null and status != ''">box_status = #{status} ,</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
|
||||
<if test="transferUser != null">transfer_user = #{transferUser},</if>
|
||||
<if test="inputUser != null">input_user = #{inputUser},</if>
|
||||
</trim>
|
||||
where box_id = #{boxId}
|
||||
</update>
|
||||
|
||||
<update id="updateBmQrcodeInfoByCode" parameterType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
update bm_qrcode_box
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="boxType != null">box_type = #{boxType},</if>
|
||||
<if test="boxName != null and boxName != ''">box_name = #{boxName},</if>
|
||||
<if test="status != null">box_status = #{status},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
where box_code = #{boxCode}
|
||||
</update>
|
||||
|
||||
<delete id="deleteById">
|
||||
delete
|
||||
from bm_qrcode_box
|
||||
where box_id = #{boxId}
|
||||
</delete>
|
||||
|
||||
<delete id="unBindQrcodeBox">
|
||||
delete
|
||||
from bm_qrcode_box_bind
|
||||
where id = #{id}
|
||||
</delete>
|
||||
|
||||
<insert id="addQrcodeBoxBind">
|
||||
insert into bm_qrcode_box_bind
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">ma_id,</if>
|
||||
<if test="boxId != null">box_id,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="maId != null">#{maId},</if>
|
||||
<if test="boxId != null">#{boxId},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBmQrcodeStatus">
|
||||
update bm_qrcode_box
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="status != null and status != ''">box_status = IF(box_status = 1,#{status},box_status) ,</if>
|
||||
</trim>
|
||||
where box_id = #{boxId}
|
||||
</update>
|
||||
|
||||
<select id="getBoxMaTypeList" resultType="java.lang.Long">
|
||||
SELECT DISTINCT(mm.type_id) from bm_qrcode_box_bind qbb
|
||||
LEFT JOIN ma_machine mm on mm.ma_id = qbb.ma_id
|
||||
WHERE qbb.box_id = #{boxId}
|
||||
</select>
|
||||
|
||||
<select id="existsMaId" resultType="int">
|
||||
select count(1) from bm_qrcode_box_bind where ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<select id="getBoxBindList" resultType="com.bonus.material.basic.domain.BmQrBoxInfo">
|
||||
SELECT
|
||||
qb.id as id, qb.box_id as boxId, qb.create_by as createBy, qb.create_time,
|
||||
mt1.type_name as typeName,
|
||||
mt.type_name as typeModelName,
|
||||
mm.ma_id as maId,mm.ma_code as maCode,mm.type_id as maTypeId,
|
||||
sdd.dict_label as maStatus
|
||||
FROM
|
||||
bm_qrcode_box_bind qb
|
||||
LEFT JOIN ma_machine mm ON qb.ma_id = mm.ma_id
|
||||
LEFT JOIN sys_dict_data sdd ON sdd.dict_type = 'ma_machine_status' and sdd.dict_value = mm.ma_status
|
||||
LEFT JOIN ma_type mt ON mm.type_id = mt.type_id AND mt.del_flag = '0'
|
||||
LEFT JOIN ma_type mt1 ON mt.parent_id = mt1.type_id AND mt1.del_flag = '0'
|
||||
<where>
|
||||
qb.box_id = #{boxId}
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -34,7 +34,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectMachineVo">
|
||||
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time, out_fac_code, assets_code, check_man, this_check_time, next_check_time, gps_code, rfid_code, erp_code, transfer_code, in_out_num, buy_task, own_house, company_id, create_time, update_time, inspect_man, inspect_status, phone from ma_machine
|
||||
select ma_id, type_id, ma_code, pre_code, ma_status, qr_code, buy_price, ma_vender, out_fac_time,
|
||||
out_fac_code, assets_code, check_man, this_check_time, next_check_time, gps_code, rfid_code,
|
||||
erp_code, transfer_code, in_out_num, buy_task, own_house, company_id, create_time, update_time,
|
||||
inspect_man, inspect_status, phone from ma_machine
|
||||
</sql>
|
||||
|
||||
<select id="selectMachineList" resultType="com.bonus.material.ma.domain.vo.MachineVo">
|
||||
|
|
@ -298,16 +301,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</delete>
|
||||
|
||||
<select id="getMachineStatus" resultType="java.lang.String">
|
||||
select ma_status
|
||||
from ma_machine
|
||||
where ma_id = #{maId}
|
||||
select ma_status from ma_machine where ma_id = #{maId}
|
||||
</select>
|
||||
|
||||
<update id="updateMaMachineStatus">
|
||||
UPDATE
|
||||
ma_machine
|
||||
ma_machine
|
||||
SET
|
||||
ma_status = #{status},create_time = NOW()
|
||||
ma_status = #{status},create_time = NOW()
|
||||
<where>
|
||||
type_id = #{record.typeId}
|
||||
<if test="record.maId != null and record.maId != ''">
|
||||
|
|
@ -315,6 +316,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</if>
|
||||
</where>
|
||||
</update>
|
||||
|
||||
<update id="updateStatus">
|
||||
UPDATE
|
||||
ma_machine
|
||||
|
|
@ -323,4 +325,45 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
where
|
||||
ma_id = #{maId}
|
||||
</update>
|
||||
|
||||
<select id="selectMachineByMaCode" resultType="com.bonus.material.ma.domain.vo.MachineVo">
|
||||
SELECT
|
||||
ma.ma_id as maId,ma.type_id as typeId,ma.ma_code as maCode,ma.pre_code as preCode,
|
||||
mt4.type_name as itemType,
|
||||
mt3.type_name as materialType,
|
||||
mt2.type_name as materialName,
|
||||
mt.type_name as materialModel,
|
||||
ma.ma_status as maStatus,ma.qr_code as qrCode,ma.buy_price as buyPrice,
|
||||
ma.ma_vender as maVender,ma.out_fac_time as outFacTime,ma.out_fac_code as outFacCode,
|
||||
ma.assets_code as assetsCode,ma.check_man as checkMan,ma.this_check_time as thisCheckTime,
|
||||
ma.next_check_time as nextCheckTime,ma.gps_code as gpsCode,ma.rfid_code as rfidCode,
|
||||
ma.erp_code as erpCode,ma.transfer_code as transferCode,ma.in_out_num as inOutNum,
|
||||
ma.buy_task as buyTask,ma.own_house as ownHouse,ma.company_id as companyId,ma.remark as remark,
|
||||
ma.create_time as createTime,ma.update_time as updateTime,ma.inspect_man as inspectMan,ma.assets_id as assetsId,
|
||||
ma.inspect_status as inspectStatus,ma.phone as phone,
|
||||
mtk.user_id as keeperId,
|
||||
mtr.user_id as repairId,
|
||||
baa.asset_name as assetName
|
||||
FROM
|
||||
ma_machine ma
|
||||
LEFT JOIN
|
||||
ma_type mt ON ma.type_id = mt.type_id and mt.`level` = '4' and mt.del_flag = '0'
|
||||
LEFT JOIN
|
||||
ma_type mt2 ON mt2.type_id = mt.parent_id and mt2.`level` = '3' and mt2.del_flag = '0'
|
||||
LEFT JOIN
|
||||
ma_type mt3 ON mt2.parent_id = mt3.type_id and mt3.`level` = '2' and mt3.del_flag = '0'
|
||||
LEFT JOIN
|
||||
ma_type mt4 ON mt3.parent_id = mt4.type_id and mt4.`level` = '1' and mt4.del_flag = '0'
|
||||
LEFT JOIN
|
||||
ma_type_keeper mtk on ma.type_id = mtk.type_id
|
||||
LEFT JOIN
|
||||
ma_type_repair mtr on ma.type_id = mtr.type_id
|
||||
LEFT JOIN
|
||||
bm_asset_attributes baa on ma.assets_id = baa.id
|
||||
where
|
||||
ma.qr_code = #{qrCode}
|
||||
group by
|
||||
ma.ma_id
|
||||
limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -81,6 +81,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
sys_user u on tk.user_id = u.user_id
|
||||
<where>
|
||||
<if test="userId != null "> and tk.user_id = #{userId}</if>
|
||||
<if test="typeId != null "> and tk.type_id = #{typeId}</if>
|
||||
<if test="companyId != null "> and tk.company_id = #{companyId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
|
|
|||
Loading…
Reference in New Issue