Commit 4a2ff26b authored by 耿迪迪's avatar 耿迪迪

我的培训

parent ebb358f3
package com.zehong.web.controller.trainmanage;
import java.util.List;
import com.zehong.common.core.domain.entity.SysUser;
import com.zehong.common.core.domain.model.LoginUser;
import com.zehong.common.utils.ServletUtils;
import com.zehong.framework.web.service.TokenService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
......@@ -33,6 +38,9 @@ public class TTrainManageController extends BaseController
@Autowired
private ITTrainManageService tTrainManageService;
@Autowired
private TokenService tokenService;
/**
* 查询培训管理列表
*/
......@@ -100,4 +108,16 @@ public class TTrainManageController extends BaseController
{
return toAjax(tTrainManageService.deleteTTrainManageByIds(trainManageIds));
}
/**
* 根据培训人员查询培训课程
* @param trainPersonId 培训人员
* @return
*/
@RequestMapping("/getTrainInfoByPersonId")
public AjaxResult getTrainInfoByPersonId(){
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
return AjaxResult.success(tTrainManageService.getTrainInfoByPersonId(user.getUserId()));
}
}
......@@ -96,6 +96,16 @@ public class SysUser extends BaseEntity
/** 岗位组 */
private Long[] postIds;
private String enterpriseId;
public String getEnterpriseId() {
return enterpriseId;
}
public void setEnterpriseId(String enterpriseId) {
this.enterpriseId = enterpriseId;
}
public SysUser()
{
......
......@@ -67,6 +67,8 @@ public class TTrainManage extends BaseEntity
/**培训人员*/
private List<TTrainPerson> tTrainPersonList;
private String isFinish;
public void setTrainManageId(Long trainManageId)
{
this.trainManageId = trainManageId;
......@@ -175,6 +177,14 @@ public class TTrainManage extends BaseEntity
this.tTrainPersonList = tTrainPersonList;
}
public String getIsFinish() {
return isFinish;
}
public void setIsFinish(String isFinish) {
this.isFinish = isFinish;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
......
......@@ -58,4 +58,11 @@ public interface TTrainManageMapper
* @return 结果
*/
public int deleteTTrainManageByIds(Long[] trainManageIds);
/**
* 根据培训人员查询培训课程
* @param trainPersonId 培训人员
* @return
*/
List<TTrainManage> getTrainInfoByPersonId(Long trainPersonId);
}
......@@ -58,4 +58,11 @@ public interface ITTrainManageService
* @return 结果
*/
public int deleteTTrainManageById(Long trainManageId);
/**
* 根据培训人员查询培训课程
* @param trainPersonId 培训人员
* @return
*/
List<TTrainManage> getTrainInfoByPersonId(Long trainPersonId);
}
......@@ -109,8 +109,17 @@ public class TTrainManageServiceImpl implements ITTrainManageService
* @return 结果
*/
@Override
@Transactional(rollbackFor = Exception.class)
public int deleteTTrainManageByIds(Long[] trainManageIds)
{
for(Long trainMangeId : trainManageIds){
TTrainPerson tTrainPerson = new TTrainPerson();
tTrainPerson.setTrainManageId(trainMangeId);
List<TTrainPerson> personList = tTrainPersonMapper.selectTTrainPersonList(tTrainPerson);
if(null != personList && personList.size()>0){
tTrainPersonMapper.deleteTTrainPersonByTrainManageId(trainMangeId);
}
}
return tTrainManageMapper.deleteTTrainManageByIds(trainManageIds);
}
......@@ -124,5 +133,14 @@ public class TTrainManageServiceImpl implements ITTrainManageService
public int deleteTTrainManageById(Long trainManageId)
{
return tTrainManageMapper.deleteTTrainManageById(trainManageId);
}
/**
* 根据培训人员查询培训课程
* @param trainPersonId 培训人员
* @return
*/
public List<TTrainManage> getTrainInfoByPersonId(Long trainPersonId){
return tTrainManageMapper.getTrainInfoByPersonId(trainPersonId);
}
}
......@@ -70,6 +70,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="phonenumber != null and phonenumber != ''">
AND u.phonenumber like concat('%', #{phonenumber}, '%')
</if>
<if test="enterpriseId != null and enterpriseId != ''">
AND enter.enterprise_id = #{enterpriseId}
</if>
<if test="nickName != null and nickName != ''">
AND u.nick_name like concat('%', #{nickName}, '%')
</if>
<if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 -->
AND date_format(u.create_time,'%y%m%d') &gt;= date_format(#{params.beginTime},'%y%m%d')
</if>
......
......@@ -19,6 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="isDel" column="is_del" />
<result property="isFinish" column="is_finish" />
</resultMap>
<sql id="selectTTrainManageVo">
......@@ -110,4 +111,29 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{trainManageId}
</foreach>
</delete>
<select id="getTrainInfoByPersonId" parameterType="Long" resultMap="TTrainManageResult">
SELECT
manage.train_manage_id,
manage.lesson_name,
manage.train_duration,
manage.train_start_time,
manage.train_end_time,
manage.lesson_content,
manage.video_url,
manage.annex_url,
manage.train_status,
manage.publish_time,
CASE WHEN manage.train_start_time >NOW() THEN '3'
WHEN now() > manage.train_end_time THEN '2'
ELSE person.is_finish END AS is_finish
FROM
t_train_manage manage
LEFT JOIN t_train_person person ON person.train_manage_id = manage.train_manage_id
<where>
manage.train_status = '1'
AND person.train_person_id = #{trainPersonId}
</where>
</select>
</mapper>
\ No newline at end of file
......@@ -27,10 +27,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
person.update_time,
person.remark,
person.is_del,
people.employed_people_name as trainPersonName
sysu.nick_name as trainPersonName
FROM
t_train_person person
LEFT JOIN t_employed_people_info people on people.employed_people_id = person.train_person_id
LEFT JOIN sys_user sysu on sysu.user_id = person.train_person_id
</sql>
<select id="selectTTrainPersonList" parameterType="TTrainPerson" resultMap="TTrainPersonResult">
......
......@@ -41,7 +41,7 @@
<select id="trainStatDetail" parameterType="Long" resultMap="trainStatDetailResult">
SELECT
people.employed_people_name,
sysu.nick_name AS employed_people_name,
enterprise.enterprise_name,
SEC_TO_TIME(person.reality_train_duration) AS reality_train_duration,
(
......@@ -54,8 +54,8 @@
) AS isComplete
FROM
t_train_person person
LEFT JOIN t_employed_people_info people ON people.employed_people_id = person.train_person_id
LEFT JOIN t_enterprise_info enterprise ON enterprise.enterprise_id = people.beyond_enterprise_id
LEFT JOIN sys_user sysu ON sysu.user_id = person.train_person_id
LEFT JOIN t_enterprise_info enterprise ON enterprise.enterprise_id = sysu.dept_id AND sysu.dept_id != '-2'
<where>
person.train_manage_id = #{trainManageId}
</where>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment