zhangjinli 3 years ago
parent 61a1b18c0a
commit e32a186894

@ -1,10 +1,12 @@
package com.zh.project0512.controller.manage;
import com.zh.project0512.annotation.AdminTokenValid;
import com.zh.project0512.mapper.AdminMapper;
import com.zh.project0512.model.dto.RankListDTO;
import com.zh.project0512.utils.result.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
@ -18,11 +20,14 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/manage/statistics")
public class StatisticsController {
// @Operation(summary = "排行列表")
// @PostMapping("/list")
// @AdminTokenValid
// public Result rankList(@Validated @RequestBody RankListDTO rankListDTO) {
// return Result.success(rankService.rankList(rankListDTO), "请求成功");
// }
@Autowired
private AdminMapper adminMapper;
@Operation(summary = "数据")
@PostMapping("/data1")
@AdminTokenValid
public Result rankList(@Validated @RequestBody RankListDTO rankListDTO) {
adminMapper.statistics1();
return Result.success( adminMapper.statistics1(), "请求成功");
}
}

@ -1,7 +1,9 @@
package com.zh.project0512.mapper;
import com.alibaba.fastjson.JSONObject;
import com.zh.project0512.model.Admin;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;
/**
* <p>
@ -12,5 +14,16 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
* @since 2022-06-10
*/
public interface AdminMapper extends BaseMapper<Admin> {
@Select("SELECT \n" +
"(SELECT COUNT(1) from task) as taskNum,\n" +
"(SELECT COUNT(1) from reference) as referenceNum,\n" +
"(SELECT COUNT(1) from customerActionNote) as customerActionNoteNum,\n" +
"sum(IFNULL(v.playNum,0)) as playNumSum, \n" +
"sum(IFNULL(v.commendNum,0)) as commendNumSum, \n" +
"sum(IFNULL(v.collectionNum,0)) as collectionNumSum, \n" +
"sum(IFNULL(v.commentNum,0)) as commentNumSum, \n" +
"sum(IFNULL(v.reSendNum,0)) as reSendNumSum, \n" +
"sum(IFNULL(v.recommendNum,0)) as recommendNumSum\n" +
" from video as v ")
JSONObject statistics1();
}

@ -13,7 +13,7 @@ import org.apache.ibatis.annotations.Update;
* @since 2022-05-26
*/
public interface BrandMapper extends BaseMapper<Brand> {
@Update("update brand set sortWeight = sortWeight + 1 where sortWeight &lt;&gt; 0;;\n" +
@Update("update brand set sortWeight = sortWeight + 1 where sortWeight <> 0;;\n" +
"insert into brand ( name, creatAt,sortWeight) VALUES ( #{name}, #{creatAt},1 );")
void addBrand(Brand brand);
@Update("<script>" +

@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Update;
* @since 2022-05-22
*/
public interface TagMapper extends BaseMapper<Tag> {
@Update("update tag set sortWeight = sortWeight + 1 where sortWeight &lt;&gt; 0;\n" +
@Update("update tag set sortWeight = sortWeight + 1 where sortWeight <> 0;\n" +
"insert into tag ( title, creatAt,sortWeight) VALUES ( #{title}, #{creatAt},1 );")
void addTag(Tag tag);
@Update("<script>" +

@ -14,7 +14,7 @@ import org.apache.ibatis.annotations.Update;
* @since 2022-06-14
*/
public interface TeachingRefeMapper extends BaseMapper<TeachingRefe> {
@Update("update teachingRefe set sortWeight = sortWeight + 1 where sortWeight &lt;&gt; 0;;\n" +
@Update("update teachingRefe set sortWeight = sortWeight + 1 where sortWeight <> 0;\n" +
"insert into teachingRefe ( fileUrl,type,title, creatAt,sortWeight) VALUES ( #{fileUrl},#{type},#{title}, #{creatAt},1 );")
void addTeachingRefe(TeachingRefe teachingRefe);
@Update("<script>" +

Loading…
Cancel
Save