NOVELTY - Method for treating pig farm breeding wastewater, involves performing solid-liquid separation, recovering methane from the treated wastewater, denitrifying the effluent and wastewater, precipitating the denitrified mixture, allowing supernatant fluid to enter into magnesium ammonium phosphate crystallization reactor, adding industrial magnesium chloride, magnesium and phosphorus, aerating and stirring the mixture to recover nitrogen and phosphorus, adding pig manure to residual sludge, and fermenting the mixture to produce methane.    USE - The method is useful for treating pig farm breeding wastewater and producing methane used as high-quality organic fertilizer in farmland and for generating power and electric energy supplied to wastewater treatment equipment (claimed).    ADVANTAGE - The method is highly efficient consumes low energy, simple and cost-effective, conveniently recycles resources, and provides stable and reliable treatment effect.    DETAILED DESCRIPTION - Method for treating pig farm breeding wastewater, involves performing solid-liquid separation using hydraulic screen, where 60-90% of wastewater enters up-flow type anaerobic sludge blanket reactor and chemical oxygen demand (COD) is converted, recovering methane from the treated wastewater, allowing effluent to enter into aerobic zone of step-fed sequencing batch reactor for treatment, and allowing effluent and 10-40% of wastewater to enter into anoxic zone, denitrifying the effluent and wastewater for 6-8 hours while replenishing alkalinity, allowing the denitrified mixture to enter into precipitation section, settling the mixture for 0.5 hours, allowing the supernatant fluid to enter into magnesium ammonium phosphate crystallization reactor, adjusting pH of the mixture to 9 using 2M sodium hydroxide solution, adding industrial magnesium chloride, magnesium and phosphorus, where the molar ratio of magnesium and phosphorus is 1.5-1.9, aerating and stirring the mixture to recover nitrogen and phosphorus, reacting the mixture for 1.5 hours, adding pig manure to residual sludge generated by the up-flow type anaerobic sludge blanket reactor and step-fed sequencing batch reactor, and fermenting the mixture in high-concentration anaerobic digester for 25-30 days to produce methane. The up-flow type anaerobic sludge blanket reactor has hydraulic retention time of 7-12 days, sludge load of not greater than 2 kg COD/kg mixed liquor volatile suspended solids (MLVSS)asteriskd, and average sludge concentration of 20-40 g/l, and step-fed sequencing batch reactor has hydraulic retention time of 4 days, sludge load of not greater than 1 kg COD/kg MLVSS, and average concentration of sludge of 2.5-4 g/l, and volume ratio of residual sludge in high-concentration anaerobic digester to pig manure is 4:1.