This commit is contained in:
齐天大圣 2024-03-27 15:56:39 +08:00
parent 2846701514
commit 11327ccd9e
4 changed files with 13 additions and 1 deletions

View File

@ -3,7 +3,6 @@ package com.fuint.business.tag.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@ -13,6 +12,8 @@ import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.service.TagCodeRecordService;
import com.fuint.business.tag.util.TagUtils;
import com.fuint.business.tag.vo.OilTagVO;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
@ -54,10 +55,12 @@ public class OilTagController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") OilTag oilTag) {
Page page = new Page(pageNo, pageSize);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<OilTag> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(oilTag.getTagCodeSn())){
queryWrapper.eq(OilTag::getTagCodeSn,oilTag.getTagCodeSn());
}
queryWrapper.eq(OilTag::getDeptId,nowAccountInfo.getDeptId());
if (ObjectUtils.isNotEmpty(oilTag.getSnCode())){
queryWrapper.eq(OilTag::getSnCode,oilTag.getSnCode());
}

View File

@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fuint.business.tag.dto.TagCodeDTO;
import com.fuint.business.tag.entity.TagCode;
import com.fuint.business.tag.service.TagCodeService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.framework.web.BaseController;
import com.fuint.framework.web.ResponseObject;
import org.apache.ibatis.annotations.Param;
@ -59,10 +61,12 @@ public class TagCodeController extends BaseController {
@RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize,
@Param("cardFuelDiesel") TagCode tagCode) {
Page page = new Page(pageNo, pageSize);
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
LambdaQueryWrapper<TagCode> queryWrapper = new LambdaQueryWrapper<>();
if (ObjectUtils.isNotEmpty(tagCode.getTagCodeSn())){
queryWrapper.eq(TagCode::getTagCodeSn,tagCode.getTagCodeSn());
}
queryWrapper.eq(TagCode::getDeptId,nowAccountInfo.getDeptId());
queryWrapper.orderByDesc(TagCode::getCreateTime);
return getSuccessResult(this.tagCodeService.page(page, queryWrapper));
}

View File

@ -24,6 +24,7 @@ public class OilTag extends Model<OilTag> {
private Integer id;
//二维码id
private Integer tagCodeId;
private Integer deptId;
//二维码SN号
private String tagCodeSn;
//厂家名字

View File

@ -9,6 +9,8 @@ import com.fuint.business.tag.entity.OilTag;
import com.fuint.business.tag.mapper.TagCodeMapper;
import com.fuint.business.tag.service.OilTagService;
import com.fuint.business.tag.service.TagCodeService;
import com.fuint.common.dto.AccountInfo;
import com.fuint.common.util.TokenUtil;
import com.fuint.module.backendApi.controller.BackendFileController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.mock.web.MockMultipartFile;
@ -34,6 +36,8 @@ public class OilTagServiceImpl extends ServiceImpl<OilTagMapper, OilTag> impleme
@Override
public boolean add(OilTag oilTag) throws Exception {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
oilTag.setDeptId(Integer.parseInt(nowAccountInfo.getDeptId().toString()));
LambdaQueryWrapper<TagCode> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(TagCode::getTagCodeSn, oilTag.getTagCodeSn());
TagCode tagCode = tagCodeService.getOne(queryWrapper);