Signed-off-by: ikun <2879883051@qq.com>
main
ikun 1 year ago
parent d6b0d70a7e
commit e7aa6c9d03

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="src/main/webapp/WEB-INF/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="test" value="true"/>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="src/main/webapp/WEB-INF/classes"/>
</classpath>

@ -0,0 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>ssm_xsktsign</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry excluding="**/bower_components/*|**/node_modules/*|**/*.min.js" 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>

@ -0,0 +1,3 @@
eclipse.preferences.version=1
encoding//src/main/java=UTF-8
encoding/<project>=UTF-8

@ -0,0 +1,9 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
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.release=disabled
org.eclipse.jdt.core.compiler.source=1.8

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

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="ssm_xsktsign-0.0.1-SNAPSHOT">
<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/test/java"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src/main/resources"/>
<property name="context-root" value="ssm_xsktsign"/>
<property name="java-output-path" value="/ssm_xsktsign/src/main/webapp/WEB-INF/classes"/>
</wb-module>
</project-modules>

@ -0,0 +1,12 @@
<root>
<facet id="jst.jsf">
<node name="libprov">
<attribute name="provider-id" value="jsf-no-op-library-provider"/>
</node>
</facet>
<facet id="jst.jaxrs">
<node name="libprov">
<attribute name="provider-id" value="jaxrs-no-op-library-provider"/>
</node>
</facet>
</root>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.8"/>
<installed facet="jst.web" version="2.5"/>
<installed facet="jst.jsf" version="2.2"/>
<installed facet="jst.jaxrs" version="2.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>

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

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

@ -0,0 +1,260 @@
<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>ssm_xsktsign</groupId>
<artifactId>ssm_xsktsign</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name />
<description />
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spring.version>4.1.4.RELEASE</spring.version>
<!-- mybatis版本号 -->
<mybatis.version>3.2.8</mybatis.version>
<!-- log4j日志文件管理包版本 -->
<slf4j.version>1.7.7</slf4j.version>
<log4j.version>1.2.17</log4j.version>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<!-- 表示开发的时候引入,发布的时候不会加载此包 -->
<scope>test</scope>
</dependency>
<!-- Spring注解编程所需jar -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<scope>test</scope>
</dependency>
<!-- spring核心包 -->
<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-oxm</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-jdbc</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-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
<version>3.1</version>
</dependency>
<!-- hibernate validator -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.0.Final</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.1.0.Final</version>
</dependency>
<!-- 映入JSON -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.6.3</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.11</version>
</dependency>
<!-- mybatis核心包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<!-- mybatis/spring包 -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.2.2</version>
</dependency>
<!-- mybatis物理分页插件 -->
<dependency>
<groupId>com.github.miemiedev</groupId>
<artifactId>mybatis-paginator</artifactId>
<version>1.2.15</version>
</dependency>
<!-- 导入javee包 -->
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
<!-- 导入dbcp的jar包用来在applicationContext.xml中配置数据库 -->
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.2.2</version>
</dependency>
<!-- JSTL标签类 -->
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- 日志文件管理包 -->
<!-- log start -->
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.6</version>
</dependency>
<!-- 上传组件包 -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3.1</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>4.2.1</version>
</dependency>
<dependency>
<groupId>jsptags</groupId>
<artifactId>pager-taglib</artifactId>
<version>2.0</version>
</dependency>
</dependencies>
<build>
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<outputDirectory>${basedir}/src/main/webapp/WEB-INF/classes</outputDirectory>
<resources>
<resource>
<directory>${basedir}/resources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<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-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
</plugins>
</build>
</project>

@ -0,0 +1,83 @@
package com.kwxy.hyt.base;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.alibaba.fastjson.JSONObject;
/**
* Controller
*/
public class BaseController {
protected Logger logger = LoggerFactory.getLogger(this.getClass());
protected final static String DATE_FORMATE = "yyyy-MM-dd";
/**
*
*
* @param obj
*
* @return JSON
*/
public String responseResult(Object obj) {
String jsonObj = null;
if (obj != null) {
logger.info("后端返回对象:{}", obj);
jsonObj = JSONObject.toJSONString(obj);
logger.info("后端返回数据:" + jsonObj);
}
logger.info("输出结果:{}", jsonObj);
return jsonObj;
}
// 下面是判断null的操作
public boolean isEmpty(String str) {
return (null == str) || (str.trim().length() <= 0);
}
public boolean isEmpty(Character cha) {
return (null == cha) || cha.equals(' ');
}
public boolean isEmpty(Object obj) {
return (null == obj);
}
public boolean isEmpty(Object[] objs) {
return (null == objs) || (objs.length <= 0);
}
public boolean isEmpty(Collection<?> obj) {
return (null == obj) || obj.isEmpty();
}
public boolean isEmpty(Set<?> set) {
return (null == set) || set.isEmpty();
}
public boolean isEmpty(Serializable obj) {
return null == obj;
}
public boolean isEmpty(Map<?, ?> map) {
return (null == map) || map.isEmpty();
}
/**
*
* map
* @return
*/
public Map<String,Object> getMap(){
return new HashMap<String,Object>();
}
}

