update code

dev_xds
haha 2024-01-16 22:54:21 +08:00
parent 003921c7b3
commit f0ddfdc118
5 changed files with 52 additions and 0 deletions

View File

@ -45,4 +45,25 @@ public class BgWorkTrainController extends BaseController {
return getDataTable(workTrainService.selectBgscreenWorkTrainListv2(workTrain));
}
/**
*
* @return
*/
@GetMapping("/getGroupByDataType")
public AjaxResult getGroupByDataType(String deptId, String projectId){
WorkTrain workTrain = new WorkTrain();
if(deptId!=null && !"0".equals(deptId)){
workTrain.setNowDept(deptId);
}else{
if (SecurityUtils.isUserB()) {
workTrain.setPrjIds(getProjectIds());
}
}
if(projectId!=null && !"0".equals(projectId)){
workTrain.setProjectId(Convert.toLong(projectId));
}
return AjaxResult.success(workTrainService.getGroupByDataType(workTrain));
}
}

View File

@ -118,4 +118,6 @@ public interface WorkTrainMapper
* @return
*/
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
public List<WorkTrain> getGroupByDataType(WorkTrain workTrain);
}

View File

@ -92,4 +92,6 @@ public interface IWorkTrainService
* @return
*/
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId);
public List<WorkTrain> getGroupByDataType(WorkTrain workTrain);
}

View File

@ -220,4 +220,9 @@ public class WorkTrainServiceImpl implements IWorkTrainService
public List<Map<String,Object>> findGroupCountByProjectId(Long projectId) {
return workTrainMapper.findGroupCountByProjectId(projectId);
}
@Override
public List<WorkTrain> getGroupByDataType(WorkTrain workTrain) {
return workTrainMapper.getGroupByDataType(workTrain);
}
}

View File

@ -199,6 +199,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</trim>
</insert>
<update id="updateWorkTrain" parameterType="WorkTrain">
update work_train
<trim prefix="SET" suffixOverrides=",">
@ -252,4 +253,25 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.trainId}, #{item.deptId}, #{item.isMain})
</foreach>
</insert>
<select id="getGroupByDataType" parameterType="WorkTrain" resultMap="WorkTrainResult">
SELECT a.dict_value data_type,dict_label train_title,css_class train_type,b.cnt id
FROM (
SELECT *
FROM sys_dict_data WHERE dict_type='work_train_data_type' ) a
LEFT JOIN
(
SELECT COUNT(1) cnt,data_type
FROM work_train
<where>
<if test="projectId != null"> and project_id = #{projectId}</if>
<if test="prjIds !=null and prjIds.size()>0">
and project_id in
<foreach collection="prjIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</if>
</where>
GROUP BY data_type
) b ON a.dict_value=b.data_type
</select>
</mapper>