jeecg 3.5.0-GA 版本发布

jeecg 3.5.0-GA 版本发布
jeecg_3.5.2
zhangdaiscott 11 years ago
parent 07998acf94
commit c211a10f79

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java"/>
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.6.0_02"/>
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>

@ -1,35 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>jeecg-framework</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.maven.ide.eclipse.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.maven.ide.eclipse.maven2Nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
</natures>
</projectDescription>

@ -1,13 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src/main/webapp"/>
<classpathentry kind="src" path="target/m2e-wtp/web-resources"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>

@ -1,7 +0,0 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding//src/main/resources=UTF-8
encoding//src/main/resources/dbconfig.properties=UTF-8
encoding//src/main/resources/sysConfig.properties=UTF-8
encoding//src/test/java=UTF-8
encoding/<project>=UTF-8

@ -1,8 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
org.eclipse.jdt.core.compiler.source=1.5

@ -1,4 +0,0 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

@ -1,11 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="jeecg-framework">
<wb-resource deploy-path="/" source-path="/target/m2e-wtp/web-resources"/>
<wb-resource deploy-path="/" source-path="/src/main/webapp" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/test/java"/>
<property name="context-root" value="jeecg-framework"/>
<property name="java-output-path" value="/jeecg-framework/target/classes"/>
</wb-module>
</project-modules>

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.5"/>
<installed facet="jst.web" version="2.3"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

@ -1 +0,0 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary

@ -1,2 +0,0 @@
disabled=06target
eclipse.preferences.version=1

@ -1,674 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The GNU General Public License is a free, copyleft license for
software and other kinds of works.
The licenses for most software and other practical works are designed
to take away your freedom to share and change the works. By contrast,
the GNU General Public License is intended to guarantee your freedom to
share and change all versions of a program--to make sure it remains free
software for all its users. We, the Free Software Foundation, use the
GNU General Public License for most of our software; it applies also to
any other work released this way by its authors. You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
them if you wish), that you receive source code or can get it if you
want it, that you can change the software or use pieces of it in new
free programs, and that you know you can do these things.
To protect your rights, we need to prevent others from denying you
these rights or asking you to surrender the rights. Therefore, you have
certain responsibilities if you distribute copies of the software, or if
you modify it: responsibilities to respect the freedom of others.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must pass on to the recipients the same
freedoms that you received. You must make sure that they, too, receive
or can get the source code. And you must show them these terms so they
know their rights.
Developers that use the GNU GPL protect your rights with two steps:
(1) assert copyright on the software, and (2) offer you this License
giving you legal permission to copy, distribute and/or modify it.
For the developers' and authors' protection, the GPL clearly explains
that there is no warranty for this free software. For both users' and
authors' sake, the GPL requires that modified versions be marked as
changed, so that their problems will not be attributed erroneously to
authors of previous versions.
Some devices are designed to deny users access to install or run
modified versions of the software inside them, although the manufacturer
can do so. This is fundamentally incompatible with the aim of
protecting users' freedom to change the software. The systematic
pattern of such abuse occurs in the area of products for individuals to
use, which is precisely where it is most unacceptable. Therefore, we
have designed this version of the GPL to prohibit the practice for those
products. If such problems arise substantially in other domains, we
stand ready to extend this provision to those domains in future versions
of the GPL, as needed to protect the freedom of users.
Finally, every program is threatened constantly by software patents.
States should not allow patents to restrict development and use of
software on general-purpose computers, but in those that do, we wish to
avoid the special danger that patents applied to a free program could
make it effectively proprietary. To prevent this, the GPL assures that
patents cannot be used to render the program non-free.
The precise terms and conditions for copying, distribution and
modification follow.
TERMS AND CONDITIONS
0. Definitions.
"This License" refers to version 3 of the GNU General Public License.
"Copyright" also means copyright-like laws that apply to other kinds of
works, such as semiconductor masks.
"The Program" refers to any copyrightable work licensed under this
License. Each licensee is addressed as "you". "Licensees" and
"recipients" may be individuals or organizations.
To "modify" a work means to copy from or adapt all or part of the work
in a fashion requiring copyright permission, other than the making of an
exact copy. The resulting work is called a "modified version" of the
earlier work or a work "based on" the earlier work.
A "covered work" means either the unmodified Program or a work based
on the Program.
To "propagate" a work means to do anything with it that, without
permission, would make you directly or secondarily liable for
infringement under applicable copyright law, except executing it on a
computer or modifying a private copy. Propagation includes copying,
distribution (with or without modification), making available to the
public, and in some countries other activities as well.
To "convey" a work means any kind of propagation that enables other
parties to make or receive copies. Mere interaction with a user through
a computer network, with no transfer of a copy, is not conveying.
An interactive user interface displays "Appropriate Legal Notices"
to the extent that it includes a convenient and prominently visible
feature that (1) displays an appropriate copyright notice, and (2)
tells the user that there is no warranty for the work (except to the
extent that warranties are provided), that licensees may convey the
work under this License, and how to view a copy of this License. If
the interface presents a list of user commands or options, such as a
menu, a prominent item in the list meets this criterion.
1. Source Code.
The "source code" for a work means the preferred form of the work
for making modifications to it. "Object code" means any non-source
form of a work.
A "Standard Interface" means an interface that either is an official
standard defined by a recognized standards body, or, in the case of
interfaces specified for a particular programming language, one that
is widely used among developers working in that language.
The "System Libraries" of an executable work include anything, other
than the work as a whole, that (a) is included in the normal form of
packaging a Major Component, but which is not part of that Major
Component, and (b) serves only to enable use of the work with that
Major Component, or to implement a Standard Interface for which an
implementation is available to the public in source code form. A
"Major Component", in this context, means a major essential component
(kernel, window system, and so on) of the specific operating system
(if any) on which the executable work runs, or a compiler used to
produce the work, or an object code interpreter used to run it.
The "Corresponding Source" for a work in object code form means all
the source code needed to generate, install, and (for an executable
work) run the object code and to modify the work, including scripts to
control those activities. However, it does not include the work's
System Libraries, or general-purpose tools or generally available free
programs which are used unmodified in performing those activities but
which are not part of the work. For example, Corresponding Source
includes interface definition files associated with source files for
the work, and the source code for shared libraries and dynamically
linked subprograms that the work is specifically designed to require,
such as by intimate data communication or control flow between those
subprograms and other parts of the work.
The Corresponding Source need not include anything that users
can regenerate automatically from other parts of the Corresponding
Source.
The Corresponding Source for a work in source code form is that
same work.
2. Basic Permissions.
All rights granted under this License are granted for the term of
copyright on the Program, and are irrevocable provided the stated
conditions are met. This License explicitly affirms your unlimited
permission to run the unmodified Program. The output from running a
covered work is covered by this License only if the output, given its
content, constitutes a covered work. This License acknowledges your
rights of fair use or other equivalent, as provided by copyright law.
You may make, run and propagate covered works that you do not
convey, without conditions so long as your license otherwise remains
in force. You may convey covered works to others for the sole purpose
of having them make modifications exclusively for you, or provide you
with facilities for running those works, provided that you comply with
the terms of this License in conveying all material for which you do
not control copyright. Those thus making or running the covered works
for you must do so exclusively on your behalf, under your direction
and control, on terms that prohibit them from making any copies of
your copyrighted material outside their relationship with you.
Conveying under any other circumstances is permitted solely under
the conditions stated below. Sublicensing is not allowed; section 10
makes it unnecessary.
3. Protecting Users' Legal Rights From Anti-Circumvention Law.
No covered work shall be deemed part of an effective technological
measure under any applicable law fulfilling obligations under article
11 of the WIPO copyright treaty adopted on 20 December 1996, or
similar laws prohibiting or restricting circumvention of such
measures.
When you convey a covered work, you waive any legal power to forbid
circumvention of technological measures to the extent such circumvention
is effected by exercising rights under this License with respect to
the covered work, and you disclaim any intention to limit operation or
modification of the work as a means of enforcing, against the work's
users, your or third parties' legal rights to forbid circumvention of
technological measures.
4. Conveying Verbatim Copies.
You may convey verbatim copies of the Program's source code as you
receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice;
keep intact all notices stating that this License and any
non-permissive terms added in accord with section 7 apply to the code;
keep intact all notices of the absence of any warranty; and give all
recipients a copy of this License along with the Program.
You may charge any price or no price for each copy that you convey,
and you may offer support or warranty protection for a fee.
5. Conveying Modified Source Versions.
You may convey a work based on the Program, or the modifications to
produce it from the Program, in the form of source code under the
terms of section 4, provided that you also meet all of these conditions:
a) The work must carry prominent notices stating that you modified
it, and giving a relevant date.
b) The work must carry prominent notices stating that it is
released under this License and any conditions added under section
7. This requirement modifies the requirement in section 4 to
"keep intact all notices".
c) You must license the entire work, as a whole, under this
License to anyone who comes into possession of a copy. This
License will therefore apply, along with any applicable section 7
additional terms, to the whole of the work, and all its parts,
regardless of how they are packaged. This License gives no
permission to license the work in any other way, but it does not
invalidate such permission if you have separately received it.
d) If the work has interactive user interfaces, each must display
Appropriate Legal Notices; however, if the Program has interactive
interfaces that do not display Appropriate Legal Notices, your
work need not make them do so.
A compilation of a covered work with other separate and independent
works, which are not by their nature extensions of the covered work,
and which are not combined with it such as to form a larger program,
in or on a volume of a storage or distribution medium, is called an
"aggregate" if the compilation and its resulting copyright are not
used to limit the access or legal rights of the compilation's users
beyond what the individual works permit. Inclusion of a covered work
in an aggregate does not cause this License to apply to the other
parts of the aggregate.
6. Conveying Non-Source Forms.
You may convey a covered work in object code form under the terms
of sections 4 and 5, provided that you also convey the
machine-readable Corresponding Source under the terms of this License,
in one of these ways:
a) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by the
Corresponding Source fixed on a durable physical medium
customarily used for software interchange.
b) Convey the object code in, or embodied in, a physical product
(including a physical distribution medium), accompanied by a
written offer, valid for at least three years and valid for as
long as you offer spare parts or customer support for that product
model, to give anyone who possesses the object code either (1) a
copy of the Corresponding Source for all the software in the
product that is covered by this License, on a durable physical
medium customarily used for software interchange, for a price no
more than your reasonable cost of physically performing this
conveying of source, or (2) access to copy the
Corresponding Source from a network server at no charge.
c) Convey individual copies of the object code with a copy of the
written offer to provide the Corresponding Source. This
alternative is allowed only occasionally and noncommercially, and
only if you received the object code with such an offer, in accord
with subsection 6b.
d) Convey the object code by offering access from a designated
place (gratis or for a charge), and offer equivalent access to the
Corresponding Source in the same way through the same place at no
further charge. You need not require recipients to copy the
Corresponding Source along with the object code. If the place to
copy the object code is a network server, the Corresponding Source
may be on a different server (operated by you or a third party)
that supports equivalent copying facilities, provided you maintain
clear directions next to the object code saying where to find the
Corresponding Source. Regardless of what server hosts the
Corresponding Source, you remain obligated to ensure that it is
available for as long as needed to satisfy these requirements.
e) Convey the object code using peer-to-peer transmission, provided
you inform other peers where the object code and Corresponding
Source of the work are being offered to the general public at no
charge under subsection 6d.
A separable portion of the object code, whose source code is excluded
from the Corresponding Source as a System Library, need not be
included in conveying the object code work.
A "User Product" is either (1) a "consumer product", which means any
tangible personal property which is normally used for personal, family,
or household purposes, or (2) anything designed or sold for incorporation
into a dwelling. In determining whether a product is a consumer product,
doubtful cases shall be resolved in favor of coverage. For a particular
product received by a particular user, "normally used" refers to a
typical or common use of that class of product, regardless of the status
of the particular user or of the way in which the particular user
actually uses, or expects or is expected to use, the product. A product
is a consumer product regardless of whether the product has substantial
commercial, industrial or non-consumer uses, unless such uses represent
the only significant mode of use of the product.
"Installation Information" for a User Product means any methods,
procedures, authorization keys, or other information required to install
and execute modified versions of a covered work in that User Product from
a modified version of its Corresponding Source. The information must
suffice to ensure that the continued functioning of the modified object
code is in no case prevented or interfered with solely because
modification has been made.
If you convey an object code work under this section in, or with, or
specifically for use in, a User Product, and the conveying occurs as
part of a transaction in which the right of possession and use of the
User Product is transferred to the recipient in perpetuity or for a
fixed term (regardless of how the transaction is characterized), the
Corresponding Source conveyed under this section must be accompanied
by the Installation Information. But this requirement does not apply
if neither you nor any third party retains the ability to install
modified object code on the User Product (for example, the work has
been installed in ROM).
The requirement to provide Installation Information does not include a
requirement to continue to provide support service, warranty, or updates
for a work that has been modified or installed by the recipient, or for
the User Product in which it has been modified or installed. Access to a
network may be denied when the modification itself materially and
adversely affects the operation of the network or violates the rules and
protocols for communication across the network.
Corresponding Source conveyed, and Installation Information provided,
in accord with this section must be in a format that is publicly
documented (and with an implementation available to the public in
source code form), and must require no special password or key for
unpacking, reading or copying.
7. Additional Terms.
"Additional permissions" are terms that supplement the terms of this
License by making exceptions from one or more of its conditions.
Additional permissions that are applicable to the entire Program shall
be treated as though they were included in this License, to the extent
that they are valid under applicable law. If additional permissions
apply only to part of the Program, that part may be used separately
under those permissions, but the entire Program remains governed by
this License without regard to the additional permissions.
When you convey a copy of a covered work, you may at your option
remove any additional permissions from that copy, or from any part of
it. (Additional permissions may be written to require their own
removal in certain cases when you modify the work.) You may place
additional permissions on material, added by you to a covered work,
for which you have or can give appropriate copyright permission.
Notwithstanding any other provision of this License, for material you
add to a covered work, you may (if authorized by the copyright holders of
that material) supplement the terms of this License with terms:
a) Disclaiming warranty or limiting liability differently from the
terms of sections 15 and 16 of this License; or
b) Requiring preservation of specified reasonable legal notices or
author attributions in that material or in the Appropriate Legal
Notices displayed by works containing it; or
c) Prohibiting misrepresentation of the origin of that material, or
requiring that modified versions of such material be marked in
reasonable ways as different from the original version; or
d) Limiting the use for publicity purposes of names of licensors or
authors of the material; or
e) Declining to grant rights under trademark law for use of some
trade names, trademarks, or service marks; or
f) Requiring indemnification of licensors and authors of that
material by anyone who conveys the material (or modified versions of
it) with contractual assumptions of liability to the recipient, for
any liability that these contractual assumptions directly impose on
those licensors and authors.
All other non-permissive additional terms are considered "further
restrictions" within the meaning of section 10. If the Program as you
received it, or any part of it, contains a notice stating that it is
governed by this License along with a term that is a further
restriction, you may remove that term. If a license document contains
a further restriction but permits relicensing or conveying under this
License, you may add to a covered work material governed by the terms
of that license document, provided that the further restriction does
not survive such relicensing or conveying.
If you add terms to a covered work in accord with this section, you
must place, in the relevant source files, a statement of the
additional terms that apply to those files, or a notice indicating
where to find the applicable terms.
Additional terms, permissive or non-permissive, may be stated in the
form of a separately written license, or stated as exceptions;
the above requirements apply either way.
8. Termination.
You may not propagate or modify a covered work except as expressly
provided under this License. Any attempt otherwise to propagate or
modify it is void, and will automatically terminate your rights under
this License (including any patent licenses granted under the third
paragraph of section 11).
However, if you cease all violation of this License, then your
license from a particular copyright holder is reinstated (a)
provisionally, unless and until the copyright holder explicitly and
finally terminates your license, and (b) permanently, if the copyright
holder fails to notify you of the violation by some reasonable means
prior to 60 days after the cessation.
Moreover, your license from a particular copyright holder is
reinstated permanently if the copyright holder notifies you of the
violation by some reasonable means, this is the first time you have
received notice of violation of this License (for any work) from that
copyright holder, and you cure the violation prior to 30 days after
your receipt of the notice.
Termination of your rights under this section does not terminate the
licenses of parties who have received copies or rights from you under
this License. If your rights have been terminated and not permanently
reinstated, you do not qualify to receive new licenses for the same
material under section 10.
9. Acceptance Not Required for Having Copies.
You are not required to accept this License in order to receive or
run a copy of the Program. Ancillary propagation of a covered work
occurring solely as a consequence of using peer-to-peer transmission
to receive a copy likewise does not require acceptance. However,
nothing other than this License grants you permission to propagate or
modify any covered work. These actions infringe copyright if you do
not accept this License. Therefore, by modifying or propagating a
covered work, you indicate your acceptance of this License to do so.
10. Automatic Licensing of Downstream Recipients.
Each time you convey a covered work, the recipient automatically
receives a license from the original licensors, to run, modify and
propagate that work, subject to this License. You are not responsible
for enforcing compliance by third parties with this License.
An "entity transaction" is a transaction transferring control of an
organization, or substantially all assets of one, or subdividing an
organization, or merging organizations. If propagation of a covered
work results from an entity transaction, each party to that
transaction who receives a copy of the work also receives whatever
licenses to the work the party's predecessor in interest had or could
give under the previous paragraph, plus a right to possession of the
Corresponding Source of the work from the predecessor in interest, if
the predecessor has it or can get it with reasonable efforts.
You may not impose any further restrictions on the exercise of the
rights granted or affirmed under this License. For example, you may
not impose a license fee, royalty, or other charge for exercise of
rights granted under this License, and you may not initiate litigation
(including a cross-claim or counterclaim in a lawsuit) alleging that
any patent claim is infringed by making, using, selling, offering for
sale, or importing the Program or any portion of it.
11. Patents.
A "contributor" is a copyright holder who authorizes use under this
License of the Program or a work on which the Program is based. The
work thus licensed is called the contributor's "contributor version".
A contributor's "essential patent claims" are all patent claims
owned or controlled by the contributor, whether already acquired or
hereafter acquired, that would be infringed by some manner, permitted
by this License, of making, using, or selling its contributor version,
but do not include claims that would be infringed only as a
consequence of further modification of the contributor version. For
purposes of this definition, "control" includes the right to grant
patent sublicenses in a manner consistent with the requirements of
this License.
Each contributor grants you a non-exclusive, worldwide, royalty-free
patent license under the contributor's essential patent claims, to
make, use, sell, offer for sale, import and otherwise run, modify and
propagate the contents of its contributor version.
In the following three paragraphs, a "patent license" is any express
agreement or commitment, however denominated, not to enforce a patent
(such as an express permission to practice a patent or covenant not to
sue for patent infringement). To "grant" such a patent license to a
party means to make such an agreement or commitment not to enforce a
patent against the party.
If you convey a covered work, knowingly relying on a patent license,
and the Corresponding Source of the work is not available for anyone
to copy, free of charge and under the terms of this License, through a
publicly available network server or other readily accessible means,
then you must either (1) cause the Corresponding Source to be so
available, or (2) arrange to deprive yourself of the benefit of the
patent license for this particular work, or (3) arrange, in a manner
consistent with the requirements of this License, to extend the patent
license to downstream recipients. "Knowingly relying" means you have
actual knowledge that, but for the patent license, your conveying the
covered work in a country, or your recipient's use of the covered work
in a country, would infringe one or more identifiable patents in that
country that you have reason to believe are valid.
If, pursuant to or in connection with a single transaction or
arrangement, you convey, or propagate by procuring conveyance of, a
covered work, and grant a patent license to some of the parties
receiving the covered work authorizing them to use, propagate, modify
or convey a specific copy of the covered work, then the patent license
you grant is automatically extended to all recipients of the covered
work and works based on it.
A patent license is "discriminatory" if it does not include within
the scope of its coverage, prohibits the exercise of, or is
conditioned on the non-exercise of one or more of the rights that are
specifically granted under this License. You may not convey a covered
work if you are a party to an arrangement with a third party that is
in the business of distributing software, under which you make payment
to the third party based on the extent of your activity of conveying
the work, and under which the third party grants, to any of the
parties who would receive the covered work from you, a discriminatory
patent license (a) in connection with copies of the covered work
conveyed by you (or copies made from those copies), or (b) primarily
for and in connection with specific products or compilations that
contain the covered work, unless you entered into that arrangement,
or that patent license was granted, prior to 28 March 2007.
Nothing in this License shall be construed as excluding or limiting
any implied license or other defenses to infringement that may
otherwise be available to you under applicable patent law.
12. No Surrender of Others' Freedom.
If conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot convey a
covered work so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you may
not convey it at all. For example, if you agree to terms that obligate you
to collect a royalty for further conveying from those to whom you convey
the Program, the only way you could satisfy both those terms and this
License would be to refrain entirely from conveying the Program.
13. Use with the GNU Affero General Public License.
Notwithstanding any other provision of this License, you have
permission to link or combine any covered work with a work licensed
under version 3 of the GNU Affero General Public License into a single
combined work, and to convey the resulting work. The terms of this
License will continue to apply to the part which is the covered work,
but the special requirements of the GNU Affero General Public License,
section 13, concerning interaction through a network will apply to the
combination as such.
14. Revised Versions of this License.
The Free Software Foundation may publish revised and/or new versions of
the GNU General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the
Program specifies that a certain numbered version of the GNU General
Public License "or any later version" applies to it, you have the
option of following the terms and conditions either of that numbered
version or of any later version published by the Free Software
Foundation. If the Program does not specify a version number of the
GNU General Public License, you may choose any version ever published
by the Free Software Foundation.
If the Program specifies that a proxy can decide which future
versions of the GNU General Public License can be used, that proxy's
public statement of acceptance of a version permanently authorizes you
to choose that version for the Program.
Later license versions may give you additional or different
permissions. However, no additional obligations are imposed on any
author or copyright holder as a result of your choosing to follow a
later version.
15. Disclaimer of Warranty.
THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. Limitation of Liability.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
SUCH DAMAGES.
17. Interpretation of Sections 15 and 16.
If the disclaimer of warranty and limitation of liability provided
above cannot be given local legal effect according to their terms,
reviewing courts shall apply local law that most closely approximates
an absolute waiver of all civil liability in connection with the
Program, unless a warranty or assumption of liability accompanies a
copy of the Program in return for a fee.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
<program> Copyright (C) <year> <name of author>
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, your program's commands
might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

