dcs 1 hónapja
szülő
commit
f4717651e5

+ 51 - 1
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrResource.java

@@ -9,7 +9,21 @@ public class MgrResource implements BaseModel{
 	private String data;
 	
 	private String comment;
-	
+
+	/**
+	 * 企业
+	 */
+	private String enterpriseData;
+
+	private String enterpriseComment;
+
+	/**
+	 * 服务商
+	 */
+	private String providerData;
+
+	private String providerComment;
+
 	public long getId() {
 		return id;
 	}
@@ -34,4 +48,40 @@ public class MgrResource implements BaseModel{
 		this.comment = comment;
 	}
 
+	public void setComment(String comment) {
+		this.comment = comment;
+	}
+
+	public String getEnterpriseData() {
+		return enterpriseData;
+	}
+
+	public void setEnterpriseData(String enterpriseData) {
+		this.enterpriseData = enterpriseData;
+	}
+
+	public String getEnterpriseComment() {
+		return enterpriseComment;
+	}
+
+	public void setEnterpriseComment(String enterpriseComment) {
+		this.enterpriseComment = enterpriseComment;
+	}
+
+	public String getProviderData() {
+		return providerData;
+	}
+
+	public void setProviderData(String providerData) {
+		this.providerData = providerData;
+	}
+
+	public String getProviderComment() {
+		return providerComment;
+	}
+
+	public void setProviderComment(String providerComment) {
+		this.providerComment = providerComment;
+	}
+
 }

+ 13 - 9
virgo.core/src/main/java/com/bosshand/virgo/core/service/MgrUserService.java

@@ -410,23 +410,27 @@ public class MgrUserService {
     	if(currentUserRole!= null && currentOrganization!=null && currentUserRole.isAdmin()) {
     		String resources = "";
     		String menus = "";
-			String workarkResources = "";
-			String workarkMenus = "";
+			MgrResource workarkDefaultResource = getWorkarkDefaultResource();
     		if(currentUserRole.getOrganizationId() == -1) {
     			MgrResource resource = getDefaultResource();
     			if(resource != null) {
     				resources = resource.getData();
     				menus = resource.getComment();
     			}
-				MgrResource workarkDefaultResource = getWorkarkDefaultResource();
-				if(workarkDefaultResource != null) {
-					workarkResources = workarkDefaultResource.getData();
-					workarkMenus = workarkDefaultResource.getComment();
-				}
 				currentUserRole.setResources(resources);
 				currentUserRole.setMenus(menus);
-				currentUserRole.setWorkarkResources(workarkResources);
-				currentUserRole.setWorkarkMenus(workarkMenus);
+
+				currentUserRole.setWorkarkResources(workarkDefaultResource.getData());
+				currentUserRole.setWorkarkMenus(workarkDefaultResource.getComment());
+			} else {
+				if (currentOrganization.getFacilitator() == 0) {
+					currentUserRole.setWorkarkResources(workarkDefaultResource.getEnterpriseData());
+					currentUserRole.setWorkarkMenus(workarkDefaultResource.getEnterpriseComment());
+				}
+				if (currentOrganization.getFacilitator() == 1) {
+					currentUserRole.setWorkarkResources(workarkDefaultResource.getProviderData());
+					currentUserRole.setWorkarkMenus(workarkDefaultResource.getProviderComment());
+				}
 			}
     	}
 

+ 11 - 2
virgo.core/src/main/resources/mapper/MgrResourceMapper.xml

@@ -6,6 +6,10 @@
 		<id column="id" property="id"/>
 		<result column="data" property="data"/>
 		<result column="comment" property="comment"/>
+		<result column="enterpriseData" property="enterpriseData"/>
+		<result column="enterpriseComment" property="enterpriseComment"/>
+		<result column="providerData" property="providerData"/>
+		<result column="providerComment" property="providerComment"/>
 	</resultMap>
 
 	<select id="get" resultType="com.bosshand.virgo.core.model.MgrResource">
@@ -15,14 +19,15 @@
 	<select id="defaultResource" resultType="com.bosshand.virgo.core.model.MgrResource">
 		SELECT * from mgr_resource limit 1
 	</select>
-	
+
 	
 	<select id="getList" resultMap="MgrResourceResult">
 		SELECT * from mgr_resource
 	</select>
 
 	<insert id="insert" parameterType="com.bosshand.virgo.core.model.MgrResource" useGeneratedKeys="true" keyProperty="id">
-		INSERT into mgr_resource(data, comment) values(#{data}, #{comment})
+		INSERT into mgr_resource(`data`, `comment`, `enterpriseData`, `enterpriseComment`, `providerData`, `providerComment`)
+		values(#{data}, #{comment}, #{enterpriseData}, #{enterpriseComment}, #{providerData}, #{providerComment})
 	</insert>
 	
 	<update id="update" parameterType="com.bosshand.virgo.core.model.MgrResource">
@@ -30,6 +35,10 @@
 			<trim prefix="set" suffixOverrides=",">
 				<if test="data!=null">data=#{data},</if>
 				<if test="comment!=null">comment=#{comment},</if>
+				<if test="enterpriseData!=null">enterpriseData=#{enterpriseData},</if>
+				<if test="enterpriseComment!=null">enterpriseComment=#{enterpriseComment},</if>
+				<if test="providerData!=null">providerData=#{providerData},</if>
+				<if test="providerComment!=null">providerComment=#{providerComment},</if>
 			</trim>
 		WHERE id=#{id}
 	</update>