Просмотр исходного кода

科德系统修改公司管理开发

anderx лет назад: 3
Родитель
Сommit
57d86232aa

+ 12 - 3
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -96,6 +96,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);
+		Set<String> useRole = roleMapper.findRoleByUserId(ad.getId());
 		if (ad.getId() != "1") {
 			userRoleMapper.deleteByUserId(ad.getId());
 			if (!roleIds.isEmpty()) {
@@ -107,7 +108,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKeySelective(ad);
 		pushAmbRole(ad);
-		pushAdminRole(ad.getId(),roleIds);
+		pushAdminRole(ad.getId(),roleIds,useRole);
 		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
 //			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
@@ -121,11 +122,19 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		return count;
 	}
 
-	private void pushAdminRole(String id,List<String>roleIds) {
+
+
+	private void pushAdminRole(String id,List<String>roleIds, Set<String> useRole) {
 		boolean flag=false;
+		for (String s : useRole) {
+			if (AFTConstants.COMPANY_MANAGER.equals(s)){
+				flag=true;
+				break;
+			}
+		}
 		List<Role> roleList = roleMapper.selectByIdList(roleIds);
 		for (Role role : roleList) {
-			if (role.getRoleType().equals(AFTConstants.COMPANY_MANAGER)){
+			if (AFTConstants.COMPANY_MANAGER.equals(role.getRoleType().toString())){
 				flag=true;
 				break;
 			}

+ 7 - 7
src/main/java/com/goafanti/common/mapper/TOrderInvoiceMapper.xml

@@ -611,12 +611,12 @@ where a.status=2 and a.order_no=  #{orderNo,jdbcType=VARCHAR}
       and c.id= #{aid}
   </update>
   <update id="updateListExamineName">
-    update
-      t_order_invoice a left join t_order_new b on a.order_no =b.order_no
-        left join (select name ,department_id from admin a left join user_role b on a.id =b.uid
-                                                           left join `role` c on b.rid =c.id where  a.status ='0'and c.role_type  in ('9993'))x
-        on b.order_dep =x.department_id
-    set a.examine_name =x.name
-    where a.`type` =1 and a.status =1 and a.approval =1 and b.order_dep= #{depId}
+    update t_order_invoice t0,(select a.id , ifnull(x.name,'暂无人员')name from t_order_invoice a
+        left join t_order_new b on a.order_no =b.order_no left join (select name ,department_id from admin a
+        left join user_role b on a.id =b.uid left join `role` c on b.rid =c.id where a.status ='0'
+            and c.role_type in ('9993'))x on b.order_dep =x.department_id
+        where a.`type` =1 and a.status =1 and a.approval =1 and b.order_dep= #{depId} )t1
+    set t0.examine_name =t1.name
+    where t0.id=t1.id
   </update>
 </mapper>