@ -1,115 +0,0 @@
JEECG 智能开发平台
===============
前言:
-----------------------------------
随着 WEB UI 框架 ( EasyUI/Jquery UI/Ext/DWZ) 等的逐渐成熟,系统界面逐渐实现统一化,代码生成器也可以生成统一规范的界面!
代码生成+手工MERGE半智能开发将是新的趋势单表数据模型和一对多数据模型的增删改查功能直接生成使用,可节省60%工作量,快速提高开发效率!!!
简介
-----------------------------------
JEECGJ2EE Code Generation是一款基于代码生成器的智能开发平台。引领新的开发模式(Online Coding模式->代码生成器模式->手工MERGE智能开发)
可以帮助解决Java项目60%的重复工作,让开发更多关注业务逻辑。既能快速提高开发效率,帮助公司节省人力成本,同时又不失灵活性。
JEECG宗旨是: 简单功能由代Online Coding配置出功能;复杂功能由代码生成器生成进行手工Merge; 复杂流程业务采用表单自定义,业务流程使用工作流来实现、扩展出任务接口,供开发编写业务逻辑。实现了流程任务节点和任务接口的灵活配置,既保证了公司流程的保密行,又减少了开发人员的工作量。
为什么选择JEECG?
-----------------------------------
* 1.采用主流框架,容易上手; 代码生成器依赖性低,很方便的扩展能力,可完全实现二次开发;
* 2.开发效率很高,采用代码生成器,单表数据模型和一对多(父子表)数据模型,增删改查功能自动生成,菜单配置直接使用;
* 3.页面校验自动生成(必须输入、数字校验、金额校验、时间空间等);
* 4.封装完善的用户基础权限和数据字典等基础功能,直接使用无需修改
* 5.常用共通封装,各种工具类(定时任务,短信接口,邮件发送,Excel导出等),基本满足80%项目需求
* 6.集成简易报表工具图像报表和数据导出非常方便可极其方便的生成pdf、excel、word等报表
* 7.集成工作流activiti并实现了只需在页面配置流程转向可极大的简化jbpm工作流的开发用jbpm的流程设计器画出了流程走向一个工作流基本就完成了只需写很少量的java代码
* 8.UI快速开发库针对WEB UI进行标准式封装页面统一采用自定义标签实现功能列表数据展现、页面校验等,标签使用简单清晰且便于维护
* 9.在线流程设计采用开源Activiti流程引擎实现在线画流程,自定义表单,表单挂靠,业务流转
* 10.查询条件生成器查询功能自动生成后台动态拼SQL追加查询条件支持多种匹配方式全匹配/模糊查询/包含查询/不匹配查询);
JEECG 适用范围
-----------------------------------
JEECG智能开发平台可以应用在任何J2EE项目的开发中尤其适合企业信息管理系统MIS、内部办公系统OA、企业资源计划系统ERP
、客户关系管理系统CRM其半智能手工Merge的开发方式可以显著提高开发效率60%以上,极大降低开发成本。
JEECG 功能特点
-----------------------------------
* JEECG V3.0版本采用SpringMVC+Hibernate+UI快速开发库+Spring jdbc+ freemarker+ Highcharts+ bootstrap+Ehcache 的基础架构</br>
* 采用面向声明的开发模式, 基于泛型编写极少代码即可实现复杂的数据展示、数据编辑、
表单处理等功能再配合Online Coding在线开发与代码生成器的使用,将J2EE的开发效率提高6倍以上可以将代码减少80%以上。</br>
* JEECG V3.0版本六大技术点: 1.Online Coding (通过在线配置实现一个表模型的增删改查功能,无需一行代码,支持用户自定义表单布局)2.代码生成器 3.UI快速开发库 4.在线流程设计 5.系统日志记录 6.Web GIS支持 7.移动平台支持Bootstrap(兼容Html5) 8.动态报表9.查询过滤器</br>
* <b>技术点一:</b>Online Coding开发模式通过配置实现单表模型和一对多数据模型的增删改查功能,No 代码,支持用户自定义表单布局) </br>
* <b>技术点二:</b>代码生成器,支持多种数据模型,根据表生成对应的Entity,Service,Dao,Action,JSP等,增删改查功能生成直接使用</br>
* <b>技术点三:</b>UI快速开发库针对WEB UI进行标准封装页面统一采用UI标签实现功能数据datagrid,表单校验,Popup,Tab等实现JSP页面零JS开发维护非常高效</br>
* <b>技术点四:</b>在线流程定义采用开源Activiti流程引擎实现在线画流程,自定义表单,表单挂接,业务流转,流程监控,流程跟踪,流程委托等</br>
* <b>技术点五:</b>系统日志记录 (详细记录操作日志)</br>
* <b>技术点六:</b>Web GIS支持 基础技术GIS的支持</br>
* <b>技术点七:</b>移动平台支持对Bootstrap(兼容Html5)进行标准封装 </br>
* <b>技术点八:</b>动态报表功能用户输入一个sql系统自动解析生成报表</br>
* JEECG V3.0,经过了专业压力测试,性能测试,保证后台数据的准确性和页面访问速度</br>
* 支持多种浏览器: IE, 火狐, Google 等</br>
* 支持数据库: Mysql,Oracle10g,Postgre,SqlServer等</br>
* 基础权限: 用户,角色,菜单权限,按钮权限,数据权限</br>
* 智能报表集成: 简易的图像报表工具和Excel导入导出</br>
* Web容器测试通过的有Jetty和Tomcat6,Weblogic</br>
* 即将推出功能:分布式部署,云平台,移动平台开发,规则引擎</br>
* 要求JDK1.6+</br>
系统演示
-----------------------------------
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123311mf9fa22tv69b228f.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123412x003euegeg7nb68z.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/124748gyhrgvr45vshyc82.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/123428ubcjjnuwjbkjrnrw.jpg "jeecg")
![github](http://www.jeecg.org/data/attachment/forum/201303/02/124749up2j5id7gj9kppp8.jpg "jeecg")
代码示例
-----------------------------------
这是一个有多行的文本框
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/context/mytags.jsp"%>
<div class="easyui-layout" fit="true">
<div region="center" style="padding:1px;">
<t:dategrid name="jeecgDemoList" title="开发DEMO列表" actionUrl="jeecgDemoController.do?datagrid" idField="id" fit="true">
<t:dgCol title="编号" field="id" hidden="false"></t:dgCol>
<t:dgCol title="用户名" field="userName" query="true"></t:dgCol>
<t:dgCol title="电话号码" sortable="false" field="mobilePhone" width="20" query="true"></t:dgCol>
<t:dgCol title="办公电话" field="officePhone"></t:dgCol>
<t:dgCol title="邮箱" field="email"></t:dgCol>
<t:dgCol title="年龄" sortable="true" field="age"></t:dgCol>
<t:dgCol title="工资" field="sex"></t:dgCol>
<t:dgCol title="性别" field="salary"></t:dgCol>
<t:dgCol title="生日" field="birthday" formatter="yyyy/MM/dd"></t:dgCol>
<t:dgCol title="创建日期" field="createTime" formatter="yyyy-MM-dd hh:mm:ss"></t:dgCol>
<t:dgCol title="操作" field="opt" width="100"></t:dgCol>
<t:dgFunOpt funname="szqm(id)" title="审核" />
<t:dgDelOpt title="删除" url="jeecgDemoController.do?del&id={id}" />
<t:dgToolBar title="录入" icon="icon-add"></t:dgToolBar>
<t:dgToolBar title="编辑" icon="icon-edit"></t:dgToolBar>
</t:dategrid>
</div>
</div>
技术文档
-----------------------------------
* [JEECG 技术文档](http://code.google.com/p/jeecg/downloads/detail?name=JEECG%20v3.3.1.beta%E5%BC%80%E5%8F%91%E6%89%8B%E5%86%8C.zip&can=2&q=#makechanges)
* [JEECG 源码下载](http://code.google.com/p/jeecg/downloads/list)
技术交流
-----------------------------------
* 作者:张代浩</br>
* 邮箱zhangdaiscott@163.com
* 论坛:[www.jeecg.org](http://www.jeecg.org)
* 交流群:106259349, 106838471, 289782002</br>
* 在线演示: [JEECG演示DEMO](http://demo.jeecg.org:8090/)

@ -1,821 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.jeecgframework</groupId>
<artifactId>jeecg</artifactId>
<version>3.4.3-GA</version>
<packaging>war</packaging>
<properties>
<!-- 主要依赖库的版本定义 -->
<spring.version>3.1.1.RELEASE</spring.version>
<hibernate.version>4.1.0.Final</hibernate.version>
<!-- 工作流 -->
<activiti.version>5.11</activiti.version>
<mybatis.version>3.1.1</mybatis.version>
<!-- 辅助依赖包 -->
<cglib.version>2.2</cglib.version>
<aspectj.version>1.6.9</aspectj.version>
<jodd.version>3.3.7</jodd.version>
<javassist.version>3.15.0-GA</javassist.version>
<ant.version>1.6.5</ant.version>
<spring-jpa.versoin>2.0.8</spring-jpa.versoin>
<mybatis-spring.version>1.1.1</mybatis-spring.version>
<!-- 工具包 -->
<jackson.version>1.8.4</jackson.version>
<jackson2.version>2.1.2</jackson2.version>
<json-lib.version>2.1</json-lib.version>
<fastjson-lib.version>1.1.37</fastjson-lib.version>
<dom4j.version>1.6.1</dom4j.version>
<slf4j.version>1.6.1</slf4j.version>
<log4j.version>1.2.16</log4j.version>
<classmate.version>0.5.4</classmate.version>
<commons-beanutils.version>1.7.0</commons-beanutils.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-chain.version>1.2</commons-chain.version>
<commons-codec.version>1.3</commons-codec.version>
<commons-digester.version>2.0</commons-digester.version>
<commons-io.version>1.3.2</commons-io.version>
<commons-fileupload.version>1.2.1</commons-fileupload.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-lang3.version>3.1</commons-lang3.version>
<commons-logging.version>1.0.4</commons-logging.version>
<commons-logging-api.version>1.1</commons-logging-api.version>
<commons-validator.version>1.3.1</commons-validator.version>
<commons-email.version>1.2</commons-email.version>
<ehcache.version>2.4.3</ehcache.version>
<freemarker.version>2.3.19</freemarker.version>
<hamcrest.version>1.3</hamcrest.version>
<hibernate-validator.version>4.2.0.Final</hibernate-validator.version>
<poi.version>3.9</poi.version>
<antlr.version>3.3</antlr.version>
<juh.version>3.2.1</juh.version>
<unoil.version>3.2.1</unoil.version>
<xwork-core.version>2.1.6</xwork-core.version>
<jurt.version>3.2.1</jurt.version>
<jacksonframework.version>1.84</jacksonframework.version>
<!-- 数据库组件包 -->
<commons-pool.version>1.6</commons-pool.version>
<commons-dbcp.version>1.4</commons-dbcp.version>
<druid.version>0.2.9</druid.version>
<!-- oracle -->
<ojdbc.version>10.2.0.1.0</ojdbc.version>
<!-- mysql -->
<mysql.version>5.1.27</mysql.version>
<!-- sqlserver2005 -->
<sqlserver.version>1.0.0</sqlserver.version>
<!-- h2 -->
<h2.version>1.3.170</h2.version>
<!-- jtds for mssql/db2 -->
<jtds.version>1.2.4</jtds.version>
<!-- postgresql -->
<postgresql.version>9.1-903.jdbc4</postgresql.version>
<!-- 测试依赖包 -->
<junit.version>4.7</junit.version>
<mockito.version>1.9.5</mockito.version>
<powermock.version>1.5</powermock.version>
<selenium.version>2.28.0</selenium.version>
<jetty.version>7.6.8.v20121106</jetty.version>
<poi-ooxml-schemas.version>3.9</poi-ooxml-schemas.version>
<poi-ooxml.version>3.9</poi-ooxml.version>
<poi-scratchpad.version>3.9</poi-scratchpad.version>
<!-- Plugin的属性定义 -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.6</jdk.version>
<codegenerate.version>3.4.3</codegenerate.version>
<minidao.version>1.3.3</minidao.version>
<CKFinder.version>2.4</CKFinder.version>
<jodconverter.version>3.0-beta-4</jodconverter.version>
<pinyin4j.version>2.5.0</pinyin4j.version>
<ojdbc14.version>10.2.0.4.0</ojdbc14.version>
<org.quartz.version>1.6.2</org.quartz.version>
<activation.version>1.1.1</activation.version>
<aopalliance.version>1.0</aopalliance.version>
<xstream.version>1.4.4</xstream.version>
</properties>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<url>http://repo.maven.apache.org/maven2</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>spy</id>
<name>Spy Repository</name>
<url>http://files.couchbase.com/maven2/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>xerces</id>
<name>xerces</name>
<url>https://xerces.apache.org/xerces2-j/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>proxool</id>
<name>proxool</name>
<url>http://proxool.cvs.sourceforge.net/viewvc/proxool/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>oschinaMavenThirdparty</id>
<name>oschinaMavenThirdparty</name>
<url>http://maven.oschina.net/content/repositories/thirdparty/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>osc</id>
<name>oschina</name>
<url>http://maven.oschina.net/content/groups/public/</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<dependencies>
<!-- activation -->
<dependency>
<groupId>javax.activation</groupId>
<artifactId>activation</artifactId>
<version>${activation.version}</version>
</dependency>
<!-- aopalliance -->
<dependency>
<groupId>aopalliance</groupId>
<artifactId>aopalliance</artifactId>
<version>${aopalliance.version}</version>
</dependency>
<!-- 自定义的依赖包 -->
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>codegenerate</artifactId>
<version>${codegenerate.version}</version>
</dependency>
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>minidao</artifactId>
<version>${minidao.version}</version>
</dependency>
<!-- ckfinder -->
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>CKFinder-updateByAlexander</artifactId>
<version>${CKFinder.version}</version>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>CKFinderPlugin-FileEditor</artifactId>
<version>${CKFinder.version}</version>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>CKFinderPlugin-ImageResize</artifactId>
<version>${CKFinder.version}</version>
</dependency>
<dependency>
<groupId>com.ckfinder</groupId>
<artifactId>CKFinderPlugin-Watermark</artifactId>
<version>${CKFinder.version}</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>0.4.6</version>
</dependency>
<dependency>
<groupId>org.jboss</groupId>
<artifactId>jboss-vfs</artifactId>
<version>3.1.0.Final</version>
</dependency>
<dependency>
<groupId>org.artofsolving</groupId>
<artifactId>jodconverter</artifactId>
<version>${jodconverter.version}</version>
</dependency>
<dependency>
<groupId>pinyin4j</groupId>
<artifactId>pinyin4j</artifactId>
<version>${pinyin4j.version}</version>
</dependency>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc14</artifactId>
<version>${ojdbc14.version}</version>
</dependency>
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>com.springsource</groupId>
<artifactId>org.quartz</artifactId>
<version>${org.quartz.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- SPRING 依赖包 -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- SPRING end -->
<!-- hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.2.3.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-ehcache</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-proxool</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate.common</groupId>
<artifactId>hibernate-commons-annotations</artifactId>
<version>4.0.2.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
<!-- poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi-ooxml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi-ooxml-schemas.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-scratchpad</artifactId>
<version>${poi-scratchpad.version}</version>
</dependency>
<!-- anltr -->
<dependency>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
<version>${antlr.version}</version>
</dependency>
<!-- spring orm -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<!--工作流依赖包 -->
<!--
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-engine</artifactId>
<version>${activiti.version}</version>
</dependency>
<dependency>
<groupId>org.activiti</groupId>
<artifactId>activiti-spring</artifactId>
<version>${activiti.version}</version>
</dependency>
-->
<!-- mybatis -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<!-- 数据库相关依赖包 -->
<dependency>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
<version>${commons-pool.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>${commons-dbcp.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>jdbc2005</artifactId>
<version>${sqlserver.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.sourceforge.jtds</groupId>
<artifactId>jtds</artifactId>
<version>${jtds.version}</version>
<scope>runtime</scope>
</dependency>
<!-- WEB begin -->
<!-- spring mvc -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- web依赖包 -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- WEB end -->
<!-- 辅助依赖包 -->
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectj.version}</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.jodd</groupId>
<artifactId>jodd</artifactId>
<version>${jodd.version}</version>
</dependency>
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>${javassist.version}</version>
</dependency>
<dependency>
<groupId>ant</groupId>
<artifactId>ant</artifactId>
<version>${ant.version}</version>
</dependency>
<!-- 工具包 -->
<!-- JSON begin -->
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>jackson</artifactId>
<version>${jacksonframework.version}</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>${json-lib.version}</version>
<classifier>jdk15</classifier>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson-lib.version}</version>
</dependency>
<!-- JSON end -->
<!-- dom4j -->
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>${dom4j.version}</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
<!-- log4j -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<!-- classmate -->
<dependency>
<groupId>com.fasterxml</groupId>
<artifactId>classmate</artifactId>
<version>${classmate.version}</version>
</dependency>
<!-- commons-beanutils -->
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- commons-collections -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>${commons-collections.version}</version>
</dependency>
<!-- commons-chain -->
<dependency>
<groupId>commons-chain</groupId>
<artifactId>commons-chain</artifactId>
<version>${commons-chain.version}</version>
</dependency>
<!-- commons-codec -->
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>${commons-codec.version}</version>
</dependency>
<!-- commons-digester -->
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
<version>${commons-digester.version}</version>
</dependency>
<!-- commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
</dependency>
<!-- commons-fileupload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<!-- commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang.version}</version>
</dependency>
<!-- commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- commons-email -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-email</artifactId>
<version>${commons-email.version}</version>
</dependency>
<!-- commons-logging -->
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging-api</artifactId>
<version>${commons-logging-api.version}</version>
</dependency>
<!-- commons-validator -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
<!-- ehcache -->
<dependency>
<groupId>net.sf.ehcache</groupId>
<artifactId>ehcache-core</artifactId>
<version>${ehcache.version}</version>
</dependency>
<!-- freemarker -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker</artifactId>
<version>${freemarker.version}</version>
</dependency>
<!-- hamcrest -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>${hamcrest.version}</version>
</dependency>
<!-- JSR303 Bean Validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator-annotation-processor</artifactId>
<version>${hibernate-validator.version}</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>juh</artifactId>
<version>${juh.version}</version>
</dependency>
<dependency>
<groupId>com.opensymphony</groupId>
<artifactId>xwork-core</artifactId>
<version>${xwork-core.version}</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>jurt</artifactId>
<version>${jurt.version}</version>
</dependency>
<dependency>
<groupId>org.openoffice</groupId>
<artifactId>unoil</artifactId>
<version>${unoil.version}</version>
</dependency>
<!-- TEST begin -->
<!-- junit -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<!-- spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
<!-- jacob -->
<dependency>
<groupId>org.jeecg</groupId>
<artifactId>jacob</artifactId>
<version>1.0.0</version>
</dependency>
<!-- h2 -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>test</scope>
</dependency>
<!--proxool -->
<dependency>
<groupId>com.cloudhopper.proxool</groupId>
<artifactId>proxool</artifactId>
<version>0.9.1</version>
</dependency>
<dependency>
<groupId>com.cloudhopper.proxool</groupId>
<artifactId>proxool-cglib</artifactId>
<version>0.9.1</version>
</dependency>
<!-- highchart 图片导出 -->
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>batik-all</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.jeecgframework</groupId>
<artifactId>fop</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<version>2.7.1</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis-ext</artifactId>
<version>1.3.04</version>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.3.04</version>
</dependency>
<dependency>
<groupId>org.apache.xmlgraphics</groupId>
<artifactId>xmlgraphics-commons</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>xalan</groupId>
<artifactId>xalan</artifactId>
<version>2.7.0</version>
</dependency>
<!-- Xml数据导出导入 -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>${xstream.version}</version>
</dependency>
<!-- json 工具类-->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.2.4</version>
</dependency>
</dependencies>
<organization>
<name>JEECG微云开发平台</name>
<url>www.jeecg.org</url>
</organization>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<version>1.1</version>
<configuration>
<path>/jeecg</path>
<port>8080</port>
<uriEncoding>UTF-8</uriEncoding>
<url>http://localhost:8080/manager/html</url>
<server>tomcat6</server>
</configuration>
</plugin>
</plugins>
<finalName>jeecg</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.sql</include>
<include>**/*.ftl</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>src/test/java</directory>
<includes>
<include>**/*.xml</include>
<include>**/*.sql</include>
<include>**/*.ftl</include>
</includes>
<filtering>false</filtering>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</build>
</project>

@ -1,26 +0,0 @@
package org.jeecgframework.core.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Target( { ElementType.METHOD })
@Documented
public @interface Ehcache {
// 缓存名称,默认为空
String cacheName() default "";
// 增加缓存还是删除缓存,默认为增加缓存
boolean addOrdel() default true;
//临时缓存还是永久缓存,默认为永久缓存
boolean eternal() default true;
}

@ -1,14 +0,0 @@
package org.jeecgframework.core.annotation;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
*
* @author
*
*/
@Retention(RetentionPolicy.RUNTIME)
public @interface JeecgEntityTitle {
String name();
}

@ -1,46 +0,0 @@
package org.jeecgframework.core.annotation.config;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
/**
*
*
* Class
* @author
*/
public @interface AutoMenu {
/**
*
* @return
*/
public String name();
/**
*
* @return
*/
public String level() default "0";
/**
*
* @return
*/
public String url();
/**
*
* @return
*/
public String icon() default "402880e740ec1fd70140ec2064ec0002";
/**
*
* @return
*/
public int order() default 0;
}

@ -1,46 +0,0 @@
package org.jeecgframework.core.annotation.config;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
/**
*
*
* Method
* @author
*/
public @interface AutoMenuOperation {
/**
*
* @return
*/
public String name();
/**
*
* @return
*/
public String code();
/**
*
* @return
*/
public MenuCodeType codeType() default MenuCodeType.TAG;
/**
*
* @return
*/
public String icon() default "";
/**
*
* @return
*/
public int status() default 0;
}

@ -1,12 +0,0 @@
package org.jeecgframework.core.annotation.config;
/**
*
* @author
*
*/
public enum MenuCodeType {
TAG, //采用Jeecg tag标签
ID, //采用控件ID方式
CSS //采用Css样式方式
}

@ -1,19 +0,0 @@
package org.jeecgframework.core.annotation.query;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
*
* @author JueYue
* @date 2014117
* @version 1.0
*/
@Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD})
@Retention(RetentionPolicy.RUNTIME)
public @interface QueryTimeFormat {
public String format();
}

@ -1,119 +0,0 @@
package org.jeecgframework.core.aop;
import java.io.Serializable;
import java.lang.reflect.Method;
import net.sf.ehcache.Cache;
import net.sf.ehcache.CacheManager;
import net.sf.ehcache.Element;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.AfterReturning;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.jeecgframework.core.annotation.Ehcache;
import org.springframework.stereotype.Component;
import com.alibaba.fastjson.JSON;
/**
*
* @author
*
*/
@Component
@Aspect
public class EhcacheAspect {
private static Cache dictCache;
private static Cache eternalCache;
static {
if (eternalCache == null) {
eternalCache = CacheManager.getInstance().getCache("eternalCache");
}
if (dictCache == null) {
dictCache = CacheManager.getInstance().getCache("dictCache");
}
}
@Pointcut("@annotation(org.jeecgframework.core.annotation.Ehcache)")
public void simplePointcut() {
}
@AfterReturning(pointcut = "simplePointcut()")
public void simpleAdvice() {
}
@Around("simplePointcut()")
public Object aroundLogCalls(ProceedingJoinPoint joinPoint)
throws Throwable {
String targetName = joinPoint.getTarget().getClass().toString();
String methodName = joinPoint.getSignature().getName();
Object[] arguments = joinPoint.getArgs();
//试图得到标注的Ehcache类
@SuppressWarnings("unused")
Method[] methods = joinPoint.getTarget().getClass().getMethods();
Ehcache flag = null;
for(Method m:methods){
if(m.getName().equals(methodName)){
Class[] tmpCs = m.getParameterTypes();
if(tmpCs.length==arguments.length){
flag = m.getAnnotation(Ehcache.class);
break;
}
}
}
if(flag==null){
return null;
}
//Ehcache flag =joinPoint.getTarget().getClass().getMethod(methodName).getAnnotation(Ehcache.class);
Object result;
String cacheKey = getCacheKey(targetName, methodName, arguments);
Element element = null;
if(flag.eternal()){
//永久缓存
element = dictCache.get(cacheKey);
}else{
//临时缓存
element = eternalCache.get(cacheKey);
}
if (element == null) {
if ((arguments != null) && (arguments.length != 0)) {
result = joinPoint.proceed(arguments);
} else {
result = joinPoint.proceed();
}
element = new Element(cacheKey, (Serializable) result);
if(flag.eternal()){
//永久缓存
dictCache.put(element);
}else{
//临时缓存
eternalCache.put(element);
}
}
return element.getValue();
}
/**
* cache keycache keyCacheElement cache key
* ++com.co.cache.service.UserServiceImpl.getAllUser
*/
private String getCacheKey(String targetName, String methodName,
Object[] arguments) {
StringBuffer sb = new StringBuffer();
sb.append(targetName).append(".").append(methodName);
if ((arguments != null) && (arguments.length != 0)) {
for (int i = 0; i < arguments.length; i++) {
sb.append(".").append(JSON.toJSONString(arguments[i]));
}
}
return sb.toString();
}
}

@ -1,117 +0,0 @@
package org.jeecgframework.core.aop;
import java.io.Serializable;
import java.util.Date;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.apache.log4j.Logger;
import org.hibernate.EmptyInterceptor;
import org.hibernate.type.Type;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.stereotype.Component;
/**
* Hiberate;
* ,,;
* @author
*/
@Component
public class HiberAspect extends EmptyInterceptor {
private static final Logger logger = Logger.getLogger(HiberAspect.class);
private static final long serialVersionUID = 1L;
public boolean onSave(Object entity, Serializable id, Object[] state,
String[] propertyNames, Type[] types) {
TSUser currentUser = null;
try {
currentUser = ResourceUtil.getSessionUserName();
} catch (RuntimeException e) {
logger.warn("当前session为空,无法获取用户");
}
if(currentUser==null){
return true;
}
try {
//添加数据
for (int index=0;index<propertyNames.length;index++)
{
/*找到名为"创建时间"的属性*/
if ("createDate".equals(propertyNames[index]))
{
/*使用拦截器将对象的"创建时间"属性赋上值*/
if(oConvertUtils.isEmpty(state[index])){
state[index] = new Date();
}
continue;
}
/*找到名为"创建人"的属性*/
else if ("createBy".equals(propertyNames[index]))
{
/*使用拦截器将对象的"创建人"属性赋上值*/
if(oConvertUtils.isEmpty(state[index])){
state[index] = currentUser.getUserName();
}
continue;
}
/*找到名为"创建人名称"的属性*/
else if ("createName".equals(propertyNames[index]))
{
/*使用拦截器将对象的"创建人名称"属性赋上值*/
if(oConvertUtils.isEmpty(state[index])){
state[index] = currentUser.getRealName();
}
continue;
}
}
} catch (RuntimeException e) {
e.printStackTrace();
}
return true;
}
public boolean onFlushDirty(Object entity, Serializable id,
Object[] currentState, Object[] previousState,
String[] propertyNames, Type[] types) {
TSUser currentUser = null;
try {
currentUser = ResourceUtil.getSessionUserName();
} catch (RuntimeException e1) {
logger.warn("当前session为空,无法获取用户");
}
if(currentUser==null){
return true;
}
//添加数据
for (int index=0;index<propertyNames.length;index++)
{
/*找到名为"修改时间"的属性*/
if ("updateDate".equals(propertyNames[index]))
{
/*使用拦截器将对象的"修改时间"属性赋上值*/
currentState[index] = new Date();
continue;
}
/*找到名为"修改人"的属性*/
else if ("updateBy".equals(propertyNames[index]))
{
/*使用拦截器将对象的"修改人"属性赋上值*/
currentState[index] = currentUser.getUserName();
continue;
}
/*找到名为"修改人名称"的属性*/
else if ("updateName".equals(propertyNames[index]))
{
/*使用拦截器将对象的"修改人名称"属性赋上值*/
currentState[index] = currentUser.getRealName();
continue;
}
}
return true;
}
}

@ -1,119 +0,0 @@
package org.jeecgframework.core.beanvalidator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import javax.validation.ConstraintViolation;
import javax.validation.ConstraintViolationException;
import javax.validation.Validator;
/**
* JSR303 Validator(Hibernate Validator).
*
* ConstraintViolationpropertyPath, message invalidValue.
* converti18n:
* 1.List<String>, Stringmessage
* 2.List<String>, StringpropertyPath + separator + message
* 3.Map<propertyPath, message>
*/
public class BeanValidators {
/**
* JSR303validate, ConstraintViolationException.
*/
public static void validateWithException(Validator validator,
Object object, Class<?>... groups)
throws ConstraintViolationException {
Set constraintViolations = validator.validate(object, groups);
if (!constraintViolations.isEmpty()) {
throw new ConstraintViolationException(constraintViolations);
}
}
/**
* ,
* ConstraintViolationExceptionSet<ConstraintViolations>List<message>.
*/
public static List<String> extractMessage(ConstraintViolationException e) {
return extractMessage(e.getConstraintViolations());
}
/**
* , Set<ConstraintViolation>List<message>
*/
public static List<String> extractMessage(
Set<? extends ConstraintViolation> constraintViolations) {
List<String> errorMessages = new ArrayList<String>();
for (ConstraintViolation violation : constraintViolations) {
errorMessages.add(violation.getMessage());
}
return errorMessages;
}
/**
* ,
* ConstraintViolationExceptionSet<ConstraintViolations>Map<property,
* message>.
*/
public static Map<String, String> extractPropertyAndMessage(
ConstraintViolationException e) {
return extractPropertyAndMessage(e.getConstraintViolations());
}
/**
* , Set<ConstraintViolation>Map<property, message>.
*/
public static Map<String, String> extractPropertyAndMessage(
Set<? extends ConstraintViolation> constraintViolations) {
Map<String, String> errorMessages = new HashMap<String, String>();
for (ConstraintViolation violation : constraintViolations) {
errorMessages.put(violation.getPropertyPath().toString(),
violation.getMessage());
}
return errorMessages;
}
/**
* , ConstraintViolationExceptionSet<ConstraintViolations>List<
* propertyPath message>.
*/
public static List<String> extractPropertyAndMessageAsList(
ConstraintViolationException e) {
return extractPropertyAndMessageAsList(e.getConstraintViolations(), " ");
}
/**
* , Set<ConstraintViolations>List<propertyPath message>.
*/
public static List<String> extractPropertyAndMessageAsList(
Set<? extends ConstraintViolation> constraintViolations) {
return extractPropertyAndMessageAsList(constraintViolations, " ");
}
/**
* , ConstraintViolationExceptionSet<ConstraintViolations>List<
* propertyPath +separator+ message>.
*/
public static List<String> extractPropertyAndMessageAsList(
ConstraintViolationException e, String separator) {
return extractPropertyAndMessageAsList(e.getConstraintViolations(),
separator);
}
/**
* , Set<ConstraintViolation>List<propertyPath +separator+ message>.
*/
public static List<String> extractPropertyAndMessageAsList(
Set<? extends ConstraintViolation> constraintViolations,
String separator) {
List<String> errorMessages = new ArrayList<String>();
for (ConstraintViolation violation : constraintViolations) {
errorMessages.add(violation.getPropertyPath() + separator
+ violation.getMessage());
}
return errorMessages;
}
}

@ -1,88 +0,0 @@
package org.jeecgframework.core.common.controller;
import java.util.Date;
import java.util.List;
import javax.servlet.http.HttpServletRequest;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projections;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.core.interceptors.DateConvertEditor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.ServletRequestDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import org.springframework.web.bind.annotation.RequestMapping;
/**
* initBinder
* @author
*
*/
@Controller
@RequestMapping("/baseController")
public class BaseController {
/**
* Date
*
* @param binder
*/
@InitBinder
public void initBinder(ServletRequestDataBinder binder) {
// SimpleDateFormat dateFormat = new SimpleDateFormat(
// "yyyy-MM-dd hh:mm:ss");
// binder.registerCustomEditor(Date.class, new CustomDateEditor(
// dateFormat, true));
binder.registerCustomEditor(Date.class, new DateConvertEditor());
}
/**
* (easyui)
*
* @author Alexander
* @date 20131022
*/
public List<?> pageBaseMethod(HttpServletRequest request,
DetachedCriteria dc, CommonService commonService, int pageRow) {
// 当前页
// 总条数
// 总页数
int currentPage = 1;
int totalRow = 0;
int totalPage = 0;
// 获取当前页
String str_currentPage = request.getParameter("str_currentPage");
currentPage = str_currentPage == null || "".equals(str_currentPage) ? 1
: Integer.parseInt(str_currentPage);
// 获取每页的条数
String str_pageRow = request.getParameter("str_pageRow");
pageRow = str_pageRow == null || "".equals(str_pageRow) ? pageRow
: Integer.parseInt(str_pageRow);
// 统计的总行数
dc.setProjection(Projections.rowCount());
totalRow = Integer.parseInt(commonService.findByDetached(dc).get(0)
.toString());
totalPage = (totalRow + pageRow - 1) / pageRow;
currentPage = currentPage < 1 ? 1 : currentPage;
currentPage = currentPage > totalPage ? totalPage : currentPage;
// 清空统计函数
dc.setProjection(null);
// dc.setResultTransformer(dc.DISTINCT_ROOT_ENTITY);
List<?> list = commonService.pageList(dc, (currentPage - 1) * pageRow,
pageRow);
request.setAttribute("currentPage", currentPage);
request.setAttribute("pageRow", pageRow);
request.setAttribute("totalRow", totalRow);
request.setAttribute("totalPage", totalPage);
return list;
}
}

@ -1,67 +0,0 @@
package org.jeecgframework.core.common.dao;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.ImportFile;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.core.extend.template.Template;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
public interface ICommonDao extends IGenericBaseCommonDao{
/**
* admin
* @param user
*/
public void pwdInit(TSUser user,String newPwd);
/**
*
* */
public TSUser getUserByUserIdAndUserNameExits(TSUser user);
public String getUserRole(TSUser user);
/**
*
* @param request
*/
public <T> T uploadFile(UploadFile uploadFile);
/**
*
* @param uploadFile
* @return
*/
public HttpServletResponse viewOrDownloadFile(UploadFile uploadFile);
public Map<Object,Object> getDataSourceMap(Template template);
/**
* XML
* @param fileName XML
*/
public HttpServletResponse createXml(ImportFile importFile);
/**
* XML
* @param fileName XML
*/
public void parserXml(String fileName);
public List<ComboTree> comTree(List<TSDepart> all,ComboTree comboTree);
/**
* JSON
* @param all
* @param in
* @param comboBox
* @return
*/
public List<ComboTree> ComboTree(List all,ComboTreeModel comboTreeModel,List in);
public List<TreeGrid> treegrid(List all,TreeGridModel treeGridModel);
}

@ -1,325 +0,0 @@
package org.jeecgframework.core.common.dao;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.hibernate.qbc.HqlQuery;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.model.common.DBTable;
import org.jeecgframework.core.common.model.json.DataGridReturn;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.springframework.dao.DataAccessException;
/**
*
* DAO
*
*
* @date 2012-12-8 05:37:33
* @version 1.0
*/
public interface IGenericBaseCommonDao {
/**
*
*
* @return
*/
public List<DBTable> getAllDbTableName();
public Integer getAllDbTableSize();
public <T> Serializable save(T entity);
public <T> void batchSave(List<T> entitys);
public <T> void saveOrUpdate(T entity);
/**
*
*
* @param <T>
*
* @param <T>
*
* @param <T>
* @param entitie
*/
public <T> void delete(T entitie);
/**
*
*
* @param <T>
* @param entityName
* @param id
* @return
*/
public <T> T get(Class<T> entityName, Serializable id);
/**
*
*
* @param propertyName
* @param value
* @return
*/
public <T> T findUniqueByProperty(Class<T> entityClass,
String propertyName, Object value);
/**
* .
*/
public <T> List<T> findByProperty(Class<T> entityClass,
String propertyName, Object value);
/**
*
*
* @param <T>
* @param entityClass
* @return
*/
public <T> List<T> loadAll(final Class<T> entityClass);
/**
*
*
* @param <T>
*
* @param <T>
* @param entityName
* @param id
* @return
*/
public <T> T getEntity(Class entityName, Serializable id);
public <T> void deleteEntityById(Class entityName, Serializable id);
/**
*
*
* @param <T>
* @param entities
*/
public <T> void deleteAllEntitie(Collection<T> entities);
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void updateEntitie(T pojo);
public <T> void updateEntityById(Class entityName, Serializable id);
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findByQueryString(String hql);
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> T singleResult(String hql);
/**
* sql
*
* @param query
* @return
*/
public int updateBySqlString(String sql);
/**
* sqlList
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findListbySql(String query);
/**
*
*
* @param <T>
* @param clas
* @return
*/
public <T> List<T> findByPropertyisOrder(Class<T> entityClass,
String propertyName, Object value, boolean isAsc);
/**
*
* cq
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final CriteriaQuery cq, final boolean isOffset);
/**
* cq
*
* @param <T>
* @param cq
* @return
*/
public <T> List<T> getListByCriteriaQuery(final CriteriaQuery cq,
Boolean ispage);
/**
*
* hqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final HqlQuery hqlQuery,
final boolean needParameter);
/**
*
* sqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageListBySql(final HqlQuery hqlQuery,
final boolean needParameter);
public Session getSession();
public List findByExample(final String entityName,
final Object exampleEntity);
/**
* hql HashMap
*
* @param <T>
* @param query
* @return
*/
public Map<Object, Object> getHashMapbyQuery(String query);
/**
* jquery datatables
*
* @param cq
* @param isOffset
* @return
*/
public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
final boolean isOffset);
/**
* easyui datagrid
*
* @param cq
* @param isOffset
* @return
*/
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
final boolean isOffset);
/**
* SQL
*/
public Integer executeSql(String sql, List<Object> param);
/**
* SQL
*/
public Integer executeSql(String sql, Object... param);
/**
* SQL 使:name
*/
public Integer executeSql(String sql, Map<String, Object> param);
/**
* SQL 使:name,
*/
public Object executeSqlReturnKey(String sql, Map<String, Object> param);
/**
* JDBC 使
*/
public List<Map<String, Object>> findForJdbc(String sql, Object... objs);
/**
* JDBC 使
*/
public Map<String, Object> findOneForJdbc(String sql, Object... objs);
/**
* JDBC, 使
*/
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows);
/**
* JDBC, 使
*/
public <T> List<T> findObjForJdbc(String sql, int page, int rows,
Class<T> clazz);
/**
* 使-
*
* @param criteria
* @param firstResult
* @param maxResults
* @return
* @throws DataAccessException
*/
public List<Map<String, Object>> findForJdbcParam(String sql, int page,
int rows, Object... objs);
/**
* 使For JDBC
*/
public Long getCountForJdbc(String sql);
/**
* 使For JDBC-
*
*/
public Long getCountForJdbcParam(String sql, Object[] objs);
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findHql(String hql, Object... param);
/**
* HQL
*
* @param hql
* @return
*/
public Integer executeHql(String hql);
public <T> List<T> pageList(DetachedCriteria dc, int firstResult,
int maxResult);
public <T> List<T> findByDetached(DetachedCriteria dc);
}

@ -1,603 +0,0 @@
package org.jeecgframework.core.common.dao.impl;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.jeecgframework.web.system.pojo.base.TSOperation;
import org.jeecgframework.web.system.pojo.base.TSRoleFunction;
import org.jeecgframework.web.system.pojo.base.TSRoleUser;
import org.jeecgframework.web.system.pojo.base.TSUser;
import org.apache.commons.lang.StringUtils;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.dom4j.io.XMLWriter;
import org.hibernate.Query;
import org.jeecgframework.core.common.dao.ICommonDao;
import org.jeecgframework.core.common.dao.IGenericBaseCommonDao;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.ImportFile;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.core.extend.swftools.SwfToolsUtil;
import org.jeecgframework.core.extend.template.DataSourceMap;
import org.jeecgframework.core.extend.template.Template;
import org.jeecgframework.core.util.DataUtils;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.GenericsUtils;
import org.jeecgframework.core.util.PasswordUtil;
import org.jeecgframework.core.util.PinyinUtil;
import org.jeecgframework.core.util.ReflectHelper;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StreamUtils;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.core.easyui.TagUtil;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
import org.springframework.stereotype.Repository;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
*
* @author
*
*/
@Repository
public class CommonDao extends GenericBaseCommonDao implements ICommonDao, IGenericBaseCommonDao {
/**
*
* */
public TSUser getUserByUserIdAndUserNameExits(TSUser user) {
String password = PasswordUtil.encrypt(user.getUserName(), user.getPassword(), PasswordUtil.getStaticSalt());
String query = "from TSUser u where u.userName = :username and u.password=:passowrd";
Query queryObject = getSession().createQuery(query);
queryObject.setParameter("username", user.getUserName());
queryObject.setParameter("passowrd", password);
List<TSUser> users = queryObject.list();
if (users != null && users.size() > 0) {
return users.get(0);
}
return null;
}
/**
* admin
*/
public void pwdInit(TSUser user,String newPwd){
String query ="from TSUser u where u.userName = :username ";
Query queryObject = getSession().createQuery(query);
queryObject.setParameter("username", user.getUserName());
List<TSUser> users = queryObject.list();
if(null != users && users.size() > 0){
user = users.get(0);
String pwd = PasswordUtil.encrypt(user.getUserName(), newPwd, PasswordUtil.getStaticSalt());
user.setPassword(pwd);
save(user);
}
}
public String getUserRole(TSUser user) {
String userRole = "";
List<TSRoleUser> sRoleUser = findByProperty(TSRoleUser.class, "TSUser.id", user.getId());
for (TSRoleUser tsRoleUser : sRoleUser) {
userRole += tsRoleUser.getTSRole().getRoleCode() + ",";
}
return userRole;
}
/**
*
*
* @param request
* @throws Exception
*/
@SuppressWarnings("unchecked")
public Object uploadFile(UploadFile uploadFile) {
Object object = uploadFile.getObject();
if(uploadFile.getFileKey()!=null)
{
updateEntitie(object);
}
else {
try {
uploadFile.getMultipartRequest().setCharacterEncoding("UTF-8");
MultipartHttpServletRequest multipartRequest = uploadFile.getMultipartRequest();
ReflectHelper reflectHelper = new ReflectHelper(uploadFile.getObject());
String uploadbasepath = uploadFile.getBasePath();// 文件上传根目录
if (uploadbasepath == null) {
uploadbasepath = ResourceUtil.getConfigByName("uploadpath");
}
Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
// 文件数据库保存路径
String path = uploadbasepath + "/";// 文件保存在硬盘的相对路径
String realPath = uploadFile.getMultipartRequest().getSession().getServletContext().getRealPath("/") + "/" + path;// 文件的硬盘真实路径
File file = new File(realPath);
if (!file.exists()) {
file.mkdirs();// 创建根目录
}
if (uploadFile.getCusPath() != null) {
realPath += uploadFile.getCusPath() + "/";
path += uploadFile.getCusPath() + "/";
file = new File(realPath);
if (!file.exists()) {
file.mkdirs();// 创建文件自定义子目录
}
}
else {
realPath += DataUtils.getDataString(DataUtils.yyyyMMdd) + "/";
path += DataUtils.getDataString(DataUtils.yyyyMMdd) + "/";
file = new File(realPath);
if (!file.exists()) {
file.mkdir();// 创建文件时间子目录
}
}
String entityName = uploadFile.getObject().getClass().getSimpleName();
// 设置文件上传路径
if (entityName.equals("TSTemplate")) {
realPath = uploadFile.getMultipartRequest().getSession().getServletContext().getRealPath("/") + ResourceUtil.getConfigByName("templatepath") + "/";
path = ResourceUtil.getConfigByName("templatepath") + "/";
} else if (entityName.equals("TSIcon")) {
realPath = uploadFile.getMultipartRequest().getSession().getServletContext().getRealPath("/") + uploadFile.getCusPath() + "/";
path = uploadFile.getCusPath() + "/";
}
String fileName = "";
String swfName = "";
for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
MultipartFile mf = entity.getValue();// 获取上传文件对象
fileName = mf.getOriginalFilename();// 获取文件名
swfName = PinyinUtil.getPinYinHeadChar(oConvertUtils.replaceBlank(FileUtils.getFilePrefix(fileName)));// 取文件名首字母作为SWF文件名
String extend = FileUtils.getExtend(fileName);// 获取文件扩展名
String myfilename="";
String noextfilename="";//不带扩展名
if(uploadFile.isRename())
{
noextfilename=DataUtils.getDataString(DataUtils.yyyymmddhhmmss)+StringUtil.random(8);//自定义文件名称
myfilename=noextfilename+"."+extend;//自定义文件名称
}
else {
myfilename=fileName;
}
String savePath = realPath + myfilename;// 文件保存全路径
String fileprefixName = FileUtils.getFilePrefix(fileName);
if (uploadFile.getTitleField() != null) {
reflectHelper.setMethodValue(uploadFile.getTitleField(), fileprefixName);// 动态调用set方法给文件对象标题赋值
}
if (uploadFile.getExtend() != null) {
// 动态调用 set方法给文件对象内容赋值
reflectHelper.setMethodValue(uploadFile.getExtend(), extend);
}
if (uploadFile.getByteField() != null) {
// 二进制文件保存在数据库中
reflectHelper.setMethodValue(uploadFile.getByteField(), StreamUtils.InputStreamTOByte(mf.getInputStream()));
}
File savefile = new File(savePath);
if (uploadFile.getRealPath() != null) {
// 设置文件数据库的物理路径
reflectHelper.setMethodValue(uploadFile.getRealPath(), path + myfilename);
}
saveOrUpdate(object);
// 文件拷贝到指定硬盘目录
FileCopyUtils.copy(mf.getBytes(), savefile);
// if (uploadFile.getSwfpath() != null) {
// // 转SWF
// reflectHelper.setMethodValue(uploadFile.getSwfpath(), path + swfName + ".swf");
// SwfToolsUtil.convert2SWF(savePath);
// }
// FileCopyUtils.copy(mf.getBytes(), savefile);
if (uploadFile.getSwfpath() != null) {
// 转SWF
reflectHelper.setMethodValue(uploadFile.getSwfpath(), path + FileUtils.getFilePrefix(myfilename) + ".swf");
SwfToolsUtil.convert2SWF(savePath);
}
}
} catch (Exception e1) {
}
}
return object;
}
/**
*
*
* @param request
* @throws Exception
* @throws Exception
*/
@SuppressWarnings("unchecked")
public HttpServletResponse viewOrDownloadFile(UploadFile uploadFile) {
uploadFile.getResponse().setContentType("UTF-8");
uploadFile.getResponse().setCharacterEncoding("UTF-8");
InputStream bis = null;
BufferedOutputStream bos = null;
HttpServletResponse response = uploadFile.getResponse();
HttpServletRequest request = uploadFile.getRequest();
String ctxPath = request.getSession().getServletContext().getRealPath("/");
String downLoadPath = "";
long fileLength = 0;
if (uploadFile.getRealPath() != null&&uploadFile.getContent() == null) {
downLoadPath = ctxPath + uploadFile.getRealPath();
fileLength = new File(downLoadPath).length();
try {
bis = new BufferedInputStream(new FileInputStream(downLoadPath));
} catch (FileNotFoundException e) {
e.printStackTrace();
}
} else {
if (uploadFile.getContent() != null)
bis = new ByteArrayInputStream(uploadFile.getContent());
fileLength = uploadFile.getContent().length;
}
try {
if (!uploadFile.isView() && uploadFile.getExtend() != null) {
if (uploadFile.getExtend().equals("text")) {
response.setContentType("text/plain;");
} else if (uploadFile.getExtend().equals("doc")) {
response.setContentType("application/msword;");
} else if (uploadFile.getExtend().equals("xls")) {
response.setContentType("application/ms-excel;");
} else if (uploadFile.getExtend().equals("pdf")) {
response.setContentType("application/pdf;");
} else if (uploadFile.getExtend().equals("jpg") || uploadFile.getExtend().equals("jpeg")) {
response.setContentType("image/jpeg;");
} else {
response.setContentType("application/x-msdownload;");
}
response.setHeader("Content-disposition", "attachment; filename=" + new String((uploadFile.getTitleField() + "." + uploadFile.getExtend()).getBytes("GBK"), "ISO8859-1"));
response.setHeader("Content-Length", String.valueOf(fileLength));
}
bos = new BufferedOutputStream(response.getOutputStream());
byte[] buff = new byte[2048];
int bytesRead;
while (-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
bos.write(buff, 0, bytesRead);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (bis != null) {
bis.close();
}
if (bos != null) {
bos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return response;
}
public Map<Object, Object> getDataSourceMap(Template template) {
return DataSourceMap.getDataSourceMap();
}
/**
* XML importFile xml
*/
public HttpServletResponse createXml(ImportFile importFile) {
HttpServletResponse response = importFile.getResponse();
HttpServletRequest request = importFile.getRequest();
try {
// 创建document对象
Document document = DocumentHelper.createDocument();
document.setXMLEncoding("UTF-8");
// 创建根节点
String rootname = importFile.getEntityName() + "s";
Element rElement = document.addElement(rootname);
Class entityClass = importFile.getEntityClass();
String[] fields = importFile.getField().split(",");
// 得到导出对象的集合
List objList = loadAll(entityClass);
Class classType = entityClass.getClass();
for (Object t : objList) {
Element childElement = rElement.addElement(importFile.getEntityName());
for (int i = 0; i < fields.length; i++) {
String fieldName = fields[i];
// 第一为实体的主键
if (i == 0) {
childElement.addAttribute(fieldName, String.valueOf(TagUtil.fieldNametoValues(fieldName, t)));
} else {
Element name = childElement.addElement(fieldName);
name.setText(String.valueOf(TagUtil.fieldNametoValues(fieldName, t)));
}
}
}
String ctxPath = request.getSession().getServletContext().getRealPath("");
File fileWriter = new File(ctxPath + "/" + importFile.getFileName());
XMLWriter xmlWriter = new XMLWriter(new FileOutputStream(fileWriter));
xmlWriter.write(document);
xmlWriter.close();
// 下载生成的XML文件
UploadFile uploadFile = new UploadFile(request, response);
uploadFile.setRealPath(importFile.getFileName());
uploadFile.setTitleField(importFile.getFileName());
uploadFile.setExtend("bak");
viewOrDownloadFile(uploadFile);
} catch (Exception e) {
e.printStackTrace();
}
return response;
}
/**
* XML
*/
@SuppressWarnings("unchecked")
public void parserXml(String fileName) {
try {
File inputXml = new File(fileName);
Class entityClass;
// 读取文件
SAXReader saxReader = new SAXReader();
Document document = saxReader.read(inputXml);
Element employees = document.getRootElement();
// 遍历根节点下的子节点
for (Iterator i = employees.elementIterator(); i.hasNext();) {
Element employee = (Element) i.next();
// 有实体名反射得到实体类
entityClass = GenericsUtils.getEntityClass(employee.getName());
// 得到实体属性
Field[] fields = TagUtil.getFiled(entityClass);
// 得到实体的ID
String id = employee.attributeValue(fields[0].getName());
// 判断实体是否已存在
Object obj1 = getEntity(entityClass, id);
// 实体不存在new个实体
if (obj1 == null) {
obj1 = entityClass.newInstance();
}
// 根据反射给实体属性赋值
for (Iterator j = employee.elementIterator(); j.hasNext();) {
Element node = (Element) j.next();
for (int k = 0; k < fields.length; k++) {
if (node.getName().equals(fields[k].getName())) {
String fieldName = fields[k].getName();
String stringLetter = fieldName.substring(0, 1).toUpperCase();
String setName = "set" + stringLetter + fieldName.substring(1);
Method setMethod = entityClass.getMethod(setName, new Class[] { fields[k].getType() });
String type = TagUtil.getColumnType(fieldName, fields);
if (type.equals("int")) {
setMethod.invoke(obj1, new Integer(node.getText()));
} else if (type.equals("string")) {
setMethod.invoke(obj1, node.getText().toString());
} else if (type.equals("short")) {
setMethod.invoke(obj1, new Short(node.getText()));
} else if (type.equals("double")) {
setMethod.invoke(obj1, new Double(node.getText()));
} else if (type.equals("Timestamp")) {
setMethod.invoke(obj1, new Timestamp(DataUtils.str2Date(node.getText(), DataUtils.datetimeFormat).getTime()));
}
}
}
}
if (obj1 != null) {
saveOrUpdate(obj1);
} else {
save(obj1);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
/**
* JSON
*
* @param all
*
* @param in
*
* @param comboBox
*
* @return
*/
public List<ComboTree> comTree(List<TSDepart> all, ComboTree comboTree) {
List<ComboTree> trees = new ArrayList<ComboTree>();
for (TSDepart depart : all) {
trees.add(tree(depart, true));
}
return trees;
}
@SuppressWarnings("unchecked")
public ComboTree tree(TSDepart depart, boolean recursive) {
ComboTree tree = new ComboTree();
tree.setId(oConvertUtils.getString(depart.getId()));
tree.setText(depart.getDepartname());
List<TSDepart> departsList = findByProperty(TSDepart.class, "TSPDepart.id", depart.getId());
if (departsList != null && departsList.size() > 0) {
tree.setState("closed");
tree.setChecked(false);
if (recursive) {// 递归查询子节点
List<TSDepart> departList = new ArrayList<TSDepart>(departsList);
//Collections.sort(departList, new SetListSort());// 排序
List<ComboTree> children = new ArrayList<ComboTree>();
for (TSDepart d : departList) {
ComboTree t = tree(d, true);
children.add(t);
}
tree.setChildren(children);
}
}
return tree;
}
/**
* ComboTree JSON
*
* @param all
* @param in
* @param comboTreeModel
* @return
*/
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel, List in) {
List<ComboTree> trees = new ArrayList<ComboTree>();
for (Object obj : all) {
trees.add(comboTree(obj, comboTreeModel, in, false));
}
return trees;
}
// 构建ComboTree
private ComboTree comboTree(Object obj, ComboTreeModel comboTreeModel, List in, boolean recursive) {
ComboTree tree = new ComboTree();
Map<String, Object> attributes = new HashMap<String, Object>();
ReflectHelper reflectHelper = new ReflectHelper(obj);
String id = oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getIdField()));
tree.setId(id);
tree.setText(oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getTextField())));
if (comboTreeModel.getSrcField() != null) {
attributes.put("href", oConvertUtils.getString(reflectHelper.getMethodValue(comboTreeModel.getSrcField())));
tree.setAttributes(attributes);
}
if (in == null) {
} else {
if (in.size() > 0) {
for (Object inobj : in) {
ReflectHelper reflectHelper2 = new ReflectHelper(inobj);
String inId = oConvertUtils.getString(reflectHelper2.getMethodValue(comboTreeModel.getIdField()));
if (inId == id) {
tree.setChecked(true);
}
}
}
}
List tsFunctions = (List) reflectHelper.getMethodValue(comboTreeModel.getChildField());
if (tsFunctions != null && tsFunctions.size() > 0) {
tree.setState("closed");
tree.setChecked(false);
/*
* if (recursive) {// 递归查询子节点 List<TSFunction> functionList = new ArrayList<TSFunction>(tsFunctions); Collections.sort(functionList, new SetListSort());// 排序 List<ComboTree> children = new ArrayList<ComboTree>(); for (TSFunction f : functionList) { ComboTree t = comboTree(f,comboTreeModel,in, true); children.add(t); } tree.setChildren(children); }
*/
}
return tree;
}
/**
*
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel) {
List<TreeGrid> treegrid = new ArrayList<TreeGrid>();
for (Object obj : all) {
ReflectHelper reflectHelper = new ReflectHelper(obj);
TreeGrid tg = new TreeGrid();
String id = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getIdField()));
String src = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getSrc()));
String text = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getTextField()));
if(StringUtils.isNotEmpty(treeGridModel.getOrder())){
String order = oConvertUtils.getString(reflectHelper.getMethodValue(treeGridModel.getOrder()));
tg.setOrder(order);
}
tg.setId(id);
if (treeGridModel.getIcon() != null) {
String iconpath = TagUtil.fieldNametoValues(treeGridModel.getIcon(), obj).toString();
if (iconpath != null) {
tg.setCode(iconpath);
} else {
tg.setCode("");
}
}
tg.setSrc(src);
tg.setText(text);
if (treeGridModel.getParentId() != null) {
Object pid = TagUtil.fieldNametoValues(treeGridModel.getParentId(), obj);
if (pid != null) {
tg.setParentId(pid.toString());
} else {
tg.setParentId("");
}
}
if (treeGridModel.getParentText() != null) {
Object ptext = TagUtil.fieldNametoValues(treeGridModel.getTextField(), obj);
if (ptext != null) {
tg.setParentText(ptext.toString());
} else {
tg.setParentText("");
}
}
List childList = (List) reflectHelper.getMethodValue(treeGridModel.getChildList());
if (childList != null && childList.size() > 0) {
tg.setState("closed");
}
if (treeGridModel.getRoleid() != null) {
String[] opStrings = {};
List<TSRoleFunction> roleFunctions = findByProperty(TSRoleFunction.class, "TSFunction.id", id);
if (roleFunctions.size() > 0) {
for (TSRoleFunction tRoleFunction : roleFunctions) {
TSRoleFunction roleFunction = tRoleFunction;
if (roleFunction.getTSRole().getId().toString().equals(treeGridModel.getRoleid())) {
String bbString = roleFunction.getOperation();
if (bbString != null) {
opStrings = bbString.split(",");
break;
}
}
}
}
List<TSOperation> operateions = findByProperty(TSOperation.class, "TSFunction.id", id);
StringBuffer attributes = new StringBuffer();
if (operateions.size() > 0) {
for (TSOperation tOperation : operateions) {
if (opStrings.length < 1) {
attributes.append("<input type=checkbox name=operatons value=" + tOperation.getId() + "_" + id + ">" + tOperation.getOperationname());
} else {
StringBuffer sb = new StringBuffer();
sb.append("<input type=checkbox name=operatons");
for (int i = 0; i < opStrings.length; i++) {
if (opStrings[i].equals(tOperation.getId().toString())) {
sb.append(" checked=checked");
}
}
sb.append(" value=" + tOperation.getId() + "_" + id + ">" + tOperation.getOperationname());
attributes.append(sb.toString());
}
}
}
tg.setOperations(attributes.toString());
}
treegrid.add(tg);
}
return treegrid;
}
}

@ -1,971 +0,0 @@
package org.jeecgframework.core.common.dao.impl;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.criterion.CriteriaSpecification;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Example;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Projection;
import org.hibernate.criterion.Projections;
import org.hibernate.criterion.Restrictions;
import org.hibernate.internal.CriteriaImpl;
import org.hibernate.metadata.ClassMetadata;
import org.hibernate.persister.entity.AbstractEntityPersister;
import org.hibernate.type.Type;
import org.jeecgframework.core.annotation.JeecgEntityTitle;
import org.jeecgframework.core.common.dao.IGenericBaseCommonDao;
import org.jeecgframework.core.common.dao.jdbc.JdbcDao;
import org.jeecgframework.core.common.exception.BusinessException;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.hibernate.qbc.DetachedCriteriaUtil;
import org.jeecgframework.core.common.hibernate.qbc.HqlQuery;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.hibernate.qbc.PagerUtil;
import org.jeecgframework.core.common.model.common.DBTable;
import org.jeecgframework.core.common.model.json.DataGridReturn;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ToEntityUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.dao.support.DataAccessUtils;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.PreparedStatementCreator;
import org.springframework.jdbc.core.namedparam.MapSqlParameterSource;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.namedparam.SqlParameterSource;
import org.springframework.jdbc.support.GeneratedKeyHolder;
import org.springframework.jdbc.support.KeyHolder;
import org.springframework.util.Assert;
/**
*
* DAO
*
*
* @date 2012-12-7 10:16:48
* @param <T>
* @param <PK>
* @version 1.0
*/
@SuppressWarnings("hiding")
public abstract class GenericBaseCommonDao<T, PK extends Serializable>
implements IGenericBaseCommonDao {
/**
* Log4j
*/
private static final Logger logger = Logger
.getLogger(GenericBaseCommonDao.class);
/**
* sessionFactory,(HibernateDaoSupport)
* **/
@Autowired
@Qualifier("sessionFactory")
private SessionFactory sessionFactory;
public Session getSession() {
// 事务必须是开启的(Required),否则获取不到
return sessionFactory.getCurrentSession();
}
/**
*
*
* @param entityName
*
*/
private <T> void getProperty(Class entityName) {
ClassMetadata cm = sessionFactory.getClassMetadata(entityName);
String[] str = cm.getPropertyNames(); // 获得该类所有的属性名称
for (int i = 0; i < str.length; i++) {
String property = str[i];
String type = cm.getPropertyType(property).getName(); // 获得该名称的类型
org.jeecgframework.core.util.LogUtil.info(property + "---&gt;" + type);
}
}
/**
*
*
* @return
*/
public List<DBTable> getAllDbTableName() {
List<DBTable> resultList = new ArrayList<DBTable>();
SessionFactory factory = getSession().getSessionFactory();
Map<String, ClassMetadata> metaMap = factory.getAllClassMetadata();
for (String key : (Set<String>) metaMap.keySet()) {
DBTable dbTable = new DBTable();
AbstractEntityPersister classMetadata = (AbstractEntityPersister) metaMap
.get(key);
dbTable.setTableName(classMetadata.getTableName());
dbTable.setEntityName(classMetadata.getEntityName());
Class<?> c;
try {
c = Class.forName(key);
JeecgEntityTitle t = c.getAnnotation(JeecgEntityTitle.class);
dbTable.setTableTitle(t != null ? t.name() : "");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
resultList.add(dbTable);
}
return resultList;
}
/**
*
*
* @return
*/
public Integer getAllDbTableSize() {
SessionFactory factory = getSession().getSessionFactory();
Map<String, ClassMetadata> metaMap = factory.getAllClassMetadata();
return metaMap.size();
}
/**
*
*
* @param propertyName
* @param value
* @return
*/
public <T> T findUniqueByProperty(Class<T> entityClass,
String propertyName, Object value) {
Assert.hasText(propertyName);
return (T) createCriteria(entityClass,
Restrictions.eq(propertyName, value)).uniqueResult();
}
/**
* .
*/
public <T> List<T> findByProperty(Class<T> entityClass,
String propertyName, Object value) {
Assert.hasText(propertyName);
return (List<T>) createCriteria(entityClass,
Restrictions.eq(propertyName, value)).list();
}
/**
*
*/
public <T> Serializable save(T entity) {
try {
Serializable id = getSession().save(entity);
getSession().flush();
if (logger.isDebugEnabled()) {
logger.debug("保存实体成功," + entity.getClass().getName());
}
return id;
} catch (RuntimeException e) {
logger.error("保存实体异常", e);
throw e;
}
}
/**
*
*
* @param <T>
* @param entitys
*
*/
public <T> void batchSave(List<T> entitys) {
for (int i = 0; i < entitys.size(); i++) {
getSession().save(entitys.get(i));
if (i % 20 == 0) {
// 20个对象后才清理缓存写入数据库
getSession().flush();
getSession().clear();
}
}
// 最后清理一下----防止大于20小于40的不保存
getSession().flush();
getSession().clear();
}
/**
*
*
* @param <T>
*
* @param entity
*/
public <T> void saveOrUpdate(T entity) {
try {
getSession().saveOrUpdate(entity);
getSession().flush();
if (logger.isDebugEnabled()) {
logger.debug("添加或更新成功," + entity.getClass().getName());
}
} catch (RuntimeException e) {
logger.error("添加或更新异常", e);
throw e;
}
}
/**
*
*/
public <T> void delete(T entity) {
try {
getSession().delete(entity);
getSession().flush();
if (logger.isDebugEnabled()) {
logger.debug("删除成功," + entity.getClass().getName());
}
} catch (RuntimeException e) {
logger.error("删除异常", e);
throw e;
}
}
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void deleteEntityById(Class entityName, Serializable id) {
delete(get(entityName, id));
getSession().flush();
}
/**
*
*
* @param <T>
*
* @param entitys
*/
public <T> void deleteAllEntitie(Collection<T> entitys) {
for (Object entity : entitys) {
getSession().delete(entity);
getSession().flush();
}
}
/**
* Id
*/
public <T> T get(Class<T> entityClass, final Serializable id) {
return (T) getSession().get(entityClass, id);
}
/**
*
*
* @param <T>
* @param entityName
* @param id
* @param lock
* @return
*/
public <T> T getEntity(Class entityName, Serializable id) {
T t = (T) getSession().get(entityName, id);
if (t != null) {
getSession().flush();
}
return t;
}
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void updateEntitie(T pojo) {
getSession().update(pojo);
getSession().flush();
}
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void updateEntitie(String className, Object id) {
getSession().update(className, id);
getSession().flush();
}
/**
*
*/
public <T> void updateEntityById(Class entityName, Serializable id) {
updateEntitie(get(entityName, id));
}
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public List<T> findByQueryString(final String query) {
Query queryObject = getSession().createQuery(query);
List<T> list = queryObject.list();
if (list.size() > 0) {
getSession().flush();
}
return list;
}
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> T singleResult(String hql) {
T t = null;
Query queryObject = getSession().createQuery(hql);
List<T> list = queryObject.list();
if (list.size() == 1) {
getSession().flush();
t = list.get(0);
} else if (list.size() > 0) {
throw new BusinessException("查询结果数:" + list.size() + "大于1");
}
return t;
}
/**
* hql HashMap
*
* @param <T>
* @param query
* @return
*/
public Map<Object, Object> getHashMapbyQuery(String hql) {
Query query = getSession().createQuery(hql);
List list = query.list();
Map<Object, Object> map = new HashMap<Object, Object>();
for (Iterator iterator = list.iterator(); iterator.hasNext();) {
Object[] tm = (Object[]) iterator.next();
map.put(tm[0].toString(), tm[1].toString());
}
return map;
}
/**
* sql
*
* @param <T>
* @param query
* @return
*/
public int updateBySqlString(final String query) {
Query querys = getSession().createSQLQuery(query);
return querys.executeUpdate();
}
/**
* sql
*
* @param <T>
* @param query
* @return
*/
public List<T> findListbySql(final String sql) {
Query querys = getSession().createSQLQuery(sql);
return querys.list();
}
/**
* Criteria
*
* @param <T>
* @param entityClass
* @param orderBy
* @param isAsc
* @param criterions
* @return
*/
private <T> Criteria createCriteria(Class<T> entityClass, boolean isAsc,
Criterion... criterions) {
Criteria criteria = createCriteria(entityClass, criterions);
if (isAsc) {
criteria.addOrder(Order.asc("asc"));
} else {
criteria.addOrder(Order.desc("desc"));
}
return criteria;
}
/**
* Criteria
*
* @param <T>
* @param entityClass
* @param criterions
* @return
*/
private <T> Criteria createCriteria(Class<T> entityClass,
Criterion... criterions) {
Criteria criteria = getSession().createCriteria(entityClass);
for (Criterion c : criterions) {
criteria.add(c);
}
return criteria;
}
public <T> List<T> loadAll(final Class<T> entityClass) {
Criteria criteria = createCriteria(entityClass);
return criteria.list();
}
/**
* Criteria
*
* @param <T>
* @param entityClass
* @param criterions
* @return
*/
private <T> Criteria createCriteria(Class<T> entityClass) {
Criteria criteria = getSession().createCriteria(entityClass);
return criteria;
}
/**
* .
*
* @param <T>
* @param entityClass
* @param propertyName
* @param value
* @param orderBy
* @param isAsc
* @return
*/
public <T> List<T> findByPropertyisOrder(Class<T> entityClass,
String propertyName, Object value, boolean isAsc) {
Assert.hasText(propertyName);
return createCriteria(entityClass, isAsc,
Restrictions.eq(propertyName, value)).list();
}
/**
* .
*
* @return .
*/
public <T> T findUniqueBy(Class<T> entityClass, String propertyName,
Object value) {
Assert.hasText(propertyName);
return (T) createCriteria(entityClass,
Restrictions.eq(propertyName, value)).uniqueResult();
}
/**
* Query
*
* @param session
* Hibernate
* @param hql
* HQL
* @param objects
*
* @return Query
*/
public Query createQuery(Session session, String hql, Object... objects) {
Query query = session.createQuery(hql);
if (objects != null) {
for (int i = 0; i < objects.length; i++) {
query.setParameter(i, objects[i]);
}
}
return query;
}
/**
*
*
* @param clas
* @param values
* @return
*/
public <T> int batchInsertsEntitie(List<T> entityList) {
int num = 0;
for (int i = 0; i < entityList.size(); i++) {
save(entityList.get(i));
num++;
}
return num;
}
/**
*
*
* @param <T>
* @param hql
* @param size
* @return
*/
/**
* 使 like"%"+username+"%" Hibernate Query
*
* @param hibernateTemplate
* @param hql
* @param valus
* ? null
* @return 2008-07-19 add by liuyang
*/
public List<T> executeQuery(final String hql, final Object[] values) {
Query query = getSession().createQuery(hql);
// query.setCacheable(true);
for (int i = 0; values != null && i < values.length; i++) {
query.setParameter(i, values[i]);
}
return query.list();
}
/**
*
*
* @param entityName
* @param exampleEntity
* @return
*/
public List findByExample(final String entityName,
final Object exampleEntity) {
Assert.notNull(exampleEntity, "Example entity must not be null");
Criteria executableCriteria = (entityName != null ? getSession()
.createCriteria(entityName) : getSession().createCriteria(
exampleEntity.getClass()));
executableCriteria.add(Example.create(exampleEntity));
return executableCriteria.list();
}
// 使用指定的检索标准获取满足标准的记录数
public Integer getRowCount(DetachedCriteria criteria) {
return oConvertUtils.getInt(((Criteria) criteria
.setProjection(Projections.rowCount())).uniqueResult(), 0);
}
/**
*
*/
public void callableStatementByName(String proc) {
}
/**
*
*
* @param clazz
* @return
*/
public int getCount(Class<T> clazz) {
int count = DataAccessUtils.intResult(getSession().createQuery(
"select count(*) from " + clazz.getName()).list());
return count;
}
/**
* CriteriaQuery final int allCounts =
* oConvertUtils.getInt(criteria
* .setProjection(Projections.rowCount()).uniqueResult(), 0);
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final CriteriaQuery cq, final boolean isOffset) {
Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
getSession());
CriteriaImpl impl = (CriteriaImpl) criteria;
// 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
Projection projection = impl.getProjection();
final int allCounts = ((Long) criteria.setProjection(
Projections.rowCount()).uniqueResult()).intValue();
criteria.setProjection(projection);
if (projection == null) {
criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
}
// 判断是否有排序字段
if (cq.getOrdermap() != null) {
cq.setOrder(cq.getOrdermap());
}
int pageSize = cq.getPageSize();// 每页显示数
int curPageNO = PagerUtil.getcurPageNo(allCounts, cq.getCurPage(),
pageSize);// 当前页
int offset = PagerUtil.getOffset(allCounts, curPageNO, pageSize);
String toolBar = "";
if (isOffset) {// 是否分页
criteria.setFirstResult(offset);
criteria.setMaxResults(cq.getPageSize());
if (cq.getIsUseimage() == 1) {
toolBar = PagerUtil.getBar(cq.getMyAction(), cq.getMyForm(),
allCounts, curPageNO, pageSize, cq.getMap());
} else {
toolBar = PagerUtil.getBar(cq.getMyAction(), allCounts,
curPageNO, pageSize, cq.getMap());
}
} else {
pageSize = allCounts;
}
return new PageList(criteria.list(), toolBar, offset, curPageNO,
allCounts);
}
/**
* JQUERY datatables DataTableReturn
*/
public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
final boolean isOffset) {
Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
getSession());
CriteriaImpl impl = (CriteriaImpl) criteria;
// 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
Projection projection = impl.getProjection();
final int allCounts = ((Long) criteria.setProjection(
Projections.rowCount()).uniqueResult()).intValue();
criteria.setProjection(projection);
if (projection == null) {
criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
}
// 判断是否有排序字段
if (cq.getOrdermap() != null) {
cq.setOrder(cq.getOrdermap());
}
int pageSize = cq.getPageSize();// 每页显示数
int curPageNO = PagerUtil.getcurPageNo(allCounts, cq.getCurPage(),
pageSize);// 当前页
int offset = PagerUtil.getOffset(allCounts, curPageNO, pageSize);
if (isOffset) {// 是否分页
criteria.setFirstResult(offset);
criteria.setMaxResults(cq.getPageSize());
} else {
pageSize = allCounts;
}
DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(), cq
.getField().split(","), cq.getEntityClass(), false);
return new DataTableReturn(allCounts, allCounts, cq.getDataTables()
.getEcho(), criteria.list());
}
/**
* easyui datagrid DataGridReturn
*/
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
final boolean isOffset) {
Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
getSession());
CriteriaImpl impl = (CriteriaImpl) criteria;
// 先把Projection和OrderBy条件取出来,清空两者来执行Count操作
Projection projection = impl.getProjection();
final int allCounts = ((Long) criteria.setProjection(
Projections.rowCount()).uniqueResult()).intValue();
criteria.setProjection(projection);
if (projection == null) {
criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
}
if (StringUtils.isNotBlank(cq.getDataGrid().getSort())) {
cq.addOrder(cq.getDataGrid().getSort(), cq.getDataGrid().getOrder());
}
// 判断是否有排序字段
if (!cq.getOrdermap().isEmpty()) {
cq.setOrder(cq.getOrdermap());
}
int pageSize = cq.getPageSize();// 每页显示数
int curPageNO = PagerUtil.getcurPageNo(allCounts, cq.getCurPage(),
pageSize);// 当前页
int offset = PagerUtil.getOffset(allCounts, curPageNO, pageSize);
if (isOffset) {// 是否分页
criteria.setFirstResult(offset);
criteria.setMaxResults(cq.getPageSize());
} else {
pageSize = allCounts;
}
// DetachedCriteriaUtil.selectColumn(cq.getDetachedCriteria(),
// cq.getField().split(","), cq.getClass1(), false);
List list = criteria.list();
cq.getDataGrid().setResults(list);
cq.getDataGrid().setTotal(allCounts);
return new DataGridReturn(allCounts, list);
}
/**
* SqlQuery
*
* @param cq
* @param isOffset
* @return
*/
@SuppressWarnings("unchecked")
public PageList getPageListBySql(final HqlQuery hqlQuery,
final boolean isToEntity) {
Query query = getSession().createSQLQuery(hqlQuery.getQueryString());
// query.setParameters(hqlQuery.getParam(), (Type[])
// hqlQuery.getTypes());
int allCounts = query.list().size();
int curPageNO = hqlQuery.getCurPage();
int offset = PagerUtil.getOffset(allCounts, curPageNO,
hqlQuery.getPageSize());
query.setFirstResult(offset);
query.setMaxResults(hqlQuery.getPageSize());
List list = null;
if (isToEntity) {
list = ToEntityUtil.toEntityList(query.list(),
hqlQuery.getClass1(), hqlQuery.getDataGrid().getField()
.split(","));
} else {
list = query.list();
}
return new PageList(hqlQuery, list, offset, curPageNO, allCounts);
}
/**
* HqlQuery
*
* @param cq
* @param isOffset
* @return
*/
@SuppressWarnings("unchecked")
public PageList getPageList(final HqlQuery hqlQuery,
final boolean needParameter) {
Query query = getSession().createQuery(hqlQuery.getQueryString());
if (needParameter) {
query.setParameters(hqlQuery.getParam(),
(Type[]) hqlQuery.getTypes());
}
int allCounts = query.list().size();
int curPageNO = hqlQuery.getCurPage();
int offset = PagerUtil.getOffset(allCounts, curPageNO,
hqlQuery.getPageSize());
String toolBar = PagerUtil.getBar(hqlQuery.getMyaction(), allCounts,
curPageNO, hqlQuery.getPageSize(), hqlQuery.getMap());
query.setFirstResult(offset);
query.setMaxResults(hqlQuery.getPageSize());
return new PageList(query.list(), toolBar, offset, curPageNO, allCounts);
}
/**
* CriteriaQueryList
*
* @param cq
* @param isOffset
* @return
*/
@SuppressWarnings("unchecked")
public List<T> getListByCriteriaQuery(final CriteriaQuery cq, Boolean ispage) {
Criteria criteria = cq.getDetachedCriteria().getExecutableCriteria(
getSession());
// 判断是否有排序字段
if (cq.getOrdermap() != null) {
cq.setOrder(cq.getOrdermap());
}
if (ispage)
criteria.setMaxResults(cq.getPageSize());
return criteria.list();
}
@Autowired
@Qualifier("jdbcTemplate")
private JdbcTemplate jdbcTemplate;
@Autowired
@Qualifier("namedParameterJdbcTemplate")
private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
/**
* 使
*/
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows) {
// 封装分页SQL
sql = JdbcDao.jeecgCreatePageSql(sql, page, rows);
return this.jdbcTemplate.queryForList(sql);
}
/**
* 使
*
* @throws IllegalAccessException
* @throws InstantiationException
*/
public <T> List<T> findObjForJdbc(String sql, int page, int rows,
Class<T> clazz) {
List<T> rsList = new ArrayList<T>();
// 封装分页SQL
sql = JdbcDao.jeecgCreatePageSql(sql, page, rows);
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
T po = null;
for (Map<String, Object> m : mapList) {
try {
po = clazz.newInstance();
MyBeanUtils.copyMap2Bean_Nobig(po, m);
rsList.add(po);
} catch (Exception e) {
e.printStackTrace();
}
}
return rsList;
}
/**
* 使-
*
* @param criteria
* @param firstResult
* @param maxResults
* @return
* @throws DataAccessException
*/
public List<Map<String, Object>> findForJdbcParam(String sql, int page,
int rows, Object... objs) {
// 封装分页SQL
sql = JdbcDao.jeecgCreatePageSql(sql, page, rows);
return this.jdbcTemplate.queryForList(sql, objs);
}
/**
* 使For JDBC
*/
public Long getCountForJdbc(String sql) {
return this.jdbcTemplate.queryForLong(sql);
}
/**
* 使For JDBC-
*
*/
public Long getCountForJdbcParam(String sql, Object[] objs) {
return this.jdbcTemplate.queryForLong(sql, objs);
}
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
return this.jdbcTemplate.queryForList(sql, objs);
}
public Integer executeSql(String sql, List<Object> param) {
return this.jdbcTemplate.update(sql, param);
}
public Integer executeSql(String sql, Object... param) {
return this.jdbcTemplate.update(sql, param);
}
public Integer executeSql(String sql, Map<String, Object> param) {
return this.namedParameterJdbcTemplate.update(sql, param);
}
public Object executeSqlReturnKey(final String sql, Map<String, Object> param) {
Object keyValue = null;
try{
KeyHolder keyHolder = new GeneratedKeyHolder();
SqlParameterSource sqlp = new MapSqlParameterSource(param);
this.namedParameterJdbcTemplate.update(sql,sqlp, keyHolder);
keyValue = keyHolder.getKey().longValue();
}catch (Exception e) {
keyValue = null;
}
return keyValue;
}
public Integer countByJdbc(String sql, Object... param) {
return this.jdbcTemplate.queryForInt(sql, param);
}
public Map<String, Object> findOneForJdbc(String sql, Object... objs) {
try {
return this.jdbcTemplate.queryForMap(sql, objs);
} catch (EmptyResultDataAccessException e) {
return null;
}
}
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findHql(String hql, Object... param) {
Query q = getSession().createQuery(hql);
if (param != null && param.length > 0) {
for (int i = 0; i < param.length; i++) {
q.setParameter(i, param[i]);
}
}
return q.list();
}
/**
* HQL
*
* @param hql
* @return
*/
public Integer executeHql(String hql) {
Query q = getSession().createQuery(hql);
return q.executeUpdate();
}
public <T> List<T> pageList(DetachedCriteria dc, int firstResult,
int maxResult) {
Criteria criteria = dc.getExecutableCriteria(getSession());
criteria.setResultTransformer(CriteriaSpecification.ROOT_ENTITY);
criteria.setFirstResult(firstResult);
criteria.setMaxResults(maxResult);
return criteria.list();
}
/**
* 线
*/
public <T> List<T> findByDetached(DetachedCriteria dc) {
return dc.getExecutableCriteria(getSession()).list();
}
}

