and op.wrt_user_seq = #{wrtUserSeq}
and op.op_name like '%'||#{opName}||'%'
and op.wrt_organ = #{wrtOrgan}
and op.op_state = #{opState}
and op.wrt_dt >= #{startDate}::date
and op.wrt_dt <= #{endDate}::date+1
and op.wrt_organ in
#{organCd}
and op_state in ('DST002')
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
and op_state in ('DST002')
and op_state in ('DST003', 'DST004', 'DST005', 'DST006')
select op.op_key,
op_name,
op_birth,
op_position,
op_phone,
op_rank,
op_state as status,
(select item_value from code_mgt where item_cd = op_state) as op_state,
wrt_user_seq,
(select item_value from code_mgt where item_cd = wrt_organ) as wrt_organ,
(select item_value from code_mgt where item_cd = wrt_part) as wrt_part,
(select item_value from code_mgt where item_cd = wrt_user_grd) as wrt_user_grd,
wrt_user_nm,
wrt_dt,
b.fileCnt
from operation_plan op
left outer join (select op_key,
count(file_seq) as fileCnt
from operation_plan_file
group by op_key) b
on op.op_key = b.op_key
order by op.op_key desc
limit #{rowCnt} offset #{firstIndex}
select count(*)
from operation_plan op
select sum("AAR001"+"AAR003"+"AAR004"+"AAR006"+"AAR008") as total_cnt,
sum("AAR001") as special_cnt,
sum("AAR003") as middle_cnt,
sum("AAR004") as tong_cnt,
sum("AAR006") as jo_cnt,
sum("AAR008") as mu_cnt
from(
select ab.affair_key,
case
when ar.affair_rate = 'AAR001' then 1
else 0
end as "AAR001",
case
when ar.affair_rate = 'AAR003' then 1
else 0
end as "AAR003",
case
when ar.affair_rate = 'AAR004' then 1
else 0
end as "AAR004",
case
when ar.affair_rate = 'AAR006' then 1
else 0
end as "AAR006",
case
when ar.affair_rate = 'AAR008' then 1
else 0
end as "AAR008"
from affair_board ab,
affair_rating ar
where ab.affair_key = ar.affair_key
and ab.affair_category = 'CAT216'
and ab.affair_key in
#{affairKey}
and (ar.organ_up != 'T' or ar.organ_up is null)
) a