Pārlūkot izejas kodu

红德堂-项目会员列表count查询sql条件修改

Long 2 nedēļas atpakaļ
vecāks
revīzija
1515982280

+ 11 - 6
fs-service/src/main/resources/mapper/his/FsUserMapper.xml

@@ -404,6 +404,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         left join fs_user_company_user ucu on ucu.user_id = fs_user.user_id
         <where>
             fs_user.is_del = 0
+            <if test="userId != null">
+                AND fs_user.user_id = #{userId}
+            </if>
             <if test="companyId != null">
                 AND ucu.company_id = #{companyId}
             </if>
@@ -411,10 +414,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 AND ucu.company_user_id = #{companyUserId}
             </if>
             <if test="registerStartTime != null and registerStartTime !='' ">
-                AND fs_user.create_time &gt;= #{registerStartTime}
+                AND ucu.update_time &gt;= #{registerStartTime}
             </if>
             <if test="registerEndTime != null and registerEndTime !='' ">
-                AND fs_user.create_time &lt;= #{registerEndTime}
+                <![CDATA[
+                AND ucu.update_time < date_add(#{registerEndTime}, interval 1 day)
+            ]]>
             </if>
             <if test="companyUserIds != null and companyUserIds.size > 0">
                 AND ucu.company_user_id in
@@ -422,11 +427,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                     ${item}
                 </foreach>
             </if>
-            <if test="nickname != null and nickname!=''">
-                AND fs_user.nick_name like concat(#{nickname},'%')
+            <if test="nickname != null and nickname != ''">
+                AND fs_user.nick_name like concat('%', #{nickname},'%')
             </if>
-            <if test="phone != null and phone!=''">
-                AND fs_user.phone = #{phone}
+            <if test="phone != null and phone != ''">
+                AND fs_user.phone like concat('%', #{phone},'%')
             </if>
             <if test="projectId != null">
                 AND ucu.project_id = #{projectId}