@ -1,250 +0,0 @@
package org.jeecgframework.core.common.dao.jdbc;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.poi.ss.formula.functions.T;
import org.jeecgframework.core.util.MyBeanUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.EmptyResultDataAccessException;
import org.springframework.stereotype.Repository;
/**
*
* @author
*
*/
@Repository("jdbcDao")
public class JdbcDao extends SimpleJdbcTemplate{
/**
*
*/
public static final String DATABSE_TYPE_MYSQL ="mysql";
public static final String DATABSE_TYPE_POSTGRE ="postgresql";
public static final String DATABSE_TYPE_ORACLE ="oracle";
public static final String DATABSE_TYPE_SQLSERVER ="sqlserver";
/**
* SQL
*/
public static final String MYSQL_SQL = "select * from ( {0}) sel_tab00 limit {1},{2}"; //mysql
public static final String POSTGRE_SQL = "select * from ( {0}) sel_tab00 limit {2} offset {1}";//postgresql
public static final String ORACLE_SQL = "select * from (select row_.*,rownum rownum_ from ({0}) row_ where rownum <= {1}) where rownum_>{2}"; //oracle
public static final String SQLSERVER_SQL = "select * from ( select row_number() over(order by tempColumn) tempRowNumber, * from (select top {1} tempColumn = 0, {0}) t ) tt where tempRowNumber > {2}"; //sqlserver
@Autowired
public JdbcDao(DataSource dataSource) {
super(dataSource);
}
/**
* sql
* @param sql(select * from tb where id=:id)
* @param clazz
* @param parameters(keyvalue)
* @return bean
*/
public List find(String sql,Class clazz,Map parameters){
return super.find(sql,clazz,parameters);
}
/**
* sql
* @param sql(select * from tb where id=:id)
* @param clazz
* @param parameters(keyvalue)
* @return bean
*/
public Object findForObject(String sql,Class clazz,Map parameters){
return super.findForObject(sql, clazz, parameters);
}
/**
* sql
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public long findForLong(String sql,Map parameters){
return super.findForLong(sql, parameters);
}
/**
* sqlMap,Bean使MapKey,value
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public Map findForMap(String sql,Map parameters){
return super.findForMap(sql, parameters);
}
/**
* sqlMap
* @see findForMap
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public List<Map<String,Object>> findForListMap(String sql,Map parameters){
return super.findForListMap(sql, parameters);
}
/**
* insertupdatedelete<br>
* insert into users (name,login_name,password) values(:name,:loginName,:password)<br>
* ,bean
* @param sql
* @param bean
*/
public int executeForObject(String sql,Object bean){
return super.executeForObject(sql, bean);
}
/**
* insertupdatedelete<br>
* insert into users (name,login_name,password) values(:name,:login_name,:password)<br>
* ,Mapkey
* @param sql
* @param parameters
*/
public int executeForMap(String sql,Map parameters){
return super.executeForMap(sql, parameters);
}
/*
*
* update t_actor set first_name = :firstName, last_name = :lastName where id = :id
*
*/
public int[] batchUpdate(final String sql,List<Object[]> batch ){
return super.batchUpdate(sql,batch);
}
/**
* 使
*/
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows) {
//封装分页SQL
sql = jeecgCreatePageSql(sql,page,rows);
return this.jdbcTemplate.queryForList(sql);
}
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
return this.jdbcTemplate.queryForList(sql,objs);
}
/**
* 使
* @throws IllegalAccessException
* @throws InstantiationException
*/
public List<T> findObjForJdbc(String sql, int page, int rows,Class<T> clazz) {
List<T> rsList = new ArrayList<T>();
//封装分页SQL
sql = jeecgCreatePageSql(sql,page,rows);
List<Map<String, Object>> mapList = jdbcTemplate.queryForList(sql);
T po = null;
for(Map<String,Object> m:mapList){
try {
po = clazz.newInstance();
MyBeanUtils.copyMap2Bean_Nobig(po, m);
rsList.add(po);
} catch (Exception e) {
e.printStackTrace();
}
}
return rsList;
}
/**
* 使-
*
* @param criteria
* @param firstResult
* @param maxResults
* @return
* @throws DataAccessException
*/
public List<Map<String, Object>> findForJdbcParam(String sql, int page, int rows,Object... objs){
//封装分页SQL
sql = jeecgCreatePageSql(sql,page,rows);
return jdbcTemplate.queryForList(sql,objs);
}
public Map<String, Object> findOneForJdbc(String sql, Object... objs) {
try{
return this.jdbcTemplate.queryForMap(sql, objs);
}catch (EmptyResultDataAccessException e) {
return null;
}
}
/**
* 使For JDBC
*/
public Long getCountForJdbc(String sql) {
return jdbcTemplate.queryForLong(sql);
}
/**
* 使For JDBC-
*
*/
public Long getCountForJdbcParam(String sql,Object... objs) {
return jdbcTemplate.queryForLong(sql, objs);
}
public Integer executeSql2(String sql,List<Object> param) {
return this.jdbcTemplate.update(sql,param);
}
public Integer executeSql(String sql, Object... param) {
return this.jdbcTemplate.update(sql,param);
}
public Integer countByJdbc(String sql, Object... param) {
return this.jdbcTemplate.queryForInt(sql, param);
}
/**
* SQL
*/
public static String jeecgCreatePageSql(String sql, int page, int rows){
int beginNum = (page - 1) * rows;
String[] sqlParam = new String[3];
sqlParam[0] = sql;
sqlParam[1] = beginNum+"";
sqlParam[2] = rows+"";
if(ResourceUtil.getJdbcUrl().indexOf(DATABSE_TYPE_MYSQL)!=-1){
sql = MessageFormat.format(MYSQL_SQL, sqlParam);
}else if(ResourceUtil.getJdbcUrl().indexOf(DATABSE_TYPE_POSTGRE)!=-1){
sql = MessageFormat.format(POSTGRE_SQL, sqlParam);
}else {
int beginIndex = (page-1)*rows;
int endIndex = beginIndex+rows;
sqlParam[2] = Integer.toString(beginIndex);
sqlParam[1] = Integer.toString(endIndex);
if(ResourceUtil.getJdbcUrl().indexOf(DATABSE_TYPE_ORACLE)!=-1) {
sql = MessageFormat.format(ORACLE_SQL, sqlParam);
} else if(ResourceUtil.getJdbcUrl().indexOf(DATABSE_TYPE_SQLSERVER)!=-1) {
sqlParam[0] = sql.substring(getAfterSelectInsertPoint(sql));
sql = MessageFormat.format(SQLSERVER_SQL, sqlParam);
}
}
return sql;
}
private static int getAfterSelectInsertPoint(String sql) {
int selectIndex = sql.toLowerCase().indexOf("select");
int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
}
}

