Browse Source

sql修改

anderx 3 years ago
parent
commit
3702e35307

+ 5 - 3
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -359,7 +359,7 @@
   </select>
 
   <select id="selectRolesByPrimaryKey" parameterType="java.lang.String" resultType="com.goafanti.common.model.Role">
-    select r.name, r.id, r.type
+    select r.role_name name, r.id, r.role_type type
     from role r
            left join user_role ur on ur.rid=r.id
     where ur.uid = #{uid,jdbcType=VARCHAR}
@@ -982,7 +982,8 @@
     from user a left join (select uid,last_follow_time from user_mid where aid= #{aid}) b  on a.id=b.uid
     left join organization_identity c on a.id=c.uid
     <if test="type==5 or type==6">
-      left join (select aid,uid from public_release where clock_in =1
+      left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
+      where b.clock_in =1
       and aid= #{aid,jdbcType=VARCHAR}
       <if test="startTime != null and endTime != null">
         and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
@@ -1033,7 +1034,8 @@
     select count(*)
     from user a
     <if test="type==5 or type==6">
-      left join (select aid,uid from public_release where clock_in =1
+      left join (select aid,uid from public_release a left join public_release_details b on a.id=b.prid
+      where b.clock_in =1
       and aid= #{aid,jdbcType=VARCHAR}
       <if test="startTime != null and endTime != null">
         and  clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}

+ 6 - 5
src/main/java/com/goafanti/common/mapper/DepartmentMapper.xml

@@ -319,13 +319,13 @@
   <insert id="insert1" parameterType="com.goafanti.organization.bo.OrganizationListOut">
     insert into department(
       id,create_id,create_time,update_time,deleted_sign,
-      name,type,manager_id,dep_no,super_id,desc,status)
+      name,type,manager_id,dep_no,super_id,status)
     values(#{id,jdbcType=VARCHAR},#{createId,jdbcType=VARCHAR},
            #{createTime,jdbcType=VARCHAR},#{updateTime,jdbcType=VARCHAR},
            #{deletedSign,jdbcType=VARCHAR},#{name,jdbcType=VARCHAR},
            #{type,jdbcType=VARCHAR},#{managerId,jdbcType=VARCHAR},
            #{depNo,jdbcType=VARCHAR},#{superId,jdbcType=VARCHAR},
-           #{desc,jdbcType=VARCHAR},#{status,jdbcType=VARCHAR})
+           #{status,jdbcType=VARCHAR})
   </insert>
   <!-- 得到上级 -->
   <select id="selectDepNo" resultType="String">
@@ -495,10 +495,11 @@
       and  transfer_time  between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by aid)x left join (select a.aid,sum(if(b.channel=0,1,0))completeCount,
-    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join `user` b on a.uid =b.id
-    where a.clock_in =1
+    sum(if(b.channel=1,1,0))channelCompleteCount from public_release a left join public_release_details prd on a.id=prd.id
+    left join `user` b on prd.uid =b.id
+    where prd.clock_in =1
     <if test="startTime != null and endTime != null">
-      and clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
+      and prd.clock_in_time between #{startTime,jdbcType=VARCHAR} and #{endTime,jdbcType=VARCHAR}
     </if>
     group by a.aid ) y on x.aid=y.aid)b on a.id=b.aid
     left join department d on a.department_id=d.id