,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>
,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), 'np123@!' ) AS CHAR) mobile
LEFT OUTER JOIN cminningscd cis ON l.cmisno = cis.cmisno
INNER JOIN users u ON l.userno = u.userno
INNER JOIN pay p ON p.payno = l.payno
<!--최종평가-->
LEFT OUTER JOIN cmex ce ON l.cmno = ce.cmno AND ce.extype = 0 AND ce.isdel = 0
LEFT OUTER JOIN lectex le ON l.lectno = le.lectno AND ce.exno = le.exno
<!--중간평가-->
LEFT OUTER JOIN cmex ce2 ON l.cmno = ce2.cmno AND ce2.extype = 1 AND ce2.isdel = 0
LEFT OUTER JOIN lectex le2 ON l.lectno = le2.lectno AND ce2.exno = le2.exno
<!--과제-->
LEFT OUTER JOIN cmsd cs ON l.cmno = cs.cmno AND cs.sdtype = 0 AND cs.isdel = 0
LEFT OUTER JOIN lectsd ls ON l.lectno = ls.lectno AND cs.sdno = ls.sdno
<!--토론-->
LEFT OUTER JOIN cmsd cs2 ON l.cmno = cs2.cmno AND cs2.sdtype = 1 AND cs2.isdel = 0
LEFT OUTER JOIN lectsd ls2 ON l.lectno = ls2.lectno AND cs2.sdno = ls2.sdno
<!--설문-->
LEFT OUTER JOIN cmrs cr ON l.cmno = cr.cmno AND cr.rstype = 0 AND cr.isdel = 0
LEFT OUTER JOIN lectrs lt ON l.lectno = lt.lectno AND cr.rsno = lt.rsno
<!--집합출석-->
LEFT OUTER JOIN cminning ci ON l.cmno=ci.cmno AND ci.isonline =0 AND ci.isscd = 1
LEFT OUTER JOIN lectinning li ON ci.cmino = li.cmino AND l.lectno = li.lectno AND li.istatus = 2
WHERE u.status = 1 AND c.ismaster=0 AND c.isdel=0 AND l.status = 1 AND l.ischanged = 0
<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 l.isrebate = 0 then p.payoktime else l.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when c.cshape = 2 then cis.eend else l.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="edate"prepend="and">date_format((case when c.cshape = 2 and cis.eend is not null then cis.eend else l.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="edate1"prepend="and">(case when c.cshape = 2 and cis.eend is not null then cis.eend else l.edate end) >= #edate1#</isNotNull>
<isNotNullproperty="edate2"prepend="and">(case when c.cshape = 2 and cis.eend is not null then cis.eend else l.edate end) <= #edate2#</isNotNull>
<isNotNullproperty="ispassex"prepend="and">(a.ispassm = #ispassex# and a.ispassf = #ispassex#) </isNotNull>
<isNotNullproperty="usernamestr"prepend="and">a.username like concat('%',#usernamestr#,'%')</isNotNull>
<isNotNullproperty="useridstr"prepend="and">a.userid like concat('%',#useridstr#,'%')</isNotNull>
<isNotEmptyproperty="usernameid"prepend="and">(a.userid like concat('%',#usernameid#,'%') or a.username like concat('%',#usernameid#,'%') or u.usernameeng like concat('%',#usernameid#,'%')) </isNotEmpty>
<isNotEmptyproperty="sdateall"prepend="and">(case when a.cshape = 0 and a.isrebate = 0 then a.payoktime else a.sdate end) >= date_format(#sdateall#,'%Y-%m-%d 00:00:00')</isNotEmpty>
<isNotEmptyproperty="edateall"prepend="and">(case when a.cshape = 2 then a.eend else b.edate end) <= date_format(#edateall#,'%Y-%m-%d 23:59:59')</isNotEmpty>
<isNotNullproperty="asname"prepend="and">a.asname like concat('%',#asname#,'%')</isNotNull>
<isNotNullproperty="edate"prepend="and">date_format((case when a.cshape = 2 and a.eend is not null then a.eend else b.edate end),'%Y-%m-%d') = #edate#</isNotNull>
<isNotNullproperty="mobile"prepend="and">a.mobile like concat('%',#mobile#,'%')</isNotNull>