@ -0,0 +1,191 @@
package com.kwxy.hyt.base;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.kwxy.hyt.utils.Pager;
/**
* dao
* @author
*
*/
public interface BaseDao<T>{
/**
*
* @param entity
*/
int insert(T entity) ;
T save(T entity) ;
/**
*
* @param primaryKey
*/
void deleteById(Serializable id);
/**
*
* @param entity
*/
void deleteByEntity(T entity);
/**
* map
* @param params
*/
void deleteByMap(Map<String,Object> params);
/**
*
* @param entity
*/
void update(T entity);
/**
* id
* @param id
*/
void updateById(T entity);
/**
*
* @param clz
* @param params
* @return
*/
public List<T> listByMap(Map<String,Object> params);
/**
*
* @return
*/
List<T> listAll();
/**
* ,
* @param entity
* @return
*/
List<T> listAllByEntity(T entity);
/**
*
* @param primaryKey
* @return
*/
T load(Serializable id);
/**
*
* @param id
* @return
*/
T getById(Serializable id);
/**
* map
* @param params
* @return
*/
T getByMap(Map<String,Object> params);
/**
*
* @param entity
* @return
*/
T getByEntity(T entity);
//=======================一下是分页方法================================
/**
* sqlId find
* @param sqlId
* @param params
* @return
*/
public List<T> findByMap(Map<String,Object> params);
/**
*
* @param entity
* @return
*/
public List<T> findByEntity(T entity);
/**
* count
* @param sqlId
* @param params
* @return
*/
public List<T> findByCount(Map<String,Object> params);
/**
*
* @param list
*/
public void insertBatch(List<T> list);
/**
*
* @param list
*/
public void updateBatch(List<T> list);
//==============================封装纯sql语法================================
/**
* map
* @param sql
* @return
*/
public Map<String,Object> getBySqlReturnMap(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public T getBySqlReturnEntity(@Param("sql")String sql);
/**
* map
* @param sql
* @return
*/
public List<Map<String,Object>> listBySqlReturnMap(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public List<T> listBySqlReturnEntity(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public List<T> findBySqlRerturnEntity(@Param("sql")String sql);
/**
* sql
* @param sql
*/
public void updateBysql(@Param("sql")String sql);
/**
* sql
* @param sql
*/
public void deleteBySql(@Param("sql")String sql);
}

@ -0,0 +1,180 @@
package com.kwxy.hyt.base;
import java.io.Serializable;
import java.util.List;
import java.util.Map;
import org.apache.ibatis.annotations.Param;
import com.kwxy.hyt.utils.Pager;
public interface BaseService<T> {
/**
*
* @param entity
*/
int insert(T entity) ;
/**
*
* @param primaryKey
*/
void deleteById(Serializable id);
/**
*
* @param entity
*/
void update(T entity);
/**
* id
* @param id
*/
void updateById(T entity);
/**
*
* @param entity
*/
void deleteByEntity(T entity);
/**
* map
* @param params
*/
void deleteByMap(Map<String,Object> params);
/**
*
* @param clz
* @param params
* @return
*/
public List<T> listByMap(Map<String,Object> params);
/**
*
* @return
*/
List<T> listAll();
/**
* ,
* @param entity
* @return
*/
List<T> listAllByEntity(T entity);
/**
*
* @param primaryKey
* @return
*/
T load(Serializable id);
/**
*
* @param id
* @return
*/
T getById(Serializable id);
/**
* map
* @param params
* @return
*/
T getByMap(Map<String,Object> params);
/**
*
* @param entity
* @return
*/
T getByEntity(T entity);
//=======================一下是分页方法================================
/**
* sqlId find
* @param sqlId
* @param params
* @return
*/
public Pager<T> findByMap(Map<String,Object> params);
/**
*
* @param entity
* @return
*/
public Pager<T> findByEntity(T entity);
/**
*
* @param list
*/
public void insertBatch(List<T> list);
/**
*
* @param list
*/
public void updateBatch(List<T> list);
//============================通过sql=========================================
/**
* map
* @param sql
* @return
*/
public Map<String,Object> getBySql(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public T getBySqlReturnEntity(@Param("sql")String sql);
/**
* map
* @param sql
* @return
*/
public List<Map<String,Object>> listBySqlReturnMap(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public List<T> listBySqlReturnEntity(@Param("sql")String sql);
/**
*
* @param sql
* @return
*/
public Pager<T> findBySqlRerturnEntity(@Param("sql")String sql);
/**
* sql
* @param sql
*/
public void updateBysql(@Param("sql")String sql);
/**
* sql
* @param sql
*/
public void deleteBySql(@Param("sql")String sql);
}

@ -0,0 +1,319 @@
package com.kwxy.hyt.base;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.apache.ibatis.session.SqlSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.kwxy.hyt.utils.Pager;
import com.kwxy.hyt.utils.SystemContext;
public abstract class BaseServiceImpl<T> implements BaseService<T>{
private BaseDao<T> baseDao;
public abstract BaseDao<T> getBaseDao();
/**
*
* @param entity
*/
public int insert(T entity) {
return this.getBaseDao().insert(entity);
}
/**
*
* @param primaryKey
*/
public void deleteById(Serializable id) {
this.getBaseDao().deleteById(id);
}
/**
*
*/
public void deleteByEntity(T entity) {
this.getBaseDao().deleteByEntity(entity);
}
/**
* map
*/
public void deleteByMap(Map<String, Object> params) {
this.getBaseDao().deleteByMap(params);
}
/**
*
* @param entity
*/
public void update(T entity) {
this.getBaseDao().update(entity);
}
/**
* id
* @param id
*/
public void updateById(T entity) {
this.getBaseDao().updateById(entity);
}
/**
*
* @param clz
* @param params
* @return
*/
public List<T> listByMap(Map<String, Object> params) {
return this.getBaseDao().listByMap(params);
}
/**
*
* @return
*/
public List<T> listAll() {
return this.getBaseDao().listAll();
}
/**
* ,
* @param entity
* @return
*/
public List<T> listAllByEntity(T entity) {
return this.getBaseDao().listAllByEntity(entity);
}
/**
*
* @param primaryKey
* @return
*/
public T load(Serializable id) {
return this.getBaseDao().load(id);
}
/**
*
* @param id
* @return
*/
public T getById(Serializable id) {
return this.getBaseDao().getById(id);
}
/**
* map
* @param params
* @return
*/
public T getByMap(Map<String, Object> params) {
return this.getBaseDao().getByMap(params);
}
/**
*
* @param entity
* @return
*/
public T getByEntity(T entity) {
return this.getBaseDao().getByEntity(entity);
}
/**
* sqlId find
* @param sqlId
* @param params
* @return
*/
public Pager<T> findByMap(Map<String, Object> params) {
/**
*
*/
Integer pageSize = SystemContext.getPageSize();
Integer pageOffset = SystemContext.getPageOffset();
if(pageOffset==null||pageOffset<0) pageOffset = 0;
if(pageSize==null||pageSize<0) pageSize = 15;
String order = SystemContext.getOrder();
String sort = SystemContext.getSort();
Integer pageNum = null;
if(pageOffset == 0){
pageNum = 1;
}else{
pageNum = pageOffset/pageSize+1;
}
PageHelper.startPage(pageNum, pageSize);
Pager<T> pages = new Pager<T>(this.getBaseDao().findByMap(params));
return pages;
}
/**
*
* @param entity
* @return
*/
public Pager<T> findByEntity(T entity){
/**
*
*/
Integer pageSize = SystemContext.getPageSize();
Integer pageOffset = SystemContext.getPageOffset();
if(pageOffset==null||pageOffset<0) pageOffset = 0;
if(pageSize==null||pageSize<0) pageSize = 15;
String order = SystemContext.getOrder();
String sort = SystemContext.getSort();
Integer pageNum = null;
if(pageOffset == 0){
pageNum = 1;
}else{
pageNum = pageOffset/pageSize+1;
}
PageHelper.startPage(pageNum, pageSize);
Pager<T> pages = new Pager<T>(this.getBaseDao().findByEntity(entity));
return pages;
}
/**
*
*/
public void insertBatch(List<T> list) {
this.getBaseDao().insertBatch(list);
}
/**
*
*/
public void updateBatch(List<T> list) {
this.getBaseDao().updateBatch(list);
}
//=====================自定义sql=========================================
/**
* map
* @param sql
* @return
*/
public Map<String, Object> getBySql(String sql) {
return this.getBaseDao().getBySqlReturnMap(sql);
}
/**
*
* @param sql
* @return
*/
public T getBySqlReturnEntity(String sql) {
return this.getBaseDao().getBySqlReturnEntity(sql);
}
/**
* map
* @param sql
* @return
*/
public List<Map<String, Object>> listBySqlReturnMap(String sql) {
return this.getBaseDao().listBySqlReturnMap(sql);
}
/**
*
* @param sql
* @return
*/
public List<T> listBySqlReturnEntity(String sql) {
return this.getBaseDao().listBySqlReturnEntity(sql);
}
/**
*
* @param sql
* @return
*/
public Pager<T> findBySqlRerturnEntity(String sql) {
/**
*
*/
Integer pageSize = SystemContext.getPageSize();
Integer pageOffset = SystemContext.getPageOffset();
if(pageOffset==null||pageOffset<0) pageOffset = 0;
if(pageSize==null||pageSize<0) pageSize = 15;
String order = SystemContext.getOrder();
String sort = SystemContext.getSort();
Integer pageNum = null;
if(pageOffset == 0){
pageNum = 1;
}else{
pageNum = pageOffset/pageSize+1;
}
PageHelper.startPage(pageNum, pageSize);
Pager<T> pages = new Pager<T>(this.getBaseDao().findBySqlRerturnEntity(sql));
return pages;
}
/**
* sql
* @param sql
*/
public void updateBysql(String sql) {
this.getBaseDao().updateBysql(sql);
}
/**
* sql
* @param sql
*/
public void deleteBySql(String sql) {
this.getBaseDao().deleteBySql(sql);
}
//判断空
public boolean isEmpty(String str) {
return (null == str) || (str.trim().length() <= 0);
}
public boolean isEmpty(Character cha) {
return (null == cha) || cha.equals(' ');
}
public boolean isEmpty(Object obj) {
return (null == obj);
}
public boolean isEmpty(Object[] objs) {
return (null == objs) || (objs.length <= 0);
}
public boolean isEmpty(Collection<?> obj) {
return (null == obj) || obj.isEmpty();
}
public boolean isEmpty(Set<?> set) {
return (null == set) || set.isEmpty();
}
public boolean isEmpty(Serializable obj) {
return null == obj;
}
public boolean isEmpty(Map<?, ?> map) {
return (null == map) || map.isEmpty();
}
}

@ -0,0 +1,180 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
@Controller
@RequestMapping("/bj")
public class BjController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private BjService bjService;
// --------------------------------------- 华丽分割线 ------------------------------
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Bj bj, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM bj WHERE isDelete = 0 ";
if(!isEmpty(bj.getName())){
sql += " and name like '%"+bj.getName()+"%'";
}
if(!isEmpty(bj.getZy())){
sql += " and zy like '%"+bj.getZy()+"%'";
}
if(!isEmpty(bj.getIsDelete())){
sql += " and isDelete like '%"+bj.getIsDelete()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Bj> pagers = bjService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", bj);
return "bj/bj";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Bj bj, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(bj.getName())){
params.put("name", bj.getName());
}
if(!isEmpty(bj.getZy())){
params.put("zy", bj.getZy());
}
if(!isEmpty(bj.getIsDelete())){
params.put("isDelete", bj.getIsDelete());
}
//分页查询
Pager<Bj> pagers = bjService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", bj);
return "bj/bj";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "bj/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Bj obj = bjService.load(id);
model.addAttribute("obj",obj);
return "bj/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Bj bj, Model model, HttpServletRequest request, HttpServletResponse response) {
bj.setIsDelete(0);
bjService.insert(bj);
return "redirect:/bj/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Bj obj = bjService.load(id);
model.addAttribute("obj",obj);
return "bj/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Bj bj, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
bjService.updateById(bj);
//2.通过主键id修改
//bjService.updateById(bj);
return "redirect:/bj/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
Bj load = bjService.load(id);
load.setIsDelete(1);
bjService.updateById(load);
return "redirect:/bj/findBySql.action";
}
}

@ -0,0 +1,239 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
@Controller
@RequestMapping("/fdy")
public class FdyController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private FdyService fdyService;
@Autowired
private BjService bjService;
// --------------------------------------- 华丽分割线 ------------------------------
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Fdy fdy, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM fdy WHERE isDelete = 0 ";
if(!isEmpty(fdy.getUsername())){
sql += " and username like '%"+fdy.getUsername()+"%'";
}
if(!isEmpty(fdy.getPassword())){
sql += " and password like '%"+fdy.getPassword()+"%'";
}
if(!isEmpty(fdy.getCode())){
sql += " and code like '%"+fdy.getCode()+"%'";
}
if(!isEmpty(fdy.getSex())){
sql += " and sex like '%"+fdy.getSex()+"%'";
}
if(!isEmpty(fdy.getBjId())){
sql += " and bjId like '%"+fdy.getBjId()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Fdy> pagers = fdyService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", fdy);
return "fdy/fdy";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Fdy fdy, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(fdy.getUsername())){
params.put("username", fdy.getUsername());
}
if(!isEmpty(fdy.getPassword())){
params.put("password", fdy.getPassword());
}
if(!isEmpty(fdy.getCode())){
params.put("code", fdy.getCode());
}
if(!isEmpty(fdy.getSex())){
params.put("sex", fdy.getSex());
}
if(!isEmpty(fdy.getBjId())){
params.put("bjId", fdy.getBjId());
}
//分页查询
Pager<Fdy> pagers = fdyService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", fdy);
return "fdy/fdy";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add(Model model) {
// 查询班级列表
Bj b = new Bj();
b.setIsDelete(0);
List<Bj> listAllByEntity = bjService.listAllByEntity(b);
model.addAttribute("bjs", listAllByEntity);
return "fdy/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Fdy obj = fdyService.load(id);
model.addAttribute("obj",obj);
return "fdy/view";
}
@RequestMapping(value = "/pass")
public String pass(Integer id,HttpServletRequest request,Model model) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
Fdy obj = fdyService.load(userId);
model.addAttribute("obj",obj);
return "fdy/pass";
}
@RequestMapping("/upass")
@ResponseBody
public String upass(HttpServletRequest request,String password){
Object attribute = request.getSession().getAttribute("userId");
JSONObject j = new JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
Fdy byId = fdyService.getById(userId);
byId.setPassword(password);
fdyService.updateById(byId);
j.put("res", 1);
return j.toString();
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Fdy fdy, Model model, HttpServletRequest request, HttpServletResponse response) {
fdy.setIsDelete(0);
fdyService.insert(fdy);
return "redirect:/fdy/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Bj b = new Bj();
b.setIsDelete(0);
List<Bj> listAllByEntity = bjService.listAllByEntity(b);
model.addAttribute("bjs", listAllByEntity);
Fdy obj = fdyService.load(id);
model.addAttribute("obj",obj);
return "fdy/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Fdy fdy, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
fdyService.updateById(fdy);
//2.通过主键id修改
//fdyService.updateById(fdy);
return "redirect:/fdy/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
Fdy load = fdyService.load(id);
load.setIsDelete(1);
fdyService.updateById(load);
return "redirect:/fdy/findBySql.action";
}
}

@ -0,0 +1,196 @@
package com.kwxy.hyt.controller;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.Fdy;
import com.kwxy.hyt.po.Manage;
import com.kwxy.hyt.po.Student;
import com.kwxy.hyt.po.Teacher;
import com.kwxy.hyt.service.FdyService;
import com.kwxy.hyt.service.ManageService;
import com.kwxy.hyt.service.StudentService;
import com.kwxy.hyt.service.TeacherService;
@Controller
@RequestMapping("/login")
public class LoginController extends BaseController{
@Autowired
private ManageService manageService;
@Autowired
private FdyService fdyService;
@Autowired
private TeacherService teacherService;
@Autowired
private StudentService studentService;
/**
*
* @return
*/
@RequestMapping("/mLogin")
public String login(){
return "login/mLogin";
}
/**
*
* @return
*/
@RequestMapping("/uLogin")
public String uLogin(){
return "login/login";
}
@RequestMapping("/message")
public String message(Integer type,Model model){
if (type == 1){
model.addAttribute("mess", "该辅导员并没有负责的班级。");
}
return "login/message";
}
/**
* 退
* @param request
* @return
*/
@RequestMapping("/mtuichu")
public String mtuichu(HttpServletRequest request){
//request.getSession().invalidate();
return "login/mLogin";
}
/**
*
* @return
*/
@RequestMapping("/welcome")
private String welcome(){
return "login/welcome";
}
/**
*
* @param manage
* @param request
* @param response
* @return
*/
@RequestMapping("/toMlogin")
public String toLogin(Manage manage, HttpServletRequest request, HttpServletResponse response){
Manage byEntity = manageService.getByEntity(manage);
if(byEntity == null){
return "redirect:/login/mtuichu";
}else{
request.getSession().setAttribute("role", 1);
request.getSession().setAttribute("username", byEntity.getUsername());
request.getSession().setAttribute("userId", byEntity.getId());
}
return "login/index";
}
/**
*
* @param code
* @param password
* @param role
* @param request
* @param response
* @return
*/
@RequestMapping("/tologin")
public String toLogin(String code,String password,Integer role, HttpServletRequest request, HttpServletResponse response){
// 4 学生3 任课教师 2辅导员
if (role == 4){
Student s = new Student();
s.setIsDelete(0);
s.setCode(code);
s.setPassword(password);
Student byEntity = studentService.getByEntity(s);
if(byEntity == null){
return "redirect:/login/uLogin.action";
}else{
request.getSession().setAttribute("role",role);
request.getSession().setAttribute("username", byEntity.getUsername());
request.getSession().setAttribute("userId", byEntity.getId());
}
}
if (role == 3){
Teacher s = new Teacher();
s.setIsDelete(0);
s.setCode(code);
s.setPassword(password);
Teacher byEntity = teacherService.getByEntity(s);
if(byEntity == null){
return "redirect:/login/uLogin.action";
}else{
request.getSession().setAttribute("role",role);
request.getSession().setAttribute("username", byEntity.getUsername());
request.getSession().setAttribute("userId", byEntity.getId());
}
}
if (role == 2){
Fdy s = new Fdy();
s.setCode(code);
s.setPassword(password);
Fdy byEntity = fdyService.getByEntity(s);
if(byEntity == null){
return "redirect:/login/uLogin.action";
}else{
request.getSession().setAttribute("role",role);
request.getSession().setAttribute("username", byEntity.getUsername());
request.getSession().setAttribute("userId", byEntity.getId());
}
}
return "login/index";
}
/**
* 退
* @param request
* @param response
* @return
*/
@RequestMapping("/tuichu")
public String tuichu( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
return "login/uLogin";
}
/*
* 退
*/
@RequestMapping("/uTui")
public String uTui( HttpServletRequest request, HttpServletResponse response){
HttpSession session = request.getSession();
session.invalidate();
return "redirect:/login/uLogin";
}
@RequestMapping("/head")
private String head(){
return "inc/head";
}
@RequestMapping("/left")
private String left(){
return "inc/left";
}
}

@ -0,0 +1,526 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/manage")
public class ManageController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private ManageService manageService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* => =>
* @Title: listAll
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
List<Manage> listAll = manageService.listAll();
model.addAttribute("list", listAll);
return "manage/manage";
}
/**
* ==>
* @Title: listByEntity
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
List<Manage> listAll = manageService.listAllByEntity(manage);
model.addAttribute("list", listAll);
return "manage/manage";
}
/**
* ==>
* @Title: listByMap
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(manage.getUsername())){
params.put("username", manage.getUsername());
}
if(!isEmpty(manage.getPassword())){
params.put("password", manage.getPassword());
}
List<Manage> listAll = manageService.listByMap(params);
model.addAttribute("list", listAll);
return "manage/manage";
}
/*********************************查询列表【分页】***********************************************/
/**
* list()
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Manage> pagers = manageService.findByEntity(manage);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", manage);
return "manage/manage";
}
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM manage WHERE 1=1 ";
if(!isEmpty(manage.getUsername())){
sql += " and username like '%"+manage.getUsername()+"%'";
}
if(!isEmpty(manage.getPassword())){
sql += " and password like '%"+manage.getPassword()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Manage> pagers = manageService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", manage);
return "manage/manage";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(manage.getUsername())){
params.put("username", manage.getUsername());
}
if(!isEmpty(manage.getPassword())){
params.put("password", manage.getPassword());
}
//分页查询
Pager<Manage> pagers = manageService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", manage);
return "manage/manage";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "manage/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Manage obj = manageService.load(id);
model.addAttribute("obj",obj);
return "manage/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
manageService.insert(manage);
return "redirect:/manage/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Manage obj = manageService.load(id);
model.addAttribute("obj",obj);
return "manage/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
manageService.updateById(manage);
//2.通过主键id修改
//manageService.updateById(manage);
return "redirect:/manage/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
manageService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// manageService.deleteByEntity(manage);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(manage.getUsername())){
// params.put("username", manage.getUsername());
// }
//
// if(!isEmpty(manage.getPassword())){
// params.put("password", manage.getPassword());
// }
//
// manageService.deleteByMap(params);
// //4.状态删除
// Manage load = manageService.getById(manage.getId())
// load.setIsDelete(1);
// manageService.update(load);
//5.状态删除
//Manage load = manageService.load(id);
//load.setIsDelete(1);
//manageService.updateById(load);
return "redirect:/manage/findBySql.action";
}
// --------------------------------------- 华丽分割线 ------------------------------
// --------------------------------------- 【下面是ajax操作的方法。】 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* => =>
* @Title: listAll
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listAllJson", method = RequestMethod.POST)
@ResponseBody
public String listAllJson(Manage manage, HttpServletRequest request, HttpServletResponse response){
List<Manage> listAll = manageService.listAll();
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", manage);
return jsonObject.toString();
}
/**
* ==>
* @Title: listByEntity
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByEntityJson", method = RequestMethod.POST)
@ResponseBody
public String listByEntityJson(Manage manage, HttpServletRequest request, HttpServletResponse response){
List<Manage> listAll = manageService.listAllByEntity(manage);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", manage);
return jsonObject.toString();
}
/**
* ==>
* @Title: listByMap
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByMapJson", method = RequestMethod.POST)
@ResponseBody
public String listByMapJson(Manage manage,HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(manage.getUsername())){
params.put("username", manage.getUsername());
}
if(!isEmpty(manage.getPassword())){
params.put("password", manage.getPassword());
}
List<Manage> listAll = manageService.listByMap(params);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", manage);
return jsonObject.toString();
}
/**
* list json()
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObjJson", method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntityJson(Manage manage, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Manage> pagers = manageService.findByEntity(manage);
JSONObject jsonObject = new JSONObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", manage);
return jsonObject.toString();
}
/**
* list json(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMapJson", method = RequestMethod.POST)
@ResponseBody
public String findByMapJson(Manage manage,HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(manage.getUsername())){
params.put("username", manage.getUsername());
}
if(!isEmpty(manage.getPassword())){
params.put("password", manage.getPassword());
}
//分页查询
Pager<Manage> pagers = manageService.findByMap(params);
JSONObject jsonObject = new JSONObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", manage);
return jsonObject.toString();
}
/**
* ajax
* @param
* @return
*/
@RequestMapping(value = "/exAddJson", method = RequestMethod.POST)
@ResponseBody
public String exAddJson(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
manageService.insert(manage);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "添加成功");
return jsonObject.toString();
}
/**
* ajax
* @param
* @return
*/
@RequestMapping(value = "/exUpdate.json", method = RequestMethod.POST)
@ResponseBody
public String exUpdateJson(Manage manage, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
manageService.updateById(manage);
//2.通过主键id修改
//manageService.updateById(manage);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "修改成功");
return jsonObject.toString();
}
/**
* ajax
* @return
*/
@RequestMapping(value = "/delete.json", method = RequestMethod.POST)
@ResponseBody
public String exDeleteJson(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
manageService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// manageService.deleteByEntity(manage);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(manage.getUsername())){
// params.put("username", manage.getUsername());
// }
//
// if(!isEmpty(manage.getPassword())){
// params.put("password", manage.getPassword());
// }
//
// manageService.deleteByMap(params);
// //4.状态删除
// Manage load = manageService.getById(manage.getId())
// load.setIsDelete(1);
// manageService.updateById(load);
//5.状态删除
//Manage load = manageService.load(id);
//load.setIsDelete(1);
//manageService.updateById(load);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "删除成功");
return jsonObject.toString();
}
/**
*
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* springMvc
* @param files
* @param id
* @return
*/
@RequestMapping(value = "/saveFiles")
public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
for(int i = 0;i<files.length;i++){
System.out.println("fileName---------->" + files[i].getOriginalFilename());
if(!files[i].isEmpty()){
int pre = (int) System.currentTimeMillis();
try {
//拿到输出流,同时重命名上传的文件
String filePath = request.getRealPath("/upload");
File f=new File(filePath);
if(!f.exists()){
f.mkdirs();
}
String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
if(!file.exists()){
file.createNewFile();
}
files[i].transferTo(file);
} catch (Exception e) {
e.printStackTrace();
System.out.println("上传出错");
}
}
}
return "";
}
// --------------------------------------- 华丽分割线 ------------------------------
}

@ -0,0 +1,326 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/qj")
public class QjController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private QjService qjService;
@Autowired
private StudentService studentService;
@Autowired
private FdyService fdyService;
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
//分页查询
String sql = "SELECT * FROM qj WHERE fdyId = "+userId;
if(!isEmpty(qj.getBjId())){
sql += " and bjId like '%"+qj.getBjId()+"%'";
}
if(!isEmpty(qj.getStudentId())){
sql += " and studentId like '%"+qj.getStudentId()+"%'";
}
if(!isEmpty(qj.getFdyId())){
sql += " and fdyId like '%"+qj.getFdyId()+"%'";
}
if(!isEmpty(qj.getStartTime())){
sql += " and startTime like '%"+qj.getStartTime()+"%'";
}
if(!isEmpty(qj.getEndTime())){
sql += " and endTime like '%"+qj.getEndTime()+"%'";
}
if(!isEmpty(qj.getStatus())){
sql += " and status like '%"+qj.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Qj> pagers = qjService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", qj);
return "qj/qj";
}
//findBySqlSign
@RequestMapping(value = "/findBySqlSign")
public String findBySqlSign(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM qj WHERE bjId = "+qj.getBjId();
if(!isEmpty(qj.getBjId())){
sql += " and bjId like '%"+qj.getBjId()+"%'";
}
if(!isEmpty(qj.getStudentId())){
sql += " and studentId like '%"+qj.getStudentId()+"%'";
}
if(!isEmpty(qj.getFdyId())){
sql += " and fdyId like '%"+qj.getFdyId()+"%'";
}
if(!isEmpty(qj.getStartTime())){
sql += " and startTime like '%"+qj.getStartTime()+"%'";
}
if(!isEmpty(qj.getEndTime())){
sql += " and endTime like '%"+qj.getEndTime()+"%'";
}
if(!isEmpty(qj.getStatus())){
sql += " and status like '%"+qj.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Qj> pagers = qjService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", qj);
model.addAttribute("bjId", qj.getBjId());
return "qj/qjSign";
}
/**
*
* @param qj
* @param model
* @param request
* @param response
* @return
*/
//myqj
//findBySqlSign
@RequestMapping(value = "/myqj")
public String myqj(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
String sql = "SELECT * FROM qj WHERE studentId = "+userId;
if(!isEmpty(qj.getBjId())){
sql += " and bjId like '%"+qj.getBjId()+"%'";
}
if(!isEmpty(qj.getStudentId())){
sql += " and studentId like '%"+qj.getStudentId()+"%'";
}
if(!isEmpty(qj.getFdyId())){
sql += " and fdyId like '%"+qj.getFdyId()+"%'";
}
if(!isEmpty(qj.getStartTime())){
sql += " and startTime like '%"+qj.getStartTime()+"%'";
}
if(!isEmpty(qj.getEndTime())){
sql += " and endTime like '%"+qj.getEndTime()+"%'";
}
if(!isEmpty(qj.getStatus())){
sql += " and status like '%"+qj.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Qj> pagers = qjService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", qj);
return "qj/myqj";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(qj.getBjId())){
params.put("bjId", qj.getBjId());
}
if(!isEmpty(qj.getStudentId())){
params.put("studentId", qj.getStudentId());
}
if(!isEmpty(qj.getFdyId())){
params.put("fdyId", qj.getFdyId());
}
if(!isEmpty(qj.getStartTime())){
params.put("startTime", qj.getStartTime());
}
if(!isEmpty(qj.getEndTime())){
params.put("endTime", qj.getEndTime());
}
if(!isEmpty(qj.getStatus())){
params.put("status", qj.getStatus());
}
//分页查询
Pager<Qj> pagers = qjService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", qj);
return "qj/qj";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "qj/add";
}
@RequestMapping(value = "/myadd")
public String myadd() {
return "qj/myadd";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Qj obj = qjService.load(id);
model.addAttribute("obj",obj);
return "qj/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
qj.setStatus(0);
Student byId = studentService.getById(userId);
Integer bjId = byId.getBjId();
Fdy f = new Fdy();
f.setBjId(bjId);
List<Fdy> listAllByEntity = fdyService.listAllByEntity(f);
qj.setBjId(bjId);
qj.setFdyId(listAllByEntity.get(0).getId());
qj.setStudentId(userId);
qjService.insert(qj);
return "redirect:/qj/myqj.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Qj obj = qjService.load(id);
model.addAttribute("obj",obj);
return "qj/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
qjService.updateById(qj);
//2.通过主键id修改
//qjService.updateById(qj);
return "redirect:/qj/myqj.action";
}
@RequestMapping(value = "/sp")
public String sp(Qj qj, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
Qj byId = qjService.getById(qj.getId());
byId.setStatus(qj.getStatus());
byId.setContent(qj.getContent());
qjService.updateById(byId);
return "redirect:/qj/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
qjService.deleteById(id);
return "redirect:/qj/myqj.action";
}
}

