|
@@ -203,8 +203,8 @@
|
|
|
|
|
|
<select id="canteenDiningRecordDetailList" parameterType="hashmap" resultType="hashmap">
|
|
<select id="canteenDiningRecordDetailList" parameterType="hashmap" resultType="hashmap">
|
|
|
|
|
|
- SELECT count(a.person_id) as personNum,a.address_ as address,c.name_ as canteenName,c.id_ as id,
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z WHERE a.address_=z.address_ and z.category_='2' and z.del_flag=FALSE
|
|
|
|
|
|
+ select a.name_ as canteenName,a.id_ as id,a.address_ as address,
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.device_no = c.device_no and z.category_='2' and z.del_flag=FALSE
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
</if>
|
|
</if>
|
|
@@ -218,8 +218,8 @@
|
|
and z.record_time <= #{searchParams.endTime}
|
|
and z.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'lunch',
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z WHERE a.address_=z.address_ and z.category_='3' and z.del_flag=FALSE
|
|
|
|
|
|
+ )) as 'lunch',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.device_no = c.device_no and z.category_='3' and z.del_flag=FALSE
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
</if>
|
|
</if>
|
|
@@ -233,8 +233,8 @@
|
|
and z.record_time <= #{searchParams.endTime}
|
|
and z.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'supper',
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z WHERE a.address_=z.address_ and z.category_='4' and z.del_flag=FALSE
|
|
|
|
|
|
+ )) as 'supper',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.device_no = c.device_no and z.category_='4' and z.del_flag=FALSE
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
</if>
|
|
</if>
|
|
@@ -248,17 +248,27 @@
|
|
and z.record_time <= #{searchParams.endTime}
|
|
and z.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'nightSnack'
|
|
|
|
- FROM base_canteen_info c
|
|
|
|
- left join base_canteen_device d on c.id_=d.canteen_id
|
|
|
|
- left join base_device_info e on d.device_id=e.id_
|
|
|
|
- left join base_canteen_dining_record a on a.device_no=e.device_no
|
|
|
|
- left join base_device_info b on a.device_no = b.device_no
|
|
|
|
- <where>
|
|
|
|
- a.del_flag = false and b.del_flag = false and c.del_flag=false
|
|
|
|
|
|
+ )) as 'nightSnack',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.device_no = c.device_no and z.del_flag=FALSE
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
- and a.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
|
|
+ and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
+ </if>
|
|
|
|
+ <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>
|
|
</if>
|
|
|
|
+ )) as 'personNum'
|
|
|
|
+ FROM base_canteen_info a
|
|
|
|
+ left JOIN base_canteen_device b on a.id_= b.canteen_id
|
|
|
|
+ left join base_device_info c on c.id_=b.device_id
|
|
|
|
+ <where>
|
|
|
|
+ a.del_flag = false and b.del_flag = false and c.del_flag=false
|
|
<if test="searchParams.beginTime != null">
|
|
<if test="searchParams.beginTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
and a.record_time >= #{searchParams.beginTime}
|
|
and a.record_time >= #{searchParams.beginTime}
|
|
@@ -269,7 +279,7 @@
|
|
and a.record_time <= #{searchParams.endTime}
|
|
and a.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- GROUP BY c.id_
|
|
|
|
|
|
+ GROUP BY a.id_
|
|
</where>
|
|
</where>
|
|
<foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
<foreach item="sort" collection="sortList" open="order by" separator=",">
|
|
${sort.name} ${sort.order}
|
|
${sort.name} ${sort.order}
|
|
@@ -278,19 +288,8 @@
|
|
|
|
|
|
|
|
|
|
<select id="canteenDiningRecordCompanyList" parameterType="hashmap" resultType="hashmap">
|
|
<select id="canteenDiningRecordCompanyList" parameterType="hashmap" resultType="hashmap">
|
|
- select count(c.person_id) as personNum,a.name_ as companyName,a.id_ as companyId,
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z
|
|
|
|
- inner join base_person_info x on z.person_id=x.id_
|
|
|
|
- inner join base_company_info y on y.id_= x.company_id
|
|
|
|
- WHERE y.id_ = a.id_ and z.category_='2' and z.del_flag=FALSE
|
|
|
|
- <if test="searchParams.companyId != null">
|
|
|
|
- <![CDATA[
|
|
|
|
- and y.code_ like #{searchParams.companyId}
|
|
|
|
- ]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.isOutsourcer != null">
|
|
|
|
- and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
- </if>
|
|
|
|
|
|
+ select a.name_ as companyName,a.id_ as companyId,
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.person_id = b.id_ and z.category_='2' and z.del_flag=FALSE
|
|
<if test="searchParams.beginTime != null">
|
|
<if test="searchParams.beginTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
and z.record_time >= #{searchParams.beginTime}
|
|
and z.record_time >= #{searchParams.beginTime}
|
|
@@ -301,19 +300,8 @@
|
|
and z.record_time <= #{searchParams.endTime}
|
|
and z.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'lunch',
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z
|
|
|
|
- inner join base_person_info x on z.person_id=x.id_
|
|
|
|
- inner join base_company_info y on y.id_= x.company_id
|
|
|
|
- WHERE y.id_ = a.id_ and z.category_='3' and z.del_flag=FALSE
|
|
|
|
- <if test="searchParams.companyId != null">
|
|
|
|
- <![CDATA[
|
|
|
|
- and y.code_ like #{searchParams.companyId}
|
|
|
|
- ]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.isOutsourcer != null">
|
|
|
|
- and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
- </if>
|
|
|
|
|
|
+ )) as 'lunch',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.person_id = b.id_ and z.category_='3' and z.del_flag=FALSE
|
|
<if test="searchParams.beginTime != null">
|
|
<if test="searchParams.beginTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
and z.record_time >= #{searchParams.beginTime}
|
|
and z.record_time >= #{searchParams.beginTime}
|
|
@@ -324,52 +312,42 @@
|
|
and z.record_time <= #{searchParams.endTime}
|
|
and z.record_time <= #{searchParams.endTime}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'supper',
|
|
|
|
- (SELECT count(z.person_id) from base_canteen_dining_record z
|
|
|
|
- inner join base_person_info x on z.person_id=x.id_
|
|
|
|
- inner join base_company_info y on y.id_= x.company_id
|
|
|
|
- WHERE y.id_ = a.id_ and z.category_='4' and z.del_flag=FALSE
|
|
|
|
- <if test="searchParams.companyId != null">
|
|
|
|
|
|
+ )) as 'supper',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.person_id = b.id_ and z.category_='4' and z.del_flag=FALSE
|
|
|
|
+ <if test="searchParams.beginTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
- and y.code_ like #{searchParams.companyId}
|
|
|
|
- ]]>
|
|
|
|
|
|
+ and z.record_time >= #{searchParams.beginTime}
|
|
|
|
+ ]]>
|
|
</if>
|
|
</if>
|
|
- <if test="searchParams.isOutsourcer != null">
|
|
|
|
- and z.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
|
|
+ <if test="searchParams.endTime != null">
|
|
|
|
+ <![CDATA[
|
|
|
|
+ and z.record_time <= #{searchParams.endTime}
|
|
|
|
+ ]]>
|
|
</if>
|
|
</if>
|
|
|
|
+ )) as 'nightSnack',
|
|
|
|
+ sum((SELECT count(z.person_id) from base_canteen_dining_record z WHERE z.person_id = b.id_ and z.del_flag=FALSE
|
|
<if test="searchParams.beginTime != null">
|
|
<if test="searchParams.beginTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
- and z.record_time >= #{searchParams.beginTime}
|
|
|
|
- ]]>
|
|
|
|
|
|
+ and z.record_time >= #{searchParams.beginTime}
|
|
|
|
+ ]]>
|
|
</if>
|
|
</if>
|
|
<if test="searchParams.endTime != null">
|
|
<if test="searchParams.endTime != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
- and z.record_time <= #{searchParams.endTime}
|
|
|
|
- ]]>
|
|
|
|
|
|
+ and z.record_time <= #{searchParams.endTime}
|
|
|
|
+ ]]>
|
|
</if>
|
|
</if>
|
|
- ) as 'nightSnack'
|
|
|
|
|
|
+ )) as 'personNum'
|
|
FROM base_company_info a
|
|
FROM base_company_info a
|
|
left join base_person_info b on a.id_=b.company_id
|
|
left join base_person_info b on a.id_=b.company_id
|
|
- left join base_canteen_dining_record c on c.person_id = b.id_
|
|
|
|
<where>
|
|
<where>
|
|
- a.del_flag = false and b.del_flag = false and c.del_flag=false
|
|
|
|
|
|
+ a.del_flag = false and b.del_flag = false
|
|
<if test="searchParams.companyId != null">
|
|
<if test="searchParams.companyId != null">
|
|
<![CDATA[
|
|
<![CDATA[
|
|
and a.code_ like #{searchParams.companyId}
|
|
and a.code_ like #{searchParams.companyId}
|
|
]]>
|
|
]]>
|
|
</if>
|
|
</if>
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
- and c.is_outsourcer = #{searchParams.isOutsourcer}
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.beginTime != null">
|
|
|
|
- <![CDATA[
|
|
|
|
- and c.record_time >= #{searchParams.beginTime}
|
|
|
|
- ]]>
|
|
|
|
- </if>
|
|
|
|
- <if test="searchParams.endTime != null">
|
|
|
|
- <![CDATA[
|
|
|
|
- and c.record_time <= #{searchParams.endTime}
|
|
|
|
- ]]>
|
|
|
|
|
|
+ and a.is_outsourcer = #{searchParams.isOutsourcer}
|
|
</if>
|
|
</if>
|
|
GROUP BY a.id_
|
|
GROUP BY a.id_
|
|
</where>
|
|
</where>
|
|
@@ -454,7 +432,7 @@
|
|
SELECT * FROM base_canteen_dining_record x WHERE x.del_flag = false and x.device_no in
|
|
SELECT * FROM base_canteen_dining_record x WHERE x.del_flag = false and x.device_no in
|
|
(SELECT DISTINCT c.device_no FROM base_canteen_info a left join base_canteen_device b on a.id_=b.canteen_id
|
|
(SELECT DISTINCT c.device_no FROM base_canteen_info a left join base_canteen_device b on a.id_=b.canteen_id
|
|
inner join base_device_info c on b.device_id=c.id_
|
|
inner join base_device_info c on b.device_id=c.id_
|
|
- WHERE a.id_= #{searchParams.id} and a.del_flag = false)
|
|
|
|
|
|
+ WHERE a.id_= #{searchParams.id} and a.del_flag = false and b.del_flag = false and c.del_flag = false)
|
|
]]>
|
|
]]>
|
|
<if test="searchParams.isOutsourcer != null">
|
|
<if test="searchParams.isOutsourcer != null">
|
|
and x.is_outsourcer = #{searchParams.isOutsourcer}
|
|
and x.is_outsourcer = #{searchParams.isOutsourcer}
|