@ -1,190 +0,0 @@
package org.jeecgframework.core.common.dao.jdbc;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
import org.springframework.jdbc.core.simple.ParameterizedBeanPropertyRowMapper;
import org.springframework.jdbc.core.simple.SimpleJdbcInsert;
import org.springframework.util.Assert;
/**
* jdbc
* @author
*
*/
@SuppressWarnings("unchecked")
public class SimpleJdbcTemplate {
protected final Log logger = LogFactory.getLog(getClass());
protected org.springframework.jdbc.core.simple.SimpleJdbcTemplate jdbcTemplate;
protected SimpleJdbcInsert simpleJdbcInsert;
public SimpleJdbcTemplate(DataSource dataSource){
jdbcTemplate=new org.springframework.jdbc.core.simple.SimpleJdbcTemplate(dataSource);
simpleJdbcInsert=new SimpleJdbcInsert(dataSource);
}
/**
* sql
* @param sql(select * from tb where id=:id)
* @param clazz
* @param parameters(keyvalue)
* @return bean
*/
public List find(final String sql,Class clazz,Map parameters){
try{
Assert.hasText(sql,"sql语句不正确!");
Assert.notNull(clazz,"集合中对象类型不能为空!");
if(parameters!=null){
return jdbcTemplate.query(sql, resultBeanMapper(clazz),parameters);
}else{
return jdbcTemplate.query(sql, resultBeanMapper(clazz));
}
}catch (Exception e) {
return null;
}
}
/**
* sql
* @param sql(select * from tb where id=:id)
* @param clazz
* @param parameters(keyvalue)
* @return bean
*/
public Object findForObject(final String sql,Class clazz,Map parameters){
try{
Assert.hasText(sql,"sql语句不正确!");
Assert.notNull(clazz,"集合中对象类型不能为空!");
if(parameters!=null){
return jdbcTemplate.queryForObject(sql, resultBeanMapper(clazz), parameters);
}else{
return jdbcTemplate.queryForLong(sql, resultBeanMapper(clazz));
}
}catch (Exception e) {
return null;
}
}
/**
* sql
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public long findForLong(final String sql,Map parameters){
try{
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.queryForLong(sql, parameters);
}else{
return jdbcTemplate.queryForLong(sql);
}
}catch (Exception e) {
return 0;
}
}
/**
* sqlMap,Bean使MapKey,value
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public Map findForMap(final String sql,Map parameters){
try{
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.queryForMap(sql, parameters);
}else{
return jdbcTemplate.queryForMap(sql);
}
}catch (Exception e) {
return null;
}
}
/**
* sqlMap
* @see findForMap
* @param sql(select count(*) from tb where id=:id)
* @param parameters(keyvalue)
* @return bean
*/
public List<Map<String,Object>> findForListMap(final String sql,Map parameters){
try{
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.queryForList(sql, parameters);
}else{
return jdbcTemplate.queryForList(sql);
}
}catch (Exception e) {
return null;
}
}
/**
* insertupdatedelete<br>
* insert into users (name,login_name,password) values(:name,:loginName,:password)<br>
* ,bean
* @param sql
* @param bean
*/
public int executeForObject(final String sql,Object bean){
Assert.hasText(sql,"sql语句不正确!");
if(bean!=null){
return jdbcTemplate.update(sql, paramBeanMapper(bean));
}else{
return jdbcTemplate.update(sql);
}
}
/**
* insertupdatedelete<br>
* insert into users (name,login_name,password) values(:name,:login_name,:password)<br>
* ,Mapkey
* @param sql
* @param parameters
*/
public int executeForMap(final String sql,Map parameters){
Assert.hasText(sql,"sql语句不正确!");
if(parameters!=null){
return jdbcTemplate.update(sql, parameters);
}else{
return jdbcTemplate.update(sql);
}
}
/*public long executeForObjectReturnPk(final String sql,Object bean){
Assert.hasText(sql,"sql语句不正确!");
if(bean!=null){
return jdbcTemplate.update(sql, paramBeanMapper(bean));
}else{
return jdbcTemplate.update(sql);
}
}*/
/*
*
* update t_actor set first_name = :firstName, last_name = :lastName where id = :id
*
*/
public int[] batchUpdate(final String sql,List<Object[]> batch ){
int[] updateCounts = jdbcTemplate.batchUpdate(sql,batch);
return updateCounts;
}
protected ParameterizedBeanPropertyRowMapper resultBeanMapper(Class clazz) {
return ParameterizedBeanPropertyRowMapper.newInstance(clazz);
}
protected BeanPropertySqlParameterSource paramBeanMapper(Object object) {
return new BeanPropertySqlParameterSource(object);
}
}