@ -0,0 +1,422 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/record")
public class RecordController extends BaseController {
@Autowired
private SignService signService;
/**
* start dao/service/===
*/
@Autowired
private RecordService recordService;
// --------------------------------------- 华丽分割线 ------------------------------
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM record WHERE signId="+record.getSignId();
if(!isEmpty(record.getSignId())){
sql += " and signId like '%"+record.getSignId()+"%'";
}
if(!isEmpty(record.getStudentId())){
sql += " and studentId like '%"+record.getStudentId()+"%'";
}
if(!isEmpty(record.getIp())){
sql += " and ip like '%"+record.getIp()+"%'";
}
if(!isEmpty(record.getCreateTime())){
sql += " and createTime like '%"+record.getCreateTime()+"%'";
}
if(!isEmpty(record.getStatus())){
sql += " and status like '%"+record.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Record> pagers = recordService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", record);
model.addAttribute("signId", record.getSignId());
return "record/record";
}
/**
*
* @param record
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/fdyRecord")
public String fdyRecord(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM record WHERE signId="+record.getSignId();
if(!isEmpty(record.getSignId())){
sql += " and signId like '%"+record.getSignId()+"%'";
}
if(!isEmpty(record.getStudentId())){
sql += " and studentId like '%"+record.getStudentId()+"%'";
}
if(!isEmpty(record.getIp())){
sql += " and ip like '%"+record.getIp()+"%'";
}
if(!isEmpty(record.getCreateTime())){
sql += " and createTime like '%"+record.getCreateTime()+"%'";
}
if(!isEmpty(record.getStatus())){
sql += " and status like '%"+record.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Record> pagers = recordService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", record);
model.addAttribute("signId", record.getSignId());
return "record/fdyRecord";
}
//mysign
/**
*
* @param record
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/mysign")
public String mysign(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
//分页查询
String sql = "SELECT * FROM record WHERE studentId="+userId;
if(!isEmpty(record.getSignId())){
sql += " and signId like '%"+record.getSignId()+"%'";
}
if(!isEmpty(record.getStudentId())){
sql += " and studentId like '%"+record.getStudentId()+"%'";
}
if(!isEmpty(record.getIp())){
sql += " and ip like '%"+record.getIp()+"%'";
}
if(!isEmpty(record.getCreateTime())){
sql += " and createTime like '%"+record.getCreateTime()+"%'";
}
if(!isEmpty(record.getStatus())){
sql += " and status like '%"+record.getStatus()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Record> pagers = recordService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", record);
model.addAttribute("signId", record.getSignId());
return "record/mysign";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(record.getSignId())){
params.put("signId", record.getSignId());
}
if(!isEmpty(record.getStudentId())){
params.put("studentId", record.getStudentId());
}
if(!isEmpty(record.getIp())){
params.put("ip", record.getIp());
}
if(!isEmpty(record.getCreateTime())){
params.put("createTime", record.getCreateTime());
}
if(!isEmpty(record.getStatus())){
params.put("status", record.getStatus());
}
//分页查询
Pager<Record> pagers = recordService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", record);
return "record/record";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "record/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Record obj = recordService.load(id);
model.addAttribute("obj",obj);
return "record/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
@ResponseBody
public String exAdd(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
String ipAdrress = getIp(request);
Record obj = recordService.load(record.getId());
JSONObject j = new JSONObject();
//查看是否有ip冲突 0 未签到 1 已签到 2 请假
Record r = new Record();
r.setSignId(obj.getSignId());
r.setIp(ipAdrress);
Integer status = obj.getSign().getStatus();
if (status == 1){
j.put("res",3);
return j.toString();
}
if (obj.getStatus() == 2){
j.put("res", 2);
return j.toString();
}
List<Record> listAllByEntity = recordService.listAllByEntity(r);
if (!CollectionUtils.isEmpty(listAllByEntity)){
j.put("res", 0);
return j.toString();
}else{
obj.setCreateTime(new Date());
obj.setIp(ipAdrress);
obj.setStatus(1);
j.put("res", 1);
recordService.updateById(obj);
return j.toString();
}
}
private static String getIpAdrress(HttpServletRequest request) {
String Xip = request.getHeader("X-Real-IP");
String XFor = request.getHeader("X-Forwarded-For");
if(!StringUtils.isEmpty(XFor) && !"unKnown".equalsIgnoreCase(XFor)){
//多次反向代理后会有多个ip值第一个ip才是真实ip
int index = XFor.indexOf(",");
if(index != -1){
return XFor.substring(0,index);
}else{
return XFor;
}
}
XFor = Xip;
if(!StringUtils.isEmpty(XFor) && !"unKnown".equalsIgnoreCase(XFor)){
return XFor;
}
if (!StringUtils.isEmpty(XFor) || "unknown".equalsIgnoreCase(XFor)) {
XFor = request.getHeader("Proxy-Client-IP");
}
if (!StringUtils.isEmpty(XFor) || "unknown".equalsIgnoreCase(XFor)) {
XFor = request.getHeader("WL-Proxy-Client-IP");
}
if (!StringUtils.isEmpty(XFor) || "unknown".equalsIgnoreCase(XFor)) {
XFor = request.getHeader("HTTP_CLIENT_IP");
}
if (!StringUtils.isEmpty(XFor) || "unknown".equalsIgnoreCase(XFor)) {
XFor = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (!StringUtils.isEmpty(XFor) || "unknown".equalsIgnoreCase(XFor)) {
XFor = request.getRemoteAddr();
}
return XFor;
}
private String getIp(HttpServletRequest request){
String ip = request.getHeader("X-Forwarded-For");
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("WL-Proxy-Client-IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_CLIENT_IP");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getHeader("HTTP_X_FORWARDED_FOR");
}
if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
ip = request.getRemoteAddr();
}
} else if (ip.length() > 15) {
String[] ips = ip.split(",");
for (int index = 0; index < ips.length; index++) {
String strIp = ips[index];
if (!("unknown".equalsIgnoreCase(strIp))) {
ip = strIp;
break;
}
}
}
return ip;
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Record obj = recordService.load(id);
model.addAttribute("obj",obj);
return "record/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/setQd")
public String setQd(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
Record obj = recordService.load(record.getId());
//1.通过实体类修改,可以多传修改条件
obj.setStatus(2);
recordService.updateById(obj);
//2.通过主键id修改
//recordService.updateById(record);
return "redirect:/record/findBySql.action?signId="+obj.getSignId();
}
@RequestMapping(value = "/exUpdate")
public String exUpdate(Record record, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
recordService.updateById(record);
//2.通过主键id修改
//recordService.updateById(record);
return "redirect:/record/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
recordService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// recordService.deleteByEntity(record);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(record.getSignId())){
// params.put("signId", record.getSignId());
// }
//
// if(!isEmpty(record.getStudentId())){
// params.put("studentId", record.getStudentId());
// }
//
// if(!isEmpty(record.getIp())){
// params.put("ip", record.getIp());
// }
//
// if(!isEmpty(record.getCreateTime())){
// params.put("createTime", record.getCreateTime());
// }
//
// if(!isEmpty(record.getStatus())){
// params.put("status", record.getStatus());
// }
//
// recordService.deleteByMap(params);
// //4.状态删除
// Record load = recordService.getById(record.getId())
// load.setIsDelete(1);
// recordService.update(load);
//5.状态删除
//Record load = recordService.load(id);
//load.setIsDelete(1);
//recordService.updateById(load);
return "redirect:/record/findBySql.action";
}
}

@ -0,0 +1,338 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/sign")
public class SignController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private RecordService recordService;
@Autowired
private SignService signService;
@Autowired
private TeacherBjService teacherBjService;
@Autowired
private FdyService fdyService;
@Autowired
private StudentService studentService;
/**
*
* mybj
*/
@RequestMapping(value = "/mybj")
public String mybj(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
TeacherBj b = new TeacherBj();
b.setTeacherId(userId);
List<TeacherBj> listAllByEntity = teacherBjService.listAllByEntity(b);
model.addAttribute("bjs", listAllByEntity);
return "sign/mybj";
}
@RequestMapping(value = "/mybj2")
public String mybj2(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
TeacherBj b = new TeacherBj();
b.setTeacherId(userId);
List<TeacherBj> listAllByEntity = teacherBjService.listAllByEntity(b);
model.addAttribute("bjs", listAllByEntity);
return "sign/mybj2";
}
//${ctx}/sign/mySign.do?bjId=${data.bjId}
@RequestMapping(value = "/findBySql")
public String findBySql(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
String sql = "SELECT * FROM sign WHERE bjId= "+sign.getBjId() + " and teacherId="+userId;
if(!isEmpty(sign.getBjId())){
sql += " and bjId like '%"+sign.getBjId()+"%'";
}
if(!isEmpty(sign.getTeacherId())){
sql += " and teacherId like '%"+sign.getTeacherId()+"%'";
}
if(!isEmpty(sign.getName())){
sql += " and name like '%"+sign.getName()+"%'";
}
if(!isEmpty(sign.getStatus())){
sql += " and status like '%"+sign.getStatus()+"%'";
}
if(!isEmpty(sign.getFdyId())){
sql += " and fdyId like '%"+sign.getFdyId()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Sign> pagers = signService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", sign);
model.addAttribute("bjId", sign.getBjId());
return "sign/sign";
}
/**
*
* @param sign
* @param model
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/fdySign")
public String fdySign(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
String sql = "SELECT * FROM sign WHERE fdyId= "+userId;
if(!isEmpty(sign.getBjId())){
sql += " and bjId like '%"+sign.getBjId()+"%'";
}
if(!isEmpty(sign.getTeacherId())){
sql += " and teacherId like '%"+sign.getTeacherId()+"%'";
}
if(!isEmpty(sign.getName())){
sql += " and name like '%"+sign.getName()+"%'";
}
if(!isEmpty(sign.getStatus())){
sql += " and status like '%"+sign.getStatus()+"%'";
}
if(!isEmpty(sign.getFdyId())){
sql += " and fdyId like '%"+sign.getFdyId()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Sign> pagers = signService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", sign);
return "sign/fdySign";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(sign.getBjId())){
params.put("bjId", sign.getBjId());
}
if(!isEmpty(sign.getTeacherId())){
params.put("teacherId", sign.getTeacherId());
}
if(!isEmpty(sign.getName())){
params.put("name", sign.getName());
}
if(!isEmpty(sign.getStatus())){
params.put("status", sign.getStatus());
}
if(!isEmpty(sign.getFdyId())){
params.put("fdyId", sign.getFdyId());
}
//分页查询
Pager<Sign> pagers = signService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", sign);
return "sign/sign";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add(Integer bjId,Model model) {
model.addAttribute("bjId", bjId);
return "sign/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Sign obj = signService.load(id);
model.addAttribute("obj",obj);
return "sign/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
sign.setTeacherId(userId);
sign.setStatus(0);
signService.insert(sign);
//查询学生,插入记录表
Student s = new Student();
s.setBjId(sign.getBjId());
s.setIsDelete(0);
List<Student> listAllByEntity = studentService.listAllByEntity(s);
if (!CollectionUtils.isEmpty(listAllByEntity)){
for (Student ss : listAllByEntity){
Record re = new Record();
// re.setCreateTime(new Date());
re.setSignId(sign.getId());
//0 未签到 1 已签到 2 请假
re.setStatus(0);
re.setStudentId(ss.getId());
recordService.insert(re);
}
}
return "redirect:/sign/findBySql.action?bjId="+sign.getBjId();
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Sign obj = signService.load(id);
model.addAttribute("obj",obj);
return "sign/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/sp")
public String sp(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
Sign obj = signService.load(sign.getId());
if (sign.getStatus() == 2){
Fdy f = new Fdy();
f.setBjId(obj.getBjId());
Fdy byEntity = null;
try {
byEntity = fdyService.listAllByEntity(f).get(0);
obj.setFdyId(byEntity.getId());
obj.setStatus(sign.getStatus());
signService.updateById(obj);
} catch (Exception e) {
}
}
//2.通过主键id修改
//signService.updateById(sign);
return "redirect:/sign/findBySql.action?bjId="+obj.getBjId();
}
@RequestMapping(value = "/exUpdate")
public String exUpdate(Sign sign, Model model, HttpServletRequest request, HttpServletResponse response) {
Sign obj = signService.load(sign.getId());
signService.updateById(sign);
return "redirect:/sign/findBySql?bjId="+obj.getBjId();
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
Sign obj = signService.load(id);
///1.通过主键删除
signService.deleteById(id);
return "redirect:/sign/findBySql?bjId="+obj.getBjId();
}
}

@ -0,0 +1,254 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/student")
public class StudentController extends BaseController {
@Autowired
private BjService bjService;
/**
* start dao/service/===
*/
@Autowired
private StudentService studentService;
@Autowired
private FdyService fdyService;
@Autowired
private RecordService recordService;
// --------------------------------------- 华丽分割线 ------------------------------
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Student student, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
Fdy byId = fdyService.getById(userId);
if (byId== null || byId.getBjId() == null){
return "redirect:/login/message?type=1";
}
//分页查询
String sql = "SELECT * FROM student WHERE isDelete = 0 and bjId = "+ byId.getBjId();
if(!isEmpty(student.getCode())){
sql += " and code like '%"+student.getCode()+"%'";
}
if(!isEmpty(student.getUsername())){
sql += " and username like '%"+student.getUsername()+"%'";
}
if(!isEmpty(student.getPassword())){
sql += " and password like '%"+student.getPassword()+"%'";
}
if(!isEmpty(student.getBjId())){
sql += " and bjId like '%"+student.getBjId()+"%'";
}
if(!isEmpty(student.getIsDelete())){
sql += " and isDelete like '%"+student.getIsDelete()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Student> pagers = studentService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", student);
return "student/student";
}
@RequestMapping(value = "/pass")
public String pass(Integer id,HttpServletRequest request,Model model) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
Student obj = studentService.load(userId);
model.addAttribute("obj",obj);
return "student/pass";
}
@RequestMapping("/upass")
@ResponseBody
public String upass(HttpServletRequest request,String password){
Object attribute = request.getSession().getAttribute("userId");
JSONObject j = new JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
Student byId = studentService.getById(userId);
byId.setPassword(password);
studentService.updateById(byId);
j.put("res", 1);
return j.toString();
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Student student, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(student.getCode())){
params.put("code", student.getCode());
}
if(!isEmpty(student.getUsername())){
params.put("username", student.getUsername());
}
if(!isEmpty(student.getPassword())){
params.put("password", student.getPassword());
}
if(!isEmpty(student.getBjId())){
params.put("bjId", student.getBjId());
}
if(!isEmpty(student.getIsDelete())){
params.put("isDelete", student.getIsDelete());
}
//分页查询
Pager<Student> pagers = studentService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", student);
return "student/student";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "student/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Student obj = studentService.load(id);
model.addAttribute("obj",obj);
return "student/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Student student, Model model, HttpServletRequest request, HttpServletResponse response) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
Fdy byId = fdyService.getById(userId);
if (byId== null || byId.getBjId() == null){
return "redirect:/login/message?type=1";
}
student.setBjId(byId.getBjId());
student.setIsDelete(0);
studentService.insert(student);
return "redirect:/student/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Student obj = studentService.load(id);
model.addAttribute("obj",obj);
return "student/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Student student, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
studentService.updateById(student);
//2.通过主键id修改
//studentService.updateById(student);
return "redirect:/student/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
Student load = studentService.load(id);
load.setIsDelete(1);
studentService.updateById(load);
return "redirect:/student/findBySql.action";
}
}

