*
* @author zhoush
* @since 2024-04-07
*/
@Service
public class DownWorkstationTaskServiceImpl extends ServiceImpl implements DownWorkstationTaskService {
public void insertdownWorkstationtask(DownGlassInfo downGlassInfo) {
DownWorkstationTask entity = new DownWorkstationTask();
// 查询当前最大的 id 值
Long maxId = getMaxId();
// 如果没有记录,则将 id 设置为 1;否则,将 id 设置为当前最大 id 值加 1
Long newId = (maxId == null) ? 1 : maxId + 1;
BeanUtils.copyProperties(downGlassInfo,entity);
entity.setId(newId); // 设置手动递增的 id
entity.setState(1);
baseMapper.insert(entity);
}
// 查询最大的 ID
private Long getMaxId() {
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.select("MAX(id) as max_id");
List