@ -1,25 +0,0 @@
package org.jeecgframework.core.common.entity;
import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import org.hibernate.annotations.GenericGenerator;
@MappedSuperclass
public abstract class IdEntity {
private String id;
@Id
@GeneratedValue(generator = "paymentableGenerator")
@GenericGenerator(name = "paymentableGenerator", strategy = "uuid")
@Column(name ="ID",nullable=false,length=32)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
}

@ -1,19 +0,0 @@
package org.jeecgframework.core.common.exception;
public class BusinessException extends RuntimeException {
private static final long serialVersionUID = 1L;
public BusinessException(String message){
super(message);
}
public BusinessException(Throwable cause)
{
super(cause);
}
public BusinessException(String message,Throwable cause)
{
super(message,cause);
}
}

@ -1,36 +0,0 @@
package org.jeecgframework.core.common.exception;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.log4j.Logger;
import org.jeecgframework.core.common.model.json.AjaxJson;
import org.jeecgframework.core.util.ExceptionUtil;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerExceptionResolver;
import org.springframework.web.servlet.ModelAndView;
/**
* spring mvc
*
*/
@Component
public class MyExceptionHandler implements HandlerExceptionResolver {
private static final Logger logger = Logger
.getLogger(MyExceptionHandler.class);
public ModelAndView resolveException(HttpServletRequest request,
HttpServletResponse response, Object handler, Exception ex) {
String exceptionMessage = ExceptionUtil.getExceptionMessage(ex);
logger.error(exceptionMessage);
Map<String, Object> model = new HashMap<String, Object>();
model.put("exceptionMessage", exceptionMessage);
model.put("ex", ex);
return new ModelAndView("common/error", model);
}
}

@ -1,64 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class DB2Dialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public boolean supportsLimitOffset()
{
return true;
}
private static String getRowNumber(String sql)
{
StringBuffer rownumber = new StringBuffer(50).append("rownumber() over(");
int orderByIndex = sql.toLowerCase().indexOf("order by");
if ((orderByIndex > 0) && (!hasDistinct(sql)))
{
rownumber.append(sql.substring(orderByIndex));
}
rownumber.append(") as rownumber_,");
return rownumber.toString();
}
private static boolean hasDistinct(String sql)
{
return sql.toLowerCase().indexOf("select distinct") >= 0;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
int startOfSelect = sql.toLowerCase().indexOf("select");
StringBuffer pagingSelect = new StringBuffer(sql.length() + 100).append(sql.substring(0, startOfSelect)).append("select * from ( select ").append(getRowNumber(sql));
if (hasDistinct(sql))
{
pagingSelect.append(" row_.* from ( ").append(sql.substring(startOfSelect)).append(" ) as row_");
}
else
{
pagingSelect.append(sql.substring(startOfSelect + 6));
}
pagingSelect.append(" ) as temp_ where rownumber_ ");
if (offset > 0)
{
String endString = offsetPlaceholder + "+" + limitPlaceholder;
pagingSelect.append("between " + offsetPlaceholder + "+1 and " + endString);
}
else
{
pagingSelect.append("<= " + limitPlaceholder);
}
return pagingSelect.toString();
}
public String getCountSql(String sql)
{
return null;
}
}

@ -1,20 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class DerbyDialect extends Dialect
{
public boolean supportsLimit()
{
return false;
}
public boolean supportsLimitOffset()
{
return false;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
throw new UnsupportedOperationException("paged queries not supported");
}
}

@ -1,30 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class Dialect
{
public boolean supportsLimit()
{
return false;
}
public boolean supportsLimitOffset()
{
return supportsLimit();
}
public String getCountSql(String sql)
{
String tmp = "select count(1) amount from (" + sql + ") a";
return tmp;
}
public String getLimitString(String sql, int offset, int limit)
{
return getLimitString(sql, offset, Integer.toString(offset), limit, Integer.toString(limit));
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
throw new UnsupportedOperationException("paged queries not supported");
}
}

@ -1,42 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
import org.springframework.beans.factory.FactoryBean;
public class DialectFactoryBean implements FactoryBean<Dialect> {
public static final String ORACLE = "oracle";
public static final String MYSQL = "mysql";
public static final String SQLSERVER = "sqlserver";
public static final String DB2 = "db2";
public static final String POSTGRES = "postgres";
private Dialect dialect;
private String dbType = "mysql";
public void setDbType(String dbType) {
this.dbType = dbType;
}
public Dialect getObject() throws Exception {
if (this.dbType.equals("oracle")) {
this.dialect = new OracleDialect();
} else if (this.dbType.equals("sqlserver")) {
this.dialect = new SQLServer2005Dialect();
} else if (this.dbType.equals("db2")) {
this.dialect = new DB2Dialect();
} else if (this.dbType.equals("mysql")) {
this.dialect = new MySQLDialect();
} else if (this.dbType.equals("postgres")) {
this.dialect = new PostgreSQLDialect();
} else {
throw new Exception("没有设置合适的数据库类型");
}
return this.dialect;
}
public Class<?> getObjectType() {
return Dialect.class;
}
public boolean isSingleton() {
return true;
}
}

@ -1,20 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class H2Dialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
return new StringBuffer(sql.length() + 40).append(sql).append(" limit " + limitPlaceholder).toString();
}
public boolean supportsLimitOffset()
{
return true;
}
}

@ -1,21 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class HSQLDialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public boolean supportsLimitOffset()
{
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
boolean hasOffset = offset > 0;
return new StringBuffer(sql.length() + 10).append(sql).insert(sql.toLowerCase().indexOf("select") + 6, " top " + limitPlaceholder).toString();
}
}

@ -1,13 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
import org.hibernate.dialect.PostgreSQLDialect;
public class MyPostgreSQLDialect extends PostgreSQLDialect {
public boolean useInputStreamToInsertBlob() {
// TODO Auto-generated method stub
return true;
}
}

@ -1,25 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class MySQLDialect extends Dialect
{
public boolean supportsLimitOffset()
{
return true;
}
public boolean supportsLimit()
{
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
if (offset > 0)
{
return sql + " limit " + offsetPlaceholder + "," + limitPlaceholder;
}
return sql + " limit " + limitPlaceholder;
}
}

@ -1,50 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class OracleDialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public boolean supportsLimitOffset()
{
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
sql = sql.trim();
boolean isForUpdate = false;
if (sql.toLowerCase().endsWith(" for update"))
{
sql = sql.substring(0, sql.length() - 11);
isForUpdate = true;
}
StringBuffer pagingSelect = new StringBuffer(sql.length() + 100);
if (offset > 0)
{
pagingSelect.append("select * from ( select row_.*, rownum rownum_ from ( ");
}
else
{
pagingSelect.append("select * from ( ");
}
pagingSelect.append(sql);
if (offset > 0)
{
String endString = offsetPlaceholder + "+" + limitPlaceholder;
pagingSelect.append(" ) row_ ) where rownum_ <= " + endString + " and rownum_ > " + offsetPlaceholder);
}
else
{
pagingSelect.append(" ) where rownum <= " + limitPlaceholder);
}
if (isForUpdate)
{
pagingSelect.append(" for update");
}
return pagingSelect.toString();
}
}

@ -1,20 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class PostgreSQLDialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public boolean supportsLimitOffset()
{
return true;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
return new StringBuffer(sql.length() + 20).append(sql).append(" limit " + limitPlaceholder).toString();
}
}

@ -1,57 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class SQLServer2005Dialect extends Dialect
{
public boolean supportsLimit()
{
return true;
}
public boolean supportsLimitOffset()
{
return true;
}
public String getLimitString(String querySqlString, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
int start = offset + 1;
StringBuffer pagingBuilder = new StringBuffer();
String orderby = getOrderByPart(querySqlString);
String distinctStr = "";
String loweredString = querySqlString.toLowerCase();
String sqlPartString = querySqlString;
if (loweredString.trim().startsWith("select"))
{
int index = 6;
if (loweredString.startsWith("select distinct"))
{
distinctStr = "DISTINCT ";
index = 15;
}
sqlPartString = sqlPartString.substring(index);
}
pagingBuilder.append(sqlPartString);
if ((orderby == null) || (orderby.length() == 0))
{
orderby = "ORDER BY CURRENT_TIMESTAMP";
}
StringBuffer result = new StringBuffer();
result.append("WITH query AS (SELECT ").append(distinctStr).append("TOP 100 PERCENT ").append(" ROW_NUMBER() OVER (").append(orderby).append(") as __row_number__, ").append(pagingBuilder).append(") SELECT * FROM query WHERE __row_number__ BETWEEN ").append(start).append(" AND ").append(offset + limit).append(" ORDER BY __row_number__");
return result.toString();
}
static String getOrderByPart(String sql)
{
String loweredString = sql.toLowerCase();
int orderByIndex = loweredString.indexOf("order by");
if (orderByIndex != -1)
{
return sql.substring(orderByIndex);
}
return "";
}
}

@ -1,37 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class SQLServerDialect extends Dialect
{
public boolean supportsLimitOffset()
{
return false;
}
public boolean supportsLimit()
{
return true;
}
static int getAfterSelectInsertPoint(String sql)
{
int selectIndex = sql.toLowerCase().indexOf("select");
int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
}
public String getLimitString(String sql, int offset, int limit)
{
return getLimitString(sql, offset, null, limit, null);
}
public String getLimitString(String querySelect, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
if (offset > 0)
{
throw new UnsupportedOperationException("sql server has no offset");
}
return new StringBuffer(querySelect.length() + 8).append(querySelect).insert(getAfterSelectInsertPoint(querySelect), " top " + limit).toString();
}
}

@ -1,20 +0,0 @@
package org.jeecgframework.core.common.hibernate.dialect;
public class SybaseDialect extends Dialect
{
public boolean supportsLimit()
{
return false;
}
public boolean supportsLimitOffset()
{
return false;
}
public String getLimitString(String sql, int offset, String offsetPlaceholder, int limit, String limitPlaceholder)
{
throw new UnsupportedOperationException("paged queries not supported");
}
}

@ -1,67 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import ognl.Ognl;
import org.hibernate.HibernateException;
import org.hibernate.transform.ResultTransformer;
import com.opensymphony.xwork2.ognl.OgnlUtil;
import com.opensymphony.xwork2.util.reflection.ReflectionContextState;
/**
* xwork-core-2.1.6.jar
*
* 2009-3-30
* @author
*/
public class AliasToBean implements ResultTransformer {
private static final long serialVersionUID = 1L;
private static final OgnlUtil ognlUntil = new OgnlUtil();
private static final Map<String,Boolean> context = new HashMap<String,Boolean>(1);
static{
context.put(ReflectionContextState.CREATE_NULL_OBJECTS, true);
}
/** POJO的class */
private final Class<?> resultClass;
public AliasToBean(Class<?> pojoClass) {
if(pojoClass==null) throw new IllegalArgumentException("resultClass cannot be null");
this.resultClass = pojoClass;
}
@SuppressWarnings("unchecked")
public List transformList(List collection) {
return collection;
}
/**
*
* 2009-4-7
* @author
* @param tuple
* @param aliases
* @return POJO--
*/
public Object transformTuple(Object[] tuple, String[] aliases) {
try {
Object root = resultClass.newInstance();
for (int i = 0; i < aliases.length; i++) {
if(aliases[i]!=null && !aliases[i].equals(""))
{
Ognl.setValue(ognlUntil.compile(aliases[i]), context, root, tuple[i]);
}
}
return root;
} catch (Exception e) {
throw new HibernateException(e.getMessage(),e);
}
}
}