@ -0,0 +1,526 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/teacherBj")
public class TeacherBjController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private TeacherBjService teacherBjService;
// --------------------------------------- 华丽分割线 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* => =>
* @Title: listAll
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listAll")
public String listAll(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response){
List<TeacherBj> listAll = teacherBjService.listAll();
model.addAttribute("list", listAll);
return "teacherBj/teacherBj";
}
/**
* ==>
* @Title: listByEntity
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByEntity")
public String listByEntity(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response){
List<TeacherBj> listAll = teacherBjService.listAllByEntity(teacherBj);
model.addAttribute("list", listAll);
return "teacherBj/teacherBj";
}
/**
* ==>
* @Title: listByMap
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByMap")
public String listByMap(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(teacherBj.getTeacherId())){
params.put("teacherId", teacherBj.getTeacherId());
}
if(!isEmpty(teacherBj.getBjId())){
params.put("bjId", teacherBj.getBjId());
}
List<TeacherBj> listAll = teacherBjService.listByMap(params);
model.addAttribute("list", listAll);
return "teacherBj/teacherBj";
}
/*********************************查询列表【分页】***********************************************/
/**
* list()
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<TeacherBj> pagers = teacherBjService.findByEntity(teacherBj);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacherBj);
return "teacherBj/teacherBj";
}
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM teacherBj WHERE 1=1 ";
if(!isEmpty(teacherBj.getTeacherId())){
sql += " and teacherId like '%"+teacherBj.getTeacherId()+"%'";
}
if(!isEmpty(teacherBj.getBjId())){
sql += " and bjId like '%"+teacherBj.getBjId()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<TeacherBj> pagers = teacherBjService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacherBj);
return "teacherBj/teacherBj";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(teacherBj.getTeacherId())){
params.put("teacherId", teacherBj.getTeacherId());
}
if(!isEmpty(teacherBj.getBjId())){
params.put("bjId", teacherBj.getBjId());
}
//分页查询
Pager<TeacherBj> pagers = teacherBjService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacherBj);
return "teacherBj/teacherBj";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add() {
return "teacherBj/add";
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
TeacherBj obj = teacherBjService.load(id);
model.addAttribute("obj",obj);
return "teacherBj/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
teacherBjService.insert(teacherBj);
return "redirect:/teacherBj/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
TeacherBj obj = teacherBjService.load(id);
model.addAttribute("obj",obj);
return "teacherBj/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
teacherBjService.updateById(teacherBj);
//2.通过主键id修改
//teacherBjService.updateById(teacherBj);
return "redirect:/teacherBj/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
teacherBjService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// teacherBjService.deleteByEntity(teacherBj);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(teacherBj.getTeacherId())){
// params.put("teacherId", teacherBj.getTeacherId());
// }
//
// if(!isEmpty(teacherBj.getBjId())){
// params.put("bjId", teacherBj.getBjId());
// }
//
// teacherBjService.deleteByMap(params);
// //4.状态删除
// TeacherBj load = teacherBjService.getById(teacherBj.getId())
// load.setIsDelete(1);
// teacherBjService.update(load);
//5.状态删除
//TeacherBj load = teacherBjService.load(id);
//load.setIsDelete(1);
//teacherBjService.updateById(load);
return "redirect:/teacherBj/findBySql.action";
}
// --------------------------------------- 华丽分割线 ------------------------------
// --------------------------------------- 【下面是ajax操作的方法。】 ------------------------------
/*********************************查询列表【不分页】***********************************************/
/**
* => =>
* @Title: listAll
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listAllJson", method = RequestMethod.POST)
@ResponseBody
public String listAllJson(TeacherBj teacherBj, HttpServletRequest request, HttpServletResponse response){
List<TeacherBj> listAll = teacherBjService.listAll();
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", teacherBj);
return jsonObject.toString();
}
/**
* ==>
* @Title: listByEntity
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByEntityJson", method = RequestMethod.POST)
@ResponseBody
public String listByEntityJson(TeacherBj teacherBj, HttpServletRequest request, HttpServletResponse response){
List<TeacherBj> listAll = teacherBjService.listAllByEntity(teacherBj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", teacherBj);
return jsonObject.toString();
}
/**
* ==>
* @Title: listByMap
* @Description: TODO()
* @param @return
* @author
* @return String
* @throws
*/
@RequestMapping(value = "/listByMapJson", method = RequestMethod.POST)
@ResponseBody
public String listByMapJson(TeacherBj teacherBj,HttpServletRequest request, HttpServletResponse response){
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(teacherBj.getTeacherId())){
params.put("teacherId", teacherBj.getTeacherId());
}
if(!isEmpty(teacherBj.getBjId())){
params.put("bjId", teacherBj.getBjId());
}
List<TeacherBj> listAll = teacherBjService.listByMap(params);
JSONObject jsonObject = new JSONObject();
jsonObject.put("list", listAll);
jsonObject.put("obj", teacherBj);
return jsonObject.toString();
}
/**
* list json()
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObjJson", method = RequestMethod.POST)
@ResponseBody
public String findByObjByEntityJson(TeacherBj teacherBj, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<TeacherBj> pagers = teacherBjService.findByEntity(teacherBj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", teacherBj);
return jsonObject.toString();
}
/**
* list json(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMapJson", method = RequestMethod.POST)
@ResponseBody
public String findByMapJson(TeacherBj teacherBj,HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(teacherBj.getTeacherId())){
params.put("teacherId", teacherBj.getTeacherId());
}
if(!isEmpty(teacherBj.getBjId())){
params.put("bjId", teacherBj.getBjId());
}
//分页查询
Pager<TeacherBj> pagers = teacherBjService.findByMap(params);
JSONObject jsonObject = new JSONObject();
jsonObject.put("pagers", pagers);
jsonObject.put("obj", teacherBj);
return jsonObject.toString();
}
/**
* ajax
* @param
* @return
*/
@RequestMapping(value = "/exAddJson", method = RequestMethod.POST)
@ResponseBody
public String exAddJson(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
teacherBjService.insert(teacherBj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "添加成功");
return jsonObject.toString();
}
/**
* ajax
* @param
* @return
*/
@RequestMapping(value = "/exUpdate.json", method = RequestMethod.POST)
@ResponseBody
public String exUpdateJson(TeacherBj teacherBj, Model model, HttpServletRequest request, HttpServletResponse response) {
//1.通过实体类修改,可以多传修改条件
teacherBjService.updateById(teacherBj);
//2.通过主键id修改
//teacherBjService.updateById(teacherBj);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "修改成功");
return jsonObject.toString();
}
/**
* ajax
* @return
*/
@RequestMapping(value = "/delete.json", method = RequestMethod.POST)
@ResponseBody
public String exDeleteJson(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
///1.通过主键删除
teacherBjService.deleteById(id);
/*以下是多种删除方式*/
// //2.通过实体条件删除
// teacherBjService.deleteByEntity(teacherBj);
// //3.通过参数删除
// //通过map查询
// Map<String,Object> params = new HashMap<String,Object>();
//
// if(!isEmpty(teacherBj.getTeacherId())){
// params.put("teacherId", teacherBj.getTeacherId());
// }
//
// if(!isEmpty(teacherBj.getBjId())){
// params.put("bjId", teacherBj.getBjId());
// }
//
// teacherBjService.deleteByMap(params);
// //4.状态删除
// TeacherBj load = teacherBjService.getById(teacherBj.getId())
// load.setIsDelete(1);
// teacherBjService.updateById(load);
//5.状态删除
//TeacherBj load = teacherBjService.load(id);
//load.setIsDelete(1);
//teacherBjService.updateById(load);
JSONObject jsonObject = new JSONObject();
jsonObject.put("message", "删除成功");
return jsonObject.toString();
}
/**
*
* @param file
* @param request
* @param model
* @return
*/
@RequestMapping(value = "/saveFile")
public String saveFile(@RequestParam(value = "file", required = false) MultipartFile file, HttpServletRequest request, Model model) {
System.out.println("开始");
String path = request.getSession().getServletContext().getRealPath("/upload");
String fileName = file.getOriginalFilename();
System.out.println(path);
File targetFile = new File(path, fileName);
if(!targetFile.exists()){
targetFile.mkdirs();
}
//保存
try {
file.transferTo(targetFile);
} catch (Exception e) {
e.printStackTrace();
}
return "";
}
/**
* springMvc
* @param files
* @param id
* @return
*/
@RequestMapping(value = "/saveFiles")
public String saveFiles(@RequestParam("file") CommonsMultipartFile[] files,Integer id,HttpServletRequest request){
for(int i = 0;i<files.length;i++){
System.out.println("fileName---------->" + files[i].getOriginalFilename());
if(!files[i].isEmpty()){
int pre = (int) System.currentTimeMillis();
try {
//拿到输出流,同时重命名上传的文件
String filePath = request.getRealPath("/upload");
File f=new File(filePath);
if(!f.exists()){
f.mkdirs();
}
String fileNmae=new Date().getTime() + files[i].getOriginalFilename();
File file=new File(filePath+"/"+pre + files[i].getOriginalFilename());
if(!file.exists()){
file.createNewFile();
}
files[i].transferTo(file);
} catch (Exception e) {
e.printStackTrace();
System.out.println("上传出错");
}
}
}
return "";
}
// --------------------------------------- 华丽分割线 ------------------------------
}

@ -0,0 +1,312 @@
package com.kwxy.hyt.controller;
import java.io.File;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import com.alibaba.fastjson.JSONObject;
import com.kwxy.hyt.base.BaseController;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Controller
@RequestMapping("/teacher")
public class TeacherController extends BaseController {
/**
* start dao/service/===
*/
@Autowired
private TeacherService teacherService;
@Autowired
private BjService bjService;
@Autowired
private TeacherBjService teacherBjService;
// --------------------------------------- 华丽分割线 ------------------------------
/**
* list()
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByObj")
public String findByObj(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
Pager<Teacher> pagers = teacherService.findByEntity(teacher);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacher);
return "teacher/teacher";
}
/**
* list(By Sql)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findBySql")
public String findBySql(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
//分页查询
String sql = "SELECT * FROM teacher WHERE isDelete = 0 ";
if(!isEmpty(teacher.getCode())){
sql += " and code like '%"+teacher.getCode()+"%'";
}
if(!isEmpty(teacher.getUsername())){
sql += " and username like '%"+teacher.getUsername()+"%'";
}
if(!isEmpty(teacher.getPassword())){
sql += " and password like '%"+teacher.getPassword()+"%'";
}
if(!isEmpty(teacher.getKc())){
sql += " and kc like '%"+teacher.getKc()+"%'";
}
if(!isEmpty(teacher.getIsDelete())){
sql += " and isDelete like '%"+teacher.getIsDelete()+"%'";
}
sql += " ORDER BY ID DESC ";
Pager<Teacher> pagers = teacherService.findBySqlRerturnEntity(sql);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacher);
return "teacher/teacher";
}
/**
* list(Map)
*
* @param request
* @param response
* @return
*/
@RequestMapping(value = "/findByMap")
public String findByMap(Teacher teacher, Model model, HttpServletRequest request, HttpServletResponse response) {
//通过map查询
Map<String,Object> params = new HashMap<String,Object>();
if(!isEmpty(teacher.getCode())){
params.put("code", teacher.getCode());
}
if(!isEmpty(teacher.getUsername())){
params.put("username", teacher.getUsername());
}
if(!isEmpty(teacher.getPassword())){
params.put("password", teacher.getPassword());
}
if(!isEmpty(teacher.getKc())){
params.put("kc", teacher.getKc());
}
if(!isEmpty(teacher.getIsDelete())){
params.put("isDelete", teacher.getIsDelete());
}
//分页查询
Pager<Teacher> pagers = teacherService.findByMap(params);
model.addAttribute("pagers", pagers);
//存储查询条件
model.addAttribute("obj", teacher);
return "teacher/teacher";
}
/**********************************【增删改】******************************************************/
/**
*
* @return
*/
@RequestMapping(value = "/add")
public String add(Model model) {
// 查询班级列表
Bj b = new Bj();
b.setIsDelete(0);
List<Bj> listAllByEntity = bjService.listAllByEntity(b);
model.addAttribute("bjs", listAllByEntity);
return "teacher/add";
}
@RequestMapping(value = "/pass")
public String pass(Integer id,HttpServletRequest request,Model model) {
Object attribute = request.getSession().getAttribute("userId");
if (attribute == null){
return "redirect:/login/uLogin";
}
Integer userId = Integer.valueOf(attribute.toString());
Teacher obj = teacherService.load(userId);
model.addAttribute("obj",obj);
return "teacher/pass";
}
@RequestMapping("/upass")
@ResponseBody
public String upass(HttpServletRequest request,String password){
Object attribute = request.getSession().getAttribute("userId");
JSONObject j = new JSONObject();
if (attribute == null){
j.put("res", 0);
return j.toString();
}
Integer userId = Integer.valueOf(attribute.toString());
Teacher byId = teacherService.getById(userId);
byId.setPassword(password);
teacherService.updateById(byId);
j.put("res", 1);
return j.toString();
}
/**
*
* @return
*/
@RequestMapping(value = "/view")
public String view(Integer id,Model model) {
Teacher obj = teacherService.load(id);
model.addAttribute("obj",obj);
return "teacher/view";
}
/**
*
* @return
*/
@RequestMapping(value = "/exAdd")
public String exAdd(Teacher teacher,@RequestParam(value = "ids") Integer[] ids, Model model, HttpServletRequest request, HttpServletResponse response) {
if (ids != null && ids.length > 0){
teacher.setIsDelete(0);
teacherService.insert(teacher);
for (Integer bId : ids){
TeacherBj tb = new TeacherBj();
tb.setBjId(bId);
tb.setTeacherId(teacher.getId());
teacherBjService.insert(tb);
}
}
return "redirect:/teacher/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/update")
public String update(Integer id,Model model) {
Teacher obj = teacherService.load(id);
// 查询班级列表
Bj b = new Bj();
b.setIsDelete(0);
List<Bj> listAllByEntity = bjService.listAllByEntity(b);
//查看教师已经选中的
TeacherBj t = new TeacherBj();
t.setTeacherId(id);
List<TeacherBj> select = teacherBjService.listAllByEntity(t);
List<Integer> ids = new ArrayList<Integer>();
if (!CollectionUtils.isEmpty(select)){
for (TeacherBj b2 : select){
ids.add(b2.getBjId());
}
}
if (!CollectionUtils.isEmpty(listAllByEntity)){
for (Bj bj : listAllByEntity){
if (!CollectionUtils.isEmpty(ids) && ids.contains(bj.getId())){
bj.setIsCheck(1);
}else{
bj.setIsCheck(0);
}
}
}
model.addAttribute("bjs", listAllByEntity);
model.addAttribute("obj",obj);
return "teacher/update";
}
/**
*
* @return
*/
@RequestMapping(value = "/exUpdate")
public String exUpdate(Teacher teacher,@RequestParam(value = "ids") Integer[] ids, Model model, HttpServletRequest request, HttpServletResponse response) {
teacherService.updateById(teacher);
if (ids != null && ids.length > 0){
teacher.setIsDelete(0);
//删除
TeacherBj t = new TeacherBj();
t.setTeacherId(teacher.getId());
teacherBjService.deleteByEntity(t);
for (Integer bId : ids){
TeacherBj tb = new TeacherBj();
tb.setBjId(bId);
tb.setTeacherId(teacher.getId());
teacherBjService.insert(tb);
}
}
return "redirect:/teacher/findBySql.action";
}
/**
*
* @return
*/
@RequestMapping(value = "/delete")
public String delete(Integer id, Model model, HttpServletRequest request, HttpServletResponse response) {
Teacher load = teacherService.load(id);
TeacherBj t = new TeacherBj();
t.setTeacherId(id);
teacherBjService.deleteByEntity(t);
load.setIsDelete(1);
teacherService.updateById(load);
return "redirect:/teacher/findBySql.action";
}
}

@ -0,0 +1,56 @@
package com.kwxy.hyt.filter;
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import com.kwxy.hyt.utils.SystemContext;
public class SystemContextFilter implements Filter{
private Integer pageSize;
public void destroy() {
}
public void doFilter(ServletRequest req, ServletResponse resp,
FilterChain chain) throws IOException, ServletException {
Integer offset = 0;
try {
offset = Integer.parseInt(req.getParameter("pager.offset"));
} catch (NumberFormatException e) {}
try {
SystemContext.setOrder(req.getParameter("order"));
SystemContext.setSort(req.getParameter("sort"));
SystemContext.setPageOffset(offset);
SystemContext.setPageSize(pageSize);
SystemContext.setRealPath(((HttpServletRequest)req).getSession().getServletContext().getRealPath("/"));
chain.doFilter(req,resp);
} finally {
SystemContext.removeOrder();
SystemContext.removeSort();
SystemContext.removePageOffset();
SystemContext.removePageSize();
SystemContext.removeRealPath();
}
}
public void init(FilterConfig cfg) throws ServletException {
try {
pageSize = Integer.parseInt(cfg.getInitParameter("pageSize"));
} catch (NumberFormatException e) {
pageSize = 15;
}
}
}

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
public interface BjMapper extends BaseDao<Bj>{
}

