部分页面加权限

This commit is contained in:
方亮 2025-10-30 13:15:13 +08:00
parent 9804d4aa0c
commit e10b5a9283
11 changed files with 57 additions and 29 deletions

View File

@ -67,20 +67,12 @@ public class ProjectController {
@RequiresPermissions("sys:project:query")
public PageTableResponse listProjects(PageTableRequest request) {
// String companyId = (String) request.getParams().get("companyId");
// log.info("前台的orgId:"+companyId);
// if(StringUtils.isEmpty(companyId) || ("-1").equals(companyId)){
// companyId = SecurityUtils.getLoginUser().getSysUser().getOrgId();
// }
// log.info("如果前台没传取登录用户的orgId:"+companyId);
// Map<String, Object> params = request.getParams();
// params.put("companyId",companyId);
request.getParams().put("generalProId", request.getParams().get("orgId"));
String orgIdStr = SecurityUtils.getLoginUser().getSysUser().getOrgId();
request.getParams().put("orgId", orgIdStr);
if(!"1".equals(orgIdStr)){
request.getParams().put("orgId", orgIdStr);
}
SelfPermissionSettingUtils.getSelfPermission(request);
String orgId = (String) request.getParams().get("orgId");

View File

@ -13,6 +13,7 @@ import com.bonus.common.core.utils.poi.ExcelUtil;
import com.bonus.common.log.annotation.Log;
import com.bonus.common.log.enums.BusinessType;
import com.bonus.common.security.annotation.RequiresPermissions;
import com.bonus.common.security.utils.SecurityUtils;
import lombok.RequiredArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -42,6 +43,12 @@ public class ProjectFileController {
@Log(title = "获取工程列表", businessType = BusinessType.SELECT)
@RequiresPermissions("sys:project:query")
public PageTableResponse listProjects(PageTableRequest request) {
String orgIdStr = SecurityUtils.getLoginUser().getSysUser().getOrgId();
String roleLevel = SecurityUtils.getLoginUser().getSysUser().getRoleLevel();
//不单独去查所有的公司了只放行一个公司
if(!"1".equals(orgIdStr)){
request.getParams().put("orgId", orgIdStr);
}
return new PageTableHandler(new PageTableHandler.CountHandler() {
@Override
public int count(PageTableRequest request) {

View File

@ -10,6 +10,7 @@ public class UserBean {
private String idNumber;
private String phone;
private String phonenumber;
private String comId;
private String orgId;
private String orgName;
private String roleId;

View File

@ -62,7 +62,7 @@ public class UserServiceImpl implements UserService {
throw new IllegalArgumentException("角色未启用,请重新选择");
}
String passWord = "Lphd@123456";
log.info("aa"+passwordEncoder.encode(passWord)+"aa");
// log.info("aa"+passwordEncoder.encode(passWord)+"aa");
user.setPassWord(passwordEncoder.encode(passWord));
user.setStatus("1");
user.setIdNumber(user.getIdNumber().toUpperCase());

View File

@ -48,6 +48,12 @@ public class InOutServiceImpl implements InOutService {
params.put("orgAll",childList);
}*/
String orgIdStr = SecurityUtils.getLoginUser().getSysUser().getOrgId();
//不单独去查所有的公司了只放行一个公司
if(!"1".equals(orgIdStr)){
request.getParams().put("orgId", orgIdStr);
}
String roleLevel = SecurityUtils.getLoginUser().getSysUser().getRoleLevel();
String subId = SecurityUtils.getLoginUser().getSysUser().getSubId();
if("4".equals(roleLevel)) {

View File

@ -73,6 +73,11 @@ public class PersonComprehensiveServiceImp implements PersonComprehensiveService
Map<String, Object> params = request.getParams();
String roleLevel = SecurityUtils.getLoginUser().getSysUser().getRoleLevel();
String subId = SecurityUtils.getLoginUser().getSysUser().getSubId();
String orgIdStr = SecurityUtils.getLoginUser().getSysUser().getOrgId();
//不单独去查所有的公司了只放行一个公司
if(!"1".equals(orgIdStr)){
request.getParams().put("orgId", orgIdStr);
}
if ("4".equals(roleLevel)) {
String subId1 = (String) params.get("subId");
if (StringUtils.isEmpty(subId1)) {
@ -599,6 +604,11 @@ public class PersonComprehensiveServiceImp implements PersonComprehensiveService
Map<String, Object> params = request.getParams();
String roleLevel = SecurityUtils.getLoginUser().getSysUser().getRoleLevel();
String subId = SecurityUtils.getLoginUser().getSysUser().getSubId();
String orgIdStr = SecurityUtils.getLoginUser().getSysUser().getOrgId();
//不单独去查所有的公司了只放行一个公司
if(!"1".equals(orgIdStr)){
request.getParams().put("orgId", orgIdStr);
}
if ("4".equals(roleLevel)) {
String subId1 = (String) params.get("subId");
if (StringUtils.isEmpty(subId1)) {
@ -1140,4 +1150,4 @@ public class PersonComprehensiveServiceImp implements PersonComprehensiveService
return initials.toString();
}
}
}

View File

@ -59,7 +59,7 @@
WHERE
bp.is_active = 1
<if test="params.orgId != null and params.orgId != ''">
AND bp.project_general_id = #{params.orgId}
AND bp.company_id = #{params.orgId}
</if>
<if test="params.proId!=null and params.proId!='' ">
and bp.ID= #{params.proId}
@ -170,4 +170,4 @@
bp.id
</select>
</mapper>
</mapper>

View File

@ -185,6 +185,9 @@
<insert id="saveUser" useGeneratedKeys="true" keyProperty = "userId" keyColumn="id">
insert into sys_user
(username, password, loginname, id_number,phone,
<if test="comId != null and comId !=''">
com_id,
</if>
<if test="orgId != null and orgId !=''">
org_id,
</if>
@ -197,6 +200,9 @@
status, is_active)
values(#{userName}, #{passWord}, #{userName}, #{idNumber},
#{phonenumber},
<if test="comId != null and comId !=''">
#{comId},
</if>
<if test="orgId != null and orgId !=''">
#{orgId},
</if>
@ -251,6 +257,9 @@
id_number= #{idNumber},
is_push = '0',
phone = #{phonenumber}
<if test="comId != null and comId !=''">
,com_id = #{comId}
</if>
<if test="orgId != null and orgId !=''">
,org_id = #{orgId}
</if>
@ -277,4 +286,4 @@
UPDATE sys_user SET `is_push`= #{user.status} WHERE phone = #{user.phone} and IS_ACTIVE = #{user.isActive}
</foreach>
</update>
</mapper>
</mapper>

View File

@ -4,16 +4,9 @@
<mapper namespace="com.bonus.bmw.person.dao.InOutDao">
<!-- bweh.is_active = '1' -->
<sql id="where">
WHERE 1=1
<if test="params.orgId != null and params.orgId != '' and params.roleLevel &lt; 3">
AND ( po.id in (${params.orgAll})
or bp.company_id in (${params.orgAll})
)
</if>
<if test="params.orgId != null and params.orgId != '' and params.roleLevel >= 3">
AND ( po.id = #{params.orgId}
or bp.company_id = #{params.orgId}
)
<where>
<if test="params.orgId != null and params.orgId != ''">
AND bp.company_id = #{params.orgId}
</if>
<if test="params.companyId != null and params.companyId != ''">
and bp.company_id = #{params.companyId}
@ -46,7 +39,7 @@
or bst.team_name like concat('%', #{params.keyWord}, '%')
)
</if>
</where>
</sql>
<insert id="addPersonEvaluate">
update bm_worker_ein_history set exit_performance = #{evaluate},exit_skill_evaluation = #{exitExamineRemark}

View File

@ -479,6 +479,9 @@
and bweh.exit_status in (${params.einStatus})
</if>
</if>
<if test="params.orgId != null and params.orgId != ''">
AND (bp.company_id = #{params.orgId} or bp.company_id is null)
</if>
GROUP BY
bw.id_number
</select>
@ -801,6 +804,9 @@
<if test="params.proStatusId != null and params.proStatusId != ''">
and locate (#{params.proStatusId},bp.pro_status)
</if>
<if test="params.orgId != null and params.orgId != ''">
AND bp.company_id = #{params.orgId}
</if>
GROUP BY
bpg.id, bp.id
</select>

View File

@ -1,5 +1,6 @@
let roleList = [];
let requirement = "";
let companyId;
let orgId;
$(function () {
layui.use(['form'], function () {
@ -49,6 +50,7 @@ function addUser(formData) {
let loadingMsg = layer.msg('数据请求中,请稍候...', {icon: 16, scrollbar: false, time: 0, shade: [0.8, '#393D49']});
// form请求地址
let formUrl = ctxPath + "/users";
formData.field.comId = companyId;
$.ajax({
type: 'POST',
async: false, // 默认异步true,false表示同步
@ -85,6 +87,7 @@ function updateUser(formData) {
$("#proId").val("");
$("#subId").val("");
}
formData.field.comId = companyId;
formData.field.phone = phone;
// 加载提示
let loadingMsg = layer.msg('数据请求中,请稍候...', {icon: 16, scrollbar: false, time: 0, shade: [0.8, '#393D49']});
@ -207,8 +210,9 @@ function findRoleType(roleId,proId,subId){
}
function loadCompanyInfo(n,c){ //分公司工程联动
var companyId = c;
companyId = c;
orgId = n;
console.log("companyId,orgId",c+","+n)
getOwnRole(companyId,"");
}
@ -217,4 +221,4 @@ function reloading() {
var index = parent.layer.getFrameIndex(window.name); //先得到当前 iframe层的索引
parent.layer.close(index); //再执行关闭
window.parent.location.reload();
}
}