@ -1,705 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.hibernate.criterion.Criterion;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Property;
import org.hibernate.criterion.Restrictions;
import org.hibernate.transform.Transformers;
import org.hibernate.type.Type;
import org.jeecgframework.core.common.model.json.DataGrid;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.tag.vo.datatable.DataTables;
import org.jeecgframework.tag.vo.datatable.SortDirection;
import org.jeecgframework.tag.vo.datatable.SortInfo;
/**
*
*CriteriaQueryhibernate QBC
*
*@date 2012-12-7 10:22:15
*@version 1.0
*/
@SuppressWarnings({"rawtypes","static-access"})
public class CriteriaQuery implements Serializable {
public CriteriaQuery() {
}
private static final long serialVersionUID = 1L;
private int curPage = 1;// 当前页
private int pageSize = 10;// 默认一页条数
private String myAction;// 请求的action 地址
private String myForm;// form 名字
private CriterionList criterionList=new CriterionList();//自定义查询条件集合
private CriterionList jqcriterionList=new CriterionList();//jquery datatable控件生成查询条件集合
private int isUseimage = 0;// 翻页工具条样式
private DetachedCriteria detachedCriteria;
private static Map<String, Object> map;
private static Map<String, Object> ordermap;//排序字段
private boolean flag = true;// 对同一字段进行第二次重命名查询时值设置FASLE不保存重命名查询条件
private String field="";//查询需要显示的字段
private Class entityClass;//POJO
private List results;// 结果集
private int total;
private List<String> alias = new ArrayList<String>();//保存创建的aliasName 防止重复创建
public List getResults() {
return results;
}
public void setResults(List results) {
this.results = results;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
private DataGrid dataGrid;
private DataTables dataTables;
public DataTables getDataTables() {
return dataTables;
}
public void setDataTables(DataTables dataTables) {
this.dataTables = dataTables;
}
public DataGrid getDataGrid() {
return dataGrid;
}
public void setDataGrid(DataGrid dataGrid) {
this.dataGrid = dataGrid;
}
public Class getEntityClass() {
return entityClass;
}
public void setEntityClass(Class entityClass) {
this.entityClass = entityClass;
}
public CriterionList getJqcriterionList() {
return jqcriterionList;
}
public void setJqcriterionList(CriterionList jqcriterionList) {
this.jqcriterionList = jqcriterionList;
}
public CriteriaQuery(Class c) {
this.detachedCriteria = DetachedCriteria.forClass(c);
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
}
public CriteriaQuery(Class c, int curPage, String myAction, String myForm) {
this.curPage = curPage;
this.myAction = myAction;
this.myForm = myForm;
this.detachedCriteria = DetachedCriteria.forClass(c);
}
public CriteriaQuery(Class c, int curPage, String myAction) {
this.myAction = myAction;
this.curPage = curPage;
this.detachedCriteria = DetachedCriteria.forClass(c);
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
}
public CriteriaQuery(Class entityClass, int curPage) {
this.curPage = curPage;
this.detachedCriteria = DetachedCriteria.forClass(entityClass);
this.map = new HashMap<String, Object>();
}
public CriteriaQuery(Class entityClass,DataGrid dg) {
this.curPage = dg.getPage();
//String[] fieldstring=dg.getField().split(",");
//this.detachedCriteria = DetachedCriteriaUtil
//.createDetachedCriteria(c, "start", "_table",fieldstring);
this.detachedCriteria = DetachedCriteria.forClass(entityClass);
//Criteria criteria = null;
this.field=dg.getField();
this.entityClass=entityClass;
this.dataGrid=dg;
this.pageSize=dg.getRows();
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
}
public CriteriaQuery(Class entityClass,DataTables dataTables) {
this.curPage = dataTables.getDisplayStart();
String[] fieldstring=dataTables.getsColumns().split(",");
this.detachedCriteria = DetachedCriteriaUtil
.createDetachedCriteria(entityClass, "start", "_table",fieldstring);
//this.detachedCriteria = DetachedCriteria.forClass(c);
this.field=dataTables.getsColumns();
this.entityClass=entityClass;
this.dataTables=dataTables;
this.pageSize=dataTables.getDisplayLength();
this.map = new HashMap<String, Object>();
this.ordermap = new HashMap<String, Object>();
addJqCriteria(dataTables);
}
public CriteriaQuery(Class c, int pageSize, int curPage,
String myAction, String myForm) {
this.pageSize = pageSize;
this.curPage = curPage;
this.myAction = myAction;
this.myForm = myForm;
this.detachedCriteria = DetachedCriteria.forClass(c);
}
/**
* () hql((this_.0 like ? and this_.1 like ?) or this_.2 like ?)
* cq.add(cq.or(cq.and(cq, 0, 1), cq, 2))----- hql2:(this_.0 like ? or
* this_.1 like ?) :cq.add(cq.or(cq, 0, 1));
* cq.in("TBPrjstatus.code", status);
cq.eq("attn", user.getUserName());
cq.isNull("attn");
cq.add(cq.and(cq.or(cq, 1, 2), cq, 0));
*/
public void add(Criterion c) {
detachedCriteria.add(c);
}
/**
*
*/
public void add() {
for (int i = 0; i < getCriterionList().size(); i++) {
add(getCriterionList().getParas(i));
}
getCriterionList().removeAll(getCriterionList());
}
/**
* dataTables
* @param dataTables
*/
public void addJqCriteria(DataTables dataTables) {
String search=dataTables.getSearch();//查询关键字
SortInfo[] sortInfo=dataTables.getSortColumns();//排序字段
String[] sColumns=dataTables.getsColumns().split(",");//字段
if(StringUtil.isNotEmpty(search))
{
for (String string : sColumns) {
if(string.indexOf("_")==-1)
{
jqcriterionList.addPara(Restrictions.like(string, "%" + search
+ "%"));
}
}
add(getOrCriterion(jqcriterionList));
}
if(sortInfo.length>0)
{
for (SortInfo sortInfo2 : sortInfo) {
addOrder(""+sColumns[sortInfo2.getColumnId()]+"",sortInfo2.getSortOrder());
}
}
}
public void createCriteria(String name) {
detachedCriteria.createCriteria(name);
}
public void createCriteria(String name, String value) {
detachedCriteria.createCriteria(name, value);
}
/**
*
*
* @param name
* @param value
*/
public void createAlias(String name, String value) {
if(!alias.contains(name)){
detachedCriteria.createAlias(name, value);
alias.add(name);
}
}
public void setResultTransformer(Class class1) {
detachedCriteria.setResultTransformer(Transformers.aliasToBean(class1));
}
public void setProjection(Property property) {
detachedCriteria.setProjection(property);
}
/**
* and
*
* @param query
* @param source
* @param dest
* hql((this_.0 like ? and this_.1 like ?) or this_.2 like ?)
* cq.add(cq.or(cq.and(cq, 0, 1), cq, 2))
* @return
*/
public Criterion and(CriteriaQuery query, int source, int dest) {
return Restrictions.and(query.getCriterionList().getParas(source),
query.getCriterionList().getParas(dest));
}
/**
* and
*
* @param query
* @param source
* @param dest
* hql:(this_.0 like ? or this_.1 like ?) :cq.add(cq.or(cq, 0,
* 1));
* @return
*/
public Criterion and(Criterion c, CriteriaQuery query, int souce) {
return Restrictions.and(c, query.getCriterionList().getParas(souce));
}
/**
*CriterionList
*/
public Criterion getOrCriterion(CriterionList list) {
Criterion c1=null;
Criterion c2=null;
Criterion c3=null;
c1=list.getParas(0);
for (int i = 1; i < list.size(); i++) {
c2=list.getParas(i);
c3=getor(c1, c2);
c1=c3;
}
return c3;
}
/**
* Criterion OR
*
* @param query
* @param source
* @param dest
* @return
*/
public Criterion getor(Criterion c1,Criterion c2) {
return Restrictions.or(c1, c2);
}
/**
* and
*
* @param query
* @param source
* @param dest
* @return
*/
public Criterion and(Criterion c1, Criterion c2)
{
return Restrictions.and(c1, c2);
}
/**
* Or
*
* @param query
* @param source1
* @param dest2
* @return
*/
public Criterion or(CriteriaQuery query, int source, int dest) {
return Restrictions.or(query.getCriterionList().getParas(source), query
.getCriterionList().getParas(dest));
}
/**
* or(Criterion c, CriteriaQuery query, int source)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public Criterion or(Criterion c, CriteriaQuery query, int source) {
return Restrictions.or(c, query.getCriterionList().getParas(source));
}
/**
* or(Criterion c1, Criterion c2)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
* Restrictions.or(Restrictions.in("username",list1),
* Restrictions.idEq(1)); :使
* criteria.add(Restrictions
* .or(Restrictions.in("username",list1),
* Restrictions.or(Restrictions.idEq(3), Restrictions.idEq(4))));
*/
public void or(Criterion c1, Criterion c2) {
this.detachedCriteria.add(Restrictions.or(c1, c2));
}
/**
* order
*
* @param ordername
*
* @param ordervalue
* "asc","desc"
*/
public void addOrder(String ordername, SortDirection ordervalue) {
ordermap.put(ordername,ordervalue);
}
/**
* order
*
* @param ordername
*
* @param ordervalue
* "asc","desc"
*/
public void setOrder(Map<String, Object> map) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
judgecreateAlias(entry.getKey());
if (SortDirection.asc.equals(entry.getValue())) {
detachedCriteria.addOrder(Order.asc(entry.getKey()));
} else {
detachedCriteria.addOrder(Order.desc(entry.getKey()));
}
}
}
/**
* alias
* @param entitys
* entitys a.b.c alias aalias bc
*
*/
public void judgecreateAlias(String entitys) {
String[] aliass = entitys.split("\\.");
for (int i = 0 ;i<aliass.length-1;i++){
createAlias(aliass[i], aliass[i]);
}
}
public static Map<String, Object> getOrdermap() {
return ordermap;
}
public static void setOrdermap(Map<String, Object> ordermap) {
CriteriaQuery.ordermap = ordermap;
}
/**
* eq()
*
* @param keyname
* :
* @param keyvalue
*
*/
public void eq(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.eq(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* notEq()
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void notEq(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.ne(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* like()
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void like(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
//criterionList.addPara(Restrictions.like(keyname, "%" + keyvalue+ "%"));
criterionList.addPara(Restrictions.like(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* gt(>)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void gt(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.gt(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* lt(<)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void lt(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.lt(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* le(<=)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void le(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.le(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* ge(>=)
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void ge(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
criterionList.addPara(Restrictions.ge(keyname, keyvalue));
if (flag) {
this.put(keyname, keyvalue);
}
flag = true;
}
}
/**
* in()
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void in(String keyname, Object[] keyvalue) {
if (keyvalue != null && keyvalue[0] != "") {
criterionList.addPara(Restrictions.in(keyname, keyvalue));
}
}
/**
* isNull
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void isNull(String keyname) {
criterionList.addPara(Restrictions.isNull(keyname));
}
/**
* isNull
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void isNotNull(String keyname) {
criterionList.addPara(Restrictions.isNotNull(keyname));
}
/**
*
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void put(String keyname, Object keyvalue) {
if (keyvalue != null && keyvalue != "") {
map.put(keyname, keyvalue);
}
}
/**
* between()
*
* @param keyname
* @param keyvalue1
* @param keyvalue2
*/
public void between(String keyname, Object keyvalue1, Object keyvalue2) {
Criterion c = null;// 写入between查询条件
if (!keyvalue1.equals(null) && !keyvalue2.equals(null)) {
c = Restrictions.between(keyname, keyvalue1, keyvalue2);
} else if (!keyvalue1.equals(null)) {
c = Restrictions.ge(keyname, keyvalue1);
} else if (!keyvalue2.equals(null)) {
c = Restrictions.le(keyname, keyvalue2);
}
criterionList.add(c);
}
public void sql(String sql) {
Restrictions.sqlRestriction(sql);
}
public void sql(String sql, Object[] objects, Type[] type) {
Restrictions.sqlRestriction(sql, objects, type);
}
public void sql(String sql, Object objects, Type type) {
Restrictions.sqlRestriction(sql, objects, type);
}
public Integer getCurPage() {
return curPage;
}
public void setCurPage(Integer curPage) {
this.curPage = curPage;
}
public int getPageSize() {
return pageSize;
}
/**
*
*
* @param pageSize
*/
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getMyAction() {
return myAction;
}
public void setMyAction(String myAction) {
this.myAction = myAction;
}
public String getMyForm() {
return myForm;
}
public void setMyForm(String myForm) {
this.myForm = myForm;
}
public CriterionList getCriterionList() {
return criterionList;
}
public void setCriterionList(CriterionList criterionList) {
this.criterionList = criterionList;
}
public DetachedCriteria getDetachedCriteria() {
return detachedCriteria;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public void setDetachedCriteria(DetachedCriteria detachedCriteria) {
this.detachedCriteria = detachedCriteria;
}
public int getIsUseimage() {
return isUseimage;
}
/**
* 0:1
*
* @param isUseimage
*/
public void setIsUseimage(int isUseimage) {
this.isUseimage = isUseimage;
}
public Map<String, Object> getMap() {
return map;
}
public void setMap(Map<String, Object> map) {
this.map = map;
}
public boolean isFlag() {
return flag;
}
/**
* FASLE
*
* @param flag
*/
public void setFlag(boolean flag) {
this.flag = flag;
}
}

@ -1,39 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.ArrayList;
import org.hibernate.criterion.Criterion;
/**
* @ClassName: CriterionList
* @Description: TODO()
* @author jeecg
* @date 2012-10-25 09:32:20
*
*/
public class CriterionList extends ArrayList<Object> {
/**
*
*/
private static final long serialVersionUID = 1L;
public final Criterion getParas(final int index) {
return (Criterion) super.get(index);
}
public final void addPara(final int index, final Criterion p) {
super.add(index, p);
}
public final void addPara(final Criterion p) {
super.add(p);
}
public final int indexofPara(final Criterion p) {
return super.indexOf(p);
}
public final void removePara(final int index) {
super.remove(index);
}
}

@ -1,253 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.servlet.http.HttpServletRequest;
import org.hibernate.FetchMode;
import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Projection;
import org.hibernate.criterion.ProjectionList;
import org.hibernate.criterion.Projections;
import org.hibernate.transform.Transformers;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.StringUtil;
/**
* Hibernate
*/
public class DetachedCriteriaUtil {
/** 小写字母X */
public static final String MIDDLE_SEPRATOR_CHAR = "x";
/** 两个空格 */
public static final String SEPARATOR_TWO_SPACE = " ";// 两个空格,避免和"日期 时间"中的空格混淆
/** 此字符串内容为" <= x <= ",不包括引号 */
static public ProjectionList projectionList;
public static ProjectionList getProjectionList() {
return projectionList;
}
private DetachedCriteriaUtil(){
//do not allow to create Object
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param alias
*
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias) {
return createDetachedCriteria(pojoClazz, startChar, alias,null);
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param alias
*
* @param columnNames
* select
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias,String[] columnNames) {
return createDetachedCriteria(pojoClazz, startChar, alias, columnNames, null);
}
/**
* 2008-11-3
*
* @author
* @param pojoClazz
*
* @param startChar
*
* @param columnNames
* select
* @param excludeParameters
*
* @param alias
*
* @return DetachedCriteria
*/
public static DetachedCriteria createDetachedCriteria(Class<?> pojoClazz,
String startChar,String alias,String[] columnNames,String[] excludeParameters) {
DetachedCriteria criteria = DetachedCriteria.forClass(pojoClazz,alias);
if(columnNames!=null && columnNames.length>0){
//selectColumn(criteria, columnNames, pojoClazz, false);
}
return criteria;
}
private static final String ALIAS_KEY_IN_REQUEST = "ALIAS_KEY_IN_REQUEST";
private static final String HAS_JOIN_TABLE_KEY_IN_REQUEST = "HAS_JOIN_TABLE_KEY_IN_REQUEST";
private static void setAliasToRequest(HttpServletRequest request,Set<String> aliases) {
request.setAttribute(ALIAS_KEY_IN_REQUEST, aliases);
}
@SuppressWarnings("unchecked")
private static Set<String> getAliasesFromRequest(){
Set<String> aliases = (Set<String>) ContextHolderUtils.getRequest().getAttribute(ALIAS_KEY_IN_REQUEST);
if(aliases==null){
aliases = new HashSet<String>(5);
setAliasToRequest(ContextHolderUtils.getRequest(), aliases);
}
return aliases;
}
private static boolean getHasJoinTatleFromRequest(){
Boolean hasJoin = (Boolean) ContextHolderUtils.getRequest().getAttribute(HAS_JOIN_TABLE_KEY_IN_REQUEST);
return hasJoin==null?false:hasJoin;
}
/**
* DetachedCriteria 2008-9-29
* 2009.9.9
* user.organization.parentOrganization.parentOrganization.orgName
* 1 ,
* @author
* @param columnNames
* String[] column={"属性1","属性2","属性3"};
* @param pojoClass
* Class,Mobile.class;
* @param aials
* POJO
* @return DetachedCriteria
*
* @param forJoinTable
*/
public static void selectColumn(DetachedCriteria criteria, String[] columnNames,
Class<?> pojoClass,boolean forJoinTable) {
if (null == columnNames) {
return;
}
//使用这个临时变量集合是因为dinstinct关键字要放在最前面而distinct关键字要在下面才决定放不放
List<Projection> tempProjectionList = new ArrayList<Projection>();
Set<String> aliases = getAliasesFromRequest();
boolean hasJoniTable = false;
String rootAlias = criteria.getAlias();
for (String property : columnNames) {
if(property.contains("_")){
String[] propertyChain = property.split("_");
createAlias(criteria,rootAlias,aliases,propertyChain,0);
tempProjectionList.add(Projections.property(StringUtil.getProperty(property)).as(StringUtil.getProperty(property)));
hasJoniTable = true;
}else{
tempProjectionList.add(Projections.property(rootAlias + POINT + property).as(property));
}
}
projectionList = Projections.projectionList();
if(hasJoniTable || forJoinTable || getHasJoinTatleFromRequest()){//这个一定要放在tempProjectionList的前面因为distinct要在最前面
projectionList.add(Projections.distinct(Projections.id()));
}
for (Projection proj : tempProjectionList) {
projectionList.add(proj);
}
criteria.setProjection(projectionList);
if(!hasJoniTable){
criteria.setResultTransformer(Transformers.aliasToBean(pojoClass));
}else{//下面这个是自定义的结果转换器
criteria.setResultTransformer(new AliasToBean(pojoClass));
}
}
private static final String POINT = ".";
/**
*
* @author
* 2009-9-9
* @param criteria
* @param rootAlais
* @param aliases
* @param columns
* @param currentStep
*/
private static void createAlias(DetachedCriteria criteria, String rootAlais, Set<String> aliases,String[] columns,int currentStep){
if(currentStep<columns.length-1){
if(!aliases.contains(converArrayToAlias(columns, currentStep))){
if(currentStep>0){
criteria.createAlias(converArrayToAlias(columns, currentStep-1) + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
}else{
criteria.createAlias(rootAlais + POINT +columns[currentStep], converArrayToAlias(columns, currentStep)).setFetchMode(columns[currentStep], FetchMode.JOIN);
}
aliases.add(converArrayToAlias(columns, currentStep));
}
currentStep++;
createAlias(criteria, rootAlais, aliases, columns, currentStep);
}
}
/**
* "organization.parentOrganization.parentOrganization.parentOrganization.id"
* "organization_parentOrganization_parentOrganization_parentOrganization.id"
* @author
* 2009-9-20
* @param property
* @return
*/
public static String getAliasFromPropertyChainString(String property){
if(property.contains(".")){
return property.substring(0, property.lastIndexOf(POINT)).replaceAll("\\.", "_") + property.substring(property.lastIndexOf(POINT));
}
return property;
}
/**
* ALIAS
* @author
* 2009-9-10
* @param columns
* @param currentStep
* @return
*/
private static String converArrayToAlias(String[] columns,int currentStep){
StringBuilder alias = new StringBuilder();
for (int i = 0; i <= currentStep; i++) {
if(alias.length()>0){
alias.append("_");
}
alias.append(columns[i]);
}
return alias.toString();
}
}

@ -1,154 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.List;
import java.util.Map;
import org.hibernate.type.Type;
import org.jeecgframework.core.common.model.json.DataGrid;
public class HqlQuery {
private int curPage =1;
private int pageSize = 10;
private String myaction;
private String myform;
private String queryString;
private Object[] param;
private Type[] types;
private Map<String, Object> map;
private DataGrid dataGrid;
private String field="";//查询需要显示的字段
private Class class1;
private List results;// 结果集
private int total;
public List getResults() {
return results;
}
public void setResults(List rsults) {
this.results = results;
}
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public Class getClass1() {
return class1;
}
public void setClass1(Class class1) {
this.class1 = class1;
}
public DataGrid getDataGrid() {
return dataGrid;
}
public void setDataGrid(DataGrid dataGrid) {
this.dataGrid = dataGrid;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
public Map<String, Object> getMap() {
return map;
}
public void setMap(Map<String, Object> map) {
this.map = map;
}
public HqlQuery(String queryString, Object[] param, Map<String, Object> map) {
this.queryString = queryString;
this.param = param;
this.map = map;
}
public HqlQuery(String queryString, Map<String, Object> map) {
this.queryString = queryString;
this.map = map;
}
public HqlQuery(String myaction) {
this.myaction = myaction;
}
public Object[] getParam() {
return param;
}
public HqlQuery(String myaction, String queryString, Object[] param, Type[] types) {
this.myaction = myaction;
this.queryString = queryString;
this.param = param;
this.types = types;
}
public HqlQuery(Class class1,String hqlString,DataGrid dataGrid) {
this.dataGrid=dataGrid;
this.queryString=hqlString;
this.pageSize=dataGrid.getRows();
this.field=dataGrid.getField();
this.class1=class1;
}
public void setParam(Object[] param) {
this.param = param;
}
public int getCurPage() {
return curPage;
}
public void setCurPage(int curPage) {
this.curPage = curPage;
}
public String getMyaction() {
return myaction;
}
public void setMyaction(String myaction) {
this.myaction = myaction;
}
public String getMyform() {
return myform;
}
public void setMyform(String myform) {
this.myform = myform;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getQueryString() {
return queryString;
}
public void setQueryString(String queryString) {
this.queryString = queryString;
}
public Type[] getTypes() {
return types;
}
public void setTypes(Type[] types) {
this.types = types;
}
}

@ -1,88 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.List;
/**
*
*
*
*@date 2012-12-7 10:20:04
*@version 1.0
*/
@SuppressWarnings("unchecked")
public class PageList {
private int curPageNO;
private int offset;
private String toolBar;//分页工具条
private int count;
private List resultList = null;//结果集
public PageList() {
}
/**
* 使
* @param resultList
* @param toolBar
* @param offset
* @param curPageNO
* @param count
*/
public PageList(List resultList, String toolBar, int offset, int curPageNO, int count) {
this.curPageNO = curPageNO;
this.offset = offset;
this.toolBar = toolBar;
this.resultList = resultList;
this.count = count;
}
/**
* 使
* @param resultList
* @param toolBar
* @param offset
* @param curPageNO
* @param count
*/
public PageList(CriteriaQuery cq,List resultList, int offset, int curPageNO, int count) {
this.curPageNO = curPageNO;
this.offset = offset;
this.resultList = resultList;
this.count = count;
}
public PageList(HqlQuery cq,List resultList, int offset, int curPageNO, int count) {
this.curPageNO = curPageNO;
this.offset = offset;
this.resultList = resultList;
this.count = count;
}
public <T> List<T> getResultList() {
return resultList;
}
public void setResultList(List resultList) {
this.resultList = resultList;
}
public String getToolBar() {
return toolBar;
}
public int getCount() {
return count;
}
public int getCurPageNO() {
return curPageNO;
}
public void setCurPageNO(int curPageNO) {
this.curPageNO = curPageNO;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
}

@ -1,167 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.Map;
/**
* (使)
* @author jeecg
* @version1.0
*/
public class Pager {
private int curPageNO = 1; // 当前页
private int pageSize; // 每页显示的记录数
private int rowsCount; // 记录行数
private int pageCount; // 页数
private Map<String, Object> map;// 封装查询条件
/**
* @param allCount
*
* @param offset
*
* @param pageSize
*
*/
public Pager(int allCount,int curPagerNo, int pageSize, Map<String, Object> map) {
this.curPageNO = curPagerNo;
this.pageSize = pageSize;
this.rowsCount = allCount;
this.map = map;
this.pageCount = (int) Math.ceil((double) allCount / pageSize);
}
public Pager() {
}
// getPageSize返回分页大小
public int getPageSize() {
return pageSize;
}
// getRowsCount返回总记录行数
public int getRowsCount() {
return rowsCount;
}
// getPageCount返回总页数
public int getPageCount() {
return pageCount;
}
// 第一页
public int first() {
return 1;
}
// 最后一页
public int last() {
return pageCount;
}
// 上一页
public int previous() {
return (curPageNO - 1 < 1) ? 1 : curPageNO - 1;
}
// 下一页
public int next() {
return (curPageNO + 1 > pageCount) ? pageCount : curPageNO + 1;
}
// 第一页
public boolean isFirst() {
return (curPageNO == 1) ? true : false;
}
// 最后一页
public boolean isLast() {
return (curPageNO == pageCount) ? true : false;
}
public String toString() {
return "Pager的值为 " + " curPageNO = " + curPageNO + " limit = " + pageSize + " rowsCount = " + rowsCount + " pageCount = " + pageCount;
}
/**
*
*
* @return String
*/
public String getToolBar(String url) {
String temp = "";
String conditions = "";
if (map.size() > 0) {
for (Map.Entry<String, Object> entry : map.entrySet()) {
conditions += "&" + entry.getKey() + "=" + entry.getValue();
}
}
if (url.indexOf("?") == -1) {
temp = "?";
} else {
temp = "&";
}
String str = "";
str += "";
if (isFirst())
str += "第" + curPageNO + "页&nbsp;共" + pageCount + "页&nbsp;首页 上一页&nbsp;";
else {
str += "第" + curPageNO + "页&nbsp;共" + pageCount + "页&nbsp;<a href='" + url + temp + "curPageNO=1" + conditions + "'>首页</a>&nbsp;";
str += "<a href='" + url + temp + "curPageNO=" + previous() + conditions + "' onMouseMove=\"style.cursor='hand'\" alt=\"上一页\">上一页</a>&nbsp;";
}
if (isLast() || rowsCount == 0)
str += "下一页 尾页&nbsp;";
else {
str += "<a href='" + url + temp + "curPageNO=" + next() + conditions + "' onMouseMove=\"style.cursor='hand'\" >下一页</a>&nbsp;";
str += "<a href='" + url + temp + "curPageNO=" + pageCount + conditions + "'>尾页</a>&nbsp;";
}
str += "&nbsp;共" + rowsCount + "条记录&nbsp;";
str += "&nbsp;转到<select name='page' onChange=\"location='" + url + temp + "curPageNO='+this.options[this.selectedIndex].value\">"; int begin = (curPageNO > 10) ? curPageNO - 10 : 1; int end = (pageCount - curPageNO > 10) ? curPageNO + 10 : pageCount; for (int i = begin; i <= end; i++) { if (i == curPageNO) str += "<option value='" + i + "' selected>第" + i + "页</option>"; else str += "<option value='" + i + "'>第" + i + "页</option>"; } str += "</select>";
return str;
}
/**
*
*
* @return String
*/
public String getToolBar(String myaction, String myform) {
String str = "";
str += "<script language='javascript'>" + "\n";
str += "function commonSubmit(val){" + "\n";
// 校验是否全由数字组成
str += "var patrn=/^[0-9]{1,20}$/;" + "\n";
str += "if (!patrn.exec(val)){" + "\n";
str += " alert(\"请输入有效页号!\");" + "\n";
str += " return false ;" + "\n";
str += " }else{" + "\n";
str += " document." + myform + ".action='" + myaction + "&curPageNO='+val;" + "\n";
str += " document." + myform + ".submit();" + "\n";
str += " return true ;" + "\n";
str += "} " + "\n";
str += " }" + "\n";
str += "</script>" + "\n";
str += "&nbsp;<DIV class=pageArea id=pageArea>共<b>" + rowsCount + "</b>条&nbsp;当前第" + curPageNO + "/" + pageCount + "页&nbsp;&nbsp;&nbsp;";
if (curPageNO == 1 || curPageNO == 0)
str += "<a class=pageFirstDisable title=首页 onMouseMove=\"style.cursor='hand'\">&nbsp;<a class=pagePreviousDisable title=上一页 onMouseMove=\"style.cursor='hand'\"></a>";
else {
str += "<a class=pageFirst title=首页 onMouseMove=\"style.cursor='hand'\" onclick=\"commonSubmit(1)\"></a>";
str += "<a class=pagePrevious title=上一页 onMouseMove=\"style.cursor='hand'\" onclick=\"commonSubmit(" + (curPageNO - 1) + ")\"></a>";
}
if (curPageNO - pageCount == 0 || pageCount == 0 || pageCount == 1)
str += "<a class=pageNextDisable title=下一页 onMouseMove=\"style.cursor='hand'\">&nbsp;<a class=pageLastDisable title=尾页 onMouseMove=\"style.cursor='hand'\"></a>&nbsp;";
else {
str += "<a class=pageNext title=下一页 onMouseMove=\"style.cursor='hand'\" onclick=\"commonSubmit(" + (curPageNO + 1) + ")\"></a>";
str += "<a class=pageLast title=尾页 onMouseMove=\"style.cursor='hand'\" onclick=\"commonSubmit(" + pageCount + ")\"></a>";
}
if (pageCount == 1 || pageCount == 0) {
str += " &nbsp;转到:<input class=SmallInput type=text style=TEXT-ALIGN: center maxLength=5 name=\"pageroffsetll\" size=3 onKeyPress=\"if (event.keyCode == 13) return commonSubmit(document.all.pageroffsetll.value)\" > 页&nbsp;";
str += "<A class=pageGoto id=pageGoto title=转到 onclick='return commonSubmit()'></A></DIV>";
} else {
str += " &nbsp;转到:<input class=SmallInput type=text style=TEXT-ALIGN: center maxLength=5 name=\"pageroffsetll\" size=3 onKeyPress=\"if (event.keyCode == 13) return commonSubmit(document.all.pageroffsetll.value)\" > 页&nbsp;";
str += "<A class=pageGoto id=pageGoto title=转到 onclick='commonSubmit(document.all.pageroffsetll.value)'></A></DIV>";
}
return str;
}
}

@ -1,76 +0,0 @@
package org.jeecgframework.core.common.hibernate.qbc;
import java.util.Map;
import org.omg.CORBA.PUBLIC_MEMBER;
/**
*
*
*@date 2012-12-7 10:19:14
*@version 1.0
*/
public class PagerUtil {
public PagerUtil() {
}
public static String getBar(String action, String form, int allCounts, int curPageNO, int pageSize, Map<String, Object> map) {
Pager pager = null;
try {
if (curPageNO > (int) Math.ceil((double) allCounts / pageSize))
curPageNO = (int) Math.ceil((double) allCounts / pageSize);
if (curPageNO <= 1)
curPageNO = 1;
// 得到offset
pager = new Pager(allCounts, curPageNO, pageSize, map);
} catch (Exception e) {
org.jeecgframework.core.util.LogUtil.info("生成工具条出错!");
}
return pager.getToolBar(action, form);
}
public static String getBar(String url, int allCounts, int curPageNO, int pageSize, Map<String, Object> map) {
Pager pager = null;
try {
if (curPageNO > (int) Math.ceil((double) allCounts / pageSize))
curPageNO = (int) Math.ceil((double) allCounts / pageSize);
if (curPageNO <= 1)
curPageNO = 1;
// 得到offset
// 生成工具条
pager = new Pager(allCounts, curPageNO, pageSize, map);
} catch (Exception e) {
org.jeecgframework.core.util.LogUtil.info("生成工具条出错!");
}
return pager.getToolBar(url);
}
public static int getOffset(int rowCounts, int curPageNO, int pageSize) {
int offset = 0;
try {
if (curPageNO > (int) Math.ceil((double) rowCounts / pageSize))
curPageNO = (int) Math.ceil((double) rowCounts / pageSize);
// 得到第几页
if (curPageNO <= 1)
curPageNO = 1;
// 得到offset
offset = (curPageNO - 1) * pageSize;
} catch (Exception e) {
org.jeecgframework.core.util.LogUtil.info("getOffset出错!");
}
return offset;
}
public static int getcurPageNo(int rowCounts, int curPageNO, int pageSize) {
try {
// 得到第几页
if (curPageNO > (int) Math.ceil((double) rowCounts / pageSize))
curPageNO = (int) Math.ceil((double) rowCounts / pageSize);
if (curPageNO <= 1)
curPageNO = 1;
} catch (Exception e) {
org.jeecgframework.core.util.LogUtil.info("getOffset出错!");
}
return curPageNO;
}
}

@ -1,51 +0,0 @@
package org.jeecgframework.core.common.model.common;
import java.io.Serializable;
import java.util.List;
import com.thoughtworks.xstream.annotations.XStreamAlias;
/**
*
* @author Hank
* 2014-01-25 List<T> class1-->tableEntityClass
* @param <T>
*/
public class DBTable<T> implements Serializable {
public String tableName;
public String entityName;
public String tableTitle;
public Class<T> tableEntityClass;
public List<T> tableData;
public String getTableName() {
return tableName;
}
public void setTableName(String tableName) {
this.tableName = tableName;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
public String getTableTitle() {
return tableTitle;
}
public void setTableTitle(String tableTitle) {
this.tableTitle = tableTitle;
}
public Class<T> getClass1() {
return tableEntityClass;
}
public void setClass1(Class<T> class1) {
this.tableEntityClass = class1;
}
public List<T> getTableData() {
return tableData;
}
public void setTableData(List<T> tableData) {
this.tableData = tableData;
}
}

@ -1,211 +0,0 @@
package org.jeecgframework.core.common.model.common;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.core.util.StringUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
*
*
* @author
*
*/
public class UploadFile {
private String byteField = "attachmentcontent";// 二进制文件内容保存到数据库的对应实体类字段
private String titleField = "attachmenttitle";// 文件名(标题)保存到数据库的对应实体类字段
private String basePath = "upload";// 文件保存目录根路径
private String realPath = "realpath";// 文件保存在硬盘的全路径对应实体字段
private String extend = "extend";// 扩展名
private boolean view = false;// 是否是预览
private boolean rename =true;// 是否重命名
private String swfpath;// 转换SWF
private String cusPath;// 文件物理路径自定义子目录
private byte[] content;// 预览或下载时传入的文件二进制内容
private Object object;// 文件对应实体对象
private String fileKey;// 上传文件ID
private MultipartHttpServletRequest multipartRequest;
private HttpServletRequest request;
private HttpServletResponse response;
/**
* @param response
* the response to set
*/
public void setResponse(HttpServletResponse response) {
this.response = response;
}
public UploadFile(HttpServletRequest request, Object object) {
String fileKey = oConvertUtils.getString(request.getParameter("fileKey"));// 文件ID
if (StringUtil.isNotEmpty(fileKey)) {
this.fileKey = fileKey;
this.request = request;
} else {
this.multipartRequest = (MultipartHttpServletRequest) request;
}
this.object = object;
}
public UploadFile(HttpServletRequest request) {
this.multipartRequest = (MultipartHttpServletRequest) request;
}
public UploadFile(HttpServletRequest request, HttpServletResponse response) {
this.request = request;
this.response = response;
}
public UploadFile() {
}
public String getSwfpath() {
return swfpath;
}
public void setSwfpath(String swfpath) {
this.swfpath = swfpath;
}
/**
* @return the realPath
*/
public String getRealPath() {
return realPath;
}
/**
* @param realPath
* the realPath to set
*/
public void setRealPath(String realPath) {
this.realPath = realPath;
}
/**
* @return the response
*/
public HttpServletResponse getResponse() {
return response;
}
/**
* @return the request
*/
public HttpServletRequest getRequest() {
return request;
}
/**
* @param request
* the request to set
*/
public void setRequest(HttpServletRequest request) {
this.request = request;
}
/**
* @return the multipartRequest
*/
public MultipartHttpServletRequest getMultipartRequest() {
return multipartRequest;
}
public String get(String name) {
return getMultipartRequest().getParameter(name);
}
/**
* @param multipartRequest
* the multipartRequest to set
*/
public void setMultipartRequest(MultipartHttpServletRequest multipartRequest) {
this.multipartRequest = multipartRequest;
}
public Object getObject() {
return object;
}
public String getBasePath() {
return basePath;
}
public void setBasePath(String basePath) {
this.basePath = basePath;
}
public void setObject(Object object) {
this.object = object;
}
public String getByteField() {
return byteField;
}
public void setByteField(String byteField) {
this.byteField = byteField;
}
public String getTitleField() {
return titleField;
}
public void setTitleField(String titleField) {
this.titleField = titleField;
}
public String getCusPath() {
return cusPath;
}
public void setCusPath(String cusPath) {
this.cusPath = cusPath;
}
public String getExtend() {
return extend;
}
public void setExtend(String extend) {
this.extend = extend;
}
public boolean isView() {
return view;
}
public void setView(boolean view) {
this.view = view;
}
public byte[] getContent() {
return content;
}
public void setContent(byte[] content) {
this.content = content;
}
public String getFileKey() {
return fileKey;
}
public void setFileKey(String fileKey) {
this.fileKey = fileKey;
}
public boolean isRename() {
return rename;
}
public void setRename(boolean rename) {
this.rename = rename;
}
}

@ -1,58 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.Map;
import com.alibaba.fastjson.JSONObject;
/**
* $.ajaxJSON
*
* @author
*
*/
public class AjaxJson {
private boolean success = true;// 是否成功
private String msg = "操作成功";// 提示信息
private Object obj = null;// 其他信息
private Map<String, Object> attributes;// 其他参数
public Map<String, Object> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
public boolean isSuccess() {
return success;
}
public void setSuccess(boolean success) {
this.success = success;
}
public String getJsonStr(){
JSONObject obj = new JSONObject();
obj.put("success", this.isSuccess());
obj.put("msg", this.getMsg());
obj.put("obj", this.obj);
obj.put("attributes", this.attributes);
return obj.toJSONString();
}
}

@ -1,38 +0,0 @@
package org.jeecgframework.core.common.model.json;
/**
* JSONeasyuidatagrid
*
* @author
*
*/
public class ComboBox {
private String id;
private String text;
private boolean selected;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public boolean isSelected() {
return selected;
}
public void setSelected(boolean selected) {
this.selected = selected;
}
}

@ -1,72 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.List;
import java.util.Map;
public class ComboTree implements java.io.Serializable {
private String id;
private String text;// 树节点名称
private String iconCls;// 前面的小图标样式
private Boolean checked = false;// 是否勾选状态
private Map<String, Object> attributes;// 其他参数
private List<ComboTree> children;// 子节点
private String state = "open";// 是否展开(open,closed)
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public Boolean getChecked() {
return checked;
}
public void setChecked(Boolean checked) {
this.checked = checked;
}
public Map<String, Object> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
public List<ComboTree> getChildren() {
return children;
}
public void setChildren(List<ComboTree> children) {
this.children = children;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
public String getIconCls() {
return iconCls;
}
public void setIconCls(String iconCls) {
this.iconCls = iconCls;
}
}

@ -1,101 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.List;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.tag.vo.datatable.SortDirection;
/**
* easyuidatagrid使model
*
* @author
*
*/
public class DataGrid {
private int page = 1;// 当前页
private int rows = 10;// 每页显示记录数
private String sort = null;// 排序字段名
private SortDirection order = SortDirection.asc;// 按什么排序(asc,desc)
private String field;//字段
private String treefield;//树形数据表文本字段
private List results;// 结果集
private int total;//总记录数
private String footer;//合计列
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public String getField() {
return field;
}
public List getResults() {
return results;
}
public void setResults(List results) {
this.results = results;
}
public void setField(String field) {
this.field = field;
}
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getRows() {
if(ContextHolderUtils.getRequest()!=null&&ResourceUtil.getParameter("rows")!=null){
return rows;
}
return 10000;
}
public void setRows(int rows) {
this.rows = rows;
}
public String getSort() {
return sort;
}
public void setSort(String sort) {
this.sort = sort;
}
public SortDirection getOrder() {
return order;
}
public void setOrder(SortDirection order) {
this.order = order;
}
public String getTreefield() {
return treefield;
}
public void setTreefield(String treefield) {
this.treefield = treefield;
}
public String getFooter() {
return footer;
}
public void setFooter(String footer) {
this.footer = footer;
}
}

@ -1,46 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.List;
/**
* JSONeasyuidatagrid
*
* @author
*
*/
public class DataGridReturn {
public DataGridReturn(Integer total, List rows) {
this.total = total;
this.rows = rows;
}
private Integer total;// 总记录数
private List rows;// 每行记录
private List footer;
public Integer getTotal() {
return total;
}
public void setTotal(Integer total) {
this.total = total;
}
public List getRows() {
return rows;
}
public void setRows(List rows) {
this.rows = rows;
}
public List getFooter() {
return footer;
}
public void setFooter(List footer) {
this.footer = footer;
}
}

@ -1,31 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.List;
/**
*
* @author
*
*/
public class Highchart {
private String name;
private String type;//类型
private List data;//数据
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List getData() {
return data;
}
public void setData(List data) {
this.data = data;
}
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

@ -1,77 +0,0 @@
package org.jeecgframework.core.common.model.json;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.multipart.MultipartHttpServletRequest;
/**
*
*
* @author
*
*/
public class ImportFile {
private Object object;// 导出实体对象
private String fileName;// 文件保存在硬盘的全路径对应实体字段
private String entityName;//导出实体名
private String field;
private Class entityClass;
private MultipartHttpServletRequest multipartRequest;
private HttpServletRequest request;
private HttpServletResponse response;
public Object getObject() {
return object;
}
public void setObject(Object object) {
this.object = object;
}
public Class getEntityClass() {
return entityClass;
}
public void setEntityClass(Class entityClass) {
this.entityClass = entityClass;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getEntityName() {
return entityName;
}
public void setEntityName(String entityName) {
this.entityName = entityName;
}
public MultipartHttpServletRequest getMultipartRequest() {
return multipartRequest;
}
public void setMultipartRequest(MultipartHttpServletRequest multipartRequest) {
this.multipartRequest = multipartRequest;
}
public HttpServletRequest getRequest() {
return request;
}
public void setRequest(HttpServletRequest request) {
this.request = request;
}
public HttpServletResponse getResponse() {
return response;
}
public void setResponse(HttpServletResponse response) {
this.response = response;
}
public ImportFile(HttpServletRequest request, HttpServletResponse response) {
this.request = request;
this.response = response;
}
public String getField() {
return field;
}
public void setField(String field) {
this.field = field;
}
}

@ -1,18 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.ElementType;
/**
* @author pengjin
* @version 2.1
* @since 2.1
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface LogAnnotation {
String operateModelNm();
String operateFuncNm();
String operateDescribe();
}

@ -1,64 +0,0 @@
package org.jeecgframework.core.common.model.json;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@JsonIgnoreProperties(value = { "hibernateLazyInitializer" })
public class ProjectDeclare {
private Integer detialid;//明细编号
private Integer declareid;//申报编号
private String constructionunit;//建设单位
private String projectname;//项目名称
private String statusid;//状态
private String buildingno;//栋号
private Double undergroundconstructionarea;//地下建筑面积
private String geom;
public Integer getDetialid() {
return detialid;
}
public void setDetialid(Integer detialid) {
this.detialid = detialid;
}
public Integer getDeclareid() {
return declareid;
}
public void setDeclareid(Integer declareid) {
this.declareid = declareid;
}
public String getConstructionunit() {
return constructionunit;
}
public void setConstructionunit(String constructionunit) {
this.constructionunit = constructionunit;
}
public String getProjectname() {
return projectname;
}
public void setProjectname(String projectname) {
this.projectname = projectname;
}
public String getStatusid() {
return statusid;
}
public void setStatusid(String statusid) {
this.statusid = statusid;
}
public String getBuildingno() {
return buildingno;
}
public void setBuildingno(String buildingno) {
this.buildingno = buildingno;
}
public Double getUndergroundconstructionarea() {
return undergroundconstructionarea;
}
public void setUndergroundconstructionarea(Double undergroundconstructionarea) {
this.undergroundconstructionarea = undergroundconstructionarea;
}
public String getGeom() {
return geom;
}
public void setGeom(String geom) {
this.geom = geom;
}
}

@ -1,31 +0,0 @@
package org.jeecgframework.core.common.model.json;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
@JsonIgnoreProperties(value = { "hibernateLazyInitializer" })
public class ProjectInfo {
private Integer gid;//
private String name;//名称(项目)
private String geom;
public Integer getGid() {
return gid;
}
public void setGid(Integer gid) {
this.gid = gid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getGeom() {
return geom;
}
public void setGeom(String geom) {
this.geom = geom;
}
}

@ -1,87 +0,0 @@
package org.jeecgframework.core.common.model.json;
import java.util.Map;
public class TreeGrid implements java.io.Serializable {
private String id;
private String text;
private String parentId;
private String parentText;
private String code;
private String src;
private String note;
private Map<String,String> attributes;// 其他参数
private String operations;// 其他参数
private String state = "open";// 是否展开(open,closed)
private String order;//排序
public String getOrder() {
return order;
}
public void setOrder(String order) {
this.order = order;
}
public String getOperations() {
return operations;
}
public void setOperations(String operations) {
this.operations = operations;
}
public Map<String, String> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, String> attributes) {
this.attributes = attributes;
}
public String getParentText() {
return parentText;
}
public void setParentText(String parentText) {
this.parentText = parentText;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getSrc() {
return src;
}
public void setSrc(String src) {
this.src = src;
}
public String getNote() {
return note;
}
public void setNote(String note) {
this.note = note;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getText() {
return text;
}
public void setText(String text) {
this.text = text;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
public String getState() {
return state;
}
public void setState(String state) {
this.state = state;
}
}

@ -1,27 +0,0 @@
package org.jeecgframework.core.common.model.json;
/**
* $.ajaxJSON
*
* @author
*
*/
public class ValidForm {
private String status ="y";// 是否成功
private String info = "验证通过";//提示信息
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getInfo() {
return info;
}
public void setInfo(String info) {
this.info = info;
}
}

@ -1,358 +0,0 @@
package org.jeecgframework.core.common.service;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.hibernate.qbc.HqlQuery;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.model.common.DBTable;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.DataGridReturn;
import org.jeecgframework.core.common.model.json.ImportFile;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.jeecgframework.tag.vo.easyui.Autocomplete;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
import org.springframework.dao.DataAccessException;
public interface CommonService {
/**
*
*
* @return
*/
public List<DBTable> getAllDbTableName();
public Integer getAllDbTableSize();
public <T> Serializable save(T entity);
public <T> void saveOrUpdate(T entity);
public <T> void delete(T entity);
public <T> void batchSave(List<T> entitys);
/**
*
*
* @param <T>
* @param entityName
* @param id
* @return
*/
public <T> T get(Class<T> class1, Serializable id);
/**
*
*
* @param <T>
* @param entityName
* @param id
* @return
*/
public <T> T getEntity(Class entityName, Serializable id);
/**
*
*
* @param <T>
* @param entityClass
* @param propertyName
* @param value
* @return
*/
public <T> T findUniqueByProperty(Class<T> entityClass,
String propertyName, Object value);
/**
* .
*/
public <T> List<T> findByProperty(Class<T> entityClass,
String propertyName, Object value);
/**
*
*
* @param <T>
* @param entityClass
* @return
*/
public <T> List<T> loadAll(final Class<T> entityClass);
/**
*
*
* @param <T>
* @param entities
*/
public <T> void deleteEntityById(Class entityName, Serializable id);
/**
*
*
* @param <T>
* @param entities
*/
public <T> void deleteAllEntitie(Collection<T> entities);
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void updateEntitie(T pojo);
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findByQueryString(String hql);
/**
* sql
*
* @param query
* @return
*/
public int updateBySqlString(String sql);
/**
* sqlList
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findListbySql(String query);
/**
*
*
* @param <T>
* @param clas
* @return
*/
public <T> List<T> findByPropertyisOrder(Class<T> entityClass,
String propertyName, Object value, boolean isAsc);
public <T> List<T> getList(Class clas);
public <T> T singleResult(String hql);
/**
*
* cq
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final CriteriaQuery cq, final boolean isOffset);
/**
* DataTableReturn
*
* @param cq
* @param isOffset
* @return
*/
public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
final boolean isOffset);
/**
* easyui datagrid
*
* @param cq
* @param isOffset
* @return
*/
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
final boolean isOffset);
/**
*
* hqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final HqlQuery hqlQuery,
final boolean needParameter);
/**
*
* sqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageListBySql(final HqlQuery hqlQuery,
final boolean isToEntity);
public Session getSession();
public List findByExample(final String entityName,
final Object exampleEntity);
/**
* cq
*
* @param <T>
* @param cq
* @return
*/
public <T> List<T> getListByCriteriaQuery(final CriteriaQuery cq,
Boolean ispage);
/**
*
*
* @param request
*/
public <T> T uploadFile(UploadFile uploadFile);
public HttpServletResponse viewOrDownloadFile(UploadFile uploadFile);
/**
* XML
*
* @param fileName
* XML
*/
public HttpServletResponse createXml(ImportFile importFile);
/**
* XML
*
* @param fileName
* XML
*/
public void parserXml(String fileName);
public List<ComboTree> comTree(List<TSDepart> all, ComboTree comboTree);
/**
* JSON
*
* @param all
*
* @param in
*
* @param comboBox
*
* @return
*/
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel,
List in);
/**
*
*
* @param all
* @param treeGridModel
* @return
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel);
/**
*
*
* @param <T>
* @return
*/
public <T> List<T> getAutoList(Autocomplete autocomplete);
/**
* SQL
*/
public Integer executeSql(String sql, List<Object> param);
/**
* SQL
*/
public Integer executeSql(String sql, Object... param);
/**
* SQL 使:name
*/
public Integer executeSql(String sql, Map<String, Object> param);
/**
* SQL 使:name,
*/
public Object executeSqlReturnKey(String sql, Map<String, Object> param);
/**
* JDBC 使
*/
public List<Map<String, Object>> findForJdbc(String sql, Object... objs);
/**
* JDBC 使
*/
public Map<String, Object> findOneForJdbc(String sql, Object... objs);
/**
* JDBC, 使
*/
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows);
/**
* JDBC, 使
*/
public <T> List<T> findObjForJdbc(String sql, int page, int rows,
Class<T> clazz);
/**
* 使-
*
* @param criteria
* @param firstResult
* @param maxResults
* @return
* @throws DataAccessException
*/
public List<Map<String, Object>> findForJdbcParam(String sql, int page,
int rows, Object... objs);
/**
* 使For JDBC
*/
public Long getCountForJdbc(String sql);
/**
* 使For JDBC-
*
*/
public Long getCountForJdbcParam(String sql, Object[] objs);
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findHql(String hql, Object... param);
public <T> List<T> pageList(DetachedCriteria dc, int firstResult,
int maxResult);
public <T> List<T> findByDetached(DetachedCriteria dc);
}

@ -1,460 +0,0 @@
package org.jeecgframework.core.common.service.impl;
import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import org.jeecgframework.web.system.pojo.base.TSDepart;
import org.hibernate.Session;
import org.hibernate.criterion.DetachedCriteria;
import org.jeecgframework.core.common.dao.ICommonDao;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.common.hibernate.qbc.HqlQuery;
import org.jeecgframework.core.common.hibernate.qbc.PageList;
import org.jeecgframework.core.common.model.common.DBTable;
import org.jeecgframework.core.common.model.common.UploadFile;
import org.jeecgframework.core.common.model.json.ComboTree;
import org.jeecgframework.core.common.model.json.DataGridReturn;
import org.jeecgframework.core.common.model.json.ImportFile;
import org.jeecgframework.core.common.model.json.TreeGrid;
import org.jeecgframework.core.common.service.CommonService;
import org.jeecgframework.tag.vo.datatable.DataTableReturn;
import org.jeecgframework.tag.vo.easyui.Autocomplete;
import org.jeecgframework.tag.vo.easyui.ComboTreeModel;
import org.jeecgframework.tag.vo.easyui.TreeGridModel;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service("commonService")
@Transactional
public class CommonServiceImpl implements CommonService {
public ICommonDao commonDao = null;
/**
*
*
* @return
*/
public List<DBTable> getAllDbTableName() {
return commonDao.getAllDbTableName();
}
public Integer getAllDbTableSize() {
return commonDao.getAllDbTableSize();
}
@Resource
public void setCommonDao(ICommonDao commonDao) {
this.commonDao = commonDao;
}
public <T> Serializable save(T entity) {
return commonDao.save(entity);
}
public <T> void saveOrUpdate(T entity) {
commonDao.saveOrUpdate(entity);
}
public <T> void delete(T entity) {
commonDao.delete(entity);
}
/**
*
*
* @param <T>
* @param entities
*/
public <T> void deleteAllEntitie(Collection<T> entities) {
commonDao.deleteAllEntitie(entities);
}
/**
*
*/
public <T> T get(Class<T> class1, Serializable id) {
return commonDao.get(class1, id);
}
/**
*
*
* @param <T>
* @param hql
* @param size
* @return
*/
public <T> List<T> getList(Class clas) {
return commonDao.loadAll(clas);
}
/**
*
*/
public <T> T getEntity(Class entityName, Serializable id) {
return commonDao.getEntity(entityName, id);
}
/**
*
*
* @param <T>
* @param entityClass
* @param propertyName
* @param value
* @return
*/
public <T> T findUniqueByProperty(Class<T> entityClass,
String propertyName, Object value) {
return commonDao.findUniqueByProperty(entityClass, propertyName, value);
}
/**
* .
*/
public <T> List<T> findByProperty(Class<T> entityClass,
String propertyName, Object value) {
return commonDao.findByProperty(entityClass, propertyName, value);
}
/**
*
*
* @param <T>
* @param entityClass
* @return
*/
public <T> List<T> loadAll(final Class<T> entityClass) {
return commonDao.loadAll(entityClass);
}
public <T> T singleResult(String hql) {
return commonDao.singleResult(hql);
}
/**
* ID
*
* @param <T>
* @param entities
*/
public <T> void deleteEntityById(Class entityName, Serializable id) {
commonDao.deleteEntityById(entityName, id);
}
/**
*
*
* @param <T>
* @param pojo
*/
public <T> void updateEntitie(T pojo) {
commonDao.updateEntitie(pojo);
}
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findByQueryString(String hql) {
return commonDao.findByQueryString(hql);
}
/**
* sql
*
* @param query
* @return
*/
public int updateBySqlString(String sql) {
return commonDao.updateBySqlString(sql);
}
/**
* sqlList
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findListbySql(String query) {
return commonDao.findListbySql(query);
}
/**
*
*
* @param <T>
* @param clas
* @return
*/
public <T> List<T> findByPropertyisOrder(Class<T> entityClass,
String propertyName, Object value, boolean isAsc) {
return commonDao.findByPropertyisOrder(entityClass, propertyName,
value, isAsc);
}
/**
*
* cq
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final CriteriaQuery cq, final boolean isOffset) {
return commonDao.getPageList(cq, isOffset);
}
/**
* DataTableReturn
*
* @param cq
* @param isOffset
* @return
*/
public DataTableReturn getDataTableReturn(final CriteriaQuery cq,
final boolean isOffset) {
return commonDao.getDataTableReturn(cq, isOffset);
}
/**
* easyui datagrid
*
* @param cq
* @param isOffset
* @return
*/
public DataGridReturn getDataGridReturn(final CriteriaQuery cq,
final boolean isOffset) {
return commonDao.getDataGridReturn(cq, isOffset);
}
/**
*
* hqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageList(final HqlQuery hqlQuery,
final boolean needParameter) {
return commonDao.getPageList(hqlQuery, needParameter);
}
/**
*
* sqlQuery
*
* @param cq
* @param isOffset
* @return
*/
public PageList getPageListBySql(final HqlQuery hqlQuery,
final boolean isToEntity) {
return commonDao.getPageListBySql(hqlQuery, isToEntity);
}
public Session getSession()
{
return commonDao.getSession();
}
public List findByExample(final String entityName,
final Object exampleEntity) {
return commonDao.findByExample(entityName, exampleEntity);
}
/**
* cq
*
* @param <T>
* @param cq
* @return
*/
public <T> List<T> getListByCriteriaQuery(final CriteriaQuery cq,
Boolean ispage) {
return commonDao.getListByCriteriaQuery(cq, ispage);
}
/**
*
*
* @param request
*/
public <T> T uploadFile(UploadFile uploadFile) {
return commonDao.uploadFile(uploadFile);
}
public HttpServletResponse viewOrDownloadFile(UploadFile uploadFile)
{
return commonDao.viewOrDownloadFile(uploadFile);
}
/**
* XML
*
* @param fileName
* XML
* @return
*/
public HttpServletResponse createXml(ImportFile importFile) {
return commonDao.createXml(importFile);
}
/**
* XML
*
* @param fileName
* XML
*/
public void parserXml(String fileName) {
commonDao.parserXml(fileName);
}
public List<ComboTree> comTree(List<TSDepart> all, ComboTree comboTree) {
return commonDao.comTree(all, comboTree);
}
/**
* JSON
*
* @param all
*
* @param in
*
* @param comboBox
*
* @return
*/
public List<ComboTree> ComboTree(List all, ComboTreeModel comboTreeModel,
List in) {
return commonDao.ComboTree(all, comboTreeModel, in);
}
/**
*
*/
public List<TreeGrid> treegrid(List all, TreeGridModel treeGridModel) {
return commonDao.treegrid(all, treeGridModel);
}
/**
*
*
* @param <T>
* @return
*/
public <T> List<T> getAutoList(Autocomplete autocomplete) {
StringBuffer sb = new StringBuffer("");
for (String searchField : autocomplete.getSearchField().split(",")) {
sb.append(" or " + searchField + " like '%"
+ autocomplete.getTrem() + "%' ");
}
String hql = "from " + autocomplete.getEntityName() + " where 1!=1 "
+ sb.toString();
return commonDao.getSession().createQuery(hql)
.setFirstResult(autocomplete.getCurPage() - 1)
.setMaxResults(autocomplete.getMaxRows()).list();
}
public Integer executeSql(String sql, List<Object> param) {
return commonDao.executeSql(sql, param);
}
public Integer executeSql(String sql, Object... param) {
return commonDao.executeSql(sql, param);
}
public Integer executeSql(String sql, Map<String, Object> param) {
return commonDao.executeSql(sql, param);
}
public Object executeSqlReturnKey(String sql, Map<String, Object> param) {
return commonDao.executeSqlReturnKey(sql, param);
}
public List<Map<String, Object>> findForJdbc(String sql, int page, int rows) {
return commonDao.findForJdbc(sql, page, rows);
}
public List<Map<String, Object>> findForJdbc(String sql, Object... objs) {
return commonDao.findForJdbc(sql, objs);
}
public List<Map<String, Object>> findForJdbcParam(String sql, int page,
int rows, Object... objs) {
return commonDao.findForJdbcParam(sql, page, rows, objs);
}
public <T> List<T> findObjForJdbc(String sql, int page, int rows,
Class<T> clazz) {
return commonDao.findObjForJdbc(sql, page, rows, clazz);
}
public Map<String, Object> findOneForJdbc(String sql, Object... objs) {
return commonDao.findOneForJdbc(sql, objs);
}
public Long getCountForJdbc(String sql) {
return commonDao.getCountForJdbc(sql);
}
public Long getCountForJdbcParam(String sql, Object[] objs) {
return commonDao.getCountForJdbc(sql);
}
public <T> void batchSave(List<T> entitys) {
this.commonDao.batchSave(entitys);
}
/**
* hql
*
* @param <T>
* @param query
* @return
*/
public <T> List<T> findHql(String hql, Object... param) {
return this.commonDao.findHql(hql, param);
}
public <T> List<T> pageList(DetachedCriteria dc, int firstResult,
int maxResult) {
return this.commonDao.pageList(dc, firstResult, maxResult);
}
public <T> List<T> findByDetached(DetachedCriteria dc) {
return this.commonDao.findByDetached(dc);
}
}

@ -1,76 +0,0 @@
package org.jeecgframework.core.constant;
import org.jeecgframework.core.util.ResourceUtil;
/**
* jeecg
* Globals
*
*
* @version
*
*/
public final class Globals {
/**
* SESSION
*/
public static String USER_SESSION="USER_SESSION";
/**
*
*/
public static Short User_Normal=1;//正常
public static Short User_Forbidden=0;//禁用
public static Short User_ADMIN=-1;//超级管理员
/**
*
*/
public static Short Log_Leavel_INFO=1;
public static Short Log_Leavel_WARRING=2;
public static Short Log_Leavel_ERROR=3;
/**
*
*/
public static Short Log_Type_LOGIN=1; //登陆
public static Short Log_Type_EXIT=2; //退出
public static Short Log_Type_INSERT=3; //插入
public static Short Log_Type_DEL=4; //删除
public static Short Log_Type_UPDATE=5; //更新
public static Short Log_Type_UPLOAD=6; //上传
public static Short Log_Type_OTHER=7; //其他
/**
*
*/
public static String TypeGroup_Database="database";//数据表分类
/**
*
*/
public static Short Function_Leave_ONE=0;//一级权限
public static Short Function_Leave_TWO=1;//二级权限
/**
*
*/
public static String Function_Order_ONE="ofun";//一级权限
public static String Function_Order_TWO="tfun";//二级权限
/**
*
*/
public static Short Document_NEW=0; //新建
public static Short Document_PUBLICH=0; //发布
/**
*
*/
public static boolean BUTTON_AUTHORITY_CHECK = false;
static{
String button_authority_jeecg = ResourceUtil.getSessionattachmenttitle("button.authority.jeecg");
if("true".equals(button_authority_jeecg)){
BUTTON_AUTHORITY_CHECK = true;
}
}
}

@ -1,31 +0,0 @@
package org.jeecgframework.core.def;
/**
*
* @author
*
*/
public final class ConstantsDefs {
private ConstantsDefs() {
}
/**
*
*/
public static final String MODE_DEVELOP = "DEV";
/**
*
*/
public static final String MODE_PUBLISH = "PUB";
/**
* 1
*/
public static final int DELETE_FLG_1 = 1;
/**
* 0
*/
public static final int DELETE_FLG_0 = 0;
}

@ -1,22 +0,0 @@
package org.jeecgframework.core.extend.datasource;
/**
*DataSourceContextHolder.java
*
*/
public class DataSourceContextHolder {
private static final ThreadLocal contextHolder=new ThreadLocal();
public static void setDataSourceType(DataSourceType dataSourceType){
contextHolder.set(dataSourceType);
}
public static DataSourceType getDataSourceType(){
return (DataSourceType) contextHolder.get();
}
public static void clearDataSourceType(){
contextHolder.remove();
}
}

@ -1,5 +0,0 @@
package org.jeecgframework.core.extend.datasource;
public enum DataSourceType {
dataSource_jeecg,dataSource_enter,dataSource4,mapdataSource
}

@ -1,38 +0,0 @@
package org.jeecgframework.core.extend.datasource;
import java.util.Map;
import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;
import org.springframework.jdbc.datasource.lookup.DataSourceLookup;
/**
*DynamicDataSource.java
*
*/
public class DynamicDataSource extends AbstractRoutingDataSource {
/*
*
*/
protected Object determineCurrentLookupKey() {
DataSourceType dataSourceType= DataSourceContextHolder.getDataSourceType();
return dataSourceType;
}
public void setDataSourceLookup(DataSourceLookup dataSourceLookup) {
super.setDataSourceLookup(dataSourceLookup);
}
public void setDefaultTargetDataSource(Object defaultTargetDataSource) {
super.setDefaultTargetDataSource(defaultTargetDataSource);
}
public void setTargetDataSources(Map targetDataSources) {
super.setTargetDataSources(targetDataSources);
}
}

@ -1,223 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch;
import java.beans.PropertyDescriptor;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import org.apache.commons.beanutils.PropertyUtils;
import org.apache.commons.lang.StringUtils;
import org.jeecgframework.core.annotation.query.QueryTimeFormat;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.BigDecimalParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.DoubleParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.FloatParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.IntegerParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.LongParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.ShortParseImpl;
import org.jeecgframework.core.extend.hqlsearch.parse.impl.StringParseImpl;
import org.jeecgframework.core.util.StringUtil;
/**
*
* @author
*
*/
public class HqlGenerateUtil {
/** 时间查询符号 */
private static final String END = "_end";
private static final String BEGIN = "_begin";
private static Map<String, IHqlParse> map = new HashMap<String, IHqlParse>();
private static final SimpleDateFormat time = new SimpleDateFormat(
"yyyy-MM-dd hh:mm:ss");
private static final SimpleDateFormat day = new SimpleDateFormat(
"yyyy-MM-dd");
static {
map.put("class java.lang.Integer", new IntegerParseImpl());
map.put("class java.lang.Short", new ShortParseImpl());
map.put("class java.lang.String", new StringParseImpl());
map.put("class java.lang.Long", new LongParseImpl());
map.put("class java.lang.Double", new DoubleParseImpl());
map.put("class java.lang.Float", new FloatParseImpl());
map.put("class java.math.BigDecimal", new BigDecimalParseImpl());
}
/**
* HQL
*
* @param hql
* @param values
* @param searchObj
* @throws Exception
*/
public static void installHql(CriteriaQuery cq, Object searchObj) {
installHqlJoinAlias(cq, searchObj,null, "");
cq.add();
}
/**
* HQL
*
* @param cq
* @param searchObj
* @param parameterMap
* request
*/
public static void installHql(CriteriaQuery cq, Object searchObj,Map<String, String[]> parameterMap) {
installHqlJoinAlias(cq, searchObj, parameterMap, "");
cq.add();
}
/**
* Alias
*@date 2014119
*@param cq
*@param searchObj
*@param parameterMap
*@param alias
*/
private static void installHqlJoinAlias(CriteriaQuery cq, Object searchObj,
Map<String, String[]> parameterMap, String alias) {
PropertyDescriptor origDescriptors[] = PropertyUtils
.getPropertyDescriptors(searchObj);
String aliasName, name, type;
for (int i = 0; i < origDescriptors.length; i++) {
aliasName = (alias.equals("") ? "" : alias + ".")
+ origDescriptors[i].getName();
name = origDescriptors[i].getName();
type = origDescriptors[i].getPropertyType().toString();
try {
if (judgedIsUselessField(name)
|| !PropertyUtils.isReadable(searchObj, name)) {
continue;
}
// 添加 判断是否有区间值
String beginValue = null;
String endValue = null;
if (parameterMap!=null&&parameterMap.containsKey(name + BEGIN)) {
beginValue = parameterMap.get(name + BEGIN)[0].trim();
}
if (parameterMap!=null&&parameterMap.containsKey(name + END)) {
endValue = parameterMap.get(name + END)[0].trim();
}
Object value = PropertyUtils.getSimpleProperty(searchObj, name);
// 根据类型分类处理
if (type.contains("class java.lang")
|| type.contains("class java.math")) {
if(parameterMap==null){
map.get(type).addCriteria(cq, aliasName, value);
}else{
map.get(type).addCriteria(cq, aliasName, value, beginValue,
endValue);
}
} else if ("class java.util.Date".equals(type)) {
QueryTimeFormat format = origDescriptors[i].getReadMethod()
.getAnnotation(QueryTimeFormat.class);
SimpleDateFormat userDefined = null;
if (format != null) {
userDefined = new SimpleDateFormat(format.format());
}
if (StringUtils.isNotBlank(beginValue)) {
if (userDefined != null) {
cq.ge(aliasName, time.parse(beginValue));
} else if (beginValue.length() == 19) {
cq.ge(aliasName, time.parse(beginValue));
} else if (beginValue.length() == 10) {
cq.ge(aliasName, day.parse(beginValue));
}
}
if (StringUtils.isNotBlank(endValue)) {
if (userDefined != null) {
cq.ge(aliasName, time.parse(beginValue));
} else if (endValue.length() == 19) {
cq.le(aliasName, time.parse(endValue));
} else if (endValue.length() == 10) {
// 对于"yyyy-MM-dd"格式日期因时间默认为0故此添加" 23:23:59"并使用time解析以方便查询日期时间数据
cq.le(aliasName, time.parse(endValue + " 23:23:59"));
}
}
if (isNotEmpty(value)) {
cq.eq(aliasName, value);
}
} else if (!StringUtil.isJavaClass(origDescriptors[i]
.getPropertyType())) {
Object param = PropertyUtils.getSimpleProperty(searchObj,
name);
if (isNotEmpty(param) && itIsNotAllEmpty(param)) {
// 如果是实体类,创建别名,继续创建查询条件
cq.createAlias(aliasName, aliasName);
installHqlJoinAlias(cq, param,parameterMap,aliasName);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}
private static boolean judgedIsUselessField(String name) {
return "class".equals(name) || "ids".equals(name)
|| "page".equals(name) || "rows".equals(name)
|| "sort".equals(name) || "order".equals(name);
}
/**
*
*/
public static boolean isNotEmpty(Object value) {
return value != null && !"".equals(value);
}
/**
*
*
* @param param
* @return
*/
private static boolean itIsNotAllEmpty(Object param) {
boolean isNotEmpty = false;
try {
PropertyDescriptor origDescriptors[] = PropertyUtils
.getPropertyDescriptors(param);
String name;
for (int i = 0; i < origDescriptors.length; i++) {
name = origDescriptors[i].getName();
if ("class".equals(name)
|| !PropertyUtils.isReadable(param, name)) {
continue;
}
if (Map.class.isAssignableFrom(origDescriptors[i]
.getPropertyType())) {
Map<?, ?> map = (Map<?, ?>) PropertyUtils
.getSimpleProperty(param, name);
if (map != null && map.size() > 0) {
isNotEmpty = true;
break;
}
} else if (Collection.class.isAssignableFrom(origDescriptors[i]
.getPropertyType())) {
Collection<?> c = (Collection<?>) PropertyUtils
.getSimpleProperty(param, name);
if (c != null && c.size() > 0) {
isNotEmpty = true;
break;
}
} else if (StringUtil.isNotEmpty(PropertyUtils
.getSimpleProperty(param, name))) {
isNotEmpty = true;
break;
}
}
} catch (Exception e) {
}
return isNotEmpty;
}
}

@ -1,34 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
/**
*
*
* @author JueYue
* @date 2014117
* @version 1.0
*/
public interface IHqlParse {
/**
*
*
* @date 2014117
* @param name
* @param value
*/
public void addCriteria(CriteriaQuery cq, String name, Object value);
/**
*
*
* @date 2014117
* @param name
* @param value
* @param beginValue
* @param endValue
*/
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue);
}

@ -1,40 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import java.math.BigDecimal;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class BigDecimalParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name,
beginValue.contains(".") ? BigDecimal
.valueOf(Double.parseDouble(beginValue))
: BigDecimal.valueOf(Long
.parseLong(beginValue)));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name,
beginValue.contains(".") ? BigDecimal
.valueOf(Double.parseDouble(endValue))
: BigDecimal.valueOf(Long
.parseLong(endValue)));
}
if (HqlGenerateUtil.isNotEmpty(value)) {
cq.eq(name, value);
}
}
}

@ -1,29 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class DoubleParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name, Double.parseDouble(beginValue));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name, Double.parseDouble(endValue));
}
if (HqlGenerateUtil.isNotEmpty(value)) {
cq.eq(name, value);
}
}
}

@ -1,29 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class FloatParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name, Float.parseFloat(beginValue));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name, Float.parseFloat(endValue));
}
if (HqlGenerateUtil.isNotEmpty(value)) {
cq.eq(name, value);
}
}
}

@ -1,35 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
/**
* Integer
*
* @author JueYue
* @date 2014117
* @version 1.0
*/
public class IntegerParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name, Integer.parseInt(beginValue));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name, Integer.parseInt(endValue));
}
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
}