@ -0,0 +1,343 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.BjMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapBj" type="com.kwxy.hyt.po.Bj">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="zy" column="zy" jdbcType="VARCHAR"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Bj_field">
id,
name,
zy,
isDelete
</sql>
<!-- 实体类属性 -->
<sql id="Bj_insert">
#{id} ,
#{name} ,
#{zy} ,
#{isDelete}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Bj_update">
<if test="name != null" >
name = #{name} ,
</if>
<if test="zy != null" >
zy = #{zy} ,
</if>
<if test="isDelete != null" >
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Bj_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="name != null " >
and name =#{name}
</if>
<if test="zy != null " >
and zy =#{zy}
</if>
<if test="isDelete != null " >
and isDelete =#{isDelete}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Bj" useGeneratedKeys="true" keyProperty="id">
INSERT INTO bj (
<include refid="Bj_field" />
) VALUES (
<include refid="Bj_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from bj where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Bj">
delete from bj
WHERE 1=1
<include refid="Bj_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from bj
WHERE 1=1
<include refid="Bj_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Bj">
UPDATE bj
<set>
<include refid="Bj_update" />
</set>
WHERE 1=1
<include refid="Bj_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Bj">
UPDATE bj
<set>
<include refid="Bj_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapBj" parameterType="map">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapBj">
select <include refid="Bj_field" />
from bj
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapBj" parameterType="com.kwxy.hyt.po.Bj">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapBj" parameterType="java.lang.Integer">
select <include refid="Bj_field" />
from bj
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapBj" parameterType="java.lang.Integer">
select <include refid="Bj_field" />
from bj
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapBj" parameterType="map">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapBj" parameterType="com.kwxy.hyt.po.Bj">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapBj" parameterType="map">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapBj" parameterType="com.kwxy.hyt.po.Bj">
select <include refid="Bj_field" />
from bj where 1=1
<include refid="Bj_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO bj (
<include refid="Bj_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.name} ,
#{item.zy} ,
#{item.isDelete}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
bj
<set>
<if test="item.name != null" >
name = #{item.name},
</if>
<if test="item.zy != null" >
zy = #{item.zy},
</if>
<if test="item.isDelete != null" >
isDelete = #{item.isDelete}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapBj">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapBj">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapBj">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
public interface FdyMapper extends BaseDao<Fdy>{
}

@ -0,0 +1,379 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.FdyMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapFdy" type="com.kwxy.hyt.po.Fdy">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="sex" column="sex" jdbcType="VARCHAR"/>
<result property="bjId" column="bjId" jdbcType="INTEGER"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
<association property="bj" column="bjId" select="com.kwxy.hyt.mapper.BjMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Fdy_field">
id,
username,
password,
code,
sex,
bjId,
isDelete
</sql>
<!-- 实体类属性 -->
<sql id="Fdy_insert">
#{id} ,
#{username} ,
#{password} ,
#{code} ,
#{sex} ,
#{bjId} ,
#{isDelete}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Fdy_update">
<if test="username != null" >
username = #{username} ,
</if>
<if test="password != null" >
password = #{password} ,
</if>
<if test="code != null" >
code = #{code} ,
</if>
<if test="sex != null" >
sex = #{sex} ,
</if>
<if test="bjId != null" >
bjId = #{bjId} ,
</if>
<if test="isDelete != null" >
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Fdy_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="username != null " >
and username =#{username}
</if>
<if test="password != null " >
and password =#{password}
</if>
<if test="code != null " >
and code =#{code}
</if>
<if test="sex != null " >
and sex =#{sex}
</if>
<if test="bjId != null " >
and bjId =#{bjId}
</if>
<if test="isDelete != null " >
and isDelete =#{isDelete}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Fdy" useGeneratedKeys="true" keyProperty="id">
INSERT INTO fdy (
<include refid="Fdy_field" />
) VALUES (
<include refid="Fdy_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from fdy where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Fdy">
delete from fdy
WHERE 1=1
<include refid="Fdy_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from fdy
WHERE 1=1
<include refid="Fdy_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Fdy">
UPDATE fdy
<set>
<include refid="Fdy_update" />
</set>
WHERE 1=1
<include refid="Fdy_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Fdy">
UPDATE fdy
<set>
<include refid="Fdy_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapFdy" parameterType="map">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapFdy">
select <include refid="Fdy_field" />
from fdy
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapFdy" parameterType="com.kwxy.hyt.po.Fdy">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapFdy" parameterType="java.lang.Integer">
select <include refid="Fdy_field" />
from fdy
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapFdy" parameterType="java.lang.Integer">
select <include refid="Fdy_field" />
from fdy
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapFdy" parameterType="map">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapFdy" parameterType="com.kwxy.hyt.po.Fdy">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapFdy" parameterType="map">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapFdy" parameterType="com.kwxy.hyt.po.Fdy">
select <include refid="Fdy_field" />
from fdy where 1=1
<include refid="Fdy_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO fdy (
<include refid="Fdy_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.username} ,
#{item.password} ,
#{item.code} ,
#{item.sex} ,
#{item.bjId}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
fdy
<set>
<if test="item.username != null" >
username = #{item.username},
</if>
<if test="item.password != null" >
password = #{item.password},
</if>
<if test="item.code != null" >
code = #{item.code},
</if>
<if test="item.sex != null" >
sex = #{item.sex},
</if>
<if test="item.bjId != null" >
bjId = #{item.bjId}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapFdy">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapFdy">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapFdy">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface ManageMapper extends BaseDao<Manage>{
}

@ -0,0 +1,330 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.ManageMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapManage" type="com.kwxy.hyt.po.Manage">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Manage_field">
id,
username,
password
</sql>
<!-- 实体类属性 -->
<sql id="Manage_insert">
#{id} ,
#{username} ,
#{password}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Manage_update">
<if test="username != null" >
username = #{username} ,
</if>
<if test="password != null" >
password = #{password}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Manage_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="username != null " >
and username =#{username}
</if>
<if test="password != null " >
and password =#{password}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Manage" useGeneratedKeys="true" keyProperty="id">
INSERT INTO manage (
<include refid="Manage_field" />
) VALUES (
<include refid="Manage_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from manage where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Manage">
delete from manage
WHERE 1=1
<include refid="Manage_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from manage
WHERE 1=1
<include refid="Manage_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Manage">
UPDATE manage
<set>
<include refid="Manage_update" />
</set>
WHERE 1=1
<include refid="Manage_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Manage">
UPDATE manage
<set>
<include refid="Manage_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapManage">
select <include refid="Manage_field" />
from manage
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapManage" parameterType="com.kwxy.hyt.po.Manage">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapManage" parameterType="java.lang.Integer">
select <include refid="Manage_field" />
from manage
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapManage" parameterType="java.lang.Integer">
select <include refid="Manage_field" />
from manage
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapManage" parameterType="com.kwxy.hyt.po.Manage">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapManage" parameterType="map">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapManage" parameterType="com.kwxy.hyt.po.Manage">
select <include refid="Manage_field" />
from manage where 1=1
<include refid="Manage_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO manage (
<include refid="Manage_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.username} ,
#{item.password}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
manage
<set>
<if test="item.username != null" >
username = #{item.username},
</if>
<if test="item.password != null" >
password = #{item.password}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapManage">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface QjMapper extends BaseDao<Qj>{
}

@ -0,0 +1,405 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.QjMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapQj" type="com.kwxy.hyt.po.Qj">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="bjId" column="bjId" jdbcType="INTEGER"/>
<result property="studentId" column="studentId" jdbcType="INTEGER"/>
<result property="fdyId" column="fdyId" jdbcType="INTEGER"/>
<result property="startTime" column="startTime" jdbcType="VARCHAR"/>
<result property="endTime" column="endTime" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="reason" column="reason" jdbcType="VARCHAR"/>
<result property="content" column="content" jdbcType="VARCHAR"/>
<association property="bj" column="bjId" select="com.kwxy.hyt.mapper.BjMapper.load"/>
<association property="student" column="studentId" select="com.kwxy.hyt.mapper.StudentMapper.load"/>
<association property="fdy" column="fdyId" select="com.kwxy.hyt.mapper.FdyMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Qj_field">
id,
bjId,
studentId,
fdyId,
startTime,
endTime,
status,
reason,
content
</sql>
<!-- 实体类属性 -->
<sql id="Qj_insert">
#{id} ,
#{bjId} ,
#{studentId} ,
#{fdyId} ,
#{startTime} ,
#{endTime} ,
#{status} ,
#{reason} ,
#{content}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Qj_update">
<if test="bjId != null" >
bjId = #{bjId} ,
</if>
<if test="studentId != null" >
studentId = #{studentId} ,
</if>
<if test="fdyId != null" >
fdyId = #{fdyId} ,
</if>
<if test="startTime != null" >
startTime = #{startTime} ,
</if>
<if test="endTime != null" >
endTime = #{endTime} ,
</if>
<if test="status != null" >
status = #{status} ,
</if>
<if test="reason != null" >
reason = #{reason} ,
</if>
<if test="content != null" >
content = #{content}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Qj_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="bjId != null " >
and bjId =#{bjId}
</if>
<if test="studentId != null " >
and studentId =#{studentId}
</if>
<if test="fdyId != null " >
and fdyId =#{fdyId}
</if>
<if test="startTime != null " >
and startTime =#{startTime}
</if>
<if test="endTime != null " >
and endTime =#{endTime}
</if>
<if test="status != null " >
and status =#{status}
</if>
<if test="reason != null" >
and reason = #{reason}
</if>
<if test="content != null" >
and content = #{content}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Qj" useGeneratedKeys="true" keyProperty="id">
INSERT INTO qj (
<include refid="Qj_field" />
) VALUES (
<include refid="Qj_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from qj where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Qj">
delete from qj
WHERE 1=1
<include refid="Qj_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from qj
WHERE 1=1
<include refid="Qj_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Qj">
UPDATE qj
<set>
<include refid="Qj_update" />
</set>
WHERE 1=1
<include refid="Qj_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Qj">
UPDATE qj
<set>
<include refid="Qj_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapQj" parameterType="map">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapQj">
select <include refid="Qj_field" />
from qj
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapQj" parameterType="com.kwxy.hyt.po.Qj">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapQj" parameterType="java.lang.Integer">
select <include refid="Qj_field" />
from qj
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapQj" parameterType="java.lang.Integer">
select <include refid="Qj_field" />
from qj
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapQj" parameterType="map">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapQj" parameterType="com.kwxy.hyt.po.Qj">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapQj" parameterType="map">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapQj" parameterType="com.kwxy.hyt.po.Qj">
select <include refid="Qj_field" />
from qj where 1=1
<include refid="Qj_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO qj (
<include refid="Qj_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.bjId} ,
#{item.studentId} ,
#{item.fdyId} ,
#{item.startTime} ,
#{item.endTime} ,
#{item.status}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
qj
<set>
<if test="item.bjId != null" >
bjId = #{item.bjId},
</if>
<if test="item.studentId != null" >
studentId = #{item.studentId},
</if>
<if test="item.fdyId != null" >
fdyId = #{item.fdyId},
</if>
<if test="item.startTime != null" >
startTime = #{item.startTime},
</if>
<if test="item.endTime != null" >
endTime = #{item.endTime},
</if>
<if test="item.status != null" >
status = #{item.status}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapQj">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapQj">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapQj">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface RecordMapper extends BaseDao<Record>{
}

@ -0,0 +1,371 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.RecordMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapRecord" type="com.kwxy.hyt.po.Record">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="signId" column="signId" jdbcType="INTEGER"/>
<result property="studentId" column="studentId" jdbcType="INTEGER"/>
<result property="ip" column="ip" jdbcType="VARCHAR"/>
<result property="createTime" column="createTime" jdbcType="TIMESTAMP"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<association property="sign" column="signId" select="com.kwxy.hyt.mapper.SignMapper.load"/>
<association property="student" column="studentId" select="com.kwxy.hyt.mapper.StudentMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Record_field">
id,
signId,
studentId,
ip,
createTime,
status
</sql>
<!-- 实体类属性 -->
<sql id="Record_insert">
#{id} ,
#{signId} ,
#{studentId} ,
#{ip} ,
#{createTime} ,
#{status}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Record_update">
<if test="signId != null" >
signId = #{signId} ,
</if>
<if test="studentId != null" >
studentId = #{studentId} ,
</if>
<if test="ip != null" >
ip = #{ip} ,
</if>
<if test="createTime != null" >
createTime = #{createTime} ,
</if>
<if test="status != null" >
status = #{status}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Record_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="signId != null " >
and signId =#{signId}
</if>
<if test="studentId != null " >
and studentId =#{studentId}
</if>
<if test="ip != null " >
and ip =#{ip}
</if>
<if test="createTime != null " >
and createTime =#{createTime}
</if>
<if test="status != null " >
and status =#{status}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Record" useGeneratedKeys="true" keyProperty="id">
INSERT INTO record (
<include refid="Record_field" />
) VALUES (
<include refid="Record_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from record where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Record">
delete from record
WHERE 1=1
<include refid="Record_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from record
WHERE 1=1
<include refid="Record_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Record">
UPDATE record
<set>
<include refid="Record_update" />
</set>
WHERE 1=1
<include refid="Record_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Record">
UPDATE record
<set>
<include refid="Record_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapRecord" parameterType="map">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapRecord">
select <include refid="Record_field" />
from record
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapRecord" parameterType="com.kwxy.hyt.po.Record">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapRecord" parameterType="java.lang.Integer">
select <include refid="Record_field" />
from record
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapRecord" parameterType="java.lang.Integer">
select <include refid="Record_field" />
from record
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapRecord" parameterType="map">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapRecord" parameterType="com.kwxy.hyt.po.Record">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapRecord" parameterType="map">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapRecord" parameterType="com.kwxy.hyt.po.Record">
select <include refid="Record_field" />
from record where 1=1
<include refid="Record_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO record (
<include refid="Record_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.signId} ,
#{item.studentId} ,
#{item.ip} ,
#{item.createTime} ,
#{item.status}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
record
<set>
<if test="item.signId != null" >
signId = #{item.signId},
</if>
<if test="item.studentId != null" >
studentId = #{item.studentId},
</if>
<if test="item.ip != null" >
ip = #{item.ip},
</if>
<if test="item.createTime != null" >
createTime = #{item.createTime},
</if>
<if test="item.status != null" >
status = #{item.status}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapRecord">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapRecord">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapRecord">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface SignMapper extends BaseDao<Sign>{
}

@ -0,0 +1,373 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.SignMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapSign" type="com.kwxy.hyt.po.Sign">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="bjId" column="bjId" jdbcType="INTEGER"/>
<result property="teacherId" column="teacherId" jdbcType="INTEGER"/>
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="status" column="status" jdbcType="INTEGER"/>
<result property="fdyId" column="fdyId" jdbcType="INTEGER"/>
<association property="fdy" column="fdyId" select="com.kwxy.hyt.mapper.FdyMapper.load"/>
<association property="bj" column="bjId" select="com.kwxy.hyt.mapper.BjMapper.load"/>
<association property="teacher" column="teacherId" select="com.kwxy.hyt.mapper.TeacherMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Sign_field">
id,
bjId,
teacherId,
name,
status,
fdyId
</sql>
<!-- 实体类属性 -->
<sql id="Sign_insert">
#{id} ,
#{bjId} ,
#{teacherId} ,
#{name} ,
#{status} ,
#{fdyId}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Sign_update">
<if test="bjId != null" >
bjId = #{bjId} ,
</if>
<if test="teacherId != null" >
teacherId = #{teacherId} ,
</if>
<if test="name != null" >
name = #{name} ,
</if>
<if test="status != null" >
status = #{status} ,
</if>
<if test="fdyId != null" >
fdyId = #{fdyId}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Sign_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="bjId != null " >
and bjId =#{bjId}
</if>
<if test="teacherId != null " >
and teacherId =#{teacherId}
</if>
<if test="name != null " >
and name =#{name}
</if>
<if test="status != null " >
and status =#{status}
</if>
<if test="fdyId != null " >
and fdyId =#{fdyId}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Sign" useGeneratedKeys="true" keyProperty="id">
INSERT INTO sign (
<include refid="Sign_field" />
) VALUES (
<include refid="Sign_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from sign where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Sign">
delete from sign
WHERE 1=1
<include refid="Sign_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from sign
WHERE 1=1
<include refid="Sign_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Sign">
UPDATE sign
<set>
<include refid="Sign_update" />
</set>
WHERE 1=1
<include refid="Sign_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Sign">
UPDATE sign
<set>
<include refid="Sign_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapSign" parameterType="map">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapSign">
select <include refid="Sign_field" />
from sign
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapSign" parameterType="com.kwxy.hyt.po.Sign">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapSign" parameterType="java.lang.Integer">
select <include refid="Sign_field" />
from sign
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapSign" parameterType="java.lang.Integer">
select <include refid="Sign_field" />
from sign
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapSign" parameterType="map">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapSign" parameterType="com.kwxy.hyt.po.Sign">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapSign" parameterType="map">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapSign" parameterType="com.kwxy.hyt.po.Sign">
select <include refid="Sign_field" />
from sign where 1=1
<include refid="Sign_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO sign (
<include refid="Sign_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.bjId} ,
#{item.teacherId} ,
#{item.name} ,
#{item.status} ,
#{item.fdyId}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
sign
<set>
<if test="item.bjId != null" >
bjId = #{item.bjId},
</if>
<if test="item.teacherId != null" >
teacherId = #{item.teacherId},
</if>
<if test="item.name != null" >
name = #{item.name},
</if>
<if test="item.status != null" >
status = #{item.status},
</if>
<if test="item.fdyId != null" >
fdyId = #{item.fdyId}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapSign">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapSign">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapSign">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface StudentMapper extends BaseDao<Student>{
}

@ -0,0 +1,370 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.StudentMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapStudent" type="com.kwxy.hyt.po.Student">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="bjId" column="bjId" jdbcType="INTEGER"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
<association property="bj" column="bjId" select="com.kwxy.hyt.mapper.BjMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Student_field">
id,
code,
username,
password,
bjId,
isDelete
</sql>
<!-- 实体类属性 -->
<sql id="Student_insert">
#{id} ,
#{code} ,
#{username} ,
#{password} ,
#{bjId} ,
#{isDelete}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Student_update">
<if test="code != null" >
code = #{code} ,
</if>
<if test="username != null" >
username = #{username} ,
</if>
<if test="password != null" >
password = #{password} ,
</if>
<if test="bjId != null" >
bjId = #{bjId} ,
</if>
<if test="isDelete != null" >
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Student_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="code != null " >
and code =#{code}
</if>
<if test="username != null " >
and username =#{username}
</if>
<if test="password != null " >
and password =#{password}
</if>
<if test="bjId != null " >
and bjId =#{bjId}
</if>
<if test="isDelete != null " >
and isDelete =#{isDelete}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Student" useGeneratedKeys="true" keyProperty="id">
INSERT INTO student (
<include refid="Student_field" />
) VALUES (
<include refid="Student_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from student where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Student">
delete from student
WHERE 1=1
<include refid="Student_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from student
WHERE 1=1
<include refid="Student_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Student">
UPDATE student
<set>
<include refid="Student_update" />
</set>
WHERE 1=1
<include refid="Student_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Student">
UPDATE student
<set>
<include refid="Student_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapStudent" parameterType="map">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapStudent">
select <include refid="Student_field" />
from student
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapStudent" parameterType="com.kwxy.hyt.po.Student">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapStudent" parameterType="java.lang.Integer">
select <include refid="Student_field" />
from student
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapStudent" parameterType="java.lang.Integer">
select <include refid="Student_field" />
from student
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapStudent" parameterType="map">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapStudent" parameterType="com.kwxy.hyt.po.Student">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapStudent" parameterType="map">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapStudent" parameterType="com.kwxy.hyt.po.Student">
select <include refid="Student_field" />
from student where 1=1
<include refid="Student_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO student (
<include refid="Student_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.code} ,
#{item.username} ,
#{item.password} ,
#{item.bjId} ,
#{item.isDelete}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
student
<set>
<if test="item.code != null" >
code = #{item.code},
</if>
<if test="item.username != null" >
username = #{item.username},
</if>
<if test="item.password != null" >
password = #{item.password},
</if>
<if test="item.bjId != null" >
bjId = #{item.bjId},
</if>
<if test="item.isDelete != null" >
isDelete = #{item.isDelete}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapStudent">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapStudent">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapStudent">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface TeacherBjMapper extends BaseDao<TeacherBj>{
}

@ -0,0 +1,332 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.TeacherBjMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapTeacherBj" type="com.kwxy.hyt.po.TeacherBj">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="teacherId" column="teacherId" jdbcType="INTEGER"/>
<result property="bjId" column="bjId" jdbcType="INTEGER"/>
<association property="bj" column="bjId" select="com.kwxy.hyt.mapper.BjMapper.load"/>
<association property="teacher" column="teacherId" select="com.kwxy.hyt.mapper.TeacherMapper.load"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="TeacherBj_field">
id,
teacherId,
bjId
</sql>
<!-- 实体类属性 -->
<sql id="TeacherBj_insert">
#{id} ,
#{teacherId} ,
#{bjId}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="TeacherBj_update">
<if test="teacherId != null" >
teacherId = #{teacherId} ,
</if>
<if test="bjId != null" >
bjId = #{bjId}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="TeacherBj_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="teacherId != null " >
and teacherId =#{teacherId}
</if>
<if test="bjId != null " >
and bjId =#{bjId}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.TeacherBj" useGeneratedKeys="true" keyProperty="id">
INSERT INTO teacher_bj (
<include refid="TeacherBj_field" />
) VALUES (
<include refid="TeacherBj_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer">
delete from teacher_bj where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.TeacherBj">
delete from teacher_bj
WHERE 1=1
<include refid="TeacherBj_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from teacher_bj
WHERE 1=1
<include refid="TeacherBj_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.TeacherBj">
UPDATE teacher_bj
<set>
<include refid="TeacherBj_update" />
</set>
WHERE 1=1
<include refid="TeacherBj_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.TeacherBj">
UPDATE teacher_bj
<set>
<include refid="TeacherBj_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapTeacherBj" parameterType="map">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapTeacherBj">
select <include refid="TeacherBj_field" />
from teacher_bj
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapTeacherBj" parameterType="com.kwxy.hyt.po.TeacherBj">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapTeacherBj" parameterType="java.lang.Integer">
select <include refid="TeacherBj_field" />
from teacher_bj
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapTeacherBj" parameterType="java.lang.Integer">
select <include refid="TeacherBj_field" />
from teacher_bj
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapTeacherBj" parameterType="map">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapTeacherBj" parameterType="com.kwxy.hyt.po.TeacherBj">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapTeacherBj" parameterType="map">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapTeacherBj" parameterType="com.kwxy.hyt.po.TeacherBj">
select <include refid="TeacherBj_field" />
from teacher_bj where 1=1
<include refid="TeacherBj_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO teacher_bj (
<include refid="TeacherBj_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.teacherId} ,
#{item.bjId}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
teacher_bj
<set>
<if test="item.teacherId != null" >
teacherId = #{item.teacherId},
</if>
<if test="item.bjId != null" >
bjId = #{item.bjId}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapTeacherBj">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapTeacherBj">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapTeacherBj">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,27 @@
package com.kwxy.hyt.mapper;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
import com.kwxy.hyt.base.BaseDao;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.utils.Pager;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface TeacherMapper extends BaseDao<Teacher>{
}

@ -0,0 +1,369 @@
<?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">
<!-- 不使用namespace的话sql搜索定位会比较方便-->
<mapper namespace="com.kwxy.hyt.mapper.TeacherMapper">
<!-- 实体类与数据库映射字段部分 start -->
<resultMap id="ResultMapTeacher" type="com.kwxy.hyt.po.Teacher">
<result property="id" column="id" jdbcType="INTEGER"/>
<result property="code" column="code" jdbcType="VARCHAR"/>
<result property="username" column="username" jdbcType="VARCHAR"/>
<result property="password" column="password" jdbcType="VARCHAR"/>
<result property="kc" column="kc" jdbcType="VARCHAR"/>
<result property="isDelete" column="isDelete" jdbcType="INTEGER"/>
</resultMap>
<!-- 实体类与数据库映射字段部分 end -->
<!-- 声明数据库字段 -->
<sql id="Teacher_field">
id,
code,
username,
password,
kc,
isDelete
</sql>
<!-- 实体类属性 -->
<sql id="Teacher_insert">
#{id} ,
#{code} ,
#{username} ,
#{password} ,
#{kc} ,
#{isDelete}
</sql>
<!-- 执行修改时 数据库字段和表字段比较 -->
<sql id="Teacher_update">
<if test="code != null" >
code = #{code} ,
</if>
<if test="username != null" >
username = #{username} ,
</if>
<if test="password != null" >
password = #{password} ,
</if>
<if test="kc != null" >
kc = #{kc} ,
</if>
<if test="isDelete != null" >
isDelete = #{isDelete}
</if>
</sql>
<!-- 查询时条件 -->
<sql id="Teacher_where">
<if test="id != null " >
and id =#{id}
</if>
<if test="code != null " >
and code =#{code}
</if>
<if test="username != null " >
and username =#{username}
</if>
<if test="password != null " >
and password =#{password}
</if>
<if test="kc != null " >
and kc =#{kc}
</if>
<if test="isDelete != null " >
and isDelete =#{isDelete}
</if>
</sql>
<!-- **************************************分割线************************************************************ -->
<!-- 以下是sql执行语句
注意1)需要传参数的请注意你使用的方法是 xxByMap还是ByEntuty 存放的参数类型不一致。
2)非自定义的方法已经是basedao注明的。方法名一定要和id相同
3)自定义类的方法注意是否和共有方法重名id
4)执行sql出现顺序和baseDao方法一致便于查询请勿随意添加自定义的sql一律放在自定义sql区域
-->
<!-- ========================================新增==================================================================== -->
<!--
【注意添加序列】
1.方法描述:新增数据
2.参数:实体类
3.返回:主键
-->
<insert id="insert" parameterType="com.kwxy.hyt.po.Teacher" useGeneratedKeys="true" keyProperty="id">
INSERT INTO teacher (
<include refid="Teacher_field" />
) VALUES (
<include refid="Teacher_insert" />
)
</insert>
<!-- ========================================删除==================================================================== -->
<!--
1.方法描述根据主键id删除
2.参数主键id
-->
<delete id="deleteById" parameterType="java.lang.Integer" >
delete from teacher where id=#{id}
</delete>
<!--
1.方法描述:根据实体类删除
2.参数主键id
-->
<delete id="deleteByEntity" parameterType="com.kwxy.hyt.po.Teacher">
delete from teacher
WHERE 1=1
<include refid="Teacher_where" />
</delete>
<!--
1.方法描述根据map删除
2.参数主键id
-->
<delete id="deleteByMap" parameterType="java.util.HashMap">
delete from teacher
WHERE 1=1
<include refid="Teacher_where" />
</delete>
<!-- ========================================修改==================================================================== -->
<!--
1.方法描述:修改数据
2.参数:实体类
-->
<update id="update" parameterType="com.kwxy.hyt.po.Teacher">
UPDATE teacher
<set>
<include refid="Teacher_update" />
</set>
WHERE 1=1
<include refid="Teacher_where" />
</update>
<!--
1.方法描述修改数据通过id
2.参数:实体类
-->
<update id="updateById" parameterType="com.kwxy.hyt.po.Teacher">
UPDATE teacher
<set>
<include refid="Teacher_update" />
</set>
WHERE 1=1
and id=#{id}
</update>
<!-- ========================================查询列表【不分页】==================================================================== -->
<!--
1.方法描述用于listByMap根据map查询
2.参数map
-->
<select id="listByMap" resultMap="ResultMapTeacher" parameterType="map" >
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!--
1.方法描述用于select查询所有
2.参数:无参数
-->
<select id="listAll" resultMap="ResultMapTeacher">
select <include refid="Teacher_field" />
from teacher
</select>
<!--
1.方法描述:查询所有实体,根据实体属性值为判断条件查询所有实体,
2.参数Entity
-->
<select id="listAllByEntity" resultMap="ResultMapTeacher" parameterType="com.kwxy.hyt.po.Teacher">
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!-- ========================================查询单个对象==================================================================== -->
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="load" resultMap="ResultMapTeacher" parameterType="java.lang.Integer">
select <include refid="Teacher_field" />
from teacher
where id=#{id}
</select>
<!--
1.方法描述select查询单个
2.参数id
-->
<select id="getById" resultMap="ResultMapTeacher" parameterType="java.lang.Integer">
select <include refid="Teacher_field" />
from teacher
where id=#{id}
</select>
<!--
1.方法描述用于getByMap根据map查询
2.参数map
-->
<select id="getByMap" resultMap="ResultMapTeacher" parameterType="map">
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!--
1.方法描述用于Entity根据Entity查询
2.参数Entity
-->
<select id="getByEntity" resultMap="ResultMapTeacher" parameterType="com.kwxy.hyt.po.Teacher">
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!-- ========================================查询列表【分页】==================================================================== -->
<!--
1.方法描述:分页
2.参数map
-->
<select id="findByMap" resultMap="ResultMapTeacher" parameterType="map">
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!--
1.方法描述:分页
2.参数Entity
-->
<select id="findByEntity" resultMap="ResultMapTeacher" parameterType="com.kwxy.hyt.po.Teacher">
select <include refid="Teacher_field" />
from teacher where 1=1
<include refid="Teacher_where" />
</select>
<!-- ========================================批量新增修改==================================================================== -->
<!--
1.方法描述:批量插入
2.参数:集合/数组
-->
<insert id="insertBatch" parameterType="java.util.List">
INSERT INTO teacher (
<include refid="Teacher_field" />
) VALUES
<foreach collection="list" item="item" index="index"
separator=",">
(
#{item.code} ,
#{item.username} ,
#{item.password} ,
#{item.kc} ,
#{item.isDelete}
)
</foreach>
</insert>
<!--
1.方法描述:批量修改
2.参数:集合/数组
-->
<update id="updateBatch" parameterType="java.util.List">
<foreach collection="list" item="item" index="index"
separator=";">
UPDATE
teacher
<set>
<if test="item.code != null" >
code = #{item.code},
</if>
<if test="item.username != null" >
username = #{item.username},
</if>
<if test="item.password != null" >
password = #{item.password},
</if>
<if test="item.kc != null" >
kc = #{item.kc},
</if>
<if test="item.isDelete != null" >
isDelete = #{item.isDelete}
</if>
</set>
WHERE
1=1
</foreach>
</update>
<!-- ******************************自定义 sql************************************************************** -->
<!--
通过sql查询单个对象 返回对象
-->
<select id="getBySqlReturnEntity" resultMap="ResultMapTeacher">
${sql}
</select>
<!--
通过sql查询单个对象 返回map
-->
<select id="getBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询集合 返回对象
-->
<select id="listBySqlReturnEntity" resultMap="ResultMapTeacher">
${sql}
</select>
<!--
通过sql查询查询集合 返回map
-->
<select id="listBySqlReturnMap" resultType="map">
${sql}
</select>
<!--
通过sql查询分页集合 返回对象
-->
<select id="findBySqlRerturnEntity" resultMap="ResultMapTeacher">
${sql}
</select>
<!-- 通过sql修改 -->
<update id="updateBysql">
${sql}
</update>
<delete id="deleteBySql">
${sql}
</delete>
</mapper>

