zhangjinli 3 years ago
parent 6e75099150
commit 8f2c65efee

@ -158,9 +158,9 @@ public class UtilsController {
public Result test(){
//获取员工排名进排名数据库
QueryWrapper<RankListDTO> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("date_format(v.creatAt, '%Y-%m')",LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM")));
queryWrapper.groupBy("u.id");
queryWrapper.orderByDesc("value");
queryWrapper.eq("date_format(v.creatAt, '%Y-%m')",LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM")));
List<RankListVo> rankUserList = qywxDepartmentUserLinkMapper.getUserRankList(queryWrapper);
return Result.success(rankUserList);
}

@ -7,13 +7,13 @@
from user as u
LEFT JOIN video as v ON u.id = v.userId and v.status &lt;&gt; 3
LEFT JOIN qywxDepartment as qd on qd.departmentId = u.main_department
${ew.SqlSegment}
${ew.customSqlSegment}
</select>
<select id="getDepartmentRankList" resultType="com.zh.project0512.model.vo.RankListVo">
select qd.departmentId as linkId,qd.name as title,sum(r.value) as value
from qywxDepartment as qd
LEFT JOIN qywxDepartmentUserLink as qdul on qd.departmentId = qdul.departmentId
LEFT JOIN rank as r on r.linkId=qdul.openid
${ew.SqlSegment}
${ew.customSqlSegment}
</select>
</mapper>

Loading…
Cancel
Save