dcs 1 year ago
parent
commit
99d9fbe073

+ 20 - 0
virgo.core/src/main/java/com/bosshand/virgo/core/model/MgrOrganizationProject.java

@@ -12,11 +12,15 @@ public class MgrOrganizationProject {
      */
     private long organizationId;
 
+    private String organizationName;
+
     /**
      * 项目id
      */
     private long projectId;
 
+    private String projectName;
+
     /**
      * 用户id
      */
@@ -71,6 +75,22 @@ public class MgrOrganizationProject {
         this.projectId = projectId;
     }
 
+    public String getOrganizationName() {
+        return organizationName;
+    }
+
+    public void setOrganizationName(String organizationName) {
+        this.organizationName = organizationName;
+    }
+
+    public String getProjectName() {
+        return projectName;
+    }
+
+    public void setProjectName(String projectName) {
+        this.projectName = projectName;
+    }
+
     public long getUserId() {
         return userId;
     }

+ 17 - 9
virgo.core/src/main/resources/mapper/MgrOrganizationProjectMapper.xml

@@ -7,7 +7,9 @@
     <resultMap type="com.bosshand.virgo.core.model.MgrOrganizationProject" id="mgrOrganizationProjectResult" >
         <id column="id" property="id"/>
         <result column="organizationId" property="organizationId"/>
+        <result column="organizationName" property="organizationName"/>
         <result column="projectId" property="projectId"/>
+        <result column="projectName" property="projectName"/>
         <result column="userId" property="userId"/>
         <result column="clientId" property="clientId"/>
         <result column="agentId" property="agentId"/>
@@ -16,6 +18,12 @@
         <result column="identityId" property="identityId"/>
     </resultMap>
 
+    <sql id="query">
+        select a.*, b.name as organizationName, c.name as projectName from mgr_organization_project a
+            left join mgr_organization b on a.organizationId = b.id
+            left join project c on a.projectId = c.id
+    </sql>
+
     <select id="get" resultMap="mgrOrganizationProjectResult">
         select * from mgr_organization_project where organizationId = #{organizationId} and userId = #{userId}
     </select>
@@ -29,16 +37,16 @@
     </select>
 
     <select id="getList" resultMap="mgrOrganizationProjectResult">
-        select * from mgr_organization_project
+        <include refid="query"/>
         <where>
-            <if test="organizationId!=0">and organizationId=#{organizationId}</if>
-            <if test="projectId!=0">and projectId=#{projectId}</if>
-            <if test="userId!=0">and userId=#{userId}</if>
-            <if test="clientId!=0">and clientId=#{clientId}</if>
-            <if test="agentId!=0">and agentId=#{agentId}</if>
-            <if test="merchantId!=0">and merchantId=#{merchantId}</if>
-            <if test="bindOrganizationId!=0">and bindOrganizationId=#{bindOrganizationId}</if>
-            <if test="identityId!=0">and identityId=#{identityId}</if>
+            <if test="organizationId!=0">and a.organizationId=#{organizationId}</if>
+            <if test="projectId!=0">and a.projectId=#{projectId}</if>
+            <if test="userId!=0">and a.userId=#{userId}</if>
+            <if test="clientId!=0">and a.clientId=#{clientId}</if>
+            <if test="agentId!=0">and a.agentId=#{agentId}</if>
+            <if test="merchantId!=0">and a.merchantId=#{merchantId}</if>
+            <if test="bindOrganizationId!=0">and a.bindOrganizationId=#{bindOrganizationId}</if>
+            <if test="identityId!=0">and a.identityId=#{identityId}</if>
         </where>
     </select>