1.SQL语句
String selectByIp(SysWhite sysWhite);
<select id="selectByIp" parameterType="com.cms.modules.sys.domain.SysWhite"resultType="string">
select ip from sys_white where ip=#{ip}
</select>
2.Service
String selectByIp(SysWhite sysWhite);
public String selectByIp(SysWhite sysWhite) {
return sysWhiteMapper.selectByIp(sysWhite);
}
3.controller
// 判断新增的ip表里是否存在
String isExist = sysWhiteService.selectByIp(sysWhite);
if (isExist != null) {
return failure("新增的IP已存在,请重新输入!");
}