1、一段正确的左连接的数据库sql语句怎么写
<select id="findAll" resultType="map" parameterType="map">
select
A.ID AS "id",
A.strName AS "strName",
A.phoneNum AS "phoneNum",
A.belongCompany AS "belongCompany",
A.applicantId AS "applicantId",
A.deptId AS "deptId",
A.applyResource AS "applyResource",
A.intStatus AS "intStatus",
B.STRNAME AS "departName"
from yf_nac_dlp A
left join do_department B
on A.deptId=B.ID
order by A.createdatetime DESC
</select>
order放在右面
A.ID , A.strName 不写的话,如果B中有同样的字段,就会提示 字段重复。
left join 后面 on 写的就是连接的条件。
2、数据库筛选条件怎么做模糊查询
<where>
<if test="strName != null and strName != ''">
AND A.strName like '%${strName}%'
</if>
</where>
3、为什么 跳转提示badRequest:400(仅限于本项目)
<form id="pagerForm" method="post" action="${ctx}/yfNacDlp/list" >
<input type="hidden" name="pageNum" value="${page.pageNum}" />
<input type="hidden" name="numPerPage" value="${page.numPerPage}" />
<input type="hidden" name="orderField" value="${page.orderField}" />
<input type="hidden" name="orderDirection" value="${page.orderDirection}" />
<input type="hidden" name="applicantId" value="${yfNacDlp.applicantId}" style="width: px;" />
<input type="hidden" name="strId" value="${yfNacDlp.strId}" style="width: px;" />
<input type="hidden" name="strName" value="${yfNacDlp.strName}" style="width: px;" />
</form>
那是因为这段传参的地方做了错误的name的定义,这个pagerform重载的时候会 自动传入,导致传入的参数出错。
400 bad request的 错误大概率可能就是因为 传入的参数不对。
4、怎么样动态改变href的url,通过js
用这样的办法:
首先跳转的地方是用function跳转的,
<shiro:hasPermission name="YfNacDlp:edit">
<a class="edit" id="editEle" onclick="changeEditPage()" target="dialog" width="800" height="500" >编辑</a>
</shiro:hasPermission>
然后在函数的地方做判断,跳转是用$("# ").attr("href","")来跳转的。
//判断跳转的页面是内部人员还是外部人员的
function changeEditPage(event){
event = event || window.event;
if(yfNacDlpEle.intStatus!='0'){
top.layer.msg("只有申请状态的任务可以编辑", {icon: 2});
event.stopPropagation();
event.preventDefault();
}
if(yfNacDlpEle.intStatus =='0' && (yfNacDlpEle.belongCompany == '内部人员')){
$("#editEle").attr("href","${ctx}/yfNacDlp/preUpdate/{slt_uid}");
}
if(yfNacDlpEle.intStatus =='0' && (yfNacDlpEle.belongCompany == '外部人员')){
$("#editEle").attr("href","${ctx}/yfNacDlp/preOutUpdate/{slt_uid}");
}
}
其中:用来阻止a 标签的默认事件
event.stopPropagation();
event.preventDefault();
1.event.stopPropagation()方法
这是阻止事件的冒泡方法,不让事件向documen上蔓延,但是默认事件任然会执行,当你掉用这个方法的时候,如果点击一个连接,这个连接仍然会被打开,
2.event.preventDefault()方法
这是阻止默认事件的方法,调用此方法是,连接不会被打开,但是会发生冒泡,冒泡会传递到上一层的父元素;
3.return false ;
这个方法比较暴力,他会同事阻止事件冒泡也会阻止默认事件;写上此代码,连接不会被打开,事件也不会传递到上一层的父元素;可以理解为return false就等于同时调用了event.stopPropagation()和event.preventDefault()
5、怎么获取layui表格当中某一行的某个字段的值
<tr target="slt_uid" rel="${yfNacDlp.id}" id="${yfNacDlp.id}" onclick="changeEle('${yfNacDlp.intStatus}','${yfNacDlp.belongCompany}')" >
然后js中这样写:
var yfNacDlpEle={};
function changeEle(intStatus,belongCompany){
yfNacDlpEle.intStatus = intStatus;
yfNacDlpEle.belongCompany = belongCompany;
}
6、一段 拼接的代码
拼接的效果是点击之后出现相关的东西:
<div style="margin-left:0px;margin-top:3px;">
<a class="add " id="ratiPerNext"></a>
</div>
$("#ratiPerNext").click(function(){
var elem1 = document.getElementById('ratifySize');
var div1 = document.createElement('div');
var addstring = "";
addstring = '<div class="layui-input-inline" style="margin-top:3px;margin-left:5px" id="ratifyPer'+ num + '">' +
'<div class="layui-input-inline" style="width:120px;">' +
'<input type="text" id="conAppr_apprNext'+ num + '" name="ratiPer" class="layui-input" style="width:120px" readOnly/>' +
'<i class="layui-icon layui-icon-close" onclick="clearSelected('+'"conAppr_apprNext' + num +'")"></i>' +
'<a class="layui-btn layui-btn-sm" href="${ctx}/common/selectUsers?singleFlag=false&userNoFilter=conAppr_apprNext'+ num + '" title="挑选人员" target="dialog" width="530" height="550"dialogId="selectUserDialog" style="position: absolute; top: 4px; right: 4px; bottom: 0px;">' +
'<i class="layui-icon layui-icon-search"></i></a></div>' +
'<div style="margin-top:3px;margin-left:3px">' +
'<a class="delete" onclick="disappearAdd(' + num +')"></a></div>' +
'<div class="layui-input-inline to_right" style="margin-top:3px;width:1px"></div>' +
'</div>';
div1.innerHTML = addstring;
var divNum = document.getElementById("contractApprove_info").getElementsByTagName("div");
if(divNum.length < (26+ divLength)){
elem1.appendChild(div1);
}else{
layer.msg('最多指定6个审批人!', {time: 2000, icon:5});
}
num += 1;
/* console.log($("#con_cre_vendorNoShow0").html()); */
})