Overseasinput 数据管理接口 - 添加、更新和查询操作
@Override public boolean addOverseasinput(Overseasinput overseasinputParam) { // 将省份名称拆分为省份ID和省份简称 overseasinputParam.setPid(Integer.parseInt(overseasinputParam.getProvinceName() .split(",")[0])); overseasinputParam.setProvinceShortName(overseasinputParam.getProvinceName() .split(",")[1]); // 如果数据库中不存在相同的省份ID和日期的数据,则插入新数据并返回true if (overseasinputMapper.selectByPidAndDatetime(overseasinputParam.getPid() ,overseasinputParam.getDatetime())==null){ overseasinputMapper.insertOverseasinput(overseasinputParam); return true; } // 如果数据库中已存在相同的省份ID和日期的数据,则不插入新数据并返回false return false; }
@Override public void updateOverseasinput(Overseasinput overseasinputParam) { // 如果数据库中存在相同的省份ID和日期的数据,则更新数据 if (overseasinputMapper.selectByPidAndDatetime(overseasinputParam.getPid() ,overseasinputParam.getDatetime())!=null){ overseasinputMapper.updateOverseasinput(overseasinputParam); } }
@Override public Overseasinput findByPidAndDatetime(Integer pid, String datetime) { // 根据省份ID和日期查询数据并返回结果 return overseasinputMapper.selectByPidAndDatetime(pid,datetime); } }
原文地址: https://www.cveoy.top/t/topic/o2g9 著作权归作者所有。请勿转载和采集!