添加删除方法deleteByCompileIds,传入前台传入的compileIds串,批量删除区域IP时调用此方法

This commit is contained in:
wangxin
2018-06-14 16:55:54 +08:00
parent f5d1409dca
commit ba536b63d3
3 changed files with 5 additions and 10 deletions

View File

@@ -29,4 +29,5 @@ public interface IpCfgDao extends CrudDao<BaseIpCfg>{
public int getIsAudit(@Param("tableName")String tableName,@Param("cfgId")Long id);
public int getIsAudit(BaseIpCfg entity);
public int deleteByCompileId(BaseIpCfg entity);
public int deleteByCompileIds(@Param("user")long user,@Param("tableName")String tableName,@Param("compileIds")String compileIds);
}

View File

@@ -543,4 +543,7 @@
<update id="deleteByCompileId" parameterType="com.nis.domain.configuration.BaseIpCfg" >
update ${tableName} set is_valid = -1, editor_id = #{editorId,jdbcType=INTEGER} , edit_time = #{editTime,jdbcType=TIMESTAMP} where compile_id = #{compileId,jdbcType=INTEGER}
</update>
<update id="deleteByCompileIds" parameterType="com.nis.domain.configuration.BaseIpCfg" >
update ${tableName} set is_valid = -1, editor_id = #{user,jdbcType=INTEGER} , edit_time = NOW() where compile_id in (${compileIds})
</update>
</mapper>

View File

@@ -334,17 +334,8 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
if(StringUtils.isNotBlank(compileIds)){
for(String compileId:compileIds.split(",")){//强转数字,防止注入
Integer.parseInt(compileId);
// AreaIpCfg area=new AreaIpCfg();
// area.setCompileId(Integer.parseInt(compileId));
// area.setFunctionId(functionId);
// area.setIsValid(Constants.VALID_DEL);
// areaIpCfgDao.updateValid(area);
}
BaseIpCfg area=new BaseIpCfg();
area.setTableName(AreaIpCfg.getTablename());
area.setCompileId(Integer.parseInt(compileIds));
area.setIsValid(Constants.VALID_DEL);
ipCfgDao.deleteByCompileId(area);
ipCfgDao.deleteByCompileIds(new BaseIpCfg().getCurrentUser().getId(),AreaIpCfg.getTablename(),compileIds);
}
List<BaseIpCfg> ipCfgs=new ArrayList<BaseIpCfg>();
Date date =new Date();