1. Add and delete enterprise employees, add and delete departments.
Actual :
70% of
the harvest is completed:
1. How to merge the id and name in the enterprise information table into the department table?
use union
select ep.id as id, ep.enterpriseName as name from enterprise ep union select d.id as id, d.departmentName as name from department d
2. Input type=radio realizes assignment and value, and uses jQuery to bind click events
$("input[type='radio']").bind("click", function(e){ var theEvent = window.event || e; var theObj = theEvent.target || theEvent.srcElement; var selectedValue = $(this).val(); if (selectedValue == "0") { $('input[name="' + theObj.name + '"][value="1"]').removeAttr("checked"); $('input[name="' + theObj.name + '"][value="0"]').attr("checked", true); } else { $('input[name="' + theObj.name + '"][value="0"]').removeAttr("checked"); $('input[name="' + theObj.name + '"][value="1"]').attr("checked", true); } }); // When opening the Dialog, let the value passed from the background be selected $('input[name=Sex][value="' + rowData.Sex + '"]').attr("checked", true); // Get the selected value when submitting Sex : $("input[name='Sex'][checked]").val();
3.mysql function, first enable function support:
set Global log_bin_trust_function_creators=1;
then write the function
cast(rootId as CHAR); concat(sTemp,',',sTempChd); SELECT group_concat(id) INTO sTempChd FROM treeNodes where FIND_IN_SET(pid,sTempChd)>0;
eg: Query all child nodes, including themselves
Drop Function if exists getChildList CREATE FUNCTION getChildList (rootId INT) RETURNS varchar(1000) BEGIN DECLARE sTemp VARCHAR(1000); DECLARE sTempChd VARCHAR(1000); SET sTemp = '$'; SET sTempChd = cast (rootId as CHAR); WHILE sTempChd is not null DO SET sTemp = concat(sTemp,',',sTempChd); SELECT group_concat(id) INTO sTempChd FROM treeNodes where FIND_IN_SET(pid,sTempChd)>0; END WHILE; RETURN sTemp; END //transfer select getChildList(10081); // output '$,10081,10086'