优化用户模块

This commit is contained in:
季圣华 2020-12-16 23:53:10 +08:00
parent 518831dac5
commit 967ff1f899
2 changed files with 5 additions and 72 deletions

View File

@ -208,14 +208,6 @@
handler: function () {
addUser();
}
},'-',
{
id: 'deleteUser',
text: '删除',
iconCls: 'icon-remove',
handler: function () {
batDeleteUser();
}
}
],
onLoadError: function () {
@ -300,60 +292,6 @@
});
}
//批量删除用户
function batDeleteUser() {
var row = $('#tableData').datagrid('getChecked');
if (row.length == 0) {
$.messager.alert('删除提示', '没有记录被选中', 'info');
return;
}
if (row.length > 0) {
$.messager.confirm('删除确认', '确定要删除选中的' + row.length + '条用户信息吗', function (r) {
if (r) {
var ids = "";
for (var i = 0; i < row.length; i++) {
if (i == row.length - 1) {
ids += row[i].id;
break;
}
ids += row[i].id + ",";
}
if(row[i].loginName == "jsh"){
$.messager.alert('提示', '租户jsh不能删除', 'warning');
return;
} else if(row[i].id == row[i].tenantId) {
$.messager.alert('提示', '不能删除自己', 'warning');
return;
} else {
$.ajax({
type: "post",
url: "/user/batchDeleteUser",
dataType: "json",
async: false,
data: ({
ids: ids,
}),
success: function (res) {
if(res && res.code != 200) {
$.messager.alert('提示', res.msg, 'error');
return;
}
$.messager.alert('提示', res.msg, 'info');
$("#searchBtn").click();
$(":checkbox").attr("checked", false);
},
//此处添加错误处理
error: function () {
$.messager.alert('删除提示', '删除用户信息异常请稍后再试', 'error');
return;
}
});
}
}
});
}
}
//增加用户
var url;
var userID = 0;

View File

@ -10,15 +10,12 @@
</resultMap>
<select id="selectByConditionUser" parameterType="com.jsh.erp.datasource.entities.UserExample" resultMap="ResultMapEx">
select user.id, user.username, user.login_name, user.position, user.email, user.phonenum,
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,rel.user_blng_orga_dspl_seq,
rel.id as orgaUserRelId, tb.roleName
FROM jsh_user user
left join
(
select ub.*,r.name roleName from jsh_user_business ub
user.description, user.remark,user.isystem,org.id as orgaId,user.tenant_id,org.org_abr,
rel.user_blng_orga_dspl_seq,rel.id as orgaUserRelId,
(select r.name from jsh_user_business ub
inner join jsh_role r on ub.value=concat("[",r.id,"]") and ifnull(r.delete_flag,'0') !='1'
where ub.type='UserRole'
) tb on tb.key_id=user.id
where ub.type='UserRole' and ub.key_id=user.id) roleName
FROM jsh_user user
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1
@ -38,12 +35,10 @@
select count(user.id)
FROM jsh_user user
left join jsh_user_business ub on user.id=ub.key_id
left join jsh_role r on ub.value=concat("[",r.id,"]") and ifnull(r.delete_flag,'0') !='1'
left join jsh_orga_user_rel rel on user.id=rel.user_id and ifnull(rel.delete_flag,'0') !='1'
left join jsh_organization org on rel.orga_id=org.id and ifnull(org.org_stcd,'0') !='5'
where 1=1
and ifnull(user.status,'0') not in('1','2')
and ub.type='UserRole'
<if test="userName != null">
and user.username like '%${userName}%'
</if>