教培定时器

dev
zhangyanli 2024-03-25 19:49:29 +08:00
parent 9a170e4a4e
commit 383e158990
14 changed files with 713 additions and 194 deletions

View File

@ -0,0 +1,68 @@
package com.zcloud.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.DefaultResourceLoader;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import javax.sql.DataSource;
import java.sql.SQLException;
/**
*
*/
@Configuration
@MapperScan(basePackages = No2DataSourceConfig.PACKAGE, sqlSessionFactoryRef = "no2SqlSessionFactory") //扫描 Mapper 接口并容器管理
public class No2DataSourceConfig {
static final String PACKAGE = "com.zcloud.mapper.dsno2"; //master 目录
static final String MAPPER_LOCATION = "classpath:mybatis/dsno2/*/*.xml"; //扫描的 xml 目录
static final String CONFIG_LOCATION = "classpath:mybatis/dsno2/mybatis-config.xml"; //自定义的mybatis config 文件位置
static final String TYPE_ALIASES_PACKAGE = "com.zcloud.entity"; //扫描的 实体类 目录
@Value("${datasource.no2.url}")
private String url;
@Value("${datasource.no2.username}")
private String user;
@Value("${datasource.no2.password}")
private String password;
@Value("${datasource.no2.driver-class-name}")
private String driverClass;
@Bean(name = "no2DataSource")
public DataSource no2DataSource() throws SQLException {
DruidDataSource dataSource = new DruidDataSource();
dataSource.setDriverClassName(driverClass);
dataSource.setUrl(url);
dataSource.setUsername(user);
dataSource.setPassword(password);
dataSource.addFilters("stat");
dataSource.addFilters("wall");
return dataSource;
}
@Bean(name = "no2TransactionManager")
public DataSourceTransactionManager no2TransactionManager() throws SQLException {
return new DataSourceTransactionManager(no2DataSource());
}
@Bean(name = "no2SqlSessionFactory")
public SqlSessionFactory no2SqlSessionFactory(@Qualifier("no2DataSource") DataSource no2DataSource)throws Exception {
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
sessionFactory.setDataSource(no2DataSource);
sessionFactory.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(No2DataSourceConfig.MAPPER_LOCATION));
sessionFactory.setConfigLocation(new DefaultResourceLoader().getResource(No2DataSourceConfig.CONFIG_LOCATION));
sessionFactory.setTypeAliasesPackage(No2DataSourceConfig.TYPE_ALIASES_PACKAGE);
return sessionFactory.getObject();
}
}

View File

@ -1,24 +0,0 @@
package com.zcloud.mapper.datasource.task;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* 线-
* luoxiaobao
* 2021-12-20
* www.zcloudchina.com
*/
public interface StudyTaskMapper {
/**
* @param pd
* @throws Exception
*/
List<PageData> getDeptExamine(PageData pd);
List<PageData> getUserExamine(PageData pd);
}

View File

@ -0,0 +1,31 @@
package com.zcloud.mapper.dsno2.education;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-05-26
* www.zcloudchina.com
*/
public interface ClassMapper {
/**
*
*
* @param pd
* @throws Exception
*/
void editState(PageData pd);
/**
* ()
*
* @param pd
* @throws Exception
*/
List<PageData> listAllScheduled(PageData pd);
}

View File

@ -0,0 +1,27 @@
package com.zcloud.mapper.dsno2.education;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2021-10-08
* www.zcloudchina.com
*/
public interface StageStudentRelationMapper {
/**
*
*
* @param
* @throws Exception
*/
void updateClassStateSch(PageData pd);
int getCountByCla(PageData pd);
}

View File

