@Test public void updateSignTest() { String oldSign = "悦跑运动2"; String newSign = "悦跑运动"; smsService.updateSign(3, newSign, SmsPlatformEnum.YunPian.getValue()); SmsSignBO smsSignBO = smsService.getSign(3); Assert.assertTrue("更新不成功!", smsSignBO.getSign().equals(newSign)); }
@Override @Transactional public void updateSign(Integer id, String newSign, Integer platform) { SmsSignDO smsSignDO = smsSignMapper.selectOne( new QueryWrapper<SmsSignDO>() .eq("sign", newSign) .eq("platform", platform)); if (smsSignDO != null) { throw new ServiceException(AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getCode(), AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getMessage()); } smsSignMapper.update( (SmsSignDO) new SmsSignDO() .setSign(newSign) .setPlatform(platform) .setUpdateTime(new Date()), new QueryWrapper<SmsSignDO>().eq("id", id) ); }
SmsServiceImpl implements SmsService { @Override @Transactional public void updateSign(Integer id, String newSign, Integer platform) { SmsSignDO smsSignDO = smsSignMapper.selectOne( new QueryWrapper<SmsSignDO>() .eq("sign", newSign) .eq("platform", platform)); if (smsSignDO != null) { throw new ServiceException(AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getCode(), AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getMessage()); } smsSignMapper.update( (SmsSignDO) new SmsSignDO() .setSign(newSign) .setPlatform(platform) .setUpdateTime(new Date()), new QueryWrapper<SmsSignDO>().eq("id", id) ); } }
SmsServiceImpl implements SmsService { @Override @Transactional public void updateSign(Integer id, String newSign, Integer platform) { SmsSignDO smsSignDO = smsSignMapper.selectOne( new QueryWrapper<SmsSignDO>() .eq("sign", newSign) .eq("platform", platform)); if (smsSignDO != null) { throw new ServiceException(AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getCode(), AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getMessage()); } smsSignMapper.update( (SmsSignDO) new SmsSignDO() .setSign(newSign) .setPlatform(platform) .setUpdateTime(new Date()), new QueryWrapper<SmsSignDO>().eq("id", id) ); }  }
SmsServiceImpl implements SmsService { @Override @Transactional public void updateSign(Integer id, String newSign, Integer platform) { SmsSignDO smsSignDO = smsSignMapper.selectOne( new QueryWrapper<SmsSignDO>() .eq("sign", newSign) .eq("platform", platform)); if (smsSignDO != null) { throw new ServiceException(AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getCode(), AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getMessage()); } smsSignMapper.update( (SmsSignDO) new SmsSignDO() .setSign(newSign) .setPlatform(platform) .setUpdateTime(new Date()), new QueryWrapper<SmsSignDO>().eq("id", id) ); }  @Override PageSmsSignBO pageSmsSign(PageQuerySmsSignDTO queryDTO); @Override PageSmsTemplateBO pageSmsTemplate(PageQuerySmsTemplateDTO queryDTO); @Override @Transactional void addSign(String sign, Integer platform); @Override SmsSignBO getSign(Integer signId); @Override @Transactional void updateSign(Integer id, String newSign, Integer platform); @Override void deleteSign(Integer id); @Override @Transactional void addTemplate(Integer smsSignId, String templateCode,
                            String template, Integer platform, Integer smsType); @Override SmsTemplateBO getTemplate(Integer id, Integer platform); @Override @Transactional void updateTemplate(Integer id, Integer smsSignId, String templateCode,
                               String template, Integer platform, Integer smsType); @Override @Transactional void deleteTemplate(Integer id); @Override void singleSend(String mobile, Integer smsTemplateId, Map<String, String> params); @Override void batchSend(List<String> mobileList, Integer smsTemplateId, Map<String, String> params); }
SmsServiceImpl implements SmsService { @Override @Transactional public void updateSign(Integer id, String newSign, Integer platform) { SmsSignDO smsSignDO = smsSignMapper.selectOne( new QueryWrapper<SmsSignDO>() .eq("sign", newSign) .eq("platform", platform)); if (smsSignDO != null) { throw new ServiceException(AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getCode(), AdminErrorCodeEnum.SMS_SIGN_IS_EXISTENT.getMessage()); } smsSignMapper.update( (SmsSignDO) new SmsSignDO() .setSign(newSign) .setPlatform(platform) .setUpdateTime(new Date()), new QueryWrapper<SmsSignDO>().eq("id", id) ); }  @Override PageSmsSignBO pageSmsSign(PageQuerySmsSignDTO queryDTO); @Override PageSmsTemplateBO pageSmsTemplate(PageQuerySmsTemplateDTO queryDTO); @Override @Transactional void addSign(String sign, Integer platform); @Override SmsSignBO getSign(Integer signId); @Override @Transactional void updateSign(Integer id, String newSign, Integer platform); @Override void deleteSign(Integer id); @Override @Transactional void addTemplate(Integer smsSignId, String templateCode,
                            String template, Integer platform, Integer smsType); @Override SmsTemplateBO getTemplate(Integer id, Integer platform); @Override @Transactional void updateTemplate(Integer id, Integer smsSignId, String templateCode,
                               String template, Integer platform, Integer smsType); @Override @Transactional void deleteTemplate(Integer id); @Override void singleSend(String mobile, Integer smsTemplateId, Map<String, String> params); @Override void batchSend(List<String> mobileList, Integer smsTemplateId, Map<String, String> params);  }