Compare commits
No commits in common. 'main' and 'main' have entirely different histories.
@ -1,75 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AutoImportSettings">
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="4d6ebe9b-a7d1-4051-b51b-6dbbab6486b0" name="更改" comment="" />
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
||||
</component>
|
||||
<component name="Git.Settings">
|
||||
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/../.." />
|
||||
</component>
|
||||
<component name="MavenImportPreferences">
|
||||
<option name="generalSettings">
|
||||
<MavenGeneralSettings>
|
||||
<option name="localRepository" value="D:\maven项目\项目" />
|
||||
<option name="userSettingsFile" value="C:\Users\Administrator\.m2\settings.xml" />
|
||||
</MavenGeneralSettings>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectColorInfo">{
|
||||
"associatedIndex": 2
|
||||
}</component>
|
||||
<component name="ProjectId" id="2uJ77sfrfWgrpLWRI6ORnLsrjvl" />
|
||||
<component name="ProjectViewState">
|
||||
<option name="hideEmptyMiddlePackages" value="true" />
|
||||
<option name="showLibraryContents" value="true" />
|
||||
</component>
|
||||
<component name="PropertiesComponent">{
|
||||
"keyToString": {
|
||||
"Maven.farm-core [clean,install].executor": "Run",
|
||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
||||
"git-widget-placeholder": "master",
|
||||
"kotlin-language-version-configured": "true",
|
||||
"node.js.detected.package.eslint": "true",
|
||||
"node.js.detected.package.tslint": "true",
|
||||
"node.js.selected.package.eslint": "(autodetect)",
|
||||
"node.js.selected.package.tslint": "(autodetect)",
|
||||
"nodejs_package_manager_path": "npm",
|
||||
"project.structure.last.edited": "模块",
|
||||
"project.structure.proportion": "0.15",
|
||||
"project.structure.side.proportion": "0.2",
|
||||
"settings.editor.selected.configurable": "MavenSettings",
|
||||
"vue.rearranger.settings.migration": "true"
|
||||
}
|
||||
}</component>
|
||||
<component name="SharedIndexes">
|
||||
<attachedChunks>
|
||||
<set>
|
||||
<option value="bundled-jdk-9f38398b9061-39b83d9b5494-intellij.indexing.shared.core-IU-241.17011.79" />
|
||||
<option value="bundled-js-predefined-1d06a55b98c1-0b3e54e931b4-JavaScript-IU-241.17011.79" />
|
||||
</set>
|
||||
</attachedChunks>
|
||||
</component>
|
||||
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="应用程序级" UseSingleDictionary="true" transferred="true" />
|
||||
<component name="TaskManager">
|
||||
<task active="true" id="Default" summary="默认任务">
|
||||
<changelist id="4d6ebe9b-a7d1-4051-b51b-6dbbab6486b0" name="更改" comment="" />
|
||||
<created>1741954660473</created>
|
||||
<option name="number" value="Default" />
|
||||
<option name="presentableId" value="Default" />
|
||||
<updated>1741954660473</updated>
|
||||
<workItem from="1741954664978" duration="571000" />
|
||||
<workItem from="1741956860321" duration="120000" />
|
||||
<workItem from="1742282371383" duration="656000" />
|
||||
</task>
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
<option name="version" value="3" />
|
||||
</component>
|
||||
</project>
|
@ -1,135 +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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.farm</groupId>
|
||||
<artifactId>farm-core</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
<version>${wcp.version}</version>
|
||||
<name>核心包</name>
|
||||
<properties>
|
||||
<wcp.version>3.2.0</wcp.version>
|
||||
<spring.version>4.1.6.RELEASE</spring.version>
|
||||
<!-- 文件拷贝时的编码 -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- 编译时的编码 -->
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sf.ehcache</groupId>
|
||||
<artifactId>ehcache</artifactId>
|
||||
<version>2.10.4</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-core</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<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>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-orm</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-tx</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aop</artifactId>
|
||||
<version>${spring.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.29</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.hibernate</groupId>
|
||||
<artifactId>hibernate-entitymanager</artifactId>
|
||||
<version>4.3.8.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.17</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.commons</groupId>
|
||||
<artifactId>beanutils</artifactId>
|
||||
<version>1.6.1-20070314</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-codec</groupId>
|
||||
<artifactId>commons-codec</artifactId>
|
||||
<version>1.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-lang</groupId>
|
||||
<artifactId>commons-lang</artifactId>
|
||||
<version>2.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-beanutils</groupId>
|
||||
<artifactId>commons-beanutils</artifactId>
|
||||
<version>1.9.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
<version>2.2.1-b03</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,7 +0,0 @@
|
||||
package com.farm.core;
|
||||
|
||||
public class Context {
|
||||
public static String MK;
|
||||
public static String FK;
|
||||
public static boolean FLAG;
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.farm.core;
|
||||
|
||||
/**
|
||||
* 参数服务接口
|
||||
*
|
||||
* @author wangdong
|
||||
* @version 2014-12
|
||||
*
|
||||
*/
|
||||
public interface LogService {
|
||||
|
||||
/**
|
||||
* 记录日志
|
||||
*
|
||||
* @param message
|
||||
* 信息
|
||||
* @param loginUserId
|
||||
* 用户id
|
||||
* @param level
|
||||
* 日志级别
|
||||
* @param methodName
|
||||
* 程序方法名称
|
||||
* @param className
|
||||
* 程序类名
|
||||
* @param ip
|
||||
* 用户IP
|
||||
*/
|
||||
public void log(String info, String loginUserId, String level,
|
||||
String methodName, String className, String ip);
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package com.farm.core;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* 参数服务接口
|
||||
*
|
||||
* @author wangdong
|
||||
* @version 2014-12
|
||||
*
|
||||
*/
|
||||
public interface ParameterService {
|
||||
|
||||
/**
|
||||
* 获得系统参数值(可以获得系统中各种参数:如系统参数、properties参数、系统常量)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getParameter(String key);
|
||||
|
||||
/**
|
||||
* 获得系统参数值(可以获得系统中各种参数:如用户个性化参数、系统参数、properties参数、系统常量)
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getParameter(String key, String userId);
|
||||
|
||||
/**
|
||||
* 获得字典列表
|
||||
*
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
public List<Entry<String, String>> getDictionaryList(String index);
|
||||
|
||||
/**
|
||||
* 获得字典
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> getDictionary(String key);
|
||||
|
||||
public int getParameterInt(String string);
|
||||
|
||||
/**
|
||||
* 获得系统参数值(可以获得系统中各种参数:如系统参数、properties参数、系统常量)
|
||||
*
|
||||
* @param string
|
||||
* @return
|
||||
*/
|
||||
public boolean getParameterBoolean(String key);
|
||||
}
|
@ -1,31 +0,0 @@
|
||||
package com.farm.core.auth.domain;
|
||||
|
||||
public interface AuthKey {
|
||||
/**
|
||||
* 是否需要用户登录使用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isLogin();
|
||||
|
||||
/**
|
||||
* 是否需要检查用户权限
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isCheck();
|
||||
|
||||
/**
|
||||
* 是否可用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean isUseAble();
|
||||
|
||||
/**
|
||||
* 获得名称
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getTitle();
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
package com.farm.core.auth.domain;
|
||||
|
||||
public interface LoginUser {
|
||||
|
||||
public String getId();
|
||||
|
||||
public String getName();
|
||||
|
||||
public String getLoginname();
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package com.farm.core.auth.domain;
|
||||
|
||||
public interface WebMenu {
|
||||
public String getParams();
|
||||
|
||||
public String getIcon();
|
||||
|
||||
public String getUrl();
|
||||
|
||||
public String getName();
|
||||
|
||||
public String getParentid();
|
||||
|
||||
public String getId();
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
package com.farm.core.auth.exception;
|
||||
|
||||
public class LoginUserNoExistException extends Exception {
|
||||
public LoginUserNoExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private static final long serialVersionUID = 6482296763929242398L;
|
||||
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
//创建一个类来存储版本信息
|
||||
@Configuration
|
||||
@ConfigurationProperties(prefix = "app.version")
|
||||
public class VersionInfo {
|
||||
private String name;
|
||||
private String version;
|
||||
private String description;
|
||||
|
||||
// getters and setters
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
@ -1,8 +0,0 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
@ -1,17 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DataSourceManagerImpl" format="xml" multifile-model="true">
|
||||
<data-source source="LOCAL" name="@localhost" uuid="08824a93-b251-4762-b303-aa8270a2043e">
|
||||
<driver-ref>mysql_aurora_aws</driver-ref>
|
||||
<synchronize>true</synchronize>
|
||||
<jdbc-driver>software.aws.rds.jdbc.mysql.Driver</jdbc-driver>
|
||||
<jdbc-url>jdbc:mysql:aws://localhost:3306</jdbc-url>
|
||||
<jdbc-additional-properties>
|
||||
<property name="com.intellij.clouds.kubernetes.db.host.port" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.enabled" value="false" />
|
||||
<property name="com.intellij.clouds.kubernetes.db.container.port" />
|
||||
</jdbc-additional-properties>
|
||||
<working-dir>$ProjectFileDir$</working-dir>
|
||||
</data-source>
|
||||
</component>
|
||||
</project>
|
@ -1,7 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding">
|
||||
<file url="file://$PROJECT_DIR$/src/main/java" charset="UTF-8" />
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources" charset="UTF-8" />
|
||||
</component>
|
||||
</project>
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||
<component name="MavenProjectsManager">
|
||||
<option name="originalFiles">
|
||||
<list>
|
||||
<option value="$PROJECT_DIR$/pom.xml" />
|
||||
</list>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="SqlDialectMappings">
|
||||
<file url="file://$PROJECT_DIR$/src/main/resources/UserMapper.xml" dialect="MySQL" />
|
||||
</component>
|
||||
</project>
|
@ -1,124 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Palette2">
|
||||
<group name="Swing">
|
||||
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
|
||||
</item>
|
||||
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.svg" removable="false" auto-create-binding="false" can-attach-label="true">
|
||||
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
|
||||
<initial-values>
|
||||
<property name="text" value="Button" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="RadioButton" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="CheckBox" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
|
||||
<initial-values>
|
||||
<property name="text" value="Label" />
|
||||
</initial-values>
|
||||
</item>
|
||||
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
|
||||
<preferred-size width="150" height="-1" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
|
||||
<preferred-size width="150" height="50" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
|
||||
<preferred-size width="200" height="200" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.svg" removable="false" auto-create-binding="true" can-attach-label="true">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
|
||||
</item>
|
||||
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
|
||||
<preferred-size width="-1" height="20" />
|
||||
</default-constraints>
|
||||
</item>
|
||||
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.svg" removable="false" auto-create-binding="false" can-attach-label="false">
|
||||
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
|
||||
</item>
|
||||
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.svg" removable="false" auto-create-binding="true" can-attach-label="false">
|
||||
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
|
||||
</item>
|
||||
</group>
|
||||
</component>
|
||||
</project>
|
Binary file not shown.
@ -1,67 +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>com.maven_javaprogram</groupId>
|
||||
<artifactId>mybatis_demo</artifactId>
|
||||
<packaging>war</packaging>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>mybatis_demo Maven Webapp</name>
|
||||
<url>http://maven.apache.org</url>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>3.8.1</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mybatis</groupId>
|
||||
<artifactId>mybatis</artifactId>
|
||||
<version>3.5.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>5.1.48</version> <!-- 使用适合你的版本 -->
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.junit.jupiter</groupId>
|
||||
<artifactId>junit-jupiter</artifactId>
|
||||
<version>RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<build>
|
||||
<finalName>mybatis_demo</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<!-- 根据需要添加其他文件类型 -->
|
||||
</includes>
|
||||
<!-- 如果需要排除某些文件,可以使用<excludes>标签 -->
|
||||
<!-- <excludes> -->
|
||||
<!-- <exclude>**/*.excluded</exclude> -->
|
||||
<!-- </excludes> -->
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.xml</include>
|
||||
</includes>
|
||||
</resource>
|
||||
|
||||
</resources>
|
||||
<!-- 其他构建配置 -->
|
||||
|
||||
|
||||
</build>
|
||||
|
||||
</project>
|
@ -1,17 +0,0 @@
|
||||
package com.kuang.dao;
|
||||
|
||||
import com.kuang.pojo.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface UseMapper {
|
||||
List<User> getUserList();
|
||||
int addUser(User user);
|
||||
User selectId(int a);
|
||||
int updateUser();
|
||||
int deleteUser(int i);
|
||||
int insertUserByMap(Map map);
|
||||
List<User> likeSelectUser(String a);
|
||||
}
|
||||
|
@ -1,28 +0,0 @@
|
||||
package com.kuang.mybatisUtils;
|
||||
|
||||
import org.apache.ibatis.io.Resources;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.apache.ibatis.session.SqlSessionFactory;
|
||||
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
public class mybatisUtils {
|
||||
private static SqlSessionFactory sqlSessionFactory;
|
||||
static{
|
||||
String resource = "mybatis-config.xml";
|
||||
InputStream inputStream;
|
||||
{
|
||||
try {
|
||||
inputStream = Resources.getResourceAsStream(resource);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream);
|
||||
}
|
||||
public static SqlSession getSqlSession(){
|
||||
return sqlSessionFactory.openSession();
|
||||
}
|
||||
}
|
@ -1,46 +0,0 @@
|
||||
package com.kuang.pojo;
|
||||
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
@Alias("user")
|
||||
public class User {
|
||||
private int id;
|
||||
private String name;
|
||||
private int numId;
|
||||
public User(int id, String name, int numId) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
this.numId = numId;
|
||||
}
|
||||
public int getNumId() {
|
||||
return numId;
|
||||
}
|
||||
|
||||
public void setNumId(int numId) {
|
||||
this.numId = numId;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "com.kuang.pojo.User{" +
|
||||
"id=" + id +
|
||||
", name='" + name+", " +"numId"+numId+
|
||||
'}';
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
package com.kuang.test;
|
||||
|
||||
import com.kuang.dao.UseMapper;
|
||||
import com.kuang.mybatisUtils.mybatisUtils;
|
||||
import com.kuang.pojo.User;
|
||||
import org.apache.ibatis.session.SqlSession;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class mybatisDemo {
|
||||
@Test
|
||||
public void test() {
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
List<User> userList = mapper.getUserList();
|
||||
for (User user : userList) {
|
||||
System.out.println(user);
|
||||
}
|
||||
sqlSession.close();
|
||||
}
|
||||
@Test
|
||||
public void test1(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
int i = mapper.addUser(new User(5,"quqiCake",5));
|
||||
if(i>0){
|
||||
System.out.println("参数加入成功");
|
||||
sqlSession.commit();
|
||||
}else{
|
||||
System.out.println("加入失败");
|
||||
}
|
||||
sqlSession.close();
|
||||
|
||||
}
|
||||
@Test
|
||||
public void test2(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
User user = mapper.selectId(1);
|
||||
System.out.println(user);
|
||||
}
|
||||
@Test
|
||||
public void test3(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
int a = mapper.updateUser();
|
||||
if(a>0){
|
||||
System.out.println("提交成功");
|
||||
sqlSession.commit();
|
||||
}
|
||||
sqlSession.close();
|
||||
}
|
||||
@Test
|
||||
public void test4(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
int a = mapper.deleteUser(5);
|
||||
if(a>0){
|
||||
System.out.println("删除成功");
|
||||
sqlSession.commit();
|
||||
}
|
||||
sqlSession.close();
|
||||
}
|
||||
@Test
|
||||
public void test5(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("id",5);
|
||||
map.put("name","quqiCake");
|
||||
map.put("numId",5);
|
||||
int a = mapper.insertUserByMap(map);
|
||||
if(a>0){
|
||||
System.out.println("添加成功");
|
||||
sqlSession.commit();
|
||||
}
|
||||
|
||||
}
|
||||
@Test
|
||||
public void test6(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
//获得sql
|
||||
UseMapper mapper = sqlSession.getMapper(UseMapper.class);
|
||||
List<User> users = mapper.likeSelectUser("h%");
|
||||
for (User user : users) {
|
||||
System.out.println(user);
|
||||
}
|
||||
}
|
||||
@Test
|
||||
public void test7(){
|
||||
SqlSession sqlSession = mybatisUtils.getSqlSession();
|
||||
//获得sql 参数是一个映射的语句
|
||||
String s="com.kuang.dao.UseMapper.selectId";
|
||||
List<User> objects = sqlSession.selectList(s);
|
||||
System.out.println(objects);
|
||||
}
|
||||
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.kuang.dao.UseMapper">
|
||||
<resultMap id="UserMapper" type="User">
|
||||
<!-- 把字段名和属性名不一样的改一下-->
|
||||
<result column="name" property="CakeName"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectId" parameterType="int" resultMap="UserMapper">
|
||||
select * from cakeinfo.cakeinfo where id=#{id};
|
||||
</select>
|
||||
|
||||
<select id="getUserList" resultType="User">
|
||||
select * from cakeinfo.cakeinfo;
|
||||
</select>
|
||||
<insert id="addUser" parameterType="com.kuang.pojo.User">
|
||||
insert into cakeinfo.cakeinfo(id, name, numId) value (#{id},#{name},#{numId});
|
||||
</insert>
|
||||
|
||||
<update id="updateUser" parameterType="com.kuang.pojo.User">
|
||||
update cakeinfo.cakeinfo set name='xiaoqiqu' where id=5;
|
||||
</update>
|
||||
<delete id="deleteUser" parameterType="int">
|
||||
delete from cakeinfo.cakeinfo where id=#{id};
|
||||
</delete>
|
||||
<insert id="insertUserByMap" parameterType="map" >
|
||||
insert into cakeinfo.cakeinfo (id, name, numId)
|
||||
values (#{id},#{name},#{numId});
|
||||
</insert>
|
||||
<select id="likeSelectUser" parameterType="String" resultType="User">
|
||||
select * from cakeinfo.cakeinfo where name like #{name};
|
||||
</select>
|
||||
</mapper>
|
@ -1,30 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE configuration
|
||||
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-config.dtd">
|
||||
|
||||
<configuration>
|
||||
<typeAliases>
|
||||
<typeAlias type="com.kuang.pojo.User" alias="User"/>
|
||||
</typeAliases>
|
||||
|
||||
|
||||
<!-- <typeAliases>-->
|
||||
<!-- <package name="com.kuang.pojo"/>-->
|
||||
<!-- </typeAliases>-->
|
||||
|
||||
<environments default="development">
|
||||
<environment id="development">
|
||||
<transactionManager type="JDBC"/>
|
||||
<dataSource type="POOLED">
|
||||
<property name="driver" value="com.mysql.jdbc.Driver"/>
|
||||
<property name="url" value="jdbc:mysql://127.0.0.1:3306/cakeinfo?useUnicode=true&characterEncoding=UTF-8&userSSL=false&serverTimezone=GMT%2B8"/>
|
||||
<property name="username" value="denglihui"/>
|
||||
<property name="password" value="123456"/>
|
||||
</dataSource>
|
||||
</environment>
|
||||
</environments>
|
||||
<mappers>
|
||||
<mapper resource="UserMapper.xml"/>
|
||||
</mappers>
|
||||
</configuration>
|
@ -1,7 +0,0 @@
|
||||
<!DOCTYPE web-app PUBLIC
|
||||
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
|
||||
"http://java.sun.com/dtd/web-app_2_3.dtd" >
|
||||
|
||||
<web-app>
|
||||
<display-name>Archetype Created Web Application</display-name>
|
||||
</web-app>
|
@ -1,5 +0,0 @@
|
||||
<html>
|
||||
<body>
|
||||
<h2>Hello World!</h2>
|
||||
</body>
|
||||
</html>
|
@ -1,54 +0,0 @@
|
||||
package com.farm.core.auth.util;
|
||||
|
||||
/**
|
||||
* 密码编码解码类
|
||||
*
|
||||
* @author 王东
|
||||
*
|
||||
*/
|
||||
public interface AuthenticateInter {
|
||||
/**
|
||||
* 将明文加密
|
||||
*
|
||||
* @param password
|
||||
* 传人明文
|
||||
* @return
|
||||
*/
|
||||
public String encodeMacpro(String password);
|
||||
|
||||
/**
|
||||
* 将密文解密
|
||||
*
|
||||
* @param password
|
||||
* 传人密文
|
||||
* @return
|
||||
* @throws Exception
|
||||
* 解码异常
|
||||
*/
|
||||
public String decodeMacpro(String password) throws Exception;
|
||||
|
||||
/**
|
||||
* md5不可逆的编码
|
||||
*
|
||||
* @param password
|
||||
* 传人明文
|
||||
* @return
|
||||
*/
|
||||
public String encodeMd5(String password);
|
||||
|
||||
/**
|
||||
* 判断是否是MD5密码
|
||||
*
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public boolean isMd5code(String password);
|
||||
|
||||
/**
|
||||
* 加密用户密码MD5(password+loginname)
|
||||
*
|
||||
* @param password
|
||||
* @return
|
||||
*/
|
||||
public String encodeLoginPasswordOnMd5(String password, String loginName);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package com.farm.core.auth.util; // 定义包名,表示该类位于 com.farm.core.auth.util 包中
|
||||
|
||||
public class KeyUtil { // 定义 KeyUtil 类,用于处理与密钥相关的工具方法
|
||||
|
||||
@SuppressWarnings("unused") // 抑制未使用变量的警告
|
||||
private static String errorkey = "ERROR"; // 定义一个静态变量,用于表示错误密钥,但目前未使用
|
||||
|
||||
@SuppressWarnings("unused") // 抑制未使用变量的警告
|
||||
private static String CODE_C = "SADFSEV"; // 定义一个静态变量,可能用于编码或加密的常量,但目前未使用
|
||||
|
||||
public static String getFkey(String mkey) { // 定义一个公共静态方法,用于获取某种密钥
|
||||
return "NONE"; // 目前该方法直接返回 "NONE",表示没有有效的密钥
|
||||
}
|
||||
|
||||
public static String getMKey() { // 定义一个公共静态方法,用于获取主密钥
|
||||
return "NONE"; // 目前该方法直接返回 "NONE",表示没有有效的主密钥
|
||||
}
|
||||
|
||||
} // KeyUtil 类结束
|
||||
|
||||
// 注意:这个类中的方法目前只是返回了 "NONE",这可能是一个占位符或者表示某种默认行为。实际应用中,这些方法应该被实现为返回有效的密钥值。同时,类中定义了两个未使用的静态变量,可能是在未来版本中会使用到。
|
||||
|
@ -1,46 +0,0 @@
|
||||
package com.farm.core.para.impl;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.farm.core.ParameterService;
|
||||
|
||||
public class ParaTestImpl implements ParameterService {
|
||||
|
||||
@Override
|
||||
public Map<String, String> getDictionary(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Entry<String, String>> getDictionaryList(String index) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParameter(String key, String userId) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getParameterInt(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getParameterBoolean(String key) {
|
||||
// TODO Auto-generated method stub
|
||||
return false;
|
||||
}
|
||||
}
|
@ -1,104 +0,0 @@
|
||||
package com.farm.core.sql.query;
|
||||
|
||||
import java.sql.SQLException;
|
||||
|
||||
import org.hibernate.Session;
|
||||
|
||||
import com.farm.core.sql.result.DataResult;
|
||||
import com.farm.util.spring.HibernateSessionFactory;
|
||||
|
||||
public class SQLQuery {
|
||||
private String sql; // SQL查询语句
|
||||
private int pagesize; // 每页显示的记录数
|
||||
private int currentPage; // 当前页码
|
||||
private String countSql; // 用于查询总记录数的SQL语句
|
||||
|
||||
private SQLQuery() {
|
||||
// 私有构造函数,防止直接实例化
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取SQLQuery实例
|
||||
* @param sql SQL查询语句
|
||||
* @param countSql 数量查询可以为空NULL
|
||||
* @param pagesize 每页显示的记录数
|
||||
* @param currentPage 当前页码
|
||||
* @return SQLQuery实例
|
||||
*/
|
||||
public static SQLQuery getInstance(String sql, String countSql,
|
||||
int pagesize, int currentPage) {
|
||||
SQLQuery query = new SQLQuery();
|
||||
query.setCurrentPage(currentPage);
|
||||
query.setPagesize(pagesize);
|
||||
query.setSql(sql);
|
||||
query.setCountSql(countSql);
|
||||
return query;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行查询
|
||||
*
|
||||
* @param session Hibernate会话
|
||||
* @return 查询结果
|
||||
* @throws SQLException 如果查询过程中发生SQL异常
|
||||
*/
|
||||
public DataResult search(Session session) throws SQLException {
|
||||
return HibernateQueryHandle.runSqlQuery(session, sql, countSql,
|
||||
pagesize, currentPage);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 执行查询
|
||||
*
|
||||
* @return 查询结果
|
||||
* @throws SQLException 如果查询过程中发生SQL异常
|
||||
*/
|
||||
public DataResult search() throws SQLException {
|
||||
Session session = HibernateSessionFactory.getSession(); // 获取Hibernate会话
|
||||
DataResult result = null;
|
||||
try {
|
||||
result = this.search(session); // 使用获取的会话执行查询
|
||||
} catch (Exception e) {
|
||||
throw new SQLException(e); // 捕获异常并转换为SQLException抛出
|
||||
} finally {
|
||||
session.close(); // 确保会话被关闭
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------
|
||||
// 以下是属性的getter和setter方法
|
||||
public String getSql() {
|
||||
return sql;
|
||||
}
|
||||
|
||||
public void setSql(String sql) {
|
||||
this.sql = sql;
|
||||
}
|
||||
|
||||
public int getPagesize() {
|
||||
return pagesize;
|
||||
}
|
||||
|
||||
public void setPagesize(int pagesize) {
|
||||
this.pagesize = pagesize;
|
||||
}
|
||||
|
||||
public int getCurrentPage() {
|
||||
return currentPage;
|
||||
}
|
||||
|
||||
public void setCurrentPage(int currentPage) {
|
||||
this.currentPage = currentPage;
|
||||
}
|
||||
|
||||
public String getCountSql() {
|
||||
return countSql;
|
||||
}
|
||||
|
||||
public void setCountSql(String countSql) {
|
||||
this.countSql = countSql;
|
||||
}
|
||||
|
||||
}
|
@ -1,18 +0,0 @@
|
||||
package com.farm.core.sql.result;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 结果集合的迭代接口
|
||||
*
|
||||
* @author Administrator
|
||||
*
|
||||
*/
|
||||
public interface ResultsHandle {
|
||||
/**
|
||||
* 结果集合中的行
|
||||
*
|
||||
* @param row
|
||||
*/
|
||||
public void handle(Map<String, Object> row);
|
||||
}
|
@ -1,145 +0,0 @@
|
||||
package com.farm.core.sql.utils;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.hibernate.Query;
|
||||
import org.hibernate.SQLQuery;
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
import org.hibernate.persister.entity.AbstractEntityPersister;
|
||||
|
||||
import com.farm.core.sql.query.DBRule;
|
||||
|
||||
public abstract class HibernateSQLTools<E> {
|
||||
|
||||
private AbstractEntityPersister classMetadata;
|
||||
|
||||
protected abstract Class<?> getTypeClass();
|
||||
|
||||
protected abstract SessionFactory getSessionFactory();
|
||||
|
||||
/**
|
||||
* 在更新时创建对象键值对
|
||||
*
|
||||
* @param keyValses
|
||||
* @return Address = 'Zhongshan 23', City = 'Nanjing'
|
||||
*/
|
||||
public static String getValusSqlStr(Map<String, Object> keyValses) {
|
||||
boolean isFirst = true;
|
||||
StringBuffer returnStr = new StringBuffer();
|
||||
for (Entry<String, Object> node : keyValses.entrySet()) {
|
||||
if (isFirst) {
|
||||
isFirst = false;
|
||||
} else {
|
||||
returnStr.append(",");
|
||||
}
|
||||
returnStr.append(node.getKey());
|
||||
returnStr.append(" = ");
|
||||
returnStr.append("'");
|
||||
returnStr.append(node.getValue());
|
||||
returnStr.append("'");
|
||||
}
|
||||
return returnStr.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建批量删除sql
|
||||
*
|
||||
* @param session
|
||||
* @param rules 条件序列
|
||||
*/
|
||||
public void deleteSqlFromFunction(Session session, List<DBRule> rules) {
|
||||
classMetadata = (AbstractEntityPersister) getSessionFactory().getClassMetadata(getTypeClass());
|
||||
String whereStr;
|
||||
if (rules == null || rules.size() <= 0) {
|
||||
whereStr = "";
|
||||
} else {
|
||||
whereStr = " WHERE 1=1" + DBRule.makeWhereStr(rules);
|
||||
}
|
||||
SQLQuery sqlquery = session.createSQLQuery("DELETE FROM " + classMetadata.getTableName() + whereStr);
|
||||
sqlquery.executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建批量查询SQL
|
||||
*
|
||||
* @param session
|
||||
* @param rules 条件序列
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<E> selectSqlFromFunction(Session session, List<DBRule> rules) {
|
||||
classMetadata = (AbstractEntityPersister) getSessionFactory().getClassMetadata(getTypeClass());
|
||||
String whereStr;
|
||||
if (rules == null || rules.size() <= 0) {
|
||||
whereStr = "";
|
||||
} else {
|
||||
whereStr = " WHERE 1=1" + DBRule.makeWhereStr(rules);
|
||||
}
|
||||
Query sqlquery = session.createQuery("FROM " + getTypeClass().getName() + whereStr);
|
||||
List<E> list = sqlquery.list();
|
||||
return list;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<E> selectSqlFromFunction(Session session, List<DBRule> rules, int maxnum) {
|
||||
classMetadata = (AbstractEntityPersister) getSessionFactory().getClassMetadata(getTypeClass());
|
||||
String whereStr;
|
||||
if (rules == null || rules.size() <= 0) {
|
||||
whereStr = "";
|
||||
} else {
|
||||
whereStr = " WHERE 1=1" + DBRule.makeWhereStr(rules);
|
||||
}
|
||||
Query sqlquery = session.createQuery("FROM " + getTypeClass().getName() + whereStr);
|
||||
sqlquery.setMaxResults(maxnum);
|
||||
List<E> list = sqlquery.list();
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建批量更新SQL
|
||||
*
|
||||
* @param sessionFatory
|
||||
* @param values
|
||||
* @param rules
|
||||
*/
|
||||
public void updataSqlFromFunction(Session session, Map<String, Object> values, List<DBRule> rules) {
|
||||
classMetadata = (AbstractEntityPersister) getSessionFactory().getClassMetadata(getTypeClass().getClass());
|
||||
if (values == null || values.size() <= 0) {
|
||||
return;
|
||||
}
|
||||
String whereStr;
|
||||
if (rules == null || rules.size() <= 0) {
|
||||
whereStr = "";
|
||||
} else {
|
||||
whereStr = " WHERE 1=1" + DBRule.makeWhereStr(rules);
|
||||
}
|
||||
SQLQuery sqlquery = session.createSQLQuery("UPDATE " + classMetadata.getTableName() + " SET "
|
||||
+ HibernateSQLTools.getValusSqlStr(values) + whereStr);
|
||||
sqlquery.executeUpdate();
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建自定义统计SQL
|
||||
*
|
||||
* @param sessionFatory
|
||||
* @param values
|
||||
* @param rules
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public int countSqlFromFunction(Session session, List<DBRule> rules) {
|
||||
classMetadata = (AbstractEntityPersister) getSessionFactory().getClassMetadata(getTypeClass());
|
||||
String whereStr;
|
||||
if (rules == null || rules.size() <= 0) {
|
||||
whereStr = "";
|
||||
} else {
|
||||
whereStr = " WHERE 1=1" + DBRule.makeWhereStr(rules);
|
||||
}
|
||||
SQLQuery sqlquery = session
|
||||
.createSQLQuery("select count(*) num FROM " + classMetadata.getTableName() + whereStr);
|
||||
List<E> list = sqlquery.list();
|
||||
return Integer.valueOf(list.get(0).toString());
|
||||
}
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
package com.farm.util.cache;
|
||||
|
||||
public interface FarmCacheGenerater{
|
||||
public Object generateData();
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package com.farm.util.cache;
|
||||
|
||||
/**
|
||||
* 缓存名称
|
||||
*
|
||||
* @author macpl
|
||||
*
|
||||
*/
|
||||
public enum FarmCacheName {
|
||||
//AI问答消息缓存
|
||||
wcpAiMessages("wcp-ai-messages"),
|
||||
//AI问答中的用户
|
||||
wcpAiUserTalking("wcp-ai-talkuser")
|
||||
;
|
||||
|
||||
/**
|
||||
* 持久缓存
|
||||
*/
|
||||
private String permanentCacheName;
|
||||
|
||||
FarmCacheName(String permanentCacheName) {
|
||||
this.permanentCacheName = permanentCacheName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 如果只有一个缓存就是这个持久缓缓存
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public String getPermanentCacheName() {
|
||||
return permanentCacheName;
|
||||
}
|
||||
}
|
@ -1,34 +0,0 @@
|
||||
package com.farm.util.spring;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.context.support.ClassPathXmlApplicationContext;
|
||||
import org.springframework.web.context.support.WebApplicationContextUtils;
|
||||
|
||||
import com.farm.core.config.AppConfig;
|
||||
|
||||
//读取配置文件进行加载
|
||||
public class BeanFactory {
|
||||
private static ApplicationContext appContext;
|
||||
|
||||
public static Object getBean(String beanId) {
|
||||
getContext();
|
||||
return appContext.getBean(beanId);
|
||||
}
|
||||
|
||||
public static ApplicationContext getContext() {
|
||||
if (appContext == null) {
|
||||
appContext = new ClassPathXmlApplicationContext(AppConfig
|
||||
.getString("init.config.spring.configs").split(","));
|
||||
}
|
||||
return appContext;
|
||||
}
|
||||
|
||||
public static Object getBean(String beanId, ServletContext servletContext) {
|
||||
ApplicationContext ctx = WebApplicationContextUtils
|
||||
.getWebApplicationContext(servletContext);
|
||||
return ctx.getBean(beanId);
|
||||
}
|
||||
|
||||
}
|
@ -1,27 +0,0 @@
|
||||
package com.farm.util.spring;
|
||||
|
||||
import org.hibernate.Session;
|
||||
import org.hibernate.SessionFactory;
|
||||
|
||||
/**
|
||||
* spring hibernateSessionFactory
|
||||
*
|
||||
* @author 王东
|
||||
*
|
||||
*/
|
||||
public class HibernateSessionFactory {
|
||||
private static final SessionFactory sessionf = (SessionFactory) BeanFactory
|
||||
.getBean("sessionFactory");
|
||||
|
||||
public static void closeSession(Session session) {
|
||||
session.close();
|
||||
}
|
||||
|
||||
public static Session getSession() {
|
||||
return sessionf.openSession();
|
||||
}
|
||||
|
||||
public static SessionFactory getFactory() {
|
||||
return sessionf;
|
||||
}
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
package com.farm.util.validate;
|
||||
|
||||
|
||||
public class ValidUtils {
|
||||
public static boolean isEmptyString(String str) {
|
||||
return str == null || str.trim().length() <= 0;
|
||||
}
|
||||
}
|
@ -1,193 +0,0 @@
|
||||
package com.farm.web.action;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.apache.log4j.MDC;
|
||||
|
||||
import com.farm.core.AuthorityService;
|
||||
import com.farm.core.auth.domain.WebMenu;
|
||||
import com.farm.core.page.ViewMode;
|
||||
import com.farm.web.online.OnlineUserOpImpl;
|
||||
import com.farm.web.online.OnlineUserOpInter;
|
||||
|
||||
/**
|
||||
* 权限资源
|
||||
*
|
||||
* @author MAC_alone
|
||||
*
|
||||
*/
|
||||
public class FarmAction {
|
||||
private String name;
|
||||
private String password;
|
||||
private String autoLogin;
|
||||
private HttpSession httpSession;
|
||||
private HttpServletRequest httprequest;
|
||||
private HttpServletResponse httprespons;
|
||||
private ViewMode page;
|
||||
private List<Map<String, Object>> result;
|
||||
private List<WebMenu> menus;
|
||||
private String menuId;
|
||||
private static final Logger log = Logger.getLogger(FarmAction.class);
|
||||
|
||||
// /**
|
||||
// * 用户登录
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public void loginCommit(HttpSession session,
|
||||
// HttpServletResponse httpResponse, HttpServletRequest httpRequest) {
|
||||
// AuthorityService authAdapter = farmService.getAuthorityService();
|
||||
// page = ViewMode.getInstance();
|
||||
// try {
|
||||
// if (!authAdapter.isLegality(name, password)) {
|
||||
// page.setError("登录失败:密码错误");
|
||||
// log.error("登录失败:密码错误");
|
||||
// return;
|
||||
// } else {
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// page.setError(e.getMessage() + "用户验证失败");
|
||||
// log.error("登录失败:用户验证失败");
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
// {// 登录成功
|
||||
// // 开始写入session用户信息
|
||||
// if (httpSession == null) {
|
||||
// WebUtils.setCurrentUser(authAdapter.getUserByLoginName(name));
|
||||
// WebUtils.setLoginTime(session);
|
||||
// } else {
|
||||
// WebUtils.setCurrentUser(authAdapter.getUserByLoginName(name),
|
||||
// httpSession);
|
||||
// WebUtils.setLoginTime(httpSession);
|
||||
// }
|
||||
//
|
||||
// // 开始写入session用户权限
|
||||
// if (httpSession == null) {
|
||||
// WebUtils.setCurrentUserAction(authAdapter
|
||||
// .getUserAuthKeys(WebUtils.getCurrentUser(session).getId()));
|
||||
// } else {
|
||||
// WebUtils.setCurrentUserAction(
|
||||
// authAdapter.getUserAuthKeys(WebUtils.getCurrentUser(
|
||||
// httpSession).getId()), httpSession);
|
||||
// }
|
||||
// // 开始写入session用户菜单
|
||||
// if (httpSession == null) {
|
||||
// WebUtils.setCurrentUserMenu(authAdapter.getUserMenu(WebUtils.getCurrentUser(
|
||||
// session).getId()));
|
||||
// } else {
|
||||
// WebUtils.setCurrentUserMenu(authAdapter.getUserMenu(WebUtils.getCurrentUser(
|
||||
// httpSession).getId()), httpSession);
|
||||
// }
|
||||
// // 写入用户上线信息
|
||||
// OnlineUserOpInter ouop = null;
|
||||
// if (httpSession == null) {
|
||||
// ouop = OnlineUserOpImpl.getInstance(
|
||||
// WebUtils.getCurrentIp(httpRequest), name, session);
|
||||
// } else {
|
||||
// ouop = OnlineUserOpImpl.getInstance(
|
||||
// httprequest.getRemoteAddr(), name,
|
||||
// WebUtils.getSession(httpSession));
|
||||
// }
|
||||
// ouop.userLoginHandle(authAdapter.getUserByLoginName(name));
|
||||
// // 记录用户登录时间
|
||||
// authAdapter.loginHandle(WebUtils.getCurrentUser(httpSession).getId());
|
||||
// }
|
||||
// MDC.put("USERID", WebUtils.getCurrentUser(httpSession).getId());
|
||||
// log.info("登录成功");
|
||||
// } catch (Exception e) {
|
||||
// page.setError(e + e.getMessage());
|
||||
// log.error("登录失败:" + e.getMessage());
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获得menu
|
||||
// *
|
||||
// * @return
|
||||
// */
|
||||
// public List<WebMenu> findMenu(HttpSession session) {
|
||||
// return WebUtils.getCurrentUserMenus(session);
|
||||
// }
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(List<Map<String, Object>> result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public String getMenuId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
public void setMenuId(String menuId) {
|
||||
this.menuId = menuId;
|
||||
}
|
||||
|
||||
public HttpSession getHttpSession() {
|
||||
return httpSession;
|
||||
}
|
||||
|
||||
public void setHttpSession(HttpSession httpSession) {
|
||||
this.httpSession = httpSession;
|
||||
}
|
||||
|
||||
public String getAutoLogin() {
|
||||
return autoLogin;
|
||||
}
|
||||
|
||||
public HttpServletRequest getHttprequest() {
|
||||
return httprequest;
|
||||
}
|
||||
|
||||
public void setHttprequest(HttpServletRequest httprequest) {
|
||||
this.httprequest = httprequest;
|
||||
}
|
||||
|
||||
public HttpServletResponse getHttprespons() {
|
||||
return httprespons;
|
||||
}
|
||||
|
||||
public void setHttprespons(HttpServletResponse httprespons) {
|
||||
this.httprespons = httprespons;
|
||||
}
|
||||
|
||||
public void setAutoLogin(String autoLogin) {
|
||||
this.autoLogin = autoLogin;
|
||||
}
|
||||
|
||||
public List<WebMenu> getMenus() {
|
||||
return menus;
|
||||
}
|
||||
|
||||
public void setMenus(List<WebMenu> menus) {
|
||||
this.menus = menus;
|
||||
}
|
||||
}
|
@ -1,227 +0,0 @@
|
||||
package com.farm.web.easyui;
|
||||
|
||||
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 com.farm.core.sql.query.DBSort;
|
||||
import com.farm.core.sql.query.DataQuery;
|
||||
import com.farm.core.sql.result.DataResult;
|
||||
|
||||
/**
|
||||
* UI扩展工具类
|
||||
*
|
||||
* @author 王东
|
||||
* @date 2013-4-28
|
||||
*/
|
||||
public class EasyUiUtils {
|
||||
/**
|
||||
* 1 字符串
|
||||
*/
|
||||
private static String EDITOR_TYPE_TEXT = "text";
|
||||
/**
|
||||
* 2 数字
|
||||
*/
|
||||
private static String EDITOR_TYPE_SELECT = "numberbox";
|
||||
/**
|
||||
* 3 枚举
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static String EDITOR_TYPE_CHECKBOX = "{ \"type\":\"checkbox\", \"options\":{\"on\":true,\"off\":false} }";
|
||||
/**
|
||||
* 4 单选{ "type":"checkbox", "options":{"on":true,"off":false} }
|
||||
*/
|
||||
@SuppressWarnings("unused")
|
||||
private static String EDITOR_TYPE_NUMBERBOX = "numberbox";
|
||||
|
||||
public static Map<String, Object> formatGridData(DataResult result) {
|
||||
Map<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("total", result.getTotalSize());
|
||||
map.put("rows", result.getResultList());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 将结果集转义成propertyGrid对象的json格式 1 字符串2 数字3 枚举4 单选rules中存放逗号分隔的选项
|
||||
*
|
||||
* @param list
|
||||
* 结果集中的list
|
||||
* @param nameIndex
|
||||
* @param valueIndex
|
||||
* @param GroupIndex
|
||||
* @param editorType
|
||||
* @return
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static List<Map<String, Object>> formatPropertygridData(
|
||||
List<Map<String, Object>> list, String nameIndex,
|
||||
String valueIndex, String GroupIndex, String editorType,
|
||||
String ruleIndex, String idIndex) {
|
||||
// [{"name":"Name","value":"Bill Smith","group":"ID Settings","editor":"text"}]
|
||||
List<Map<String, Object>> returnList = new ArrayList<Map<String, Object>>();
|
||||
for (@SuppressWarnings("rawtypes")
|
||||
Iterator iterator = list.iterator(); iterator.hasNext();) {
|
||||
Map<String, Object> map = (Map<String, Object>) iterator.next();
|
||||
Map<String, Object> easyMap = new HashMap<String, Object>();
|
||||
easyMap.put("name", map.get(nameIndex).toString());
|
||||
easyMap.put("value", map.get(valueIndex).toString());
|
||||
easyMap.put("group", map.get(GroupIndex).toString());
|
||||
easyMap.put("id", map.get(idIndex).toString());
|
||||
// 1是文本2是枚举
|
||||
Object editor = EDITOR_TYPE_TEXT;
|
||||
if ("2".equals(map.get(editorType).toString())) {
|
||||
editor = EDITOR_TYPE_SELECT;
|
||||
}
|
||||
if ("3".equals(map.get(editorType).toString())) {
|
||||
if(map.get(ruleIndex)!=null){
|
||||
editor = getComboboxOptions(map.get(ruleIndex).toString());
|
||||
}
|
||||
}
|
||||
if ("4".equals(map.get(editorType).toString())) {
|
||||
Map<String, Object> type = new HashMap<String, Object>();
|
||||
type.put("type", "checkbox");
|
||||
Map<String, Object> type2 = new HashMap<String, Object>();
|
||||
type2.put("on", true);
|
||||
type2.put("off", false);
|
||||
type.put("options", type2);
|
||||
editor = type;
|
||||
// { "type":"checkbox", "options":{"on":true,"off":false} }
|
||||
}
|
||||
easyMap.put("editor", editor);
|
||||
returnList.add(easyMap);
|
||||
}
|
||||
|
||||
return returnList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成 propertyGrid中的下拉框JSON
|
||||
*
|
||||
* @param Rules
|
||||
* 逗号分隔的枚举项
|
||||
* @return
|
||||
*/
|
||||
private static Map<String, Object> getComboboxOptions(String Rules) {
|
||||
// "editor":{
|
||||
// "type":"combobox",
|
||||
// "options":{
|
||||
// "data":[{"value":1,"text":"一"},{"value":2,"text":"二"}],
|
||||
// "panelHeight":"auto"
|
||||
// }
|
||||
Map<String, Object> map1 = new HashMap<String, Object>();
|
||||
// ---------------------------------------
|
||||
String[] ruleArray = Rules.split(",");
|
||||
List<Map<String, Object>> ruleList = new ArrayList<Map<String, Object>>();
|
||||
for (int i = 0; i < ruleArray.length; i++) {
|
||||
Map<String, Object> nodeMap = new HashMap<String, Object>();
|
||||
nodeMap.put("value", ruleArray[i]);
|
||||
nodeMap.put("text", ruleArray[i]);
|
||||
ruleList.add(nodeMap);
|
||||
}
|
||||
Map<String, Object> mapOptions = new HashMap<String, Object>();
|
||||
mapOptions.put("data", ruleList);
|
||||
mapOptions.put("panelHeight", "auto");
|
||||
map1.put("type", "combobox");
|
||||
map1.put("options", mapOptions);
|
||||
return map1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化ajax子树数据
|
||||
*
|
||||
* @param result1
|
||||
* 依据父id查询出来的节点集合
|
||||
* @param result2
|
||||
* 依据父id查询出来的节点的子节点集合
|
||||
* @param parentIdIndex
|
||||
* 父id的key
|
||||
* @param idIndex
|
||||
* id的key
|
||||
* @param titleIndex
|
||||
* 显示字段的key
|
||||
* @param checkIndex
|
||||
* 选中状态的key
|
||||
* @return
|
||||
*/
|
||||
public static List<EasyUiTreeNode> formatAjaxTree(
|
||||
List<Map<String, Object>> result1, String parentIdIndex,
|
||||
String idIndex, String titleIndex, String checkIndex) {
|
||||
return EasyUiTreeNode.formatAjaxTree(result1, parentIdIndex, idIndex,
|
||||
titleIndex, checkIndex, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化ajax子树数据
|
||||
*
|
||||
* @param result1
|
||||
* 依据父id查询出来的节点集合
|
||||
* @param result2
|
||||
* 依据父id查询出来的节点的子节点集合
|
||||
* @param parentIdIndex
|
||||
* 父id的key
|
||||
* @param idIndex
|
||||
* id的key
|
||||
* @param titleIndex
|
||||
* 显示字段的key
|
||||
* @return
|
||||
*/
|
||||
public static List<EasyUiTreeNode> formatAjaxTree(
|
||||
List<Map<String, Object>> result1, String parentIdIndex,
|
||||
String idIndex, String titleIndex) {
|
||||
return EasyUiTreeNode.formatAjaxTree(result1, parentIdIndex, idIndex,
|
||||
titleIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化异步ajax子树数据
|
||||
*
|
||||
* @param result1
|
||||
* 依据父id查询出来的节点集合
|
||||
* @param result2
|
||||
* 依据父id查询出来的节点的子节点集合
|
||||
* @param parentIdIndex
|
||||
* 父id的key
|
||||
* @param idIndex
|
||||
* id的key
|
||||
* @param titleIndex
|
||||
* 显示字段的key
|
||||
* @return
|
||||
*/
|
||||
public static List<EasyUiTreeNode> formatAsyncAjaxTree(
|
||||
List<Map<String, Object>> result1,
|
||||
List<Map<String, Object>> result2, String parentIdIndex,
|
||||
String idIndex, String titleIndex, String imgIndex) {
|
||||
return EasyUiTreeNode.formatAsyncAjaxTree(result1, result2,
|
||||
parentIdIndex, idIndex, titleIndex, imgIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化grid的查询条件
|
||||
*
|
||||
* @param request
|
||||
* @param query
|
||||
* @return
|
||||
*/
|
||||
public static DataQuery formatGridQuery(HttpServletRequest request,
|
||||
DataQuery query) {
|
||||
// page=1&rows=10&sort=TITLE&order=asc
|
||||
if (query == null) {
|
||||
query = new DataQuery();
|
||||
}
|
||||
if (request.getParameter("page") != null) {
|
||||
query.setCurrentPage(request.getParameter("page").toString());
|
||||
}
|
||||
if (request.getParameter("rows") != null) {
|
||||
query.setPagesize(Integer.valueOf(request.getParameter("rows")));
|
||||
}
|
||||
if (request.getParameter("sort") != null) {
|
||||
query.addSort(new DBSort(request.getParameter("sort"), request
|
||||
.getParameter("order")));
|
||||
}
|
||||
return query;
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package com.farm.web.local;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLDecoder;
|
||||
|
||||
public class ConfDirHandle {
|
||||
/**
|
||||
* 对配置文件做处理
|
||||
*
|
||||
* @param strPath
|
||||
* 配置文件夹路径
|
||||
* @param index
|
||||
* 配置文件关键字
|
||||
* @param handle
|
||||
* @param context
|
||||
*/
|
||||
public static void findDirForConf(String strPath, String[] indexs,
|
||||
ConfHandleInter handle, Object context) {
|
||||
try {
|
||||
strPath=URLDecoder.decode(strPath,"utf-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
System.out.println("ERROR:配置文件夹路径,解析错误");
|
||||
}
|
||||
File dir = new File(strPath);
|
||||
File[] files = dir.listFiles();
|
||||
if (files == null)
|
||||
return;
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].isDirectory()) {
|
||||
findDirForConf(files[i].getAbsolutePath(), indexs, handle,
|
||||
context);
|
||||
} else {
|
||||
String strFileName = files[i].getAbsolutePath().toLowerCase();
|
||||
for (String index : indexs) {
|
||||
if (strFileName.replace("\\", ".").replace("/", ".")
|
||||
.indexOf(index) >= 0) {
|
||||
handle.execute(context, files[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.farm.web.local;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public interface ConfHandleInter {
|
||||
public void execute(Object para,File file);
|
||||
}
|
@ -1,17 +0,0 @@
|
||||
|
||||
package com.farm.web.task;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
/**
|
||||
* 随系统启动任务接口
|
||||
*
|
||||
* @author 王东
|
||||
*
|
||||
*/
|
||||
public interface ServletInitJobInter {
|
||||
/**被执行的任务
|
||||
* @param context
|
||||
*/
|
||||
public void execute(ServletContext context);
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
package com.farm.web.task;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServlet;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.farm.util.spring.BeanFactory;
|
||||
|
||||
public class SysInit extends HttpServlet {
|
||||
|
||||
/**
|
||||
* 任务集合
|
||||
*/
|
||||
private static List<ServletInitJobInter> list = new ArrayList<ServletInitJobInter>();
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
// 配置系统所有默认启动任务
|
||||
|
||||
public SysInit() {
|
||||
super();
|
||||
}
|
||||
|
||||
private final Logger log = Logger.getLogger(this.getClass());
|
||||
|
||||
public void destroy() {
|
||||
super.destroy();
|
||||
}
|
||||
|
||||
public void init() throws ServletException {
|
||||
list = ((TaskListInter) BeanFactory.getBean("startServerTasksId", getServletContext())).getTasks();
|
||||
log.info("--系统准备运行" + list.size() + "项");
|
||||
if (list == null) {
|
||||
list = new ArrayList<ServletInitJobInter>();
|
||||
}
|
||||
int n = 0;
|
||||
try {
|
||||
for (Iterator<ServletInitJobInter> iterator = list.iterator(); iterator.hasNext();) {
|
||||
n++;
|
||||
ServletInitJobInter name = (ServletInitJobInter) iterator.next();
|
||||
name.execute(this.getServletContext());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("第" + n + "项任务启动失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
package com.farm.web.task.impl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.farm.web.constant.FarmConstant;
|
||||
import com.farm.web.task.ServletInitJobInter;
|
||||
|
||||
public class ServerLicenceInit implements ServletInitJobInter {
|
||||
|
||||
private final static Logger log = Logger.getLogger(ServerLicenceInit.class);
|
||||
|
||||
@Override
|
||||
public void execute(ServletContext context) {
|
||||
try {
|
||||
FarmConstant.LICENCE = read(
|
||||
new File(context.getRealPath("") + File.separator
|
||||
+ "licence.data")).replace("\n", "");
|
||||
} catch (Exception e) {
|
||||
FarmConstant.LICENCE = null;
|
||||
}
|
||||
try {
|
||||
// System.out.println("info: case is "+FarmConstant.LICENCE + " for "
|
||||
// + MayCase.isCase(FarmConstant.LICENCE));
|
||||
} catch (Exception e) {
|
||||
System.out.println("info: case is "+FarmConstant.LICENCE + " for "+ ":false");
|
||||
}
|
||||
}
|
||||
|
||||
public String read(File file) throws Exception {
|
||||
StringBuffer lines = new StringBuffer();
|
||||
InputStream inputStream = null;
|
||||
BufferedReader reader = null;
|
||||
InputStreamReader inputStreamReader = null;
|
||||
try {
|
||||
inputStream = new FileInputStream(file);
|
||||
inputStreamReader = new InputStreamReader(inputStream);
|
||||
reader = new BufferedReader(inputStreamReader);
|
||||
String line = null;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
lines.append(line).append("\n");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.info(e.getMessage(), e);
|
||||
} finally {
|
||||
try {
|
||||
inputStreamReader.close();
|
||||
inputStream.close();
|
||||
reader.close();
|
||||
} catch (IOException e) {
|
||||
log.info(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
return lines.toString();
|
||||
}
|
||||
}
|
@ -1,20 +0,0 @@
|
||||
package com.farm.web.task.impl;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.farm.web.task.ServletInitJobInter;
|
||||
import com.farm.web.task.TaskListInter;
|
||||
|
||||
public class TaskListImpl implements TaskListInter {
|
||||
private List<ServletInitJobInter> tasks;
|
||||
|
||||
@Override
|
||||
public List<ServletInitJobInter> getTasks() {
|
||||
return tasks;
|
||||
}
|
||||
|
||||
public void setTasks(List<ServletInitJobInter> tasks) {
|
||||
this.tasks = tasks;
|
||||
}
|
||||
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
package com.farm.web.test;
|
||||
|
||||
import com.farm.core.auth.domain.LoginUser;
|
||||
|
||||
public class FarmTest {
|
||||
public LoginUser user =null;
|
||||
}
|
@ -1,10 +0,0 @@
|
||||
package com.farm.text;
|
||||
|
||||
import com.farm.core.auth.util.KeyUtil;
|
||||
public class MarkLicenceKey {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(KeyUtil.getMKey());
|
||||
//System.out.println(KeyUtil.getFkey("8C8-60723AA5"));
|
||||
System.out.println(KeyUtil.getFkey("C4B-8AF11814"));
|
||||
}
|
||||
}
|
@ -1,28 +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/xsd/maven-4.0.0.xsd">
|
||||
<!-- //这是个pom文件,远程仓库的资源依赖在这里纪录-->
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.farm.wcp</groupId>
|
||||
<artifactId>wcp-api</artifactId>
|
||||
<version>${wcp.version}</version>
|
||||
<properties>
|
||||
<wcp.version>3.2.0</wcp.version>
|
||||
<!-- 文件拷贝时的编码 -->
|
||||
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- 编译时的编码 -->
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,64 +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/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.farm</groupId>
|
||||
<artifactId>wcp-authority</artifactId>
|
||||
<version>${wcp.version}</version>
|
||||
<name>用户和权限系统</name>
|
||||
<properties>
|
||||
<wcp.version>3.2.0</wcp.version>
|
||||
<!-- 文件拷贝时的编码 -->
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<!-- 编译时的编码 -->
|
||||
<maven.compiler.encoding>UTF-8</maven.compiler.encoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.farm</groupId>
|
||||
<artifactId>farm-core</artifactId>
|
||||
<version>${wcp.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.farm</groupId>
|
||||
<artifactId>wcp-parameter</artifactId>
|
||||
<version>${wcp.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>javax.servlet.jsp</groupId>
|
||||
<artifactId>jsp-api</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<configuration>
|
||||
<archive>
|
||||
<manifest>
|
||||
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
|
||||
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
|
||||
</manifest>
|
||||
</archive>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -1,17 +0,0 @@
|
||||
package com.farm.authority;
|
||||
|
||||
import javax.servlet.http.HttpSession;
|
||||
|
||||
import com.farm.authority.domain.Organization;
|
||||
import com.farm.authority.service.UserServiceInter;
|
||||
import com.farm.core.auth.domain.LoginUser;
|
||||
import com.farm.util.spring.BeanFactory;
|
||||
import com.farm.web.constant.FarmConstant;
|
||||
|
||||
public class AuthUtils {
|
||||
public static Organization getCurrentOrganization(HttpSession session) {
|
||||
UserServiceInter users = (UserServiceInter) BeanFactory.getBean("userServiceImpl");
|
||||
LoginUser user = (LoginUser) session.getAttribute(FarmConstant.SESSION_USEROBJ);
|
||||
return users.getOrg(user.getId());
|
||||
}
|
||||
}
|
@ -1,133 +0,0 @@
|
||||
package com.farm.authority;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import com.farm.authority.domain.Action;
|
||||
import com.farm.authority.domain.User;
|
||||
import com.farm.authority.service.ActionServiceInter;
|
||||
import com.farm.authority.service.UserServiceInter;
|
||||
import com.farm.core.AuthorityService;
|
||||
import com.farm.core.auth.domain.AuthKey;
|
||||
import com.farm.core.auth.domain.LoginUser;
|
||||
import com.farm.core.auth.domain.WebMenu;
|
||||
import com.farm.core.auth.exception.LoginUserNoExistException;
|
||||
import com.farm.core.auth.util.AuthenticateInter;
|
||||
import com.farm.core.auth.util.AuthenticateProvider;
|
||||
import com.farm.util.spring.BeanFactory;
|
||||
|
||||
public class FarmAuthorityService implements AuthorityService {
|
||||
private UserServiceInter userServiceImpl;
|
||||
private ActionServiceInter actionServiceImpl;
|
||||
private AuthenticateInter authUtil = AuthenticateProvider.getInstance();
|
||||
private static FarmAuthorityService service;
|
||||
|
||||
public static AuthorityService getInstance() {
|
||||
if (service == null) {
|
||||
service = new FarmAuthorityService();
|
||||
service.userServiceImpl = (UserServiceInter) BeanFactory.getBean("userServiceImpl");
|
||||
service.actionServiceImpl = (ActionServiceInter) BeanFactory.getBean("actionServiceImpl");
|
||||
}
|
||||
return service;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loginHandle(String userId) {
|
||||
userServiceImpl.setLoginTime(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Set<String> getUserAuthKeys(String userId) {
|
||||
User user = userServiceImpl.getUserEntity(userId);
|
||||
List<Action> actions = null;
|
||||
if (user.getType().equals("3")) {
|
||||
actions = actionServiceImpl.getAllActions();
|
||||
} else {
|
||||
actions = userServiceImpl.getUserActions(userId);
|
||||
}
|
||||
Set<String> set = new HashSet<String>();
|
||||
for (Action action : actions) {
|
||||
set.add(action.getAuthkey());
|
||||
}
|
||||
return set;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserById(String userId) {
|
||||
return userServiceImpl.getUserEntity(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LoginUser getUserByLoginName(String loginName) {
|
||||
return userServiceImpl.getUserByLoginName(loginName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WebMenu> getUserMenu(String userId) {
|
||||
User user = userServiceImpl.getUserEntity(userId);
|
||||
List<WebMenu> list = null;
|
||||
if (user.getType().equals("3")) {
|
||||
list = actionServiceImpl.getAllMenus();
|
||||
} else {
|
||||
list = userServiceImpl.getUserMenus(userId);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLegality(String loginName, String password) throws LoginUserNoExistException {
|
||||
User user = userServiceImpl.getUserByLoginName(loginName);
|
||||
if (user == null) {
|
||||
throw new LoginUserNoExistException("该登录名不存在!");
|
||||
}
|
||||
if (user.getType().equals("2")) {
|
||||
throw new LoginUserNoExistException("该用户无登录权限!");
|
||||
}
|
||||
if (!user.getState().equals("1")) {
|
||||
throw new LoginUserNoExistException("该用户已停用!");
|
||||
}
|
||||
if (authUtil.isMd5code(password)) {
|
||||
if (password.toUpperCase().equals(user.getPassword())) {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
if (authUtil.encodeLoginPasswordOnMd5(password, loginName).equals(user.getPassword())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuthKey getAuthKey(String key) {
|
||||
return actionServiceImpl.getCacheAction(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getUserPostKeys(String userId) {
|
||||
return userServiceImpl.getUserPostIds(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUserOrgKey(String userId) {
|
||||
return userServiceImpl.getUserOrganization(userId).getId();
|
||||
}
|
||||
|
||||
public UserServiceInter getUserServiceImpl() {
|
||||
return userServiceImpl;
|
||||
}
|
||||
|
||||
public void setUserServiceImpl(UserServiceInter userServiceImpl) {
|
||||
this.userServiceImpl = userServiceImpl;
|
||||
}
|
||||
|
||||
public ActionServiceInter getActionServiceImpl() {
|
||||
return actionServiceImpl;
|
||||
}
|
||||
|
||||
public void setActionServiceImpl(ActionServiceInter actionServiceImpl) {
|
||||
this.actionServiceImpl = actionServiceImpl;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue