作者 mxy

删除配置后提交

正在显示 100 个修改的文件 包含 713 行增加0 行删除

要显示太多修改。

为保证性能只显示 100 of 100+ 个文件。

######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
rebel.xml
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
!*/build/*.java
!*/build/*.html
!*/build/*.xml
\ No newline at end of file
... ...
gYyg01S75mxBaAI4
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"
default-lazy-init="false">
<context:component-scan base-package="com.chuanqi.reading">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 数据源-->
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://119.3.81.232:3306/pinggu_db?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8"/>
<property name="username" value="bronet" />
<property name="password" value="BroNet2021" />
<property name="maxActive" value="30" />
<property name="maxIdle" value="15" />
<property name="initialSize" value="5" />
<property name="validationQuery" value="SELECT 1" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
</bean>
<!-- 会话工厂bean sqlSessionFactoryBean -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 数据源 -->
<property name="dataSource" ref="dataSource" />
<!-- 别名 -->
<property name="typeAliasesPackage" value="com.chuanqi.reading.*.entity" />
<!-- sql映射文件路径 -->
<property name="mapperLocations" value="classpath*:mapper/*.xml" />
<!-- 配置文件 -->
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>
<!-- 自动扫描对象关系映射 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--指定会话工厂,如果当前上下文中只定义了一个则该属性可省去 -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
<!-- 指定要自动扫描接口的基础包,实现接口 -->
<property name="basePackage" value="com.chuanqi.reading.*.dao" />
</bean>
<!-- 声明式事务管理 -->
<!--定义事物管理器,由spring管理事务 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 支持注解驱动的事务管理,指定事务管理器 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- aspectj支持自动代理实现AOP功能 -->
<aop:aspectj-autoproxy proxy-target-class="true" />
<util:properties id="wxProperties" location="classpath:/wx.properties"/>
</beans>
... ...
log4j.rootLogger=INFO,consoleAppender,logfile
log4j.appender.consoleAppender=org.apache.log4j.ConsoleAppender
log4j.appender.consoleAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.consoleAppender.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p [%t] (%F:%L) - %m%n
log4j.appender.logfile=org.apache.log4j.DailyRollingFileAppender
log4j.appender.logfile.File=/home/logs/pinggu.log
log4j.appender.logfile.Append =true
log4j.appender.logfile.DatePattern='.'yyyy-MM-dd
log4j.appender.logfile.layout=org.apache.log4j.PatternLayout
log4j.appender.logfile.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss,SSS} %5p [%t] (%F:%L) - %m%n
... ...
<?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.chuanqi.reading.home.dao.CourseDao">
<sql id="queryCourseVo">
select ci.course_id id, ci.term_id termId, ci.course_name title, date_format(audit_time, '%Y-%m-%d %H:%i') dataTime, count(cg.id) dataCount, NOT ISNULL(t.articleStatus) articleStatus
from course_info ci
left join (select distinct i.course_id, 1 articleStatus from course_info i
join( select course_id from course_relation group by course_id having count(question_type) = 1) cr on i.course_id = cr.course_id
join course_read r on i.course_id = r.course_id and r.read_flag = '1' and r.customer_id=#{userId}) t on ci.course_id = t.course_id
left join course_progress cg on ci.course_id = cg.course_id and cg.customer_id = #{userId}
where ci.audit_status = '1' and ci.course_status = '0'
</sql>
<select id="queryCourseList" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
<!--include refid="queryCourseVo" /-->
select ci.course_id id, ci.term_id termId, ci.course_name title, date_format(audit_time, '%Y-%m-%d %H:%i') dataTime, count(cg.id) dataCount, NOT ISNULL(t.articleStatus) articleStatus
from course_info ci
left join course_progress cg on ci.course_id = cg.course_id and cg.customer_id = #{userId}
left join (select distinct i.course_id, 1 articleStatus from course_info i
join( select course_id from course_relation group by course_id having count(question_type) = 1) cr on i.course_id = cr.course_id
join course_read r on i.course_id = r.course_id and r.read_flag = '1' and r.customer_id=#{userId}) t on ci.course_id = t.course_id
where ci.audit_status = '1' and ci.course_status = '0'
and term_id = #{termId} group by ci.course_id order by sticky_status desc, dataCount, audit_time desc LIMIT #{startIndex},5
</select>
<select id="queryCourseById" resultType="com.chuanqi.reading.home.entity.CourseInfo"
parameterType="long" >
select course_id id, course_name name, term_id termId, course_num num, release_status resultStatus, ifnull(passing_Score,0) passingScore from course_info where course_id = #{id}
</select>
<select id="queryCourseListByRead" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
select ci.course_id id, ci.term_id termId, ci.course_name name, audit_time dateTime, count(cg.id) dataCount, NOT ISNULL(t.articleStatus) articleStatus
from course_info ci
left join course_progress cg on ci.course_id = cg.course_id
left join (select distinct i.course_id, 1 articleStatus from course_info i
join( select course_id from course_relation group by course_id having count(question_type) = 1) cr on i.course_id = cr.course_id
join course_read r on i.course_id = r.course_id and r.read_flag = '1' and r.customer_id=#{userId}) t on ci.course_id = t.course_id
where ci.audit_status = '1' and ci.course_status = '0'
and ci.term_id in(
select term_id from course_term_student where user_id = #{userId}
) and cg.customer_id = #{userId}
group by ci.course_id order by audit_time desc
</select>
<!--查询指定用户已读文章(包含无题目文章和已读不一定答题文章)-->
<select id="queryCourseListByOnlyRead" resultType="com.chuanqi.reading.home.entity.CourseInfo"
parameterType="com.chuanqi.reading.home.entity.SysUser">
SELECT course_id id, course_name NAME FROM course_info WHERE course_id IN (
SELECT DISTINCT course_id FROM course_read WHERE customer_id=#{userId} AND course_id IN (
SELECT course_id FROM course_info ci WHERE ci.audit_status = '1' AND ci.course_status = '0'
AND (ci.term_id IN (SELECT term_id FROM course_term_student WHERE user_id = #{userId}) OR ci.term_id &lt;0)))
ORDER BY audit_time DESC
</select>
<!--获取没有题目的文章阅读的记录-->
<select id="queryByOnlyRead" resultType="com.chuanqi.reading.home.entity.CourseRead" parameterType="java.util.Map">
SELECT id, course_id courseId, category_id categoryId,customer_id customerId, begin_time beginTime, end_time endTime,TIMEDIFF(end_time, begin_time) readFlag
FROM course_read WHERE course_id=#{courseId} AND customer_id=#{userId} AND read_flag=1 order by endTime desc
</select>
<!--获得所有文章按照课程id -->
<select id="queryArticle" resultType="com.chuanqi.reading.home.entity.Article" parameterType="java.util.Map">
SELECT ca.article_id id, ca.article_title title, ca.article_content content, ca.article_time time,
ca.classify_id classifyId, ca.article_label articleLabel
from course_article ca
where article_id in (
SELECT question_id FROM course_relation
where course_id = #{id} and category_id = 1 and classify_id = #{classify}
)LIMIT 1
</select>
<!--获得所有题目查询-->
<select id="queryQuestions" resultType="com.chuanqi.reading.home.entity.Question" parameterType="java.util.Map">
select cc.choice_id id,cr.id relationId,cc.choice_question question,cc.optionA,cc.optionB,cc.optionC,cc.optionD,
cc.optionE, cc.optionF, cc.optionG, cc.optionH, cc.optionI, cc.choice_answer answer,
support_answer support,cc.choice_explain `explain`,cr.category_id categoryId,'choice' type ,cc.choice_score score
from course_relation cr LEFT JOIN course_choice cc on cr.question_id = cc.choice_id where cr.question_type = 'choice' and cr.course_id = #{id}
union
select cf.fill_id id,cr.id relationId,cf.fill_question question,null optionA,null optionB,null optionC,null optionD,
null optionE, null optionF, null optionG, null optionH, null optionI, cf.fill_answer answer,
support_answer support,cf.fill_explain `explain`,cr.category_id categoryId,'fill' type ,cf.fill_score score
from course_relation cr LEFT JOIN course_fill cf on cr.question_id = cf.fill_id where cr.question_type = 'fill' and cr.course_id = #{id}
union
select cj.judge_id id,cr.id relationId,cj.judge_question question,null optionA,null optionB,null optionC,null optionD,
null optionE, null optionF, null optionG, null optionH, null optionI, cj.judge_answer answer,
null support,cj.judge_explain `explain`,cr.category_id categoryId,'judge' type ,cj.judge_score score
from course_relation cr LEFT JOIN course_judge cj on cr.question_id = cj.judge_id where cr.question_type = 'judge' and cr.course_id = #{id}
ORDER BY relationId/*categoryId,type,question_sort*/
</select>
<insert id="saveCourseRead" parameterType="com.chuanqi.reading.home.entity.CourseRead" useGeneratedKeys="true"
keyProperty="id">
insert into course_read(course_id,category_id,customer_id,begin_time,end_time,read_flag)
values (#{courseId},#{categoryId},#{customerId},#{beginTime},#{endTime},#{readFlag})
</insert>
<!--更新阅读记录-->
<update id="updateCourseRead" parameterType="com.chuanqi.reading.home.entity.CourseRead">
update course_read set end_time = #{endTime}, read_flag = #{readFlag} where id = ${id}
</update>
<!--保存完progress记录时,更新阅读记录-->
<update id="updateCourseReadProgress" parameterType="java.util.Map">
update course_read set progress_id = #{progressId}, read_flag = 1 where id in(${ids})
</update>
<insert id="saveCourseProgress" parameterType="com.chuanqi.reading.home.entity.CourseProgress"
useGeneratedKeys="true" keyProperty="id">
insert into course_progress(course_id, customer_id, lookback_num, lookback_time, read_time, answer_rate,
course_status, create_time, begin_time, answer_score, exam_total, answer_right)
values (#{courseId}, #{customerId}, #{lookbackNum}, #{lookbackTime}, #{readTime}, #{answerRate},
#{courseStatus}, #{createTime}, #{beginTime}, #{answerScore}, #{examTotal}, #{answerRight})
</insert>
<select id="queryCourseProgress" resultType="com.chuanqi.reading.home.entity.CourseProgress" parameterType="java.util.Map">
select id, course_id, customer_id, lookback_num lookbackNum, lookback_time lookbackTime, answer_rate answerRate,
read_time readTime, course_status courseStatus, create_Time createTime
from course_progress
where course_id = ${courseId} and customer_id = #{userId} order by createTime
</select>
<insert id="saveCourseAnswer">
insert into course_answer(progress_id, relation_id, customer_id, answer, right_num) values
<foreach item="item" index="index" collection="list" separator=",">
(#{item.progressId}, #{item.relationId}, #{item.customerId}, #{item.answer}, #{item.rightNum})
</foreach>
</insert>
<!--查询公开试卷-->
<select id="queryOpenCourse" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
<include refid="queryCourseVo" />
and term_id = -100 and course_num = #{id} <!-- course_num主题编号 -->
group by ci.course_id order by sticky_status desc, dataCount, audit_time desc LIMIT #{startIndex},5
</select>
<!--查询用户所属培训班-->
<select id="queryUserTermList" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
SELECT id, title, content, userId FROM (
/*##查询自己所属层级单位的所有培训班信息*/
SELECT a.term_id id, term_title title, begin_date, CONCAT(begin_date, ' ~ ', end_date) content, user_id userId FROM course_term a
LEFT JOIN course_term_student b ON a.term_id = b.term_id AND b.status='0' AND b.user_id=#{userId}
WHERE dept_id IN (SELECT dept_id FROM sys_dept WHERE FIND_IN_SET(#{id}, ancestors)>0 OR dept_id IN(#{id},101))
AND a.term_status='0' /*AND CURRENT_DATE BETWEEN begin_date AND end_date*/
/*##查询自己所在培训班但是该班级不在所属机构下*/
UNION
SELECT t.term_id id, term_title title, begin_date, CONCAT(begin_date, ' ~ ', end_date) content, user_id userId
FROM course_term_student ts ,course_term t
WHERE ts.term_id=t.term_id AND ts.user_id=#{userId}
AND t.term_status='0' /*AND CURRENT_DATE BETWEEN begin_date AND end_date*/
AND t.dept_id NOT IN (SELECT dept_id FROM sys_dept WHERE FIND_IN_SET(#{id}, ancestors)>0)
) temp ORDER BY userId DESC, begin_date LIMIT #{startIndex},5
</select>
<select id="queryTermById" resultType="com.chuanqi.reading.home.entity.DataSet" parameterType="long">
SELECT term_id id, term_title title FROM course_term WHERE term_id = #{termId}
</select>
<sql id="queryMediaVo">
SELECT media_id id, media_name title, media_desc content, media_link remark, media_image search,
date_format(ifnull(update_time, create_time), '%Y-%m-%d %H:%i') dataTime
FROM course_media
</sql>
<select id="queryMediaList" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
<include refid="queryMediaVo" />
WHERE media_status='0' and theme_id=#{id} ORDER BY media_num LIMIT #{startIndex},5
</select>
<select id="queryMediaById" resultType="com.chuanqi.reading.home.entity.DataSet" parameterType="long">
<include refid="queryMediaVo" />
WHERE media_id = #{mediaId}
</select>
<select id="queryThemeList" resultType="com.chuanqi.reading.home.entity.DataSet"
parameterType="com.chuanqi.reading.home.entity.DataSet">
SELECT theme_id id, theme_name title FROM course_theme
WHERE theme_status='0' and theme_type=#{remark} ORDER BY theme_num LIMIT #{startIndex},5
</select>
<select id="queryThemeById" resultType="com.chuanqi.reading.home.entity.DataSet" parameterType="long">
SELECT theme_id id, theme_name title FROM course_theme WHERE theme_id = #{themeId}
</select>
<!-- 统计培训班个数 -->
<select id="getClassCount" resultType="int">
SELECT COUNT(DISTINCT term_id) FROM course_term
</select>
<!-- 统计培训学员个数 -->
<select id="getStudentCount" resultType="int">
SELECT COUNT(DISTINCT user_id) FROM course_term_student
</select>
<!-- 统计培训部门下的培训班和班级人数 -->
<select id="getTermListByDeptId" parameterType="long" resultType="com.chuanqi.reading.home.entity.Term">
SELECT theme_id termId, theme_name termTitle, 0 userSum, '2019-01-01' begin_date FROM course_theme WHERE theme_type=1
UNION ALL
SELECT t.term_id termId, term_title termTitle, IFNULL(user_count, 0) userSum, begin_date FROM course_term t
LEFT JOIN (SELECT term_id, COUNT(user_id) user_count FROM course_term_student GROUP BY term_id) ts
ON t.term_id=ts.term_id WHERE term_status=0 ORDER BY begin_date <!-- AND t.dept_id=#{deptId} -->
</select>
<!-- 根据班级ID查询班级信息 -->
<select id="getTermById" parameterType="long" resultType="com.chuanqi.reading.home.entity.Term">
SELECT term_id termId, term_title termTitle FROM course_term WHERE term_id=#{termId}
</select>
<!--查询个人明细-公共培训-->
<select id="queryPublicDetailForList" parameterType="java.util.Map" resultType="com.chuanqi.reading.home.entity.Details">
SELECT t1.course_id courseId, ci.course_name courseName, DATE_FORMAT(t1.begin_time, '%Y-%m-%d %H:%i:%s') beginTime,
useTime, answer_rate answerRate FROM (
SELECT course_id,begin_time, TIMEDIFF(create_time, begin_time) useTime, answer_rate FROM course_progress
WHERE course_id IN (SELECT course_id FROM course_info WHERE term_id &lt; 0) AND customer_id=#{userId}
UNION ALL
SELECT course_id, begin_time, TIMEDIFF(end_time, begin_time) useTime,'-' AS answer_rate FROM course_read
WHERE course_id IN (SELECT course_id FROM course_info WHERE term_id &lt; 0) AND read_flag=1 AND customer_id=#{userId}
) t1 , course_info ci WHERE t1.course_id=#{courseId} and ci.course_id = #{courseId} ORDER BY t1.begin_time DESC LIMIT #{startIndex},5
</select>
<!--查询个人-专项培训-->
<select id="queryTermSpecialForList" parameterType="java.util.Map" resultType="com.chuanqi.reading.home.entity.Term">
select t.term_id termId, term_title termTitle
from course_term t
where exists(select * from course_read r inner join
course_info i on i.course_id=r.course_id and r.customer_id=#{userId} inner join
course_progress p on r.progress_id=p.id and r.read_flag=1 and p.customer_id = #{userId}
where i.term_id = t.term_id ) OR
exists(select * from course_read cr inner join
v_course_article v on cr.course_id = v.course_id and cr.customer_id = #{userId} and cr.read_flag = 1 where t.term_id =v.term_id)
order by t.begin_date desc LIMIT #{startIndex},5
</select>
<!--查询个人明细专项培训-->
<select id="querySpecialDetailForList" parameterType="java.util.Map" resultType="com.chuanqi.reading.home.entity.Details">
SELECT t1.course_id courseId, ci.course_name courseName, DATE_FORMAT(t1.begin_time, '%Y-%m-%d %H:%i:%s') beginTime,
useTime, answer_rate answerRate FROM (
SELECT course_id,begin_time, TIMEDIFF(create_time, begin_time) useTime, answer_rate FROM course_progress
WHERE course_id = #{courseId} and course_id IN (SELECT course_id FROM course_info WHERE term_id &gt; 0 ) AND customer_id=#{userId}
UNION ALL
SELECT course_id, begin_time, TIMEDIFF(end_time, begin_time) useTime,'-' AS answer_rate FROM course_read
WHERE course_id NOT IN (SELECT course_id FROM course_info WHERE term_id &lt; 0)
AND course_id NOT IN (SELECT DISTINCT course_id FROM course_progress WHERE customer_id=#{userId})
AND read_flag=1 AND customer_id=#{userId} and course_id = #{courseId}
) t1 , course_info ci WHERE t1.course_id=ci.course_id and ci.term_id= #{termId} ORDER BY t1.begin_time DESC LIMIT #{startIndex},7
</select>
<!--查询个人概况-时长、篇数、成绩:按照当天最高算-->
<select id="queryPersonalLogForList" parameterType="long" resultType="com.chuanqi.reading.home.entity.DataSet">
SELECT DATE_FORMAT(dataTime, '%m-%d') AS dataTime, termId, dataCount, search FROM (
SELECT DATE_FORMAT(begin_time, '%Y-%m-%d') dataTime,
SUM(TIMESTAMPDIFF(SECOND,begin_time,create_time)) termId,
COUNT(customer_id) dataCount,
MAX(CONVERT(answer_rate,DECIMAL(5,2))) search
FROM course_progress WHERE customer_id=#{0} GROUP BY dataTime ORDER BY dataTime DESC
) t ORDER BY dataTime LIMIT #{startIndex}, 5
</select>
<select id="getSpecialTermCourseSumById" parameterType="long" resultType="com.chuanqi.reading.home.entity.TermCourse">
SELECT i.term_id termId, count(*) courseNum,
CONCAT(SUM(TIMESTAMPDIFF(SECOND, r.begin_time, IFNULL(p.create_time, r.end_time))) div 60, ':', LPAD(SUM(TIMESTAMPDIFF(SECOND, r.begin_time, IFNULL(p.create_time, r.end_time))) mod 60, 2, '0')) TimeTotal
FROM course_read r
INNER JOIN course_info i ON r.course_id = i.course_id AND i.term_id = #{termId}
LEFT JOIN course_progress p on p.course_id = r.course_id and p.customer_id = #{userId} and r.progress_Id=p.Id
LEFT JOIN v_course_article v ON v.course_id = r.course_id
WHERE r.customer_id = #{userId} and r.read_flag = 1 and (r.progress_id IS NOT NULL or v.course_name is not null)
GROUP BY i.term_id
</select>
<!--查询个人概况- 专项培训 完成的课程列表-->
<select id="getSpecialTermCourseList" parameterType="long" resultType="com.chuanqi.reading.home.entity.CourseInfo">
SELECT ci.course_id id, ci.course_name name, ci.course_num num, ci.term_id termId
from course_info ci where ci.term_Id=#{termId} and
(exists(select * from v_course_article ca inner join
course_read cr on ca.course_id = cr.course_id and cr.read_flag = 1 and cr.customer_id = #{userId} where ci.course_id=cr.course_id) OR
exists(select * from course_read r inner join
course_progress cp on r.progress_id = cp.id and r.read_flag = 1 and r.customer_id = #{userId} where ci.course_id=r.course_id ))
</select>
<!--查询个人概况- 公开培训 主题列表-->
<select id="getPubThemeList" parameterType="long" resultType="com.chuanqi.reading.home.entity.Theme">
select ct.theme_id themeId, ct.theme_name themeName
from course_theme ct
where exists(select * from course_info ci inner join course_read cr on ci.course_id = cr.course_id and cr.customer_id = #{userId} and cr.read_flag = 1
where ci.course_num = ct.theme_id and ci.term_id &lt; 0 )
</select>
<select id="getPubThemeById" parameterType="long" resultType="com.chuanqi.reading.home.entity.Theme">
select ct.theme_id themeId, ct.theme_name themeName
from course_theme ct where ct.theme_id = #{themeId}
</select>
<select id="getPubThemeCourseSumById" parameterType="long" resultType="com.chuanqi.reading.home.entity.ThemeCourse">
SELECT ci.course_num themeId, count(*) AS courseNum,
CONCAT(SUM(TIMESTAMPDIFF(SECOND, cr.begin_time, IFNULL(p.create_time, cr.end_time))) div 60,':', LPAD(SUM(TIMESTAMPDIFF(SECOND, cr.begin_time, IFNULL(p.create_time, cr.end_time))) mod 60, 2, '0')) TimeTotal
FROM course_read cr INNER JOIN course_info ci ON cr.course_id = ci.course_id AND ci.term_id &lt; 0 LEFT JOIN
v_course_article va ON cr.course_id = va.course_id LEFT JOIN course_progress p ON p.course_id = cr.course_id AND p.customer_id = #{userId} AND cr.progress_Id = p.Id
WHERE cr.customer_id = #{userId} AND cr.read_flag = 1 AND ci.course_num = #{themeId}
AND (cr.progress_id IS NOT NULL OR va.course_name IS NOT NULL)
GROUP BY course_num
</select>
<select id="getPubThemeCourseList" parameterType="long" resultType="com.chuanqi.reading.home.entity.CourseInfo">
select ci.course_id id, ci.course_name name, ci.course_num themeId
from course_info ci
where ci.course_num = #{themeId} and ci.term_id &lt; 0 and
exists(select * from course_read cr left join v_course_article va on cr.course_id = va.course_id
where cr.customer_id = #{userId} and cr.read_flag = 1 and (NOT ISNULL(cr.progress_id) or NOT ISNULL(va.course_name)) and cr.course_id =ci.course_id)
</select>
</mapper>
\ No newline at end of file
... ...
<?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.chuanqi.reading.home.dao.SysDeptDao">
<!--查询部门信息 SUBSTRING去除0,100,的父级节点-->
<select id="queryDeptById" resultType="com.chuanqi.reading.home.entity.SysDept" parameterType="long">
SELECT dept_id deptId, parent_id parentId, SUBSTRING(sys_dept.ancestors, 7) ancestors, dept_name deptName, order_num FROM sys_dept
WHERE dept_id = #{deptId}
</select>
<!--查询部门祖级列表信息-->
<select id="queryDeptAncestors" resultType="String" parameterType="map">
select GROUP_CONCAT(dept_name) from sys_dept where dept_id in (${deptIds})
</select>
<!--查询父节点下的子节点-->
<select id="queryDeptByParentId" resultType="com.chuanqi.reading.home.entity.SysDept" parameterType="long">
SELECT dept_id deptId, parent_id parentId, dept_name deptName FROM sys_dept
WHERE status='0' and del_flag='0' and parent_id = #{deptId} ORDER BY order_num
</select>
<!--查询一级部门和其下属班级以及汇总各班级人数-->
<select id="selectDeptListByPId" resultType="com.chuanqi.reading.home.entity.SysDept" parameterType="long">
SELECT d.dept_id deptId, dept_name deptName, IFNULL(class_count, 0) ancestors , IFNULL(user_num,0) orderNum
FROM sys_dept d LEFT JOIN (SELECT dept_id, COUNT(dept_id) class_count FROM course_term GROUP BY dept_id) t
ON d.dept_id=t.dept_id
LEFT JOIN (
SELECT dept_id, SUM(IFNULL(user_count,0)) user_num FROM course_term term
LEFT JOIN (SELECT term_id, COUNT(user_id) user_count FROM course_term_student GROUP BY term_id) ts
ON term.term_id=ts.term_id GROUP BY dept_id
) temp ON t.dept_id=temp.dept_id
WHERE d.parent_id=#{deptId} AND d.dept_id>0 AND d.del_flag = '0' AND d.STATUS = 0 AND class_count>0 ORDER BY d.order_num
</select>
</mapper>
\ No newline at end of file
... ...
<?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.chuanqi.reading.home.dao.SysUserDao">
<select id="queryUser" parameterType="com.chuanqi.reading.home.entity.SysUser" resultType="com.chuanqi.reading.home.entity.SysUser">
select user_id userId, dept_id deptId, login_name loginName, user_name userName, open_id openId from sys_user
where del_flag='0' and status='0'
<if test="userId != null and userId !=0">
AND user_id=#{userId}
</if>
</select>
<!--登录查询用户信息-->
<select id="queryUserByLogin" resultType="com.chuanqi.reading.home.entity.SysUser"
parameterType="com.chuanqi.reading.home.entity.SysUser">
select user_id userId, login_name loginName, user_name userName, open_id openId from sys_user
where del_flag='0' and status='0' and phonenumber=#{phonenumber}
</select>
<!--登录查询用户信息-->
<select id="queryUserByOpenId" resultType="com.chuanqi.reading.home.entity.SysUser" parameterType="String">
select user_id userId, dept_id deptId, user_name userName, email, phonenumber, sex,
open_id openId, nick_name nickName, wx_avatar wxAvatar,
status, login_date loginDate from sys_user
where del_flag='0' and status='0' and open_id=#{0}
</select>
<!--更新用户登录信息-->
<update id="updateUserByUserId" parameterType="com.chuanqi.reading.home.entity.SysUser">
update sys_user
<set>
<if test="openId != null and openId != ''">open_id = #{openId},</if>
<if test="nickName != null and nickName != ''">nick_name = #{nickName},</if>
<if test="wxAvatar != null and wxAvatar != ''">wx_avatar = #{wxAvatar},</if>
<if test="loginIp != null and loginIp != ''">login_ip = #{loginIp},</if>
login_date = sysdate()
</set>
where user_id = #{userId}
</update>
<!--更新用户部门信息-->
<update id="updateDeptByUserId" parameterType="com.chuanqi.reading.home.entity.SysUser">
update sys_user set dept_id = #{deptId} where user_id = #{userId}
</update>
<!--更新用户OpenId-->
<update id="updateOpenIdByUserId" parameterType="com.chuanqi.reading.home.entity.SysUser">
update sys_user set open_id = #{openId} where user_id = #{userId}
</update>
<!--新增用户信息-->
<insert id="insertUser" parameterType="com.chuanqi.reading.home.entity.SysUser" useGeneratedKeys="true" keyProperty="userId">
insert into sys_user(login_name, user_name, phonenumber, open_id, user_type, create_time)
values (#{loginName}, #{userName}, #{phonenumber}, #{openId}, '11', sysdate())
</insert>
<!--查询班级学员-->
<select id="queryUserByTermId" parameterType="long" resultType="com.chuanqi.reading.home.entity.SysUser">
SELECT s.user_id userId,s.user_name userName FROM course_term_student stu LEFT JOIN sys_user s ON stu.user_id=s.user_id
WHERE term_id=#{termId}
</select>
<!-- 插入用户签到打卡信息 -->
<insert id="insertUserLocation" parameterType="com.chuanqi.reading.home.entity.Location" useGeneratedKeys="true"
keyProperty="id">
insert into sys_user_location(user_id, term_id, latitude, longitude, state, create_time)
values (#{userId}, #{termId}, #{latitude}, #{longitude}, #{state}, sysdate())
</insert>
</mapper>
\ No newline at end of file
... ...
<?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.chuanqi.reading.home.dao.SystemDao">
<!--查询数据字典表 -->
<select id="queryDictData" resultType="java.util.Map" parameterType="java.util.Map">
select dict_value value,
dict_label label,
remark
from sys_dict_data
where dict_type = #{type}
and status = '0'
ORDER BY dict_sort
</select>
</mapper>
\ No newline at end of file
... ...
sys.title=\u5feb\u6613\u8bad\u57f9\u8bad\u6f14\u793a\u5e73\u53f0
\ No newline at end of file
... ...
<?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="STDOUT_LOGGING" />
</settings>
</configuration>
\ No newline at end of file
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:p="http://www.springframework.org/schema/p"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
xmlns:util="http://www.springframework.org/schema/util" xmlns:cache="http://www.springframework.org/schema/cache"
xmlns:task="http://www.springframework.org/schema/task"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-4.0.xsd
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-4.0.xsd"
default-lazy-init="false">
<context:component-scan base-package="com.chuanqi.reading">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 数据源-->
<bean id="dataSource" class="org.apache.tomcat.jdbc.pool.DataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver" />
<property name="url" value="jdbc:mysql://119.3.81.232:3306/pinggu_db?useUnicode=true&amp;characterEncoding=UTF-8&amp;serverTimezone=GMT%2B8"/>
<property name="username" value="bronet" />
<property name="password" value="BroNet2021" />
<property name="maxActive" value="30" />
<property name="maxIdle" value="15" />
<property name="initialSize" value="5" />
<property name="validationQuery" value="SELECT 1" />
<property name="testOnBorrow" value="true" />
<property name="testOnReturn" value="true" />
<property name="testWhileIdle" value="true" />
</bean>
<!-- 会话工厂bean sqlSessionFactoryBean -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<!-- 数据源 -->
<property name="dataSource" ref="dataSource" />
<!-- 别名 -->
<property name="typeAliasesPackage" value="com.chuanqi.reading.*.entity" />
<!-- sql映射文件路径 -->
<property name="mapperLocations" value="classpath*:mapper/*.xml" />
<!-- 配置文件 -->
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean>
<!-- 自动扫描对象关系映射 -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<!--指定会话工厂,如果当前上下文中只定义了一个则该属性可省去 -->
<property name="sqlSessionFactoryBeanName" value="sqlSessionFactory" />
<!-- 指定要自动扫描接口的基础包,实现接口 -->
<property name="basePackage" value="com.chuanqi.reading.*.dao" />
</bean>
<!-- 声明式事务管理 -->
<!--定义事物管理器,由spring管理事务 -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- 支持注解驱动的事务管理,指定事务管理器 -->
<tx:annotation-driven transaction-manager="transactionManager"/>
<!-- aspectj支持自动代理实现AOP功能 -->
<aop:aspectj-autoproxy proxy-target-class="true" />
<util:properties id="wxProperties" location="classpath:/wx.properties"/>
</beans>
... ...
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd">
<!-- <context:property-placeholder location="classpath:config.properties" ignore-unresolvable="true"/> -->
<mvc:annotation-driven />
<mvc:default-servlet-handler /><!--spring默认Servlet-->
<context:component-scan base-package="com.chuanqi.reading.*.control" />
<mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/**"/>
<mvc:exclude-mapping path="/resource/**"/>
<mvc:exclude-mapping path="/login/**"/>
<mvc:exclude-mapping path="/check"/>
<mvc:exclude-mapping path="/core"/>
<mvc:exclude-mapping path="/MP_verify_gYyg01S75mxBaAI4.txt"/>
<bean class="com.chuanqi.reading.wechat.interceptor.WeChatInterceptor"/>
</mvc:interceptor>
</mvc:interceptors>
<!-- json乱码转换器 -->
<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"
p:ignoreDefaultModelOnRedirect="true">
<property name="cacheSeconds" value="0" />
<property name="messageConverters">
<list>
<ref bean="mappingJacksonHttpMessageConverter" />
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:contentType="text/html"
p:prefix="/WEB-INF/view/" p:suffix=".jsp" p:viewClass="org.springframework.web.servlet.view.JstlView" />
<mvc:resources mapping="/resource/**" location="/resource/" />
<bean id="localeResolver" class="org.springframework.web.servlet.i18n.FixedLocaleResolver">
<property name="defaultLocale" value="zh_CN" />
</bean>
<!-- 资源文件绑定 -->
<bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource">
<property name="basename" value="messages" />
<property name="defaultEncoding" value="UTF-8" />
<property name="useCodeAsDefaultMessage" value="true" />
</bean>
<!-- 国际化请求拦截器处理 -->
<!--<mvc:interceptors>
<bean class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor" />
</mvc:interceptors> -->
<!-- 异常处理类 -->
<bean id="exceptionHandler" class="com.chuanqi.reading.wechat.handler.ExceptionHandler" />
<!-- 系统错误转发配置[并记录错误日志] -->
<bean
class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<property name="defaultErrorView" value="error" />
<property name="defaultStatusCode" value="500" /><!-- 默认为500,系统错误(error.jsp) -->
<property name="statusCodes"><!-- 配置多个statusCode -->
<props>
<prop key="500">500</prop> <!-- 500.jsp -->
<prop key="404">404</prop> <!-- 404.jsp -->
</props>
</property>
</bean>
<!-- 文件上传 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"
p:defaultEncoding="UTF-8" >
<property name="maxUploadSize" value="104857600" />
<property name="maxInMemorySize" value="4096" />
</bean>
</beans>
\ No newline at end of file
... ...
##\u516C\u4F17\u53F7 APP_ID
#appId=wxf73d6679eb44ec74
##\u516C\u4F17\u53F7 APP_SECRET
#appSecret=96255e3d8bbdac52023d3b564c8c2067
##\u516C\u4F17\u53F7 TOKEN
#token=QU7J21Sf2xsS9odeIO19OsoXosX92jqJ
##\u516C\u4F17\u53F7 AES_KEY
#aesKey=
#domain=peixunpingtai.youngmakers.cn
#template=nlq3zgR9CMvIxBPP-6xsuGYjRxHOP45ZBRs7YZmSmY4
##domain=gmxtcs.fsygroup.com
##template=
appId=wxed9c28a16a30132a
appSecret=5006027484170752812a010453a12735
token=hello
aesKey=
domain=139.129.101.173
template=0vy4c3t_eJHHyvAZVKTYivXzuKl-ZWq0w_Py6tpPjWA
\ No newline at end of file
... ...