@ -0,0 +1,100 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
public class Bj implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields Name : name
*
* */
private String name;
/**
* @Fields Zy :
*
* */
private String zy;
private Integer isCheck;
/**
* @Fields IsDelete : 0 1
*
* */
private Integer isDelete;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public String getZy() {
return this.zy;
}
public void setZy(String zy) {
this.zy = zy;
}
public Integer getIsDelete() {
return this.isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Bj() {
}
public Bj(Integer id ,String name ,String zy ,Integer isDelete ){
super();
this.id=id;
this.name=name;
this.zy=zy;
this.isDelete=isDelete;
}
@Override
public String toString() {
return "Bj [id="+ id + ",name="+ name + ",zy="+ zy + ",isDelete="+ isDelete + "]";
}
public Integer getIsCheck() {
return isCheck;
}
public void setIsCheck(Integer isCheck) {
this.isCheck = isCheck;
}
}

@ -0,0 +1,136 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
public class Fdy implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields Username : username
*
* */
private String username;
/**
* @Fields Password : password
*
* */
private String password;
/**
* @Fields Code : code
*
* */
private String code;
/**
* @Fields Sex : sex
*
* */
private String sex;
/**
* @Fields BjId : id
*
* */
private Integer bjId;
private Bj bj;
private Integer isDelete;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getSex() {
return this.sex;
}
public void setSex(String sex) {
this.sex = sex;
}
public Integer getBjId() {
return this.bjId;
}
public void setBjId(Integer bjId) {
this.bjId = bjId;
}
public Fdy() {
}
public Fdy(Integer id ,String username ,String password ,String code ,String sex ,Integer bjId ){
super();
this.id=id;
this.username=username;
this.password=password;
this.code=code;
this.sex=sex;
this.bjId=bjId;
}
@Override
public String toString() {
return "Fdy [id="+ id + ",username="+ username + ",password="+ password + ",code="+ code + ",sex="+ sex + ",bjId="+ bjId + "]";
}
public Integer getIsDelete() {
return isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Bj getBj() {
return bj;
}
public void setBj(Bj bj) {
this.bj = bj;
}
}

@ -0,0 +1,74 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Manage implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields Username : username
*
* */
private String username;
/**
* @Fields Password : password
*
* */
private String password;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public Manage() {
}
public Manage(Integer id ,String username ,String password ){
super();
this.id=id;
this.username=username;
this.password=password;
}
@Override
public String toString() {
return "Manage [id="+ id + ",username="+ username + ",password="+ password + "]";
}
}

