#define buildIF(x)
#end
insert into #(table)
(#for(x : fields)`#(x.field)`#if(!for.last),#end #end)
values
(#for(x : fields)#{#(x.field)}#if(!for.last),#end #end)
#elseif(x.filter == "like")
#@buildIF(x)
and `#(x.field)` like CONCAT('%',#{#(x.field)},'%')
#elseif(x.filter == "2")
and `datatime` > #{start_#(x.field)}
and `datatime` < #{start_#(x.field)}
#end
#end
#if(verify)
and id in (
select ids from (
select group_concat(id) ids,count(*) count from #(table) where `status` !=9 group by
#(verify)
) n where n.count > 1
)
#end
and `status` != 9
update #(table)
set
id=id
#for(x : fields)
,`#(x.field)`=#{#(x.field)}
#end
where `id`=#{id}
update #(table) set status=9 where id=#{id}