package com.zjrs.ggfw.xcx.blo.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.apache.commons.lang.StringUtils;
import org.mohrss.leaf.core.framework.domain.blo.impl.BLOImpl;
import com.zjrs.ggfw.xcx.blo.Gcj02BLO;
import com.zjrs.ggfw.xcx.dto.Gcj02DTO;
import com.zjrs.ggfw.xcx.entity.Gcj02DataMapper;
import com.zjrs.ggfw.xcx.po.Gcj02Data;
import org.springframework.stereotype.Service;

import jakarta.annotation.Resource;

@Service
public class Gcj02BLOImpl extends BLOImpl implements Gcj02BLO {
	
	@Resource
	Gcj02DataMapper gcj02DataMapper;
	
	@Override
	public Integer getRecord(Gcj02DTO dto) {
		QueryWrapper<Gcj02Data> queryWrapper = new QueryWrapper<Gcj02Data>();
		queryWrapper.eq("NAME", dto.getName());
		return gcj02DataMapper.selectCount(queryWrapper);
	}
	
	@Override
	public Gcj02Data saveRecord(Gcj02Data gcj02Data) {
		if(StringUtils.isNotBlank(gcj02Data.getGcj02DataLsh())) {
			gcj02DataMapper.updateById(gcj02Data);
		}
		return gcj02Data;
	}
}