沐梦. 8 horas atrás
pai
commit
4a06d391b9

+ 13 - 11
ruoyi-modules/ruoyi-customer/src/main/resources/mapper/customer/SalesleadsMapper.xml

@@ -58,11 +58,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                         AND s.leader != #{bo.params.currentUserId}
                         AND (
                             FIND_IN_SET(#{bo.params.currentUserId}, s.product_support)
-                            OR s.id IN (
-                                SELECT CAST(tm.object_no AS UNSIGNED) FROM team_member tm
+                            OR EXISTS (
+                                SELECT 1 FROM team_member tm
                                 WHERE tm.user_no = #{bo.params.currentUserId}
                                   AND tm.data_type = 1
                                   AND tm.is_delete = 0
+                                  AND tm.object_no = s.id
                             )
                         )
                     </when>
@@ -70,11 +71,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                         AND (
                             s.leader = #{bo.params.currentUserId}
                             OR FIND_IN_SET(#{bo.params.currentUserId}, s.product_support)
-                            OR s.id IN (
-                                SELECT CAST(tm.object_no AS UNSIGNED) FROM team_member tm
+                            OR EXISTS (
+                                SELECT 1 FROM team_member tm
                                 WHERE tm.user_no = #{bo.params.currentUserId}
                                   AND tm.data_type = 1
                                   AND tm.is_delete = 0
+                                  AND tm.object_no = s.id
                             )
                         )
                     </otherwise>
@@ -83,32 +85,32 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <if test="bo.params.beginTime != null and bo.params.beginTime != ''">
                 <choose>
                     <when test="bo.timeType == '2'">
-                        AND date_format(s.approval_date,'%Y-%m-%d') &gt;= #{bo.params.beginTime}
+                        AND s.approval_date &gt;= concat(#{bo.params.beginTime}, ' 00:00:00')
                     </when>
                     <when test="bo.timeType == '3'">
-                        AND date_format(s.expected_completion_time,'%Y-%m-%d') &gt;= #{bo.params.beginTime}
+                        AND s.expected_completion_time &gt;= concat(#{bo.params.beginTime}, ' 00:00:00')
                     </when>
                     <otherwise>
-                        AND date_format(s.create_time,'%Y-%m-%d') &gt;= #{bo.params.beginTime}
+                        AND s.create_time &gt;= concat(#{bo.params.beginTime}, ' 00:00:00')
                     </otherwise>
                 </choose>
             </if>
             <if test="bo.params.endTime != null and bo.params.endTime != ''">
                 <choose>
                     <when test="bo.timeType == '2'">
-                        AND date_format(s.approval_date,'%Y-%m-%d') &lt;= #{bo.params.endTime}
+                        AND s.approval_date &lt;= concat(#{bo.params.endTime}, ' 23:59:59')
                     </when>
                     <when test="bo.timeType == '3'">
-                        AND date_format(s.expected_completion_time,'%Y-%m-%d') &lt;= #{bo.params.endTime}
+                        AND s.expected_completion_time &lt;= concat(#{bo.params.endTime}, ' 23:59:59')
                     </when>
                     <otherwise>
-                        AND date_format(s.create_time,'%Y-%m-%d') &lt;= #{bo.params.endTime}
+                        AND s.create_time &lt;= concat(#{bo.params.endTime}, ' 23:59:59')
                     </otherwise>
                 </choose>
             </if>
             ${bo.params.dataScope}
         </where>
-        ORDER BY create_time DESC
+        ORDER BY s.create_time DESC
     </select>
 
 </mapper>