,concat(substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),1,6),'-',substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),7,7)) userpno
<isNotNullproperty="ispassex"prepend="and">(a.ispassm = #ispassex# and a.ispassf = #ispassex#) </isNotNull>
<isNotNullproperty="usernamestr"prepend="and">u.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">u.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(u.userid like concat('%',#usernameid#,'%') or u.username like concat('%',#usernameid#,'%') or u.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotEmptyproperty="sdateall"prepend="and">(case when c.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when c.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="asname"prepend="and">ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNullproperty="edate"prepend="and">date_format((case when c.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
,concat(substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),1,6),'-',substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),7,7)) userpno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <includerefid="sql.digest"></include>) AS char) mobile
<isNotNullproperty="ispassex"prepend="and">(a.ispassm = #ispassex# and a.ispassf = #ispassex#) </isNotNull>
<isNotNullproperty="usernamestr"prepend="and">u.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">u.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(u.userid like concat('%',#usernameid#,'%') or u.username like concat('%',#usernameid#,'%') or u.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotEmptyproperty="sdateall"prepend="and">(case when c.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when c.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="asname"prepend="and">ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNullproperty="edate"prepend="and">date_format((case when c.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="mobile"prepend="and">cast(AES_DECRYPT(UNHEX(u.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%')</isNotNull>
,concat(substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),1,6),'-',substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),7,7)) userpno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <includerefid="sql.digest"></include>) AS char) mobile
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="cname">and a2.cname like concat('%',#cname#,'%')</isNotNull>
<isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
) a
left outer join cmsd b on b.cmno=a.cmno and b.sdtype=1 and b.isdel=0
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
group by a.lectno
union all
select a.lectno
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,count(b.rsno),count(c.lectno),0
,0,0
from (
select b.lectno,a.cmno
from cm a
inner join cm a2 on a.pcmno = a2.cmno
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="cname">and a2.cname like concat('%',#cname#,'%')</isNotNull>
<isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
) a
left outer join cmrs b on b.cmno=a.cmno and b.rstype=0 and b.isdel=0
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
group by a.lectno
union all
select a.lectno
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,count(b.cmino),count(c.lectno)
from (
select b.lectno,a.cmno
from cm a
inner join cm a2 on a.pcmno = a2.cmno
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="ispassex"prepend="and">(a.ispassm = #ispassex# and a.ispassf = #ispassex#) </isNotNull>
<isNotNullproperty="usernamestr"prepend="and">u.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">u.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(u.userid like concat('%',#usernameid#,'%') or u.username like concat('%',#usernameid#,'%') or u.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotEmptyproperty="sdateall"prepend="and">(case when c.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when c.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="asname"prepend="and">ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNullproperty="edate"prepend="and">date_format((case when c.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="mobile"prepend="and">cast(AES_DECRYPT(UNHEX(u.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%')</isNotNull>
,concat(substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),1,6),'-',substring(CAST(AES_DECRYPT(UNHEX(u.userpno),<includerefid="sql.digest"></include>) as char),7,7)) userpno
,CAST(AES_DECRYPT(UNHEX(u.mobile), <includerefid="sql.digest"></include>) AS char) mobile
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="edate1"prepend="and">(case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end) >= #edate1#</isNotNull>
<isNotNullproperty="edate2"prepend="and">(case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end) <= #edate2#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="cname">and a2.cname like concat('%',#cname#,'%')</isNotNull>
<isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
) a
left outer join cmsd b on b.cmno=a.cmno and b.sdtype=1 and b.isdel=0
left outer join lectsd c on c.lectno=a.lectno and c.sdno=b.sdno
group by a.lectno
union all
select a.lectno
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,count(b.rsno),count(c.lectno),0
,0,0
from (
select b.lectno,a.cmno
from cm a
inner join cm a2 on a.pcmno = a2.cmno
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="cname">and a2.cname like concat('%',#cname#,'%')</isNotNull>
<isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
) a
left outer join cmrs b on b.cmno=a.cmno and b.rstype=0 and b.isdel=0
left outer join lectrs c on c.lectno=a.lectno and c.rsno=b.rsno
group by a.lectno
union all
select a.lectno
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,0,0,0
,count(b.cmino),count(c.lectno)
from (
select b.lectno,a.cmno
from cm a
inner join cm a2 on a.pcmno = a2.cmno
inner join lect b on b.cmno=a.cmno and b.status=1 and b.ischanged=0
inner join users c on c.userno=b.userno and c.status=1
inner join pay p on p.payno=b.payno
left outer join cminningscd e on e.cmisno = b.cmisno
where a.ismaster=0 and a.isdel=0
<isNotNullproperty="usernamestr"prepend="and">c.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">c.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(c.userid like concat('%',#usernameid#,'%') or c.username like concat('%',#usernameid#,'%') or c.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotNullproperty="cmisno"prepend="and">b.cmisno = #cmisno#</isNotNull><isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="ispassex"prepend="and">(a.ispassm = #ispassex# and a.ispassf = #ispassex#) </isNotNull>
<isNotNullproperty="usernamestr"prepend="and">u.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">u.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(u.userid like concat('%',#usernameid#,'%') or u.username like concat('%',#usernameid#,'%') or u.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotEmptyproperty="sdateall"prepend="and">(case when c.cshape = 0 and b.isrebate = 0 then p.payoktime else b.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when c.cshape = 2 then e.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="asname"prepend="and">ua.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNullproperty="edate"prepend="and">date_format((case when c.cshape = 2 and e.eend is not null then e.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="mobile"prepend="and">cast(AES_DECRYPT(UNHEX(u.mobile), 'np123@!' ) as char) like concat('%',#mobile#,'%')</isNotNull>