@ -0,0 +1,182 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Qj implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields BjId : bjId
*
* */
private Integer bjId;
/**
* @Fields StudentId : studentId
*
* */
private Integer studentId;
private Student student;
private Bj bj;
/**
* @Fields FdyId : fdyId
*
* */
private Integer fdyId;
private Fdy fdy;
/**
* @Fields StartTime : startTime
*
* */
private String startTime;
/**
* @Fields EndTime : endTime
*
* */
private String endTime;
/**
* @Fields Status : 0 1 2
*
* */
private Integer status;
private String reason;
private String content;
public String getReason() {
return reason;
}
public void setReason(String reason) {
this.reason = reason;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBjId() {
return this.bjId;
}
public void setBjId(Integer bjId) {
this.bjId = bjId;
}
public Integer getStudentId() {
return this.studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public Integer getFdyId() {
return this.fdyId;
}
public void setFdyId(Integer fdyId) {
this.fdyId = fdyId;
}
public String getStartTime() {
return this.startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return this.endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Qj() {
}
public Qj(Integer id ,Integer bjId ,Integer studentId ,Integer fdyId ,String startTime ,String endTime ,Integer status ){
super();
this.id=id;
this.bjId=bjId;
this.studentId=studentId;
this.fdyId=fdyId;
this.startTime=startTime;
this.endTime=endTime;
this.status=status;
}
@Override
public String toString() {
return "Qj [id="+ id + ",bjId="+ bjId + ",studentId="+ studentId + ",fdyId="+ fdyId + ",startTime="+ startTime + ",endTime="+ endTime + ",status="+ status + "]";
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
public Bj getBj() {
return bj;
}
public void setBj(Bj bj) {
this.bj = bj;
}
public Fdy getFdy() {
return fdy;
}
public void setFdy(Fdy fdy) {
this.fdy = fdy;
}
}

@ -0,0 +1,136 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Record implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields SignId : signId
*
* */
private Integer signId;
private Sign sign;
private Student student;
/**
* @Fields StudentId : studentId
*
* */
private Integer studentId;
/**
* @Fields Ip : ip
*
* */
private String ip;
/**
* @Fields CreateTime : createTime
*
* */
private java.util.Date createTime;
/**
* @Fields Status : 0 1 2
*
* */
private Integer status;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getSignId() {
return this.signId;
}
public void setSignId(Integer signId) {
this.signId = signId;
}
public Integer getStudentId() {
return this.studentId;
}
public void setStudentId(Integer studentId) {
this.studentId = studentId;
}
public String getIp() {
return this.ip;
}
public void setIp(String ip) {
this.ip = ip;
}
public java.util.Date getCreateTime() {
return this.createTime;
}
public void setCreateTime(java.util.Date createTime) {
this.createTime = createTime;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Record() {
}
public Record(Integer id ,Integer signId ,Integer studentId ,String ip ,java.util.Date createTime ,Integer status ){
super();
this.id=id;
this.signId=signId;
this.studentId=studentId;
this.ip=ip;
this.createTime=createTime;
this.status=status;
}
@Override
public String toString() {
return "Record [id="+ id + ",signId="+ signId + ",studentId="+ studentId + ",ip="+ ip + ",createTime="+ createTime + ",status="+ status + "]";
}
public Sign getSign() {
return sign;
}
public void setSign(Sign sign) {
this.sign = sign;
}
public Student getStudent() {
return student;
}
public void setStudent(Student student) {
this.student = student;
}
}

@ -0,0 +1,147 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Sign implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields BjId : bjId
*
* */
private Integer bjId;
/**
* @Fields TeacherId : teacherId
*
* */
private Integer teacherId;
/**
* @Fields Name : 0 1 2
*
* */
private String name;
/**
* @Fields Status : status
*
* */
private Integer status;
/**
* @Fields FdyId : fdyId
*
* */
private Integer fdyId;
private Teacher teacher;
private Fdy fdy;
private Bj bj;
public Bj getBj() {
return bj;
}
public void setBj(Bj bj) {
this.bj = bj;
}
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBjId() {
return this.bjId;
}
public void setBjId(Integer bjId) {
this.bjId = bjId;
}
public Integer getTeacherId() {
return this.teacherId;
}
public void setTeacherId(Integer teacherId) {
this.teacherId = teacherId;
}
public String getName() {
return this.name;
}
public void setName(String name) {
this.name = name;
}
public Integer getStatus() {
return this.status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getFdyId() {
return this.fdyId;
}
public void setFdyId(Integer fdyId) {
this.fdyId = fdyId;
}
public Sign() {
}
public Sign(Integer id ,Integer bjId ,Integer teacherId ,String name ,Integer status ,Integer fdyId ){
super();
this.id=id;
this.bjId=bjId;
this.teacherId=teacherId;
this.name=name;
this.status=status;
this.fdyId=fdyId;
}
@Override
public String toString() {
return "Sign [id="+ id + ",bjId="+ bjId + ",teacherId="+ teacherId + ",name="+ name + ",status="+ status + ",fdyId="+ fdyId + "]";
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
public Fdy getFdy() {
return fdy;
}
public void setFdy(Fdy fdy) {
this.fdy = fdy;
}
}

@ -0,0 +1,127 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Student implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields Code : code
*
* */
private String code;
/**
* @Fields Username : username
*
* */
private String username;
/**
* @Fields Password : password
*
* */
private String password;
/**
* @Fields BjId : bjId
*
* */
private Integer bjId;
private Bj bj;
/**
* @Fields IsDelete : isDelete
*
* */
private Integer isDelete;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public Integer getBjId() {
return this.bjId;
}
public void setBjId(Integer bjId) {
this.bjId = bjId;
}
public Integer getIsDelete() {
return this.isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Student() {
}
public Student(Integer id ,String code ,String username ,String password ,Integer bjId ,Integer isDelete ){
super();
this.id=id;
this.code=code;
this.username=username;
this.password=password;
this.bjId=bjId;
this.isDelete=isDelete;
}
@Override
public String toString() {
return "Student [id="+ id + ",code="+ code + ",username="+ username + ",password="+ password + ",bjId="+ bjId + ",isDelete="+ isDelete + "]";
}
public Bj getBj() {
return bj;
}
public void setBj(Bj bj) {
this.bj = bj;
}
}

@ -0,0 +1,116 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class Teacher implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields Code : code
*
* */
private String code;
/**
* @Fields Username : username
*
* */
private String username;
/**
* @Fields Password : password
*
* */
private String password;
/**
* @Fields Kc :
*
* */
private String kc;
/**
* @Fields IsDelete : isDelete
*
* */
private Integer isDelete;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public String getCode() {
return this.code;
}
public void setCode(String code) {
this.code = code;
}
public String getUsername() {
return this.username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return this.password;
}
public void setPassword(String password) {
this.password = password;
}
public String getKc() {
return this.kc;
}
public void setKc(String kc) {
this.kc = kc;
}
public Integer getIsDelete() {
return this.isDelete;
}
public void setIsDelete(Integer isDelete) {
this.isDelete = isDelete;
}
public Teacher() {
}
public Teacher(Integer id ,String code ,String username ,String password ,String kc ,Integer isDelete ){
super();
this.id=id;
this.code=code;
this.username=username;
this.password=password;
this.kc=kc;
this.isDelete=isDelete;
}
@Override
public String toString() {
return "Teacher [id="+ id + ",code="+ code + ",username="+ username + ",password="+ password + ",kc="+ kc + ",isDelete="+ isDelete + "]";
}
}

@ -0,0 +1,94 @@
package com.kwxy.hyt.po;
import java.util.*;
import java.io.Serializable;
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
public class TeacherBj implements Serializable {
private static final long serialVersionUID = 3148176768559230877L;
/**
* @Fields Id : id
*
* */
private Integer id;
/**
* @Fields TeacherId : teacherId
*
* */
private Integer teacherId;
/**
* @Fields BjId : bjId
*
* */
private Integer bjId;
private Bj bj;
private Teacher teacher;
public Integer getId() {
return this.id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getTeacherId() {
return this.teacherId;
}
public void setTeacherId(Integer teacherId) {
this.teacherId = teacherId;
}
public Integer getBjId() {
return this.bjId;
}
public void setBjId(Integer bjId) {
this.bjId = bjId;
}
public TeacherBj() {
}
public TeacherBj(Integer id ,Integer teacherId ,Integer bjId ){
super();
this.id=id;
this.teacherId=teacherId;
this.bjId=bjId;
}
@Override
public String toString() {
return "TeacherBj [id="+ id + ",teacherId="+ teacherId + ",bjId="+ bjId + "]";
}
public Bj getBj() {
return bj;
}
public void setBj(Bj bj) {
this.bj = bj;
}
public Teacher getTeacher() {
return teacher;
}
public void setTeacher(Teacher teacher) {
this.teacher = teacher;
}
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
public interface BjService extends BaseService<Bj>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
public interface FdyService extends BaseService<Fdy>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface ManageService extends BaseService<Manage>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface QjService extends BaseService<Qj>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface RecordService extends BaseService<Record>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface SignService extends BaseService<Sign>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface StudentService extends BaseService<Student>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface TeacherBjService extends BaseService<TeacherBj>{
}

@ -0,0 +1,19 @@
package com.kwxy.hyt.service;
import com.kwxy.hyt.base.BaseService;
import com.kwxy.hyt.po.*;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
public interface TeacherService extends BaseService<Teacher>{
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.BjService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
@Service
public class BjServiceImpl extends BaseServiceImpl<Bj> implements BjService{
@Autowired
private BjMapper bjMapper;
@Override
public BaseDao<Bj> getBaseDao() {
return bjMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094823
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.FdyService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094823
*/
@Service
public class FdyServiceImpl extends BaseServiceImpl<Fdy> implements FdyService{
@Autowired
private FdyMapper fdyMapper;
@Override
public BaseDao<Fdy> getBaseDao() {
return fdyMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.ManageService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class ManageServiceImpl extends BaseServiceImpl<Manage> implements ManageService{
@Autowired
private ManageMapper manageMapper;
@Override
public BaseDao<Manage> getBaseDao() {
return manageMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.QjService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class QjServiceImpl extends BaseServiceImpl<Qj> implements QjService{
@Autowired
private QjMapper qjMapper;
@Override
public BaseDao<Qj> getBaseDao() {
return qjMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.RecordService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class RecordServiceImpl extends BaseServiceImpl<Record> implements RecordService{
@Autowired
private RecordMapper recordMapper;
@Override
public BaseDao<Record> getBaseDao() {
return recordMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.SignService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class SignServiceImpl extends BaseServiceImpl<Sign> implements SignService{
@Autowired
private SignMapper signMapper;
@Override
public BaseDao<Sign> getBaseDao() {
return signMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.StudentService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class StudentServiceImpl extends BaseServiceImpl<Student> implements StudentService{
@Autowired
private StudentMapper studentMapper;
@Override
public BaseDao<Student> getBaseDao() {
return studentMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.TeacherBjService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class TeacherBjServiceImpl extends BaseServiceImpl<TeacherBj> implements TeacherBjService{
@Autowired
private TeacherBjMapper teacherBjMapper;
@Override
public BaseDao<TeacherBj> getBaseDao() {
return teacherBjMapper;
}
}

@ -0,0 +1,39 @@
/**
* @ClassName:
* @Description:
* @author administrator
* @date - 20181027 094824
*/
package com.kwxy.hyt.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import com.kwxy.hyt.base.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.service.TeacherService;
import java.util.*;
import com.kwxy.hyt.po.*;
import com.kwxy.hyt.mapper.*;
import com.kwxy.hyt.service.*;
/**
* @ClassName:
* @Description:
* @author - - admin
* @date - 20181027 094824
*/
@Service
public class TeacherServiceImpl extends BaseServiceImpl<Teacher> implements TeacherService{
@Autowired
private TeacherMapper teacherMapper;
@Override
public BaseDao<Teacher> getBaseDao() {
return teacherMapper;
}
}

@ -0,0 +1,579 @@
package com.kwxy.hyt.utils;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
/**
*
*/
public class DateUtil extends java.util.Date {
private static final long serialVersionUID = 1L;
private static final DateFormat datetimeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private static final DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
private static final String strFormat1 = "yyyy-MM-dd HH:mm";
/**
M Month July; Jul; 07
w Number 27
W Number 2
D Number 189
d Number 10
F Number 2
E Text Tuesday; Tue
a Am/pm Text PM
H 0-23 Number 0
k 1-24 Number 24
K am/pm 0-11 Number 0
h am/pm 1-12 Number 12
m Number 30
s Number 55
S Number 978
z General time zone Pacific Standard Time; PST; GMT-08:00
Z RFC 822 time zone -0800
*/
/**
*
*/
public DateUtil() {
super(getSystemDate().getTime().getTime());
}
/**
*
*
* @return Timestamp
*/
public java.sql.Timestamp parseTime() {
return new java.sql.Timestamp(this.getTime());
}
/**
* Date yyyy-MM-dd HH:mm:ss
*
* @param Date
* @return String
*/
public static String format(Date date) {
return format(date, null);
}
/**
* Date
*
* @param Date
* @param pattern
* @return String
*/
public static String format(Date date, String pattern) {
if (date == null) {
return "";
} else if (pattern == null || pattern.equals("") || pattern.equals("null")) {
return datetimeFormat.format(date);
} else {
return new SimpleDateFormat(pattern).format(date);
}
}
/**
* Date yyyy-MM-dd
*
* @param Date
* @return String
*/
public static String formatDate(Date date) {
if (date == null) {
return "";
}
return dateFormat.format(date);
}
/**
* Date
*
* @param sDate yyyy-MM-dd HH:mm:ss
* @return
*/
public static Date convert(String sDate) {
try {
if (sDate != null) {
if (sDate.length() == 10) {
return dateFormat.parse(sDate);
} else if (sDate.length() == 19) {
return datetimeFormat.parse(sDate);
}
}
} catch (ParseException pe) {
}
return convert(sDate, null);
}
/**
* Date
*
* @param sDate
* @param pattern
* @return
*/
public static Date convert(String sDate, String pattern) {
Date date = null;
try {
if (sDate == null || sDate.equals("") || sDate.equals("null")) {
return null;
} else if (pattern == null || pattern.equals("") || pattern.equals("null")) {
return datetimeFormat.parse(sDate);
} else {
return new SimpleDateFormat(pattern).parse(sDate);
}
} catch (ParseException pe) {
}
return date;
}
/**
* StringDate
*
* @param sDate "yyyy-MM-dd"
* @return Date
*/
public static Date convertDate(String dateStr) {
return convert(dateStr, "yyyy-MM-dd");
}
/**
* StringTimestamp
*
* @param sDate "yyyy-MM-dd" / "yyyy-MM-dd HH:mm:ss"
* @return Timestamp
*/
public static Timestamp convertTimestamp(String sDate) {
if (sDate.length() == 10) {
sDate = sDate + " 00:00:00";
}
if (sDate.length() == 16) {
sDate = sDate + ":00";
}
return Timestamp.valueOf(sDate);
}
/**
* DateTimestamp
*/
public static Timestamp convert(Date date) {
return new Timestamp(date.getTime());
}
/**
* (yyyy-mm-dd)
*
* @return Timestamp
*/
public static String getTodayDate() {
return formatDate(new Date());
}
/**
* (yyyy-mm-dd hh:mm:ss)
*
* @return Timestamp
*/
public static String getTodayDateTime() {
return format(new Date());
}
/**
* n
*
* @param date
* @param afterMins
* @return Timestamp
*/
public static Date getAfterMinute(Date date, long afterMins) {
if (date == null)
date = new Date();
long longTime = date.getTime() + afterMins * 60 * 1000;
return new Date(longTime);
}
/**
* add by yinshengming start 2016-4-7
* n
*
* @param date
* @param afterMins
* @return Timestamp
*/
public static Date getAfterSecond(Date date, long afterMins) {
if (date == null)
date = new Date();
long longTime = date.getTime() + afterMins * 1000;
return new Date(longTime);
}
// public static void main(String[] arg) {
// System.err.println(format((new Date())));
// System.err.println(format(getAfterMinute(new Date(), 3)));
// }
/**
*
*
* @param date
* @param afterDays
* @return
*/
public static Date getAfterDay(Date date, int afterDays) {
if (date == null)
date = new Date();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
cal.add(java.util.Calendar.DATE, afterDays);
return cal.getTime();
}
/**
*
*
* @param sDate yyyy-MM-dd
* @param afterDays
* @return
*/
public static String getAfterDay(String sDate, int afterDays) {
Date date = convertDate(sDate);
date = getAfterDay(date, afterDays);
return formatDate(date);
}
/**
*
*
* @param date
* @param beforeDays (0)
* @return
*/
public static Date getBeforeDay(Date date, int beforeDays) {
if (date == null)
date = new Date();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
cal.add(java.util.Calendar.DATE, 0 - Math.abs(beforeDays));
return cal.getTime();
}
/**
*
*
* @param sDate yyyy-MM-dd
* @param beforeDays (0)
* @return
*/
public static String getBeforeDay(String sDate, int beforeDays) {
Date date = convertDate(sDate);
date = getBeforeDay(date, beforeDays);
return formatDate(date);
}
/**
*
*
* @param date
* @param afterMonth
* @return Date
*/
public static Date getAfterMonth(Date date, int afterMonth) {
if (date == null)
date = new Date();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
cal.add(java.util.Calendar.MONTH, afterMonth);
return cal.getTime();
}
/**
*
*
* @param sDate
* @param afterMonth
* @return "yyyy-MM-dd"
*/
public static String getAfterMonth(String sDate, int afterMonth) {
Date date = convertDate(sDate);
date = getAfterMonth(date, afterMonth);
return formatDate(date);
}
/**
*
*
* @param date
* @param afterYear
* @return Date
*/
public static Date getAfterYear(Date date, int afterYear) {
if (date == null)
date = new Date();
GregorianCalendar cal = new GregorianCalendar();
cal.setTime(date);
cal.add(java.util.Calendar.YEAR, afterYear);
return cal.getTime();
}
/**
*
*
* @param date
* @param afterYear
* @return Date
*/
public static String getAfterYear(String sDate, int afterYear) {
Date date = convertDate(sDate);
date = getAfterYear(date, afterYear);
return formatDate(date);
}
/**
*
*
* @param sDate(yyyy-mm-dd) : Null
* @return yyyy-mm-dd
*/
public static String getMonthFirstDay(String sDate) {
Date date = null;
if (sDate != null && sDate.length() > 0) {
date = convertDate(sDate);
}
Calendar gc = Calendar.getInstance();
if (date != null) {
gc.setTime(date);
}
gc.set(Calendar.DATE, 1);
return formatDate(gc.getTime());
}
/**
*
*
* @param sDate(yyyy-mm-dd) : Null
* @return yyyy-mm-dd
*/
public static String getMonthLastDay(String sDate) {
Date date = null;
if (sDate != null && sDate.length() > 0) {
date = convertDate(sDate);
}
Calendar gc = Calendar.getInstance();
if (date != null) {
gc.setTime(date);
}
gc.add(Calendar.MONTH, 1);
gc.add(Calendar.DATE, -gc.get(Calendar.DAY_OF_MONTH));
return formatDate(gc.getTime());
}
/**
*
*
* @param dateTime : dateTime
* @return "星期日","星期一","星期二","星期三","星期四","星期五","星期六"
*/
public static String getWeekDayName(String dateTime) throws ParseException {
String dayNames[] = { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
Date d = convertDate(dateTime);
Calendar cal = Calendar.getInstance();
cal.setTime(d);
int day = cal.get(Calendar.DAY_OF_WEEK);
String week_day_name = dayNames[day - 1];
return week_day_name;
}
/**
* yyyy-MM-dd
*
* @param in
* @return :true,:false
*/
public static boolean isFormatDate(String in) {
return isFormatDate(in, "yyyy-MM-dd");
}
/**
*
*
* @param in
* @param format
* @return :true,:false
*/
private static boolean isFormatDate(String in, String format) {
if (format != null & format.length() > 0) {
return false;
}
final SimpleDateFormat sdFormat = new SimpleDateFormat(format);
Date dateCompare = null;
String sDate = "";
try {
dateCompare = sdFormat.parse(in, new ParsePosition(0));
sDate = sdFormat.format(dateCompare);
} catch (final Exception e) {
return false;
}
if (dateCompare == null) {
return false;
} else {
return sDate.equals(in);
}
}
/**
*
*
* @param date1 : yyyy-MM-dd
* @param date1 : yyyy-MM-dd
* @return date1 > date2 : true else : false
*/
public static boolean compareDate(String date1, String date2) {
if (isFormatDate(date1, "yyyy-MM-dd") && isFormatDate(date2, "yyyy-MM-dd")) {
if (date1.compareTo(date2) > 0) {
return false;
} else {
return true;
}
} else {
return false;
}
}
/**
*
*
* @return Calendar
*/
public static Calendar getSystemDate() {
return Calendar.getInstance();
}
/**
*
*
* @param sDate "yyyy-MM-dd HH:mm"
* @return Date
* @throws Exception
*/
public static java.util.Date convertDate1(String sDate) throws Exception {
SimpleDateFormat sFormat1 = new SimpleDateFormat(strFormat1);
return sFormat1.parse(sDate);
}
/**
* n
*
* @param date
* @param lminute
* @return Timestamp
*/
public static Timestamp gettimebefore(java.util.Date date, long lminute) {
long lngTime = date.getTime() - lminute * 60 * 1000;
return new Timestamp(lngTime);
}
/**
*
*
* @param dateTime
* : dateTime
* @return "周日","周一","周二","周三","周四","周五","周六"
*/
public static String getWeekDays(Date dateTime){
String dayNames[] = { "周日", "周一", "周二", "周三", "周四", "周五", "周六" };
int day = getWeekDay(dateTime);
String week_day_name = dayNames[day - 1];
return week_day_name;
}
/**
*
*
* @param dateTime
* : dateTime
* @return "周日","周一","周二","周三","周四","周五","周六"
*/
public static String getWeekOfDate(Date dateTime){
String dayNames[] = {"星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"};
int day = getWeekDay(dateTime);
String week_day_name = dayNames[day - 1];
return week_day_name;
}
/**
*
*
* @param dateTime
* : dateTime
* @return :1 "星期日"2"星期一" 3"星期二",4"星期三", 5"星期四", 6"星期五", 7"星期六"
*/
public static int getWeekDay(Date dateTime) {
Calendar cal = Calendar.getInstance();
cal.setTime(dateTime);
return cal.get(Calendar.DAY_OF_WEEK);
}
/**
* 2
*
* @param StartDay
* @param endDay
* @param IncludeEndFlag ,Y:,N:
* @return
* @throws Exception
*/
public static long DayCountBetweenDays(String StartDay, String endDay,
String IncludeEndFlag) throws Exception {
long DAY = 24L * 60L * 60L * 1000L;
long countBetweenDay = 0;
SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd");
Date d1 = df.parse(StartDay);
Date d2 = df.parse(endDay);
countBetweenDay = (d2.getTime() - d1.getTime()) / DAY;
if (IncludeEndFlag == "Y") {
countBetweenDay++;
}
return countBetweenDay;
}
}

@ -0,0 +1,27 @@
package com.kwxy.hyt.utils;
public class HttpConstants {
public static final String SYSTEM_ERROR_MSG = "系统错误";
public static final String REQUEST_PARAMS_NULL = "请求参数为空";
public static final String SERVICE_RESPONSE_NULL = "服务端返回结果为空";
// 服务端返回成功的标志
public static final String SERVICE_RESPONSE_SUCCESS_CODE = "AMS00000";
// 服务端返回结果的标志
public static final String SERVICE_RESPONSE_RESULT_FLAG = "returnCode";
// 服务端返回结果失败的标志
public static final String SERVICE_RESPONSE_RESULT_MSG = "errorMsg";
// 返回给前段页面成功或失败的标志
public static final String RESPONSE_RESULT_FLAG_ISERROR = "isError";
// 执行删除操作
public static final String OPERATION_TYPE_DELETE = "D";
}

@ -0,0 +1,109 @@
package com.kwxy.hyt.utils;
import java.io.IOException;
import java.util.List;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializeConfig;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.alibaba.fastjson.serializer.SimpleDateFormatSerializer;
@SuppressWarnings("unused")
public class JsonUtil {
private static final String[] DATE_FORMAT = { "yyyy-MM-dd HH:mm:ss" };
private static SerializeConfig config = new SerializeConfig();
static {
String dateFormat = "yyyy-MM-dd HH:mm:ss";
config.put(java.util.Date.class, new SimpleDateFormatSerializer(dateFormat));
}
public static String toJson(Object obj) {
String json = null;
try {
if (obj != null) {
json = JSON.toJSONString(obj, SerializerFeature.WriteDateUseDateFormat);
}
} catch (Exception e) {
e.printStackTrace();
}
return json;
}
public static <T> T toBean(String json, Class<T> clazz) {
T bean = null;
try {
if (json != null) {
bean = JSON.parseObject(json, clazz);
}
} catch (Exception e) {
e.printStackTrace();
}
return bean;
}
public static <T> List<T> toBeanList(String json, Class<T> clazz) {
List<T> beanList = null;
try {
if (json != null) {
beanList = JSON.parseArray(json, clazz);
}
} catch (Exception e) {
e.printStackTrace();
}
return beanList;
}
@SuppressWarnings({ "rawtypes", "unchecked" })
public static void main(String[] args) throws IOException {
// {
//
// Map map = new HashMap();
// map.put("total", 0);
// map.put("rows", new Object[0]);
// map.put("sessionStatus", 0);
// map.put("null", null);
// map.put("date", new Date());
// map.put("time", new Timestamp(System.currentTimeMillis()));
//
// String json = toJson(map);
// System.out.println(json);
//
// Map toMap = toBean(json, Map.class);
// System.out.println(toMap);
// }
// {
// List<HeatInfoVO> heatInfoList = new ArrayList<HeatInfoVO>();
//
// HeatInfoVO heatInfoVO = new HeatInfoVO();
// heatInfoVO.setErrMsg("err");
// heatInfoList.add(heatInfoVO);
//
// List<HeatInfoDetailVO> heatInfoDetailList = new ArrayList<HeatInfoDetailVO>();
//
// for (int i = 0; i < 3; i++) {
// HeatInfoDetailVO heatInfoDetailVO = new HeatInfoDetailVO();
// heatInfoDetailVO.setAreaType("type" + i);
// heatInfoDetailList.add(heatInfoDetailVO);
// }
//
// heatInfoVO.setHeatInfoDetailList(heatInfoDetailList);
//
// String json = JsonUtil.toJson(heatInfoList);
// System.out.println(json);
//
// List<HeatInfoVO> heatInfoList2 = JsonUtil.toBeanList(json, HeatInfoVO.class);
// System.out.println(heatInfoList2.get(0).getErrMsg());
// System.out.println(heatInfoList2.get(0).getHeatInfoDetailList().get(0).getAreaType());
// System.out.println(JsonUtil.toJson(heatInfoList2));
//
// }
}
}

@ -0,0 +1,73 @@
package com.kwxy.hyt.utils;
import java.util.List;
import com.github.pagehelper.Page;
/**
*
* @author Administrator
*
* @param <T>
*/
public class Pager<T> {
/**
*
*/
private int size;
/**
*
*/
private int offset;
/**
*
*/
private long total;
/**
*
*/
private List<T> datas;
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public int getOffset() {
return offset;
}
public void setOffset(int offset) {
this.offset = offset;
}
public long getTotal() {
return total;
}
public void setTotal(long total) {
this.total = total;
}
public List<T> getDatas() {
return datas;
}
public void setDatas(List<T> datas) {
this.datas = datas;
}
/**
*
* @param datas
*/
public Pager(List<T> datas) {
if(datas instanceof Page){
Page<T> page = (Page<T>)datas;
setOffset(page.getPageNum());
setSize(page.getPageSize());
setTotal(page.getTotal());
setDatas(datas);
}
}
public Pager() {
}
}

@ -0,0 +1,80 @@
package com.kwxy.hyt.utils;
/**
* ThreadLocal
* @author Administrator
*
*/
public class SystemContext {
/**
*
*/
private static ThreadLocal<Integer> pageSize = new ThreadLocal<Integer>();
/**
*
*/
private static ThreadLocal<Integer> pageOffset = new ThreadLocal<Integer>();
/**
*
*/
private static ThreadLocal<String> sort = new ThreadLocal<String>();
/**
*
*/
private static ThreadLocal<String> order = new ThreadLocal<String>();
private static ThreadLocal<String> realPath = new ThreadLocal<String>();
public static String getRealPath() {
return realPath.get();
}
public static void setRealPath(String _realPath) {
SystemContext.realPath.set(_realPath);
}
public static Integer getPageSize() {
return pageSize.get();
}
public static void setPageSize(Integer _pageSize) {
pageSize.set(_pageSize);
}
public static Integer getPageOffset() {
return pageOffset.get();
}
public static void setPageOffset(Integer _pageOffset) {
pageOffset.set(_pageOffset);
}
public static String getSort() {
return sort.get();
}
public static void setSort(String _sort) {
SystemContext.sort.set(_sort);
}
public static String getOrder() {
return order.get();
}
public static void setOrder(String _order) {
SystemContext.order.set(_order);
}
public static void removePageSize() {
pageSize.remove();
}
public static void removePageOffset() {
pageOffset.remove();
}
public static void removeSort() {
sort.remove();
}
public static void removeOrder() {
order.remove();
}
public static void removeRealPath() {
realPath.remove();
}
}

@ -0,0 +1,99 @@
package com.kwxy.hyt.utils;
import java.math.BigInteger;
import java.security.SecureRandom;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.locks.ReentrantLock;
/**
* Helper for creating random and Type 1 (time-based) UUIDs.
*
* @author xuan.chen
*/
public class UUIDUtils {
private static boolean IS_THREADLOCALRANDOM_AVAILABLE = false;
private static Random random;
private static final long leastSigBits;
private static final ReentrantLock lock = new ReentrantLock();
private static long lastTime;
static {
try {
IS_THREADLOCALRANDOM_AVAILABLE = null != UUIDUtils.class.getClassLoader().loadClass(
"java.util.concurrent.ThreadLocalRandom");
} catch (ClassNotFoundException e) {
}
byte[] seed = new SecureRandom().generateSeed(8);
leastSigBits = new BigInteger(seed).longValue();
if (!IS_THREADLOCALRANDOM_AVAILABLE) {
random = new Random(leastSigBits);
}
}
private UUIDUtils() {
}
/**
* Create a new random UUID.
*
* @return the new UUID
*/
public static String random() {
byte[] randomBytes = new byte[16];
if (IS_THREADLOCALRANDOM_AVAILABLE) {
java.util.concurrent.ThreadLocalRandom.current().nextBytes(randomBytes);
} else {
random.nextBytes(randomBytes);
}
long mostSigBits = 0;
for (int i = 0; i < 8; i++) {
mostSigBits = (mostSigBits << 8) | (randomBytes[i] & 0xff);
}
long leastSigBits = 0;
for (int i = 8; i < 16; i++) {
leastSigBits = (leastSigBits << 8) | (randomBytes[i] & 0xff);
}
return new UUID(mostSigBits, leastSigBits).toString().replaceAll("-", "");
}
/**
* Create a new time-based UUID.
*
* @return the new UUID
*/
public static String create() {
long timeMillis = (System.currentTimeMillis() * 10000) + 0x01B21DD213814000L;
lock.lock();
try {
if (timeMillis > lastTime) {
lastTime = timeMillis;
} else {
timeMillis = ++lastTime;
}
} finally {
lock.unlock();
}
// time low
long mostSigBits = timeMillis << 32;
// time mid
mostSigBits |= (timeMillis & 0xFFFF00000000L) >> 16;
// time hi and version
mostSigBits |= 0x1000 | ((timeMillis >> 48) & 0x0FFF); // version 1
return new UUID(mostSigBits, leastSigBits).toString().replaceAll("-", "");
}
}

@ -0,0 +1,6 @@
jdbc.driver=com.mysql.jdbc.Driver
jdbc.url=jdbc:mysql://127.0.0.1:3306/ssm_xsktsign?useUnicode=true&amp;characterEncoding=utf-8&amp;allowPublicKeyRetrieval=true
jdbc.username=root
jdbc.password=123456

@ -0,0 +1,10 @@
log4j.rootLogger=DEBUG, Console
#Console
log4j.appender.Console=org.apache.log4j.ConsoleAppender
log4j.appender.Console.layout=org.apache.log4j.PatternLayout
log4j.appender.Console.layout.ConversionPattern=%d [%t] %-5p [%c] - %m%n
log4j.logger.java.sql.ResultSet=INFO
log4j.logger.org.apache=INFO
log4j.logger.java.sql.Connection=DEBUG
log4j.logger.java.sql.Statement=DEBUG
log4j.logger.java.sql.PreparedStatement=DEBUG

@ -0,0 +1,45 @@
<?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>
<!-- 配置别名 -->
<settings>
<setting name="logImpl" value="LOG4J"/>
</settings>
<typeAliases>
<!-- 批量扫描别名 -->
<package name="com.kwxy.hyt.po"/>
</typeAliases>
<plugins>
<!-- com.github.pagehelper为PageHelper类所在包名 -->
<plugin interceptor="com.github.pagehelper.PageHelper">
<!-- 4.0.0以后版本可以不设置该参数 -->
<property name="dialect" value="mysql"/>
<!-- 该参数默认为false -->
<!-- 设置为true时会将RowBounds第一个参数offset当成pageNum页码使用 -->
<!-- 和startPage中的pageNum效果一样-->
<property name="offsetAsPageNum" value="true"/>
<!-- 该参数默认为false -->
<!-- 设置为true时使用RowBounds分页会进行count查询 -->
<property name="rowBoundsWithCount" value="true"/>
<!-- 设置为true时如果pageSize=0或者RowBounds.limit = 0就会查询出全部的结果 -->
<!-- 相当于没有执行分页查询但是返回结果仍然是Page类型-->
<property name="pageSizeZero" value="true"/>
<!-- 3.3.0版本可用 - 分页参数合理化默认false禁用 -->
<!-- 启用合理化时如果pageNum<1会查询第一页如果pageNum>pages会查询最后一页 -->
<!-- 禁用合理化时如果pageNum<1或pageNum>pages会返回空数据 -->
<property name="reasonable" value="true"/>
<!-- 3.5.0版本可用 - 为了支持startPage(Object params)方法 -->
<!-- 增加了一个`params`参数来配置参数映射用于从Map或ServletRequest中取值 -->
<!-- 可以配置pageNum,pageSize,count,pageSizeZero,reasonable,orderBy,不配置映射的用默认值 -->
<!-- 不理解该含义的前提下,不要随便复制该配置 -->
<property name="params" value="pageNum=start;pageSize=limit;"/>
<!-- 支持通过Mapper接口参数来传递分页参数 -->
<property name="supportMethodsArguments" value="true"/>
<!-- always总是返回PageInfo类型,check检查返回类型是否为PageInfo,none返回Page -->
<property name="returnPageInfo" value="check"/>
</plugin>
</plugins>
</configuration>

@ -0,0 +1,46 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!-- 加载db.properties文件中的内容db.properties文件中key命名要有一定的特殊规则 -->
<context:property-placeholder location="classpath:db.properties" />
<!-- 配置数据源 dbcp -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
destroy-method="close">
<property name="driverClassName" value="${jdbc.driver}" />
<property name="url" value="${jdbc.url}" />
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
<property name="maxActive" value="30" />
<property name="maxIdle" value="5" />
</bean>
<!-- sqlSessionFactory -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 数据库连接池 -->
<property name="dataSource" ref="dataSource" />
<!-- 加载mybatis的全局配置文件 -->
<property name="configLocation" value="classpath:mybatis/sqlMapConfig.xml" />
</bean>
<!-- mapper扫描器 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!-- 扫描包路径,如果需要扫描多个包,中间使用半角逗号隔开 -->
<property name="basePackage" value="com.kwxy.hyt.mapper"></property>
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
</bean>
</beans>

@ -0,0 +1,18 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd " default-autowire="byName">
<!-- 商品管理的service -->
<context:component-scan base-package="com.kwxy.hyt"></context:component-scan>
<context:annotation-config></context:annotation-config>
</beans>

@ -0,0 +1,44 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!-- 事务管理器
对mybatis操作数据库事务控制spring使用jdbc的事务控制类
-->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<!-- 数据源
dataSource在applicationContext-dao.xml中配置了
-->
<property name="dataSource" ref="dataSource"/>
</bean>
<!-- 通知 -->
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<!-- 传播行为 -->
<tx:method name="save*" propagation="REQUIRED"/>
<tx:method name="delete*" propagation="REQUIRED"/>
<tx:method name="insert*" propagation="REQUIRED"/>
<tx:method name="update*" propagation="REQUIRED"/>
<tx:method name="find*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="get*" propagation="SUPPORTS" read-only="true"/>
<tx:method name="select*" propagation="SUPPORTS" read-only="true"/>
</tx:attributes>
</tx:advice>
<!-- aop -->
<!--<aop:config>
<aop:advisor advice-ref="txAdvice" pointcut="execution(* com.ttc.ssm.service.impl.*.*(..))"/>
</aop:config>
--></beans>

@ -0,0 +1,58 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!-- 可以扫描controller、service、...
这里让扫描controller指定controller的包
-->
<context:component-scan base-package="com.kwxy.hyt.controller"></context:component-scan>
<!--注解映射器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/> -->
<!--注解适配器 -->
<!-- <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/> -->
<!-- 使用 mvc:annotation-driven代替上边注解映射器和注解适配器配置
mvc:annotation-driven默认加载很多的参数绑定方法
比如json转换解析器就默认加载了如果使用mvc:annotation-driven不用配置上边的RequestMappingHandlerMapping和RequestMappingHandlerAdapter
实际开发时使用mvc:annotation-driven
-->
<mvc:annotation-driven></mvc:annotation-driven>
<mvc:annotation-driven>
<mvc:message-converters>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
<mvc:resources mapping="/resource/**" location="/resource/"/>
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/>
<!-- 视图解析器
解析jsp解析默认使用jstl标签classpath下的得有jstl的包
-->
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 配置jsp路径的前缀 -->
<property name="prefix" value="/WEB-INF/jsp/"/>
<!-- 配置jsp路径的后缀 -->
<property name="suffix" value=".jsp"/>
</bean>
</beans>

@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

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

Loading…
Cancel
Save