package com.stylefeng.guns.modular.system.service.impl;
|
|
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
|
import com.stylefeng.guns.modular.system.dao.GDInterfaceMapper;
|
import com.stylefeng.guns.modular.system.model.GDInterface;
|
import com.stylefeng.guns.modular.system.service.IGDInterfaceService;
|
import org.springframework.stereotype.Service;
|
|
import javax.annotation.Resource;
|
import java.text.SimpleDateFormat;
|
import java.util.Date;
|
|
|
@Service
|
public class GDInterfaceServiceImpl extends ServiceImpl<GDInterfaceMapper, GDInterface> implements IGDInterfaceService {
|
|
@Resource
|
private GDInterfaceMapper gdInterfaceMapper;
|
|
|
|
@Override
|
public void saveData(String name, String explanation) {
|
Date date = new Date();
|
SimpleDateFormat sdf = new SimpleDateFormat("YYYY-MM-dd");
|
GDInterface query = gdInterfaceMapper.query(name, explanation, sdf.format(date));
|
if(null == query){
|
query = new GDInterface();
|
query.setName(name);
|
query.setExplanation(explanation);
|
query.setTime(sdf.format(date));
|
query.setNum(1);
|
this.insert(query);
|
}else{
|
query.setNum(query.getNum() + 1);
|
this.updateById(query);
|
}
|
}
|
}
|