@ -0,0 +1,84 @@
package com.zcloud.scheduled.education;
import com.zcloud.entity.PageData;
import com.zcloud.service.education.ClassService;
import com.zcloud.service.education.StageStudentRelationService;
import com.zcloud.util.DateUtil;
import com.zcloud.util.Tools;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;
@Component
public class ClassScheduled {
@Autowired
private ClassService classService;
@Autowired
private StageStudentRelationService stageStudentRelationService;
@Scheduled(cron = "0 30 0 * * ?") // 每天晚上12:30执行
// @Scheduled(cron ="0 0/5 * * * ?") // 测试 每5分钟执行一次
public void scheduled() {
try {
PageData pd = new PageData();
String[] STATEARRAY = new String[]{"4", "5"};
pd.put("STATEARRAY", STATEARRAY);
// 查询所有班级列表
List<PageData> classList = classService.listAllScheduled(pd);
if (classList != null && classList.size() > 0) {
for (PageData classInfo : classList) {
if (classInfo != null
&& classInfo.get("TRAINTYPE") != null && Tools.notEmpty(classInfo.get("TRAINTYPE").toString())
&& classInfo.get("START_TIME") != null
&& classInfo.get("END_TIME") != null) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date startTime = formatter.parse(classInfo.getString("START_TIME"));
Date endTime = formatter.parse(classInfo.getString("END_TIME"));
Date now = new Date();
if (startTime.before(now) && now.before(endTime)) {
classInfo.put("STATE", "5");
} else if (endTime.before(now)) {
classInfo.put("STATE", "6");
pd.put("CLASS_ID", classInfo.getString("CLASS_ID"));
int count = stageStudentRelationService.getCountByCla(pd);
PageData studyState = new PageData();
if (count > 0) {
studyState.put("STUDYSTATE", "6");
studyState.put("WHERESTUDYSTATE", new String[]{"5"});
studyState.put("OPERATOR", "1"); //修改人
studyState.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
studyState.put("CLASS_ID", classInfo.get("CLASS_ID"));
stageStudentRelationService.updateClassStateSch(studyState);
}
studyState.put("STUDYSTATE", "4");
studyState.put("WHERESTUDYSTATE", new String[]{"0", "1"});
studyState.put("OPERATOR", "1"); //修改人
studyState.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
studyState.put("CLASS_ID", classInfo.get("CLASS_ID"));
stageStudentRelationService.updateClassStateSch(studyState);
PageData stageExamState = new PageData();
stageExamState.put("STAGEEXAMSTATE", "4");
stageExamState.put("WHERESTAGEEXAMSTATE", new String[]{"1"});
stageExamState.put("OPERATOR", "1"); //修改人
stageExamState.put("CLASS_ID", classInfo.get("CLASS_ID"));
stageExamState.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
stageStudentRelationService.updateClassStateSch(stageExamState);
}
classInfo.put("OPERATOR", "1"); //修改人
classInfo.put("OPERATTIME", DateUtil.date2Str(new Date())); //修改时间
classService.editState(classInfo);
}
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -0,0 +1,35 @@
package com.zcloud.service.education;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import java.util.List;
/**
*
* luoxiaobao
* 2022-05-26
* www.zcloudchina.com
*/
public interface ClassService {
/**
*
*
* @param pd
* @throws Exception
*/
void editState(PageData pd) throws Exception;
/**
* ()
*
* @param pd
* @throws Exception
*/
List<PageData> listAllScheduled(PageData pd) throws Exception;
}

View File

@ -0,0 +1,29 @@
package com.zcloud.service.education;
import com.zcloud.entity.Page;
import com.zcloud.entity.PageData;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
/**
*
* luoxiaobao
* 2021-10-08
* www.zcloudchina.com
*/
public interface StageStudentRelationService {
/**
*
*
* @param
* @throws Exception
*/
void updateClassStateSch(PageData pd) throws Exception;
int getCountByCla(PageData pd);
}

View File

@ -0,0 +1,47 @@
package com.zcloud.service.education.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.education.ClassMapper;
import com.zcloud.service.education.ClassService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.*;
/**
*
* luoxiaobao
* 2022-05-26
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class ClassServiceImpl implements ClassService {
@Resource
private ClassMapper classMapper;
/**
*
*
* @param pd
* @throws Exception
*/
public void editState(PageData pd) throws Exception {
classMapper.editState(pd);
}
/**
* ()
*
* @param pd
* @throws Exception
*/
public List<PageData> listAllScheduled(PageData pd) throws Exception {
return classMapper.listAllScheduled(pd);
}
}

View File

@ -0,0 +1,41 @@
package com.zcloud.service.education.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.dsno2.education.StageStudentRelationMapper;
import com.zcloud.service.education.StageStudentRelationService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
/**
*
* luoxiaobao
* 2021-10-08
* www.zcloudchina.com
*/
@Service
@Transactional //开启事物
public class StageStudentRelationServiceImpl implements StageStudentRelationService {
@Resource
private StageStudentRelationMapper stagestudentrelationMapper;
/**
*
*
* @param
* @throws Exception
*/
@Override
public void updateClassStateSch(PageData pd) throws Exception {
stagestudentrelationMapper.updateClassStateSch(pd);
}
@Override
public int getCountByCla(PageData pd) {
return stagestudentrelationMapper.getCountByCla(pd);
}
}

View File

@ -3,15 +3,22 @@ server.port=9099
•°æ®æº1
datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no1.url=jdbc:mysql://192.168.0.42:3306/integrated_whb?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.url=jdbc:mysql://192.168.0.64:3306/qa-traffic-prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no1.username=root
datasource.no1.password=root
datasource.no2.driver-class-name: com.mysql.cj.jdbc.Driver
datasource.no2.url=jdbc:mysql://192.168.0.64:3306/qa-traffic-education-org?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
datasource.no2.username=root
datasource.no2.password=root
#datasource.no1.driver-class-name: com.mysql.cj.jdbc.Driver
#datasource.no1.url=jdbc:mysql://39.103.211.146:33068/zcloud_prevention?serverTimezone=UTC&useSSL=false&useUnicode=true&characterEncoding=utf-8
#datasource.no1.username=root
#datasource.no1.password=Mysqlzcloud88888
#druid连接池
spring.datasource.type: com.alibaba.druid.pool.DruidDataSource
#最大活跃数

View File

@ -1,169 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.datasource.task.StudyTaskMapper">
<!--表名 -->
<sql id="tableName">
BUS_STUDYTASK
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f.STUDY_NAME,
f.TRAINTYPE,
f.POSTTYPE,
f.PEIXUE_START_TIME,
f.PEIXUE_END_TIME,
f.KJ_STATE,
f.GJ_STATE,
f.STAGEEXAMPAPER_ID,
f.STUDY_USER_ID,
f.STUDY_CURRICULUM_ID,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.CORPINFO_ID,
f.STATE,
f.COURSEWARE_COUNT,
f.SUM_CLASSHOUR,
f.STUDYTASK_ID
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
STUDY_NAME,
TRAINTYPE,
POSTTYPE,
PEIXUE_START_TIME,
PEIXUE_END_TIME,
KJ_STATE,
GJ_STATE,
STAGEEXAMPAPER_ID,
STUDY_USER_ID,
STUDY_CURRICULUM_ID,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
CORPINFO_ID,
STATE,
COURSEWARE_COUNT,
SUM_CLASSHOUR,
STUDYTASK_ID
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{STUDY_NAME},
#{TRAINTYPE},
#{POSTTYPE},
#{PEIXUE_START_TIME},
#{PEIXUE_END_TIME},
#{KJ_STATE},
#{GJ_STATE},
#{STAGEEXAMPAPER_ID},
#{STUDY_USER_ID},
#{STUDY_CURRICULUM_ID},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{CORPINFO_ID},
#{STATE},
#{COURSEWARE_COUNT},
#{SUM_CLASSHOUR},
#{STUDYTASK_ID}
</sql>
<!-- 绩效得分 -->
<select id="getDeptExamine" parameterType="pd" resultType="pd" >
SELECT
d.DEPARTMENT_ID,
ifnull(un.user_count,0) as user_count,
ifnull(st.NUM,0) as st_count
FROM
OA_DEPARTMENT d
LEFT JOIN (
SELECT
count( distinct f.USER_ID) NUM,
u.DEPARTMENT_ID
FROM
bus_stagestudentrelation f
LEFT JOIN BUS_STUDYTASK t ON t.STUDYTASK_ID = f.STUDYTASK_ID
LEFT JOIN SYS_USER u ON u.USER_ID = f.USER_ID
WHERE
(
t.PEIXUE_START_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
t.PEIXUE_END_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
(t.PEIXUE_START_TIME &lt;= #{STARTTIME} and t.PEIXUE_END_TIME &gt;= #{ENDTIME})
)
group by u.DEPARTMENT_ID
) st on st.DEPARTMENT_ID=d.DEPARTMENT_ID
LEFT JOIN
( SELECT count( 1 ) as user_count,u.DEPARTMENT_ID FROM SYS_USER u WHERE u.ISDELETE = 0 group by u.DEPARTMENT_ID) un on un.DEPARTMENT_ID = d.DEPARTMENT_ID
where
d.ISDELETE = 0
</select>
<select id="getUserExamine" parameterType="pd" resultType="pd" >
SELECT
u.USER_ID,
ifnull(st.NUM,0) as st_count,
ifnull(pa.NUM,0) as pass_count
FROM
SYS_USER u
LEFT JOIN (
SELECT
count( distinct f.USER_ID) NUM,
f.USER_ID
FROM
bus_stagestudentrelation f
LEFT JOIN BUS_STUDYTASK t ON t.STUDYTASK_ID = f.STUDYTASK_ID
WHERE
(
t.PEIXUE_START_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
t.PEIXUE_END_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
(t.PEIXUE_START_TIME &lt;= #{STARTTIME} and t.PEIXUE_END_TIME &gt;= #{ENDTIME})
)
group by f.USER_ID
) st on st.USER_ID=u.USER_ID
LEFT JOIN (
SELECT
count( distinct f.USER_ID) NUM,
f.USER_ID
FROM
bus_stagestudentrelation f
LEFT JOIN BUS_STUDYTASK t ON t.STUDYTASK_ID = f.STUDYTASK_ID
LEFT JOIN BUS_STAGEEXAMPAPER p ON t.STUDYTASK_ID = p.STUDYTASK_ID
WHERE
(
t.PEIXUE_START_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
t.PEIXUE_END_TIME BETWEEN #{STARTTIME} and #{ENDTIME}
or
(t.PEIXUE_START_TIME &lt;= #{STARTTIME} and t.PEIXUE_END_TIME &gt;= #{ENDTIME})
)
and p.PASSSCORE &lt;= f.STAGEEXAMSCORE
group by f.USER_ID
) pa on pa.USER_ID=u.USER_ID
where
u.ISDELETE = 0
</select>
</mapper>

View File

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.education.ClassMapper">
<!--表名 -->
<sql id="tableName">
BUS_CLASS
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f
.
NAME
,
f.ADMIN_DIVISION,
f.START_TIME,
f.END_TIME,
f.PRINCIPAL,
f.PRINCIPAL_PHONE,
f.TRAINTYPE,
f.POSTTYPE,
f.INDUSTRY_END_ID,
f.INDUSTRY_ALL_NAME,
f.INDUSTRY_ALL_TYPE,
f.TRAINLEVEL,
f.TRAINERS_NUMBER,
f.ISSUE,
f.EXAM_TIME,
f.ISCHECKPERIOD,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.CORPINFO_ID,
f.PROVINCE,
f.CITY,
f.COUNTY,
f.VILLAGE,
f.STREET,
f.ISQUESTIONNAIRE,
f.SAMPLINGNUMBER,
f.CODE,
f.STATE,
f.SURVEY_ID,
f.ENTERPRISE_ID,
f.RECORDOR,
f.ASSESSOR,
f.SAFETYDEPTOR,
f.ISFACE,
f.EXAMINATION,
f.NUMBEROFEXAMS,
f.CLASS_ID,
f.ISSTRENGTHEN,
f.RELEASE_TYPE,
f.PERSONNEL_TYPES
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
NAME
,
ADMIN_DIVISION,
START_TIME,
END_TIME,
PRINCIPAL,
PRINCIPAL_PHONE,
TRAINTYPE,
POSTTYPE,
INDUSTRY_END_ID,
INDUSTRY_ALL_NAME,
INDUSTRY_ALL_TYPE,
TRAINLEVEL,
TRAINERS_NUMBER,
ISSUE,
EXAM_TIME,
ISCHECKPERIOD,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
CORPINFO_ID,
PROVINCE,
CITY,
COUNTY,
VILLAGE,
STREET,
ISQUESTIONNAIRE,
SAMPLINGNUMBER,
CODE,
STATE,
SURVEY_ID,ENTERPRISE_ID,
RECORDOR,
ASSESSOR,
SAFETYDEPTOR,
NUMBEROFEXAMS,
EXAMINATION,
ISFACE,
CLASS_ID,
ISSTRENGTHEN,
RELEASE_TYPE,
PERSONNEL_TYPES
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{NAME}
,
#{ADMIN_DIVISION},
#{START_TIME},
#{END_TIME},
#{PRINCIPAL},
#{PRINCIPAL_PHONE},
#{TRAINTYPE},
#{POSTTYPE},
#{INDUSTRY_END_ID},
#{INDUSTRY_ALL_NAME},
#{INDUSTRY_ALL_TYPE},
#{TRAINLEVEL},
#{TRAINERS_NUMBER},
#{ISSUE},
#{EXAM_TIME},
#{ISCHECKPERIOD},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{CORPINFO_ID},
#{PROVINCE},
#{CITY},
#{COUNTY},
#{VILLAGE},
#{STREET},
#{ISQUESTIONNAIRE},
#{SAMPLINGNUMBER},
#{CODE},
#{STATE},
#{SURVEY_ID},
#{ENTERPRISE_ID},
#{RECORDOR},
#{ASSESSOR},
#{SAFETYDEPTOR},
#{NUMBEROFEXAMS},
#{EXAMINATION},
#{ISFACE},
#{CLASS_ID},
#{ISSTRENGTHEN},
#{RELEASE_TYPE},
#{PERSONNEL_TYPES}
</sql>
<!-- 修改 -->
<update id="editState" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="NEW_END_TIME != null and NEW_END_TIME != ''"><!-- 关键词检索 -->
END_TIME = #{NEW_END_TIME},
</if>
STATE = #{STATE},
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME}
where
CLASS_ID = #{CLASS_ID}
</update>
<!-- 列表(全部)定时器使用 -->
<select id="listAllScheduled" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include>
f
WHERE f.ISDELETE = '0'
<if test="STATEARRAY != null and STATEARRAY != ''">
and f.STATE in
<foreach item="item" index="index" collection="STATEARRAY" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY
f.CLASS_ID
</select>
</mapper>

View File

@ -0,0 +1,127 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zcloud.mapper.dsno2.education.StageStudentRelationMapper">
<!--表名 -->
<sql id="tableName">
BUS_STAGESTUDENTRELATION
</sql>
<!--数据字典表名 -->
<sql id="dicTableName">
SYS_DICTIONARIES
</sql>
<!-- 字段 -->
<sql id="Field">
f
.
STAGESTUDENTRELATION_ID
,
f.STAGEEXAMPAPER_ID,
f.USER_ID,
f.STAGEEXAMSTATE,
f.STAGEEXAMSCORE,
f.CREATOR,
f.CREATTIME,
f.OPERATOR,
f.OPERATTIME,
f.ISDELETE,
f.CORPINFO_ID,
f.STUDYTASK_ID,
f.COMPLETE_COURSEWARE,
f.COMPLETE_CLASSHOUR,
f.USER_SIGN_PATH,
f.CLASS_ID,
f.STUDENT_ID,
f.PAPER_ID,
f.STUDYSTATE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
STAGESTUDENTRELATION_ID
,
STAGEEXAMPAPER_ID,
USER_ID,
STAGEEXAMSTATE,
STAGEEXAMSCORE,
CREATOR,
CREATTIME,
OPERATOR,
OPERATTIME,
ISDELETE,
CORPINFO_ID,
STUDYTASK_ID,
COMPLETE_COURSEWARE,
COMPLETE_CLASSHOUR,
USER_SIGN_PATH,
CLASS_ID,
STUDENT_ID,
PAPER_ID,
STUDYSTATE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{STAGESTUDENTRELATION_ID}
,
#{STAGEEXAMPAPER_ID},
#{USER_ID},
#{STAGEEXAMSTATE},
#{STAGEEXAMSCORE},
#{CREATOR},
#{CREATTIME},
#{OPERATOR},
#{OPERATTIME},
#{ISDELETE},
#{CORPINFO_ID},
#{STUDYTASK_ID},
#{COMPLETE_COURSEWARE},
#{COMPLETE_CLASSHOUR},
#{USER_SIGN_PATH},
#{CLASS_ID},
#{STUDENT_ID},
#{PAPER_ID},
#{STUDYSTATE}
</sql>
<!-- 修改(更新班级所有学员考试状态) -->
<update id="updateClassStateSch" parameterType="pd">
update
<include refid="tableName"></include>
set
<if test="STUDYSTATE!= null and STUDYSTATE != ''"><!-- 关键词检索 -->
STUDYSTATE = #{STUDYSTATE},
</if>
<if test="STAGEEXAMSTATE!= null and STAGEEXAMSTATE != ''"><!-- 关键词检索 -->
STAGEEXAMSTATE = #{STAGEEXAMSTATE},
</if>
OPERATOR = #{OPERATOR},
OPERATTIME = #{OPERATTIME}
where
CLASS_ID = #{CLASS_ID}
<if test="WHERESTUDYSTATE!= null and WHERESTUDYSTATE != ''"><!-- 关键词检索 -->
and STUDYSTATE in
<foreach item="item" index="index" collection="WHERESTUDYSTATE" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="WHERESTAGEEXAMSTATE!= null and WHERESTAGEEXAMSTATE != ''"><!-- 关键词检索 -->
and STAGEEXAMSTATE in
<foreach item="item" index="index" collection="WHERESTAGEEXAMSTATE" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</update>
<select id="getCountByCla" resultType="int">
select count(*)
from bus_stagestudentrelation f
where f.CLASS_ID = #{CLASS_ID}
and f.STUDYSTATE = '5'
and f.ISDELETE = '0'
</select>
</mapper>

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD SQL Map Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<typeAliases>
<typeAlias type="com.zcloud.entity.PageData" alias="pd"/>
<typeAlias type="com.zcloud.entity.Page" alias="page"/>
<!-- 这里添加实体类 -->
</typeAliases>
<plugins>
<plugin interceptor="com.zcloud.plugins.PagePlugin">
<property name="dialect" value="mysql"/>
<property name="pageSqlId" value=".*listPage.*"/>
</plugin>
</plugins>
</configuration>