@ -1,29 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class LongParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name, Long.parseLong(beginValue));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name, Long.parseLong(endValue));
}
if (HqlGenerateUtil.isNotEmpty(value)) {
cq.eq(name, value);
}
}
}

@ -1,29 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.HqlGenerateUtil;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class ShortParseImpl implements IHqlParse {
public void addCriteria(CriteriaQuery cq, String name, Object value) {
if (HqlGenerateUtil.isNotEmpty(value))
cq.eq(name, value);
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
if (HqlGenerateUtil.isNotEmpty(beginValue)) {
cq.ge(name, Short.parseShort(beginValue));
}
if (HqlGenerateUtil.isNotEmpty(endValue)) {
cq.le(name, Short.parseShort(endValue));
}
if (HqlGenerateUtil.isNotEmpty(value)) {
cq.eq(name, value);
}
}
}

@ -1,65 +0,0 @@
package org.jeecgframework.core.extend.hqlsearch.parse.impl;
import org.jeecgframework.core.common.hibernate.qbc.CriteriaQuery;
import org.jeecgframework.core.extend.hqlsearch.parse.IHqlParse;
public class StringParseImpl implements IHqlParse {
private static final String SUFFIX_COMMA = ",";
private static final String SUFFIX_KG = " ";
/** 模糊查询符号 */
private static final String SUFFIX_ASTERISK = "*";
private static final String SUFFIX_ASTERISK_VAGUE = "%";
/** 不等于查询符号 */
private static final String SUFFIX_NOT_EQUAL = "!";
private static final String SUFFIX_NOT_EQUAL_NULL = "!NULL";
public void addCriteria(CriteriaQuery cq, String name, Object value) {
String searchValue = null;
if (value != null && (searchValue = value.toString().trim()) != "") {
// [1].In 多个条件查询{逗号隔开参数}
if (searchValue.indexOf(SUFFIX_COMMA) >= 0) {
// 页面输入查询条件,情况(取消字段的默认条件)
if (searchValue.indexOf(SUFFIX_KG) >= 0) {
String val = searchValue.substring(searchValue
.indexOf(SUFFIX_KG));
cq.eq(name, val);
} else {
String[] vs = searchValue.split(SUFFIX_COMMA);
cq.in(name, vs);
}
}
// [2].模糊查询{带有* 星号的参数}
else if (searchValue.indexOf(SUFFIX_ASTERISK) >= 0) {
cq.like(name, searchValue.replace(SUFFIX_ASTERISK,
SUFFIX_ASTERISK_VAGUE));
}
// [3].不匹配查询{等于!叹号}
// (1).不为空字符串
else if (searchValue.equals(SUFFIX_NOT_EQUAL)) {
cq.isNotNull(name);
}
// (2).不为NULL
else if (searchValue.toUpperCase().equals(SUFFIX_NOT_EQUAL_NULL)) {
cq.isNotNull(name);
}
// (3).正常不匹配
else if (searchValue.indexOf(SUFFIX_NOT_EQUAL) >= 0) {
cq.notEq(name, searchValue.replace(SUFFIX_NOT_EQUAL, ""));
}
// [4].全匹配查询{没有特殊符号的参数}
else {
cq.eq(name, searchValue);
}
}
}
public void addCriteria(CriteriaQuery cq, String name, Object value,
String beginValue, String endValue) {
addCriteria(cq,name,value);
}
}

