Er-lang Shen may be a deified version of several semi-mythical folk heroes who help regulate China's torrential floods, dating variously from the Qin, Sui and Jin dynasties. A later Buddhist source identify him as the second son of the Northern Heavenly King Vaishravana.
In the Ming semi-mythical novels Creation of the Gods and Journey to the West Erlang Shen is the nephew of the Jade Emperor. In the former he assisted the Zhou army in defeating the Shang. In the latter, he is the second son of a mortal and Jade emperor's sister. In the legend, he is known as the greatest warrior god of heaven.
According to the "Story about Li Bing and His Son in Harnessing the Rivers" in Records of Guansian, Li Erlang assisted his father in the construction of the complex irrigation system that prevented the Min River from flooding and irrigated the Chengdu Plain. In thanks for the prosperity that this brought to them the local people elevated the father and son to gods and dedicated the Two Kings Temple to their honour.
Legend states that Governor Li Bing sent his son out to discover the source of the flooding. He spent a year exploring the county without success. One day whilst sheltering in a cave he encountered a tiger which he slew and seven hunters who had witnessed this bravery agreed to join him on his quest.
The group finally came to a cottage on the outskirts of Guan County (modern Dujiangyan City). From within they heard the sound of an old woman crying. The woman was Grandma Wang and she told them that her grandson was to be sacrificed to an evil dragon who was the local river god. Li Erlang reported this to his father who devised a plan to capture the dragon.
The eight friends hid in the River God Temple and jumped out on the dragon when it arrived to claim its offering. The dragon fled to river pursued by Li Erlang who eventually captured it. Grandma Wang arrived with an iron chain and the dragon was secured in the pool below the Dragon-Taming Temple, freeing the region from floods.
Another legend tells of Li Erlang suppressing a fire dragon that lived in the mountains north of Dujiangyan by climbing to the top of Mount Yulei, turning into a giant and building a dam with 66 mountains then filling it with water from Dragon Pacifying Pool.
Theatrical interpretation (Bao Lian Deng)
Erlang Shen means "2nd son god" as direct translation. Er means 2nd, lang means boy, and Shen means god. His mother was the goddess of desire realm in heaven. Her job is to limit the gods and spirit's mortal desires such as love/affection, greed, and dream. When she was chasing an evil dragon who broke his chain in his heavenly prison, she fell in love with a mortal man who is willing to save her with his heart. They had three children: Yang Jiao, Yang Jian (Erlang Shen), and Yang Chan (Holy Mother of Hua Shan). When Jade emperor discovered her marriage, he sent his son and heaven armies to kill the half bloods, the mortal man, and the goddess of desire realm. Only Erlang and his sister Yang Chan survived.
Many legends, novels as well as television series often describe Erlang as Yang Jian, a nephew of the Jade Emperor. According to an ancient text Erlang Baojuan, Yang Jian's mother was the Jade Emperor's sister, Princess Yaoji who was imprisoned under Mount Tao, because she violated the Heavenly Rules by marrying a human named Yang Tianyou. Many years later her son Yang Jian cleaved Mount Tao using his axe, hoping to set his mother free. Unfortunately ten Sun Gods (the Jade Emperor's sons) arrived and burnt her to death. The angry Yang Jian killed nine of the sun deities, but was advised to release the last sun by the Third Dragon Princess of West Sea. Later he married the Dragon Princess and canonized as deity.
The 2009 television series; Prelude to Lotus Lantern (Bao Lian Deng Qian Zhuan) was made based on Erlang Baojuan. However there were several difference and inconsistency with the original novel, such as the story of Erlang had love interest with the Moon Goddess Chang E or Erlang divorced the Dragon Princess to become the Judicial God of Heaven. Both of stories were unavailable in the original novel.
In this television series, Yang Jian's third eye is known as the Heavenly Eye "天眼".It is not only able to see through deceptions and transformations, but can also fire energy beams of immense destructive power. 
Erlang Shen is also identified with Zhao Yun, a hermit who lived on Mount Qingcheng and was appointed by Emperor Yang of Sui as Governor of Jiazhou. Zhao Yu is said to have set forth with 1000 men to defeat a flood dragon that had been tormenting the area. Upon reaching the river Zhao Yu dived into the water with his double-edged sword and emerged holding the dragon’s head, Following his death, according to the Chronicle of Changshu County, the region was once again plagued by flood and he was seen riding a white horse amidst the swirling currents. The locals built a temple enshrining Zhao Yu as the God Erlang and the floods were subdued.
Deng Xia is said to have been a general under Erlang who surpassed his predecessors in valour and defeated a flood dragon, receiving the title "Erlang Shen" and a temple in his honour at Zhongqingli in Hangzhou.
Representations in Chinese culture
Journey to the West
Erlang makes an appearance near the start of the classic Journey to the West by Wu Cheng'en. Erlang, who is titled as being either True Lord, or Illustrious Sage, is the nephew of the Jade Emperor. Erlang made his first appearance when he had been ordered by the Jade Emperor (in which Erlang was also with his seven elite sages whom he called his brothers) to subdue Sun Wukong, who was to be punished for his havoc in heaven.
His bearing was refined, his visage noble, His ears hung down to his shoulders, and his eyes shone. The hat on his head had three peaks and phoenixes flying, And his robe was of a pale goose−yellow. His boots were lined with cloth of gold; dragons coiled round his socks; His jade belt was decorated with the eight jewels, At his waist was a bow, curved like the moon, In his hand a Three-pointed Double−edged Spear. His axe had split open Peach Mountain when he rescued his mother, His bow had killed the twin phoenixes of Zongluo. Widespread was his fame for killing the Eight Demons, And he had become one of Plum Hill's seven sages. His heart was too lofty to acknowledge his relatives in Heaven; In his pride he went back to be a god at Guanjiang. He was the Merciful and Miraculous Sage of the red city, Erlang, whose transformations were numberless.
Throughout the course of Erlang's duel between Sun Wukong, Erlang had been the stronger adversary though Sun Wukong always managed to stay ahead and at times get the better of Erlang thanks to his quick wits. After many transformations that were performed in their duel (Sun Wukong fleeing as a fish; Erlang and Sun Wukong becoming larger birds, and so forth). Near the conclusion of the battle, he managed to see through Sun Wukong's disguise (as a temple) using his third-eye. He eventually defeated Wukong through teamwork with several other gods; Laozi personally had dropped his refined golden ring that had hit Sun Wukong on the head, giving Erlang a chance to bring him down, and Erlang's dog bit him in the leg. After Sun Wukong had been captured (to which Sun Wukong retorts that they are cowards for attacking from behind), he and his heavenly soldiers would burn random areas of the Mount Huaguo. Erlang is seen again far later in the novel when he assists Sun Wukong through chance by fighting against a certain ancient Dragon King and his allies.
In Investiture of the Gods, Yang Jian would first appear during the time of the Diablo Brothers' attack on the Western Foothills. After hearing of the situation, Yang would personally take the offensive against the brothers. During his duel against all four brothers, Yang would deliberately allow himself to be consumed by Diablo Long Life's flying mink. Following the battle, Yang Jian would suddenly reappear before Jiang Ziya after killing the mink inside its stomach with his many transformations. To trick the Diablo Brothers, Yang would later transform himself into Long Life's flying mink and steal Diablo Red's Havoc-Umbrella. Thus, Yang would be renowned as the true reason for Jiang Ziya's victory over the Diablo Brothers at an overall point.
Bao Lian Deng
In the tale Lotus Lantern (Bao Lian Deng), Erlang had a sister known as the Holy Mother of Mount Hua (Hua Shan). She married a mortal man, Liu Yanchang, who was a scholar. Together, they had a son by the name of Chen Xiang. She was admonished by Erlang for this unlawful human-deity union and imprisoned under Mount Hua. When Chen Xiang came of age, he split the mountain with an axe to free his mother, but not before facing people who repeatedly tried to undermine his mission, most notably his own uncle Erlang.
As Li Bing
As Li Bing, the first hydraulic engineer in the Shu area, was the hero who stopped the flooding of the Min River by constructing the Dujiangyan. This somehow led to Li Bing being turned into a folk hero who defeated a river god in order to save his prefecture from being flooded, where this story had then associated him as a new river god that protected the local people in the area from floods. However a discrepancy comes up that even though Li Bing/Erlang was known as Guankou Shen, the river that he is associated with is in Qianwei and not Guankou. Another discrepancy is that Li Erlang had never appeared in any of the tales related to stopping the Min River. The first appearance of Li Erlang was in Zhishui ji 治水記 by Li Ying 李膺 of the Liang 梁 Dynasty.
Historically Li Bing was conferred an official title until the Five Dynasties period under the rule of the Shu kingdom. He rose to political power when the great flood that occurred on the twenty-sixth day of the eighth month in 920 CE, was reported to the emperor by Daoist Du Guangting 杜光庭.
As a filial deity
In Chinese belief he was a filial son that entered the Chinese underworld to save his deceased mother from torment and will punish unfilial children by striking them with thunder strike as a punishment, hence the Chinese parent saying "Being smitten by lightning for being unfilial and ungrateful" towards unruly children. A warrior deity, he wields a Sān Jiān Liǎng Rèn Dāo (三尖两刃刀 - "three-pointed, double-edged blade") and always has his faithful Xiàotiān quǎn (啸天犬 - "Howling Celestial Dog") by his side. This dog also helps him subdue evil spirits.
- Cheng Manchao (1995). The Origin of Chinese Deities. Beijing: Foreign Languages Press. pp. 170–180. ISBN 7-119-00030-6.
- "Zhulong". God Erlang Suppressed Fire Dragon.
Legend goes, on one of the northern mountains of Dujiang Dam lived a fire dragon which was raging the common people. Libing asked his son-God Erlang to subdue it. God Erlang climbed onto Yulei Mountain and became a giant. He was as tall as the sky. He wrapped clouds on his waist and cut a tree to make a carrying pole. Then he carried two mountains at a time to build the dam. After he brought 66 mountains the dam was built. God Erlang got water from Pacifying Dragon Pool to put into the dam. At length the fire dragon was subdued.