package com.zy.asrs.service.impl; import com.baomidou.mybatisplus.mapper.EntityWrapper; import com.baomidou.mybatisplus.service.impl.ServiceImpl; import com.core.common.Cools; import com.zy.asrs.entity.RowLastno; import com.zy.asrs.mapper.RowLastnoMapper; import com.zy.asrs.service.RowLastnoService; import org.springframework.stereotype.Service; @Service("rowLastnoService") public class RowLastnoServiceImpl extends ServiceImpl implements RowLastnoService { @Override public RowLastno findBySection(Integer row) { return this.baseMapper.findBySection(row); } @Override public Integer selectNextWhsType() { RowLastno wrk_mk = this.selectOne(new EntityWrapper() .eq("wrk_mk", 1)); if (Cools.isEmpty(wrk_mk)) { this.baseMapper.updateInitWrkMk(); return 1; }else { int i = this.selectCount(null); if (wrk_mk.getWhsType() >= i){ this.baseMapper.updateInitWrkMk(); wrk_mk.setWrkMk("0"); this.update(wrk_mk,new EntityWrapper() .eq("whs_type",wrk_mk.getWhsType())); }else { this.baseMapper.updateNextWrkMk(wrk_mk.getWhsType()+1); wrk_mk.setWrkMk("0"); this.update(wrk_mk,new EntityWrapper() .eq("whs_type",wrk_mk.getWhsType())); } return wrk_mk.getWhsType(); } } }