@ -1,68 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import javax.servlet.http.HttpServletRequest;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
/**
*
*/
public class ConStant {
/**OpenOffice安装根目录*/
public static final String OFFICE_HOME;
static{
OFFICE_HOME = ResourceUtil.getSessionattachmenttitle("office_home");
}
/**文件上传保存根目录*/
public static final String UPLOAD_BASE_DIR = "upload";
/**文件转换工具根目录*/
public static final String SWFTOOLS_BASE_DIR = "swftools";
/**PDF-SWF*/
public static final String SWFTOOLS_PDF2SWF_PATH ="pdf2swf.exe";
/**GIF-SWF*/
public static final String SWFTOOLS_GIF2SWF_PATH ="gif2swf.exe";
/**PNG-SWF*/
public static final String SWFTOOLS_PNG2SWF_PATH ="png2swf.exe";
/**JPEG-SWF*/
public static final String SWFTOOLS_JPEG2SWF_PATH ="jpeg2swf.exe";
/**WAV-SWF*/
public static final String SWFTOOLS_WAV2SWF_PATH = "wav2swf.exe";
/**PDF合并*/
public static final String SWFTOOLS_PDFCOMBINE_PATH ="swfcombine.exe";
/**SWF文件后缀*/
public static final String SWF_STUFFIX = "swf";
public static String SWFTOOLS_HOME="";
/**
*
* @param extend
* @return
*/
public static String getSWFToolsPath(String extend)
{
HttpServletRequest request=ContextHolderUtils.getRequest();
SWFTOOLS_HOME=request.getSession().getServletContext().getRealPath("/") + SWFTOOLS_BASE_DIR + "/";
if(extend.equals("pdf"))
{
SWFTOOLS_HOME+=SWFTOOLS_PDF2SWF_PATH;
}
if(extend.equals("gif"))
{
SWFTOOLS_HOME+=SWFTOOLS_GIF2SWF_PATH;
}
if(extend.equals("png"))
{
SWFTOOLS_HOME+=SWFTOOLS_PNG2SWF_PATH;
}
if(extend.equals("jpeg"))
{
SWFTOOLS_HOME+=SWFTOOLS_JPEG2SWF_PATH;
}
if(extend.equals("wav"))
{
SWFTOOLS_HOME+=SWFTOOLS_WAV2SWF_PATH;
}
return SWFTOOLS_HOME;
}
}

@ -1,30 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import org.jeecgframework.core.util.FileUtils;
public class DocConverter {
private PDFConverter pdfConverter;
private SWFConverter swfConverter;
public DocConverter(PDFConverter pdfConverter, SWFConverter swfConverter) {
super();
this.pdfConverter = pdfConverter;
this.swfConverter = swfConverter;
}
public void convert(String inputFile,String swfFile,String extend){
this.pdfConverter.convert2PDF(inputFile,extend);
String pdfFile = FileUtils.getFilePrefix(inputFile)+".pdf";
this.swfConverter.convert2SWF(pdfFile, swfFile);
}
public void convert(String inputFile,String extend){
this.pdfConverter.convert2PDF(inputFile,extend);
String pdfFile = FileUtils.getFilePrefix2(inputFile)+".pdf";
extend=FileUtils.getExtend(pdfFile);
this.swfConverter.convert2SWF(pdfFile,extend);
}
}

@ -1,94 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import java.io.File;
import java.io.FileNotFoundException;
import org.artofsolving.jodconverter.OfficeDocumentConverter;
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
import org.artofsolving.jodconverter.office.OfficeManager;
import org.jeecgframework.core.util.FileUtils;
/**
* OFFICE
*
* @author
*
*/
public class OpenOfficePDFConverter implements PDFConverter {
private static OfficeManager officeManager;
/** OpenOffice安装根目录 */
private static String OFFICE_HOME = ConStant.OFFICE_HOME;
private static int[] port = { 8100 };
public void convert2PDF(String inputFile, String pdfFile, String extend) {
if (extend.equals("txt")) {
String odtFile = FileUtils.getFilePrefix(inputFile) + ".odt";
if (new File(odtFile).exists()) {
org.jeecgframework.core.util.LogUtil.info("odt文件已存在");
inputFile = odtFile;
} else {
try {
FileUtils.copyFile(inputFile, odtFile);
inputFile = odtFile;
} catch (FileNotFoundException e) {
org.jeecgframework.core.util.LogUtil.info("Odt文档不存在");
e.printStackTrace();
}
}
}
startService();
//pdfFile = pdfFile.replaceAll(" ", "").replaceAll(" ", "");
org.jeecgframework.core.util.LogUtil.info("进行文档转换转换:" + inputFile + " --> " + pdfFile);
OfficeDocumentConverter converter = new OfficeDocumentConverter(
officeManager);
try {
converter.convert(new File(inputFile), new File(pdfFile));
} catch (Exception e) {
// TODO: handle exception
org.jeecgframework.core.util.LogUtil.info(e.getMessage());
}
stopService();
org.jeecgframework.core.util.LogUtil.info("进行文档转换转换---- 结束----");
}
public void convert2PDF(String inputFile, String extend) {
//inputFile = inputFile.replaceAll(" ", "").replaceAll(" ", "");
String pdfFile = FileUtils.getFilePrefix2(inputFile) + ".pdf";
convert2PDF(inputFile, pdfFile, extend);
}
public static void startService() {
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
try {
// 准备启动服务
configuration.setOfficeHome(OFFICE_HOME);// 设置OpenOffice.org安装目录
// 设置转换端口默认为8100
configuration.setPortNumbers(port);
// 设置任务执行超时为5分钟
configuration.setTaskExecutionTimeout(1000 * 60 * 5L);
// 设置任务队列超时为24小时
configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
officeManager = configuration.buildOfficeManager();
officeManager.start(); // 启动服务
org.jeecgframework.core.util.LogUtil.info("office转换服务启动成功!");
} catch (Exception ce) {
org.jeecgframework.core.util.LogUtil.info("office转换服务启动失败!详细信息:" + ce);
}
}
public static void stopService() {
org.jeecgframework.core.util.LogUtil.info("关闭office转换服务....");
if (officeManager != null) {
officeManager.stop();
}
org.jeecgframework.core.util.LogUtil.info("关闭office转换成功!");
}
}

@ -1,12 +0,0 @@
package org.jeecgframework.core.extend.swftools;
/**
* PDF
* @author
*
*/
public interface PDFConverter {
public void convert2PDF(String inputFile,String pdfFile,String extend);
public void convert2PDF(String inputFile,String extend);
}

@ -1,6 +0,0 @@
package org.jeecgframework.core.extend.swftools;
public interface SWFConverter {
public void convert2SWF(String inputFile,String swfFile,String extend);
public void convert2SWF(String inputFile,String extend);
}

@ -1,55 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import java.io.File;
import java.io.IOException;
import org.jeecgframework.core.util.FileUtils;
import org.jeecgframework.core.util.PinyinUtil;
public class SWFToolsSWFConverter implements SWFConverter {
/** SWFTools pdf2swf.exe路径 */
private static String PDF2SWF_PATH = ConStant.SWFTOOLS_PDF2SWF_PATH;
public void convert2SWF(String inputFile, String swfFile, String extend) {
File pdfFile = new File(inputFile);
File outFile = new File(swfFile);
if (!pdfFile.exists()) {
org.jeecgframework.core.util.LogUtil.info("PDF文件不存在");
return;
}
if (outFile.exists()) {
org.jeecgframework.core.util.LogUtil.info("SWF文件已存在");
return;
}
String command = ConStant.getSWFToolsPath(extend) + " \"" + inputFile
//---update-for--文件预览无效------ scott@2013/05/22 ADD START
+ "\" -o " +" \""+ swfFile +" \""+ " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
// + "\" -o " + swfFile + " -s languagedir=D:\\xpdf-chinese-simplified -T 9 -f";
// ---update-for--文件预览无效----- scott@2013/05/22 ADD END
try {
// 开始转换文档
Process process = Runtime.getRuntime().exec(command);
StreamGobbler errorGobbler = new StreamGobbler(
process.getErrorStream(), "Error");
StreamGobbler outputGobbler = new StreamGobbler(
process.getInputStream(), "Output");
errorGobbler.start();
outputGobbler.start();
try {
process.waitFor();
org.jeecgframework.core.util.LogUtil.info("时间-------"+process.waitFor());
} catch (InterruptedException e) {
e.printStackTrace();
}
} catch (IOException e) {
e.printStackTrace();
}
}
public void convert2SWF(String inputFile, String extend) {
String swfFile = PinyinUtil.getPinYinHeadChar(FileUtils.getFilePrefix2(inputFile)) + ".swf";
convert2SWF(inputFile, swfFile, extend);
}
}

@ -1,35 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
public class StreamGobbler extends Thread {
InputStream is;
String type;
public StreamGobbler(InputStream is, String type) {
this.is = is;
this.type = type;
}
public void run() {
try {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ((line = br.readLine()) != null) {
if (type.equals("Error")) {
org.jeecgframework.core.util.LogUtil.info("Error :" + line);
} else {
org.jeecgframework.core.util.LogUtil.info("文件转换:" + line);
}
}
} catch (IOException ioe) {
ioe.printStackTrace();
}
}
}

@ -1,26 +0,0 @@
package org.jeecgframework.core.extend.swftools;
import org.jeecgframework.core.util.FileUtils;
/**
*
* @author
*
*/
public class SwfToolsUtil {
public static void convert2SWF(String inputFile) {
String extend=FileUtils.getExtend(inputFile);
PDFConverter pdfConverter = new OpenOfficePDFConverter();
SWFConverter swfConverter = new SWFToolsSWFConverter();
if(extend.equals("pdf"))
{
swfConverter.convert2SWF(inputFile,extend);
}
if(extend.equals("doc")||extend.equals("docx")||extend.equals("xls")||extend.equals("pptx")||extend.equals("xlsx")||extend.equals("ppt")||extend.equals("txt")||extend.equals("odt"))
{
DocConverter converter = new DocConverter(pdfConverter,swfConverter);
converter.convert(inputFile,extend);
}
}
}

@ -1,305 +0,0 @@
package org.jeecgframework.core.extend.template;
import java.text.DecimalFormat;
import java.text.NumberFormat;
import java.util.Stack;
import java.util.Vector;
/**
* @author
*
*/
public class Caculator {
public static java.text.NumberFormat nfd = NumberFormat.getNumberInstance();
public static java.text.NumberFormat nfi = NumberFormat.getNumberInstance();
public static DecimalFormat dfd = (DecimalFormat) nfd;
public static DecimalFormat dfi = (DecimalFormat) nfi;
static{
dfd.applyPattern("######.00");
dfi.applyPattern("######");
}
class Item
{
boolean ops;
double value;
Character opVal;
int opPriority;
}
Stack<Item> opStack=new Stack<Item>();
Vector<Item> calcStack=new Vector<Item>();
/**
*
*/
public Caculator() {
// TODO Auto-generated constructor stub
}
public String calc()
{
Stack<Item> tmp=new Stack<Item>();
while(!calcStack.isEmpty())
{
Item it=calcStack.remove(0);
if(!it.ops)
{
tmp.push(it);
}
else
{
double op2=tmp.pop().value;
double op1=0L;//tmp.pop().value;
if(!tmp.isEmpty())
{
op1=tmp.pop().value;
}
Item newItem=new Item();
newItem.ops=true;
switch(it.opVal)
{
case '+':
newItem.value=op1+op2;
break;
case '-':
newItem.value=op1-op2;
break;
case '*':
newItem.value=op1*op2;
break;
case '/':
newItem.value=op1/op2;
if(newItem.value==Double.NEGATIVE_INFINITY || newItem.value==Double.POSITIVE_INFINITY || new Double(newItem.value).toString().equals("NaN"))
{
newItem.value=0.0;
}
// double tt=0.0/0.0;
// double ff=Double.longBitsToDouble(0x7ff8000000000000L);
// if(new Double(tt).toString().equals("NaN"))
// {
// org.jeecgframework.core.util.LogUtil.info(tt);
// }
break;
}
tmp.push(newItem);
}
}
Double result = tmp.pop().value;
return getDtoI(result);
/* double c=0;
long b = (long)Math.round(result * 100); //小数点后两位前移,并四舍五入
if((b % 100)!=0)
{
c = (double)b / 100.00; //还原小数点后两位
return dfd.format(c);
}else
{
c = (double)b / 100.00;
return dfi.format(c);
}
*/
}
public static String getDtoI(Double d)
{
double c=0;
long b = (long)Math.round(d * 100); //小数点后两位前移,并四舍五入
if((b % 100)!=0)
{
c = (double)b / 100.00; //还原小数点后两位
return dfd.format(c);
}else
{
c = (double)b / 100.00;
return dfi.format(c);
}
}
/**
* 1)
* 2)
* 3
* 4
* a)
* b
* 5
* @param in
* @return
*/
public String transInfixToPosfix(String in)
{
char[] cin=in.toCharArray();
StringBuffer buffer=new StringBuffer();
for(int i=0;i<cin.length;i++)
{
Item newItem=new Item();
newItem.opPriority=1;
newItem.ops=false;
switch(cin[i])
{
case '+':
newItem.opPriority=1;
newItem.ops=true;
newItem.opVal='+';
doOps(buffer, newItem);
break;
case '-':
newItem.opPriority=1;
newItem.ops=true;
newItem.opVal='-';
doOps(buffer, newItem);
break;
case '*':
newItem.opPriority=2;
newItem.ops=true;
newItem.opVal='*';
doOps(buffer, newItem);
break;
case '/':
newItem.opPriority=2;
newItem.ops=true;
newItem.opVal='/';
doOps(buffer, newItem);
break;
case '(':
newItem.ops=true;
newItem.opVal='(';
opStack.push(newItem);
break;
case ')':
boolean meetClose=false;
while(!opStack.isEmpty())
{
Item item=opStack.peek();
if(item.ops&&item.opVal!='(')
{
calcStack.add(item);
opStack.pop();
buffer.append(item.opVal);
}
else if(item.ops)
{
opStack.pop();
meetClose=true;
break;
}
}
if(!meetClose)
{
org.jeecgframework.core.util.LogUtil.info(in);
throw new RuntimeException();
}
break;
default:
int j=i;
for(;j<cin.length && ((cin[j]>='0'&&cin[j]<='9') ||cin[j]=='.' || cin[j]=='E');j++);
if(j==i)
{
throw new RuntimeException("wrong input.");
}
newItem.ops=false;
try {
newItem.value=Double.parseDouble(new String(cin,i,j-i));
} catch (NumberFormatException e) {
// TODO Auto-generated catch block
e.printStackTrace();
org.jeecgframework.core.util.LogUtil.info("cal数字生成错误");
}
buffer.append(newItem.value);
calcStack.add(newItem);
i=j-1;
break;
}
}
while(!opStack.isEmpty())
{
Item item=opStack.pop();
calcStack.add(item);
buffer.append(item.opVal);
}
return buffer.toString();
}
private void doOps(StringBuffer buffer, Item newItem) {
while(!opStack.isEmpty())
{
Item item=opStack.peek();
if(item.opVal!='('&&item.opPriority>=newItem.opPriority)
{
calcStack.add(item);
opStack.pop();
buffer.append(item.opVal);
}
else
{
break;
}
}
opStack.push(newItem);
}
/**
* @param args
*/
public static void main(String[] args) {
Caculator calc=new Caculator();
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("1+2*3+7.5-(4/2+8)/5"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("110815.00047*2"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("110815.125047*2"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("((110815.0347)*2+10)/0"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("0.02"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
// org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("0.0"));
// org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
org.jeecgframework.core.util.LogUtil.info(calc.transInfixToPosfix("1.3E7+0.5"));
org.jeecgframework.core.util.LogUtil.info("value is:"+calc.calc());
Double dd=Double.parseDouble("1.35378957E7");
org.jeecgframework.core.util.LogUtil.info(Caculator.getDtoI(dd));
org.jeecgframework.core.util.LogUtil.info(dd);
}
}

@ -1,37 +0,0 @@
package org.jeecgframework.core.extend.template;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
@SuppressWarnings("unchecked")
public class DataSourceMap {
private static Map<Object,Object> dsm;
static{
InputStream is=Thread.currentThread().getContextClassLoader().getResourceAsStream("dataSourceMap.properties");
Properties p=new Properties();
try {
p.load(is);
dsm=(HashMap<Object,Object>) new HashMap<Object,Object>();
Set ps=p.entrySet();
for (Iterator iterator = ps.iterator(); iterator.hasNext();) {
Map.Entry<Object, Object> entry = (Map.Entry<Object, Object>) iterator.next();
dsm.put(entry.getKey().toString(), entry.getValue()==null?"":entry.getValue().toString().trim());
}
is.close();//关闭
is=null;
} catch (IOException e) {
e.printStackTrace();
}
}
public static Map<Object,Object> getDataSourceMap() {
Map<Object,Object> datadsm=new HashMap<Object,Object>();
datadsm.putAll(dsm);
return datadsm;
}
}

@ -1,108 +0,0 @@
package org.jeecgframework.core.extend.template;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Template {
public HashMap<String, String> teprems = null;
public String templatecCode;
public String parameterName;
public String parameterValue;
public String parameterTagName;
public String parameterTagValue;
public Object templatecObject;
public String templatePath;
public Class templateClass;
public Map<String, String> dataSourceMap;
public List dataSet;
public List getDataSet() {
return dataSet;
}
public void setDataSet(List dataSet) {
this.dataSet = dataSet;
}
public String getTemplatePath() {
return templatePath;
}
public void setTemplatePath(String templatePath) {
this.templatePath = templatePath;
}
public Map<String, String> getDataSourceMap() {
return dataSourceMap;
}
public void setDataSourceMap(Map<String, String> dataSourceMap) {
this.dataSourceMap = dataSourceMap;
}
public String getParameterName() {
return parameterName;
}
public Class getTemplateClass() {
return templateClass;
}
public void setTemplateClass(Class templateClass) {
this.templateClass = templateClass;
}
public void setParameterName(String parameterName) {
this.parameterName = parameterName;
}
public String getParameterTagName() {
return parameterTagName;
}
public void setParameterTagName(String parameterTagName) {
this.parameterTagName = parameterTagName;
}
public String getParameterTagValue() {
return parameterTagValue;
}
public void setParameterTagValue(String parameterTagValue) {
this.parameterTagValue = parameterTagValue;
}
public String getParameterValue() {
return parameterValue;
}
public void setParameterValue(String parameterValue) {
this.parameterValue = parameterValue;
}
public Object getTemplatecObject() {
return templatecObject;
}
public void setTemplatecObject(Object templatecObject) {
this.templatecObject = templatecObject;
}
public String getTemplatecCode() {
return templatecCode;
}
public void setTemplatecCode(String templatecCode) {
this.templatecCode = templatecCode;
}
public HashMap<String, String> getTeprems() {
return teprems;
}
public void setTeprems(HashMap<String, String> teprems) {
this.teprems = teprems;
}
}

@ -1,159 +0,0 @@
package org.jeecgframework.core.interceptors;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.jeecgframework.web.system.manager.ClientManager;
import org.jeecgframework.web.system.pojo.base.Client;
import org.jeecgframework.web.system.service.SystemService;
import org.apache.log4j.Logger;
import org.jeecgframework.core.util.ContextHolderUtils;
import org.jeecgframework.core.util.ResourceUtil;
import org.jeecgframework.core.util.oConvertUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;
/**
*
*
* @author
*
*/
public class AuthInterceptor implements HandlerInterceptor {
private static final Logger logger = Logger.getLogger(AuthInterceptor.class);
private SystemService systemService;
private List<String> excludeUrls;
public List<String> getExcludeUrls() {
return excludeUrls;
}
public void setExcludeUrls(List<String> excludeUrls) {
this.excludeUrls = excludeUrls;
}
public SystemService getSystemService() {
return systemService;
}
@Autowired
public void setSystemService(SystemService systemService) {
this.systemService = systemService;
}
/**
* controller
*/
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object object, Exception exception) throws Exception {
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object object, ModelAndView modelAndView) throws Exception {
}
/**
* controller
*/
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {
String requestPath = ResourceUtil.getRequestPath(request);// 用户访问的资源地址
HttpSession session = ContextHolderUtils.getSession();
Client client = ClientManager.getInstance().getClient(session.getId());
if(client == null){
client = ClientManager.getInstance().getClient(
request.getParameter("sessionId"));
}
if (excludeUrls.contains(requestPath)) {
return true;
} else {
if (client != null && client.getUser()!=null ) {
if(!hasMenuAuth(request)){
response.sendRedirect("loginController.do?noAuth");
//request.getRequestDispatcher("webpage/common/noAuth.jsp").forward(request, response);
return false;
}
String functionId=oConvertUtils.getString(request.getParameter("clickFunctionId"));
if(!oConvertUtils.isEmpty(functionId)){
Set<String> operationCodes = systemService.getOperationCodesByUserIdAndFunctionId(client.getUser().getId(), functionId);
request.setAttribute("operationCodes", operationCodes);
}
if(!oConvertUtils.isEmpty(functionId)){
List<String> allOperation=this.systemService.findListbySql("SELECT operationcode FROM t_s_operation WHERE functionid='"+functionId+"'");
List<String> newall = new ArrayList<String>();
if(allOperation.size()>0){
for(String s:allOperation){
s=s.replaceAll(" ", "");
newall.add(s);
}
String hasOperSql="SELECT operation FROM t_s_role_function fun, t_s_role_user role WHERE " +
"fun.functionid='"+functionId+"' AND fun.operation!='' AND fun.roleid=role.roleid AND role.userid='"+client.getUser().getId()+"' ";
List<String> hasOperList = this.systemService.findListbySql(hasOperSql);
for(String strs:hasOperList){
for(String s:strs.split(",")){
s=s.replaceAll(" ", "");
newall.remove(s);
}
}
}
request.setAttribute("noauto_operationCodes", newall);
}
return true;
} else {
//forword(request);
forward(request, response);
return false;
}
}
}
private boolean hasMenuAuth(HttpServletRequest request){
String requestPath = ResourceUtil.getRequestPath(request);// 用户访问的资源地址
String funcid=oConvertUtils.getString(request.getParameter("clickFunctionId"));
if(requestPath.indexOf("loginController.do")!=-1||funcid.length()==0){
return true;
}
String userid = ClientManager.getInstance().getClient(
ContextHolderUtils.getSession().getId()).getUser().getId();
//requestPath=requestPath.substring(0, requestPath.indexOf("?")+1);
String sql = "SELECT DISTINCT f.id FROM t_s_function f,t_s_role_function rf,t_s_role_user ru " +
" WHERE f.id=rf.functionid AND rf.roleid=ru.roleid AND " +
"ru.userid='"+userid+"' AND f.functionurl like '"+requestPath+"%'";
List list = this.systemService.findListbySql(sql);
if(list.size()==0){
return false;
}else{
return true;
}
}
/**
*
*
* @param user
* @param req
* @return
*/
@RequestMapping(params = "forword")
public ModelAndView forword(HttpServletRequest request) {
return new ModelAndView(new RedirectView("loginController.do?login"));
}
private void forward(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
request.getRequestDispatcher("webpage/login/timeout.jsp").forward(request, response);
}
}

@ -1,41 +0,0 @@
package org.jeecgframework.core.interceptors;
import java.beans.PropertyEditorSupport;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import org.springframework.util.StringUtils;
/**
*
* @author
*
*/
public class DateConvertEditor extends PropertyEditorSupport {
private SimpleDateFormat datetimeFormat = new SimpleDateFormat(
"yyyy-MM-dd HH:mm:ss");
private SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
public void setAsText(String text) throws IllegalArgumentException {
if (StringUtils.hasText(text)) {
try {
if (text.indexOf(":") == -1 && text.length() == 10) {
setValue(this.dateFormat.parse(text));
} else if (text.indexOf(":") > 0 && text.length() == 19) {
setValue(this.datetimeFormat.parse(text));
} else if (text.indexOf(":") > 0 && text.length() == 21) {
text = text.replace(".0", "");
setValue(this.datetimeFormat.parse(text));
} else {
throw new IllegalArgumentException(
"Could not parse date, date format is error ");
}
} catch (ParseException ex) {
IllegalArgumentException iae = new IllegalArgumentException(
"Could not parse date: " + ex.getMessage());
iae.initCause(ex);
throw iae;
}
} else {
setValue(null);
}
}
}

@ -1,37 +0,0 @@
package org.jeecgframework.core.interceptors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;
/**
*
*
* @author
*
*/
public class EncodingInterceptor implements HandlerInterceptor {
/**
* controller
*/
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object object, Exception exception) throws Exception {
}
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object object, ModelAndView modelAndView) throws Exception {
}
/**
* controller
*/
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object object) throws Exception {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
return true;
}
}

@ -1,67 +0,0 @@
package org.jeecgframework.core.interceptors;
import java.lang.reflect.Array;
import java.lang.reflect.Method;
import javax.servlet.http.HttpServletRequest;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.jeecgframework.core.common.model.json.LogAnnotation;
import org.springframework.stereotype.Component;
/**
*
* @author
*
*/
@Component
@Aspect
public class LogInterceptor {
@Before("execution(* com.renfang.controller.*.*(..))")
public void beforeMethod(JoinPoint joinPoint) throws Exception {
String temp = joinPoint.getStaticPart().toShortString();
String longTemp = joinPoint.getStaticPart().toLongString();
joinPoint.getStaticPart().toString();
String classType = joinPoint.getTarget().getClass().getName();
String methodName = temp.substring(10, temp.length() - 1);
Class<?> className = Class.forName(classType);
Class[] args = new Class[joinPoint.getArgs().length];
String[] sArgs = (longTemp.substring(longTemp.lastIndexOf("(") + 1,
longTemp.length() - 2)).split(",");
for (int i = 0; i < args.length; i++) {
if (sArgs[i].endsWith("String[]")) {
args[i] = Array.newInstance(Class.forName("java.lang.String"),
1).getClass();
} else if (sArgs[i].endsWith("Long[]")) {
args[i] = Array.newInstance(Class.forName("java.lang.Long"), 1)
.getClass();
} else if (sArgs[i].indexOf(".") == -1) {
if (sArgs[i].equals("int")) {
args[i] = int.class;
} else if (sArgs[i].equals("char")) {
args[i] = char.class;
} else if (sArgs[i].equals("float")) {
args[i] = float.class;
} else if (sArgs[i].equals("long")) {
args[i] = long.class;
}
} else {
args[i] = Class.forName(sArgs[i]);
}
}
Method method = className.getMethod(
methodName.substring(methodName.indexOf(".") + 1,
methodName.indexOf("(")), args);
if (method.isAnnotationPresent(LogAnnotation.class)) {
LogAnnotation logAnnotation = method
.getAnnotation(LogAnnotation.class);
String operateModelNm = logAnnotation.operateModelNm();
String operateDescribe = logAnnotation.operateDescribe();
String operateFuncNm = logAnnotation.operateFuncNm();
}
}
}

@ -1,20 +0,0 @@
package org.jeecgframework.core.interceptors;
import java.util.Date;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.support.WebBindingInitializer;
import org.springframework.web.context.request.WebRequest;
public class MyWebBinding implements WebBindingInitializer {
public void initBinder(WebDataBinder binder, WebRequest request) {
// 1. 使用spring自带的CustomDateEditor
// SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
// binder.registerCustomEditor(Date.class, new
// CustomDateEditor(dateFormat, true));
//2. 自定义的PropertyEditorSupport
binder.registerCustomEditor(Date.class, new DateConvertEditor());
}
}

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save