Browse Source

食堂部门就餐详情完善。

tomatozq 4 years ago
parent
commit
4adc355a80
1 changed files with 42 additions and 8 deletions
  1. 42 8
      common/src/main/resources/mapper/base/CanteenDiningRecord.xml

+ 42 - 8
common/src/main/resources/mapper/base/CanteenDiningRecord.xml

@@ -378,15 +378,52 @@
 	</select>
 
 	<select id="canteenDiningRecordCompanyDetail" parameterType="hashmap" resultType="hashmap">
-		<![CDATA[
 			SELECT a.id_,c.name_ as companyName,a.name_,a.job_number,count(b.person_id) as personNum,
-			(SELECT count(*) FROM base_canteen_dining_record z WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='2') as 'lunch',
-			(SELECT count(*) FROM base_canteen_dining_record z WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='3') as 'supper',
-			(SELECT count(*) FROM base_canteen_dining_record z WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='4') as 'nightSnack'
+			(
+				SELECT count(*) FROM base_canteen_dining_record z
+				WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='2'
+				<if test="searchParams.beginTime != null">
+				<![CDATA[
+					and z.record_time >= #{searchParams.beginTime}
+				]]>
+				</if>
+				<if test="searchParams.endTime != null">
+					<![CDATA[
+					  and z.record_time <= #{searchParams.endTime}
+					]]>
+				</if>
+			) as 'lunch',
+			(
+				SELECT count(*) FROM base_canteen_dining_record z
+				WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='3'
+				<if test="searchParams.beginTime != null">
+					<![CDATA[
+							and z.record_time >= #{searchParams.beginTime}
+						]]>
+				</if>
+				<if test="searchParams.endTime != null">
+					<![CDATA[
+							  and z.record_time <= #{searchParams.endTime}
+							]]>
+				</if>
+			) as 'supper',
+			(
+				SELECT count(*) FROM base_canteen_dining_record z
+				WHERE z.person_id = a.id_ and z.del_flag=FALSE and z.category_='4'
+				<if test="searchParams.beginTime != null">
+					<![CDATA[
+							and z.record_time >= #{searchParams.beginTime}
+						]]>
+				</if>
+				<if test="searchParams.endTime != null">
+					<![CDATA[
+							  and z.record_time <= #{searchParams.endTime}
+							]]>
+				</if>
+			) as 'nightSnack'
 			FROM base_person_info a
 			left join base_canteen_dining_record b on a.id_=b.person_id
 			left join base_company_info c on a.company_id = c.id_
-		]]>
 		<where>
 			a.del_flag = false and b.del_flag = false
 			<if test="searchParams.companyId != null">
@@ -411,9 +448,6 @@
 		</foreach>
 	</select>
 
-
-
-
     <select id="canteenDiningRecordDetail" parameterType="hashmap" resultType="hashmap">
         <![CDATA[
             SELECT * FROM base_canteen_dining_record x WHERE x.del_flag = false and x.device_no in