Commit 21d1bd0f1f0adf61a009591e897f6401b5091c66
1 parent
e5f98c16
Exists in
master
招生咨询会
Showing
13 changed files
with
373 additions
and
35 deletions
Show diff stats
src/main/java/com/sincere/student/controller/SysYxController.java
1 | package com.sincere.student.controller; | 1 | package com.sincere.student.controller; |
2 | 2 | ||
3 | import com.sincere.student.dto.BaseDto; | 3 | import com.sincere.student.dto.BaseDto; |
4 | +import com.sincere.student.dto.IdDto; | ||
4 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; | 5 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; |
5 | import com.sincere.student.dto.yx.AddYxSchoolVo; | 6 | import com.sincere.student.dto.yx.AddYxSchoolVo; |
7 | +import com.sincere.student.dto.yx.CountYxSchoolConsult; | ||
8 | +import com.sincere.student.dto.yx.QueryCountYxSchoolConsult; | ||
6 | import com.sincere.student.model.yx.SysYxSchool; | 9 | import com.sincere.student.model.yx.SysYxSchool; |
7 | import com.sincere.student.model.yx.SysYxSchoolConsult; | 10 | import com.sincere.student.model.yx.SysYxSchoolConsult; |
8 | import com.sincere.student.service.SysYxColumnService; | 11 | import com.sincere.student.service.SysYxColumnService; |
@@ -34,9 +37,9 @@ public class SysYxController { | @@ -34,9 +37,9 @@ public class SysYxController { | ||
34 | } | 37 | } |
35 | 38 | ||
36 | @ApiOperation("删除学校") | 39 | @ApiOperation("删除学校") |
37 | - @GetMapping(value = "delSchool") | ||
38 | - public BaseDto delSchool(@RequestParam Integer id) { | ||
39 | - sysYxColumnService.delSchool(id); | 40 | + @PostMapping(value = "delSchool") |
41 | + public BaseDto delSchool(@RequestBody IdDto idDto) { | ||
42 | + sysYxColumnService.delSchool(idDto.getId()); | ||
40 | return new BaseDto(); | 43 | return new BaseDto(); |
41 | } | 44 | } |
42 | 45 | ||
@@ -107,27 +110,35 @@ public class SysYxController { | @@ -107,27 +110,35 @@ public class SysYxController { | ||
107 | } | 110 | } |
108 | 111 | ||
109 | @ApiOperation("删除咨询会(传主键)") | 112 | @ApiOperation("删除咨询会(传主键)") |
110 | - @GetMapping(value = "/delConsult") | ||
111 | - public BaseDto deleteConsult(@RequestParam Integer id) { | 113 | + @PostMapping(value = "/delConsult") |
114 | + public BaseDto deleteConsult(@RequestBody IdDto idDto) { | ||
112 | BaseDto result = new BaseDto(); | 115 | BaseDto result = new BaseDto(); |
113 | - sysYxColumnService.delConsult(id); | 116 | + sysYxColumnService.delConsult(idDto.getId()); |
114 | return result; | 117 | return result; |
115 | } | 118 | } |
116 | 119 | ||
117 | @ApiOperation("获取详情") | 120 | @ApiOperation("获取详情") |
118 | - @GetMapping(value = "/getConsultDetail") | ||
119 | - public BaseDto getConsultDetail(@RequestParam Integer id) { | 121 | + @PostMapping(value = "/getConsultDetail") |
122 | + public BaseDto getConsultDetail(@RequestBody IdDto idDto) { | ||
120 | BaseDto result = new BaseDto(); | 123 | BaseDto result = new BaseDto(); |
121 | - SysYxSchoolConsult consult = sysYxColumnService.getConsultDetail(id); | 124 | + SysYxSchoolConsult consult = sysYxColumnService.getConsultDetail(idDto.getId()); |
122 | result.setData(consult); | 125 | result.setData(consult); |
123 | return result; | 126 | return result; |
124 | } | 127 | } |
125 | 128 | ||
126 | @ApiOperation("累加阅读量接口") | 129 | @ApiOperation("累加阅读量接口") |
127 | - @GetMapping(value = "/updateRead") | ||
128 | - public BaseDto updateRead(@RequestParam Integer id) { | 130 | + @PostMapping(value = "/updateRead") |
131 | + public BaseDto updateRead(@RequestBody IdDto idDto) { | ||
129 | BaseDto result = new BaseDto(); | 132 | BaseDto result = new BaseDto(); |
130 | - sysYxColumnService.updateRead(id); | 133 | + sysYxColumnService.updateRead(idDto.getId()); |
134 | + return result; | ||
135 | + } | ||
136 | + | ||
137 | + @ApiOperation("统计接口") | ||
138 | + @PostMapping(value = "/countNum") | ||
139 | + public BaseDto<Page<CountYxSchoolConsult>> updateRead(@RequestBody QueryCountYxSchoolConsult consult) { | ||
140 | + BaseDto<Page<CountYxSchoolConsult>> result = new BaseDto<>(); | ||
141 | + result.setData(sysYxColumnService.countConsultList(consult)); | ||
131 | return result; | 142 | return result; |
132 | } | 143 | } |
133 | } | 144 | } |
src/main/java/com/sincere/student/dto/yx/AddYxSchoolConsultVo.java
@@ -12,7 +12,7 @@ public class AddYxSchoolConsultVo extends PageDto { | @@ -12,7 +12,7 @@ public class AddYxSchoolConsultVo extends PageDto { | ||
12 | @ApiModelProperty(value = "学校id") | 12 | @ApiModelProperty(value = "学校id") |
13 | private Integer schoolId; | 13 | private Integer schoolId; |
14 | @ApiModelProperty(value = "标题描述") | 14 | @ApiModelProperty(value = "标题描述") |
15 | - private Integer titleDesc; | 15 | + private String titleDesc; |
16 | @ApiModelProperty(value = "视频地址") | 16 | @ApiModelProperty(value = "视频地址") |
17 | private String videoUrl; | 17 | private String videoUrl; |
18 | @ApiModelProperty(value = "内容") | 18 | @ApiModelProperty(value = "内容") |
@@ -21,8 +21,6 @@ public class AddYxSchoolConsultVo extends PageDto { | @@ -21,8 +21,6 @@ public class AddYxSchoolConsultVo extends PageDto { | ||
21 | private String background; | 21 | private String background; |
22 | @ApiModelProperty(value = "图片地址") | 22 | @ApiModelProperty(value = "图片地址") |
23 | private String imgUrl; | 23 | private String imgUrl; |
24 | - @ApiModelProperty(value = "时间") | ||
25 | - private Date createTime; | ||
26 | @ApiModelProperty(value = "排序") | 24 | @ApiModelProperty(value = "排序") |
27 | private Integer sort; | 25 | private Integer sort; |
28 | @ApiModelProperty(value = "状态 0预览1发布") | 26 | @ApiModelProperty(value = "状态 0预览1发布") |
@@ -48,11 +46,11 @@ public class AddYxSchoolConsultVo extends PageDto { | @@ -48,11 +46,11 @@ public class AddYxSchoolConsultVo extends PageDto { | ||
48 | this.schoolId = schoolId; | 46 | this.schoolId = schoolId; |
49 | } | 47 | } |
50 | 48 | ||
51 | - public Integer getTitleDesc() { | 49 | + public String getTitleDesc() { |
52 | return titleDesc; | 50 | return titleDesc; |
53 | } | 51 | } |
54 | 52 | ||
55 | - public void setTitleDesc(Integer titleDesc) { | 53 | + public void setTitleDesc(String titleDesc) { |
56 | this.titleDesc = titleDesc; | 54 | this.titleDesc = titleDesc; |
57 | } | 55 | } |
58 | 56 | ||
@@ -88,14 +86,6 @@ public class AddYxSchoolConsultVo extends PageDto { | @@ -88,14 +86,6 @@ public class AddYxSchoolConsultVo extends PageDto { | ||
88 | this.imgUrl = imgUrl; | 86 | this.imgUrl = imgUrl; |
89 | } | 87 | } |
90 | 88 | ||
91 | - public Date getCreateTime() { | ||
92 | - return createTime; | ||
93 | - } | ||
94 | - | ||
95 | - public void setCreateTime(Date createTime) { | ||
96 | - this.createTime = createTime; | ||
97 | - } | ||
98 | - | ||
99 | public Integer getSort() { | 89 | public Integer getSort() { |
100 | return sort; | 90 | return sort; |
101 | } | 91 | } |
src/main/java/com/sincere/student/dto/yx/AddYxSchoolVo.java
@@ -9,6 +9,9 @@ public class AddYxSchoolVo extends PageDto { | @@ -9,6 +9,9 @@ public class AddYxSchoolVo extends PageDto { | ||
9 | private String schoolName; | 9 | private String schoolName; |
10 | 10 | ||
11 | private Integer schoolType; | 11 | private Integer schoolType; |
12 | + private String province; | ||
13 | + private String city; | ||
14 | + private String area; | ||
12 | 15 | ||
13 | public Integer getId() { | 16 | public Integer getId() { |
14 | return id; | 17 | return id; |
@@ -33,4 +36,28 @@ public class AddYxSchoolVo extends PageDto { | @@ -33,4 +36,28 @@ public class AddYxSchoolVo extends PageDto { | ||
33 | public void setSchoolType(Integer schoolType) { | 36 | public void setSchoolType(Integer schoolType) { |
34 | this.schoolType = schoolType; | 37 | this.schoolType = schoolType; |
35 | } | 38 | } |
39 | + | ||
40 | + public String getProvince() { | ||
41 | + return province; | ||
42 | + } | ||
43 | + | ||
44 | + public void setProvince(String province) { | ||
45 | + this.province = province; | ||
46 | + } | ||
47 | + | ||
48 | + public String getCity() { | ||
49 | + return city; | ||
50 | + } | ||
51 | + | ||
52 | + public void setCity(String city) { | ||
53 | + this.city = city; | ||
54 | + } | ||
55 | + | ||
56 | + public String getArea() { | ||
57 | + return area; | ||
58 | + } | ||
59 | + | ||
60 | + public void setArea(String area) { | ||
61 | + this.area = area; | ||
62 | + } | ||
36 | } | 63 | } |
src/main/java/com/sincere/student/dto/yx/CountYxSchoolConsult.java
0 → 100644
@@ -0,0 +1,64 @@ | @@ -0,0 +1,64 @@ | ||
1 | +package com.sincere.student.dto.yx; | ||
2 | + | ||
3 | +public class CountYxSchoolConsult { | ||
4 | + | ||
5 | + private String province; | ||
6 | + | ||
7 | + private String city; | ||
8 | + | ||
9 | + private String area; | ||
10 | + | ||
11 | + private Integer addVideoNum; | ||
12 | + | ||
13 | + private Integer totalVideoNum; | ||
14 | + | ||
15 | + private Integer totalReadNum; | ||
16 | + | ||
17 | + public String getProvince() { | ||
18 | + return province; | ||
19 | + } | ||
20 | + | ||
21 | + public void setProvince(String province) { | ||
22 | + this.province = province; | ||
23 | + } | ||
24 | + | ||
25 | + public String getCity() { | ||
26 | + return city; | ||
27 | + } | ||
28 | + | ||
29 | + public void setCity(String city) { | ||
30 | + this.city = city; | ||
31 | + } | ||
32 | + | ||
33 | + public String getArea() { | ||
34 | + return area; | ||
35 | + } | ||
36 | + | ||
37 | + public void setArea(String area) { | ||
38 | + this.area = area; | ||
39 | + } | ||
40 | + | ||
41 | + public Integer getAddVideoNum() { | ||
42 | + return addVideoNum; | ||
43 | + } | ||
44 | + | ||
45 | + public void setAddVideoNum(Integer addVideoNum) { | ||
46 | + this.addVideoNum = addVideoNum; | ||
47 | + } | ||
48 | + | ||
49 | + public Integer getTotalVideoNum() { | ||
50 | + return totalVideoNum; | ||
51 | + } | ||
52 | + | ||
53 | + public void setTotalVideoNum(Integer totalVideoNum) { | ||
54 | + this.totalVideoNum = totalVideoNum; | ||
55 | + } | ||
56 | + | ||
57 | + public Integer getTotalReadNum() { | ||
58 | + return totalReadNum; | ||
59 | + } | ||
60 | + | ||
61 | + public void setTotalReadNum(Integer totalReadNum) { | ||
62 | + this.totalReadNum = totalReadNum; | ||
63 | + } | ||
64 | +} | ||
0 | \ No newline at end of file | 65 | \ No newline at end of file |
src/main/java/com/sincere/student/dto/yx/QueryCountYxSchoolConsult.java
0 → 100644
@@ -0,0 +1,56 @@ | @@ -0,0 +1,56 @@ | ||
1 | +package com.sincere.student.dto.yx; | ||
2 | + | ||
3 | +import com.sincere.student.dto.PageDto; | ||
4 | + | ||
5 | +public class QueryCountYxSchoolConsult extends PageDto { | ||
6 | + | ||
7 | + private String province; | ||
8 | + | ||
9 | + private String city; | ||
10 | + | ||
11 | + private String area; | ||
12 | + | ||
13 | + private String startTime; | ||
14 | + | ||
15 | + private String endTime; | ||
16 | + | ||
17 | + public String getProvince() { | ||
18 | + return province; | ||
19 | + } | ||
20 | + | ||
21 | + public void setProvince(String province) { | ||
22 | + this.province = province; | ||
23 | + } | ||
24 | + | ||
25 | + public String getCity() { | ||
26 | + return city; | ||
27 | + } | ||
28 | + | ||
29 | + public void setCity(String city) { | ||
30 | + this.city = city; | ||
31 | + } | ||
32 | + | ||
33 | + public String getArea() { | ||
34 | + return area; | ||
35 | + } | ||
36 | + | ||
37 | + public void setArea(String area) { | ||
38 | + this.area = area; | ||
39 | + } | ||
40 | + | ||
41 | + public String getStartTime() { | ||
42 | + return startTime; | ||
43 | + } | ||
44 | + | ||
45 | + public void setStartTime(String startTime) { | ||
46 | + this.startTime = startTime; | ||
47 | + } | ||
48 | + | ||
49 | + public String getEndTime() { | ||
50 | + return endTime; | ||
51 | + } | ||
52 | + | ||
53 | + public void setEndTime(String endTime) { | ||
54 | + this.endTime = endTime; | ||
55 | + } | ||
56 | +} | ||
0 | \ No newline at end of file | 57 | \ No newline at end of file |
src/main/java/com/sincere/student/mapper/SysYxSchoolConsultMapper.java
1 | package com.sincere.student.mapper; | 1 | package com.sincere.student.mapper; |
2 | 2 | ||
3 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; | 3 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; |
4 | +import com.sincere.student.dto.yx.QueryCountYxSchoolConsult; | ||
4 | import com.sincere.student.model.yx.SysYxSchoolConsult; | 5 | import com.sincere.student.model.yx.SysYxSchoolConsult; |
5 | import org.apache.ibatis.annotations.Param; | 6 | import org.apache.ibatis.annotations.Param; |
6 | 7 | ||
@@ -22,4 +23,8 @@ public interface SysYxSchoolConsultMapper { | @@ -22,4 +23,8 @@ public interface SysYxSchoolConsultMapper { | ||
22 | List<SysYxSchoolConsult> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id); | 23 | List<SysYxSchoolConsult> countSort(@Param(value = "sort") int sort, @Param(value = "flag") int flag, @Param(value = "id") Integer id); |
23 | 24 | ||
24 | int updateSort(SysYxSchoolConsult record); | 25 | int updateSort(SysYxSchoolConsult record); |
26 | + | ||
27 | + List<SysYxSchoolConsult> countConsultList(QueryCountYxSchoolConsult consult); | ||
28 | + | ||
29 | +// int getCountConsult(QueryCountYxSchoolConsult record); | ||
25 | } | 30 | } |
26 | \ No newline at end of file | 31 | \ No newline at end of file |
src/main/java/com/sincere/student/model/yx/SysYxSchool.java
@@ -11,6 +11,10 @@ public class SysYxSchool { | @@ -11,6 +11,10 @@ public class SysYxSchool { | ||
11 | 11 | ||
12 | private Date createTime; | 12 | private Date createTime; |
13 | 13 | ||
14 | + private String province; | ||
15 | + private String city; | ||
16 | + private String area; | ||
17 | + | ||
14 | public Integer getId() { | 18 | public Integer getId() { |
15 | return id; | 19 | return id; |
16 | } | 20 | } |
@@ -42,4 +46,12 @@ public class SysYxSchool { | @@ -42,4 +46,12 @@ public class SysYxSchool { | ||
42 | public void setCreateTime(Date createTime) { | 46 | public void setCreateTime(Date createTime) { |
43 | this.createTime = createTime; | 47 | this.createTime = createTime; |
44 | } | 48 | } |
49 | + | ||
50 | + public String getProvince() { | ||
51 | + return province; | ||
52 | + } | ||
53 | + | ||
54 | + public void setProvince(String province) { | ||
55 | + this.province = province; | ||
56 | + } | ||
45 | } | 57 | } |
46 | \ No newline at end of file | 58 | \ No newline at end of file |
src/main/java/com/sincere/student/model/yx/SysYxSchoolConsult.java
@@ -9,6 +9,8 @@ public class SysYxSchoolConsult { | @@ -9,6 +9,8 @@ public class SysYxSchoolConsult { | ||
9 | 9 | ||
10 | private Integer columnType; | 10 | private Integer columnType; |
11 | 11 | ||
12 | + private String titleDesc; | ||
13 | + | ||
12 | private String videoUrl; | 14 | private String videoUrl; |
13 | 15 | ||
14 | private String context; | 16 | private String context; |
@@ -122,4 +124,43 @@ public class SysYxSchoolConsult { | @@ -122,4 +124,43 @@ public class SysYxSchoolConsult { | ||
122 | public void setModelList(String modelList) { | 124 | public void setModelList(String modelList) { |
123 | this.modelList = modelList == null ? null : modelList.trim(); | 125 | this.modelList = modelList == null ? null : modelList.trim(); |
124 | } | 126 | } |
127 | + | ||
128 | + public String getTitleDesc() { | ||
129 | + return titleDesc; | ||
130 | + } | ||
131 | + | ||
132 | + public void setTitleDesc(String titleDesc) { | ||
133 | + this.titleDesc = titleDesc; | ||
134 | + } | ||
135 | + | ||
136 | + private String province; | ||
137 | + | ||
138 | + private String city; | ||
139 | + | ||
140 | + private String area; | ||
141 | + | ||
142 | + public String getProvince() { | ||
143 | + | ||
144 | + return province; | ||
145 | + } | ||
146 | + | ||
147 | + public void setProvince(String province) { | ||
148 | + this.province = province; | ||
149 | + } | ||
150 | + | ||
151 | + public String getCity() { | ||
152 | + return city; | ||
153 | + } | ||
154 | + | ||
155 | + public void setCity(String city) { | ||
156 | + this.city = city; | ||
157 | + } | ||
158 | + | ||
159 | + public String getArea() { | ||
160 | + return area; | ||
161 | + } | ||
162 | + | ||
163 | + public void setArea(String area) { | ||
164 | + this.area = area; | ||
165 | + } | ||
125 | } | 166 | } |
126 | \ No newline at end of file | 167 | \ No newline at end of file |
src/main/java/com/sincere/student/service/SysYxColumnService.java
@@ -2,6 +2,8 @@ package com.sincere.student.service; | @@ -2,6 +2,8 @@ package com.sincere.student.service; | ||
2 | 2 | ||
3 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; | 3 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; |
4 | import com.sincere.student.dto.yx.AddYxSchoolVo; | 4 | import com.sincere.student.dto.yx.AddYxSchoolVo; |
5 | +import com.sincere.student.dto.yx.CountYxSchoolConsult; | ||
6 | +import com.sincere.student.dto.yx.QueryCountYxSchoolConsult; | ||
5 | import com.sincere.student.model.ColumnType; | 7 | import com.sincere.student.model.ColumnType; |
6 | import com.sincere.student.model.yx.SysYxSchool; | 8 | import com.sincere.student.model.yx.SysYxSchool; |
7 | import com.sincere.student.model.yx.SysYxSchoolConsult; | 9 | import com.sincere.student.model.yx.SysYxSchoolConsult; |
@@ -30,4 +32,6 @@ public interface SysYxColumnService { | @@ -30,4 +32,6 @@ public interface SysYxColumnService { | ||
30 | SysYxSchoolConsult getConsultDetail(Integer id); | 32 | SysYxSchoolConsult getConsultDetail(Integer id); |
31 | 33 | ||
32 | void updateRead(Integer id); | 34 | void updateRead(Integer id); |
35 | + | ||
36 | + Page<CountYxSchoolConsult> countConsultList(QueryCountYxSchoolConsult consult); | ||
33 | } | 37 | } |
src/main/java/com/sincere/student/service/impl/SysYxColumnServiceImpl.java
@@ -3,22 +3,26 @@ package com.sincere.student.service.impl; | @@ -3,22 +3,26 @@ package com.sincere.student.service.impl; | ||
3 | import com.github.pagehelper.PageHelper; | 3 | import com.github.pagehelper.PageHelper; |
4 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; | 4 | import com.sincere.student.dto.yx.AddYxSchoolConsultVo; |
5 | import com.sincere.student.dto.yx.AddYxSchoolVo; | 5 | import com.sincere.student.dto.yx.AddYxSchoolVo; |
6 | +import com.sincere.student.dto.yx.CountYxSchoolConsult; | ||
7 | +import com.sincere.student.dto.yx.QueryCountYxSchoolConsult; | ||
6 | import com.sincere.student.mapper.SysYxColumnTypeMapper; | 8 | import com.sincere.student.mapper.SysYxColumnTypeMapper; |
7 | import com.sincere.student.mapper.SysYxSchoolConsultMapper; | 9 | import com.sincere.student.mapper.SysYxSchoolConsultMapper; |
8 | import com.sincere.student.mapper.SysYxSchoolMapper; | 10 | import com.sincere.student.mapper.SysYxSchoolMapper; |
9 | import com.sincere.student.model.ColumnType; | 11 | import com.sincere.student.model.ColumnType; |
10 | -import com.sincere.student.model.yx.SysYxColumnType; | ||
11 | -import com.sincere.student.model.yx.SysYxSchool; | ||
12 | -import com.sincere.student.model.yx.SysYxSchoolConsult; | 12 | +import com.sincere.student.model.yx.*; |
13 | import com.sincere.student.service.SysYxColumnService; | 13 | import com.sincere.student.service.SysYxColumnService; |
14 | import com.sincere.student.utils.Page; | 14 | import com.sincere.student.utils.Page; |
15 | +import org.apache.commons.lang3.StringUtils; | ||
15 | import org.springframework.beans.BeanUtils; | 16 | import org.springframework.beans.BeanUtils; |
16 | import org.springframework.beans.factory.annotation.Autowired; | 17 | import org.springframework.beans.factory.annotation.Autowired; |
17 | import org.springframework.stereotype.Service; | 18 | import org.springframework.stereotype.Service; |
18 | import org.springframework.util.CollectionUtils; | 19 | import org.springframework.util.CollectionUtils; |
19 | 20 | ||
21 | +import java.util.ArrayList; | ||
20 | import java.util.Date; | 22 | import java.util.Date; |
21 | import java.util.List; | 23 | import java.util.List; |
24 | +import java.util.Map; | ||
25 | +import java.util.stream.Collectors; | ||
22 | 26 | ||
23 | @Service | 27 | @Service |
24 | public class SysYxColumnServiceImpl implements SysYxColumnService { | 28 | public class SysYxColumnServiceImpl implements SysYxColumnService { |
@@ -149,6 +153,7 @@ public class SysYxColumnServiceImpl implements SysYxColumnService { | @@ -149,6 +153,7 @@ public class SysYxColumnServiceImpl implements SysYxColumnService { | ||
149 | i++; | 153 | i++; |
150 | } | 154 | } |
151 | } | 155 | } |
156 | + consult.setCreateTime(new Date()); | ||
152 | if(schoolConsultVo.getId() != null){ | 157 | if(schoolConsultVo.getId() != null){ |
153 | sysYxSchoolConsultMapper.updateByPrimaryKeySelective(consult); | 158 | sysYxSchoolConsultMapper.updateByPrimaryKeySelective(consult); |
154 | }else { | 159 | }else { |
@@ -188,4 +193,46 @@ public class SysYxColumnServiceImpl implements SysYxColumnService { | @@ -188,4 +193,46 @@ public class SysYxColumnServiceImpl implements SysYxColumnService { | ||
188 | result.setCount(sysYxSchoolConsultMapper.getListCount(vo)); | 193 | result.setCount(sysYxSchoolConsultMapper.getListCount(vo)); |
189 | return result; | 194 | return result; |
190 | } | 195 | } |
196 | + | ||
197 | + | ||
198 | + @Override | ||
199 | + public Page<CountYxSchoolConsult> countConsultList(QueryCountYxSchoolConsult consult) { | ||
200 | + Page<CountYxSchoolConsult> result = new Page<>(consult.getPage(), consult.getPageSize()); | ||
201 | + PageHelper.startPage(consult.getPage(), consult.getPageSize()); | ||
202 | + List<SysYxSchoolConsult> list = sysYxSchoolConsultMapper.countConsultList(consult); | ||
203 | + List<CountYxSchoolConsult> resultConsult = new ArrayList<>(); | ||
204 | + if(list.size()>0){ | ||
205 | + Map<String, List<SysYxSchoolConsult>> map = list.parallelStream() | ||
206 | + .filter(s->StringUtils.isNotEmpty(s.getArea())) | ||
207 | + .collect(Collectors.groupingBy(SysYxSchoolConsult::getArea)); | ||
208 | + if(!map.isEmpty()){ | ||
209 | + for (Map.Entry<String, List<SysYxSchoolConsult>> entry : map.entrySet()) { | ||
210 | + CountYxSchoolConsult countYxSchoolConsult = new CountYxSchoolConsult(); | ||
211 | + | ||
212 | + List<SysYxSchoolConsult> keyList = entry.getValue(); | ||
213 | + SysYxSchoolConsult sysYxSchoolConsult = keyList.get(0); | ||
214 | + String area = entry.getKey(); | ||
215 | + | ||
216 | + QueryCountYxSchoolConsult query = new QueryCountYxSchoolConsult(); | ||
217 | + query.setArea(area); | ||
218 | + List<SysYxSchoolConsult> total = sysYxSchoolConsultMapper.countConsultList(query); | ||
219 | + int totalReadNum = total.stream().mapToInt(SysYxSchoolConsult::getReadNumber).sum(); | ||
220 | + countYxSchoolConsult.setProvince(sysYxSchoolConsult.getProvince()); | ||
221 | + countYxSchoolConsult.setCity(sysYxSchoolConsult.getCity()); | ||
222 | + countYxSchoolConsult.setArea(sysYxSchoolConsult.getArea()); | ||
223 | + countYxSchoolConsult.setTotalReadNum(totalReadNum); | ||
224 | + countYxSchoolConsult.setTotalVideoNum(total.size()); | ||
225 | + if(StringUtils.isNotBlank(consult.getStartTime()) && StringUtils.isNotBlank(consult.getEndTime())){ | ||
226 | + countYxSchoolConsult.setAddVideoNum(keyList.size()); | ||
227 | + }else{ | ||
228 | + countYxSchoolConsult.setAddVideoNum(total.size()); | ||
229 | + } | ||
230 | + resultConsult.add(countYxSchoolConsult); | ||
231 | + } | ||
232 | + } | ||
233 | + } | ||
234 | + result.setList(resultConsult); | ||
235 | + result.setCount(resultConsult.size()); | ||
236 | + return result; | ||
237 | + } | ||
191 | } | 238 | } |
src/main/resources/application.yaml
@@ -31,5 +31,5 @@ mybatis: | @@ -31,5 +31,5 @@ mybatis: | ||
31 | 31 | ||
32 | logging: | 32 | logging: |
33 | level: | 33 | level: |
34 | -# com.sincere.student.mapper: info | ||
35 | - com.sincere.student.mapper: DEBUG | ||
36 | \ No newline at end of file | 34 | \ No newline at end of file |
35 | + com.sincere.student.mapper: info | ||
36 | +# com.sincere.student.mapper: DEBUG | ||
37 | \ No newline at end of file | 37 | \ No newline at end of file |
src/main/resources/mapper/SysYxSchoolConsultMapper.xml
@@ -14,6 +14,9 @@ | @@ -14,6 +14,9 @@ | ||
14 | <result column="background" jdbcType="VARCHAR" property="background" /> | 14 | <result column="background" jdbcType="VARCHAR" property="background" /> |
15 | <result column="model_list" jdbcType="VARCHAR" property="modelList" /> | 15 | <result column="model_list" jdbcType="VARCHAR" property="modelList" /> |
16 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | 16 | <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> |
17 | + <result column="province" jdbcType="VARCHAR" property="province" /> | ||
18 | + <result column="city" jdbcType="VARCHAR" property="city" /> | ||
19 | + <result column="area" jdbcType="VARCHAR" property="area" /> | ||
17 | </resultMap> | 20 | </resultMap> |
18 | <sql id="Base_Column_List"> | 21 | <sql id="Base_Column_List"> |
19 | id, school_id, title_desc, video_url, context, img_url, sort, status, read_number, | 22 | id, school_id, title_desc, video_url, context, img_url, sort, status, read_number, |
@@ -47,7 +50,7 @@ | @@ -47,7 +50,7 @@ | ||
47 | </where> | 50 | </where> |
48 | </select> | 51 | </select> |
49 | 52 | ||
50 | - <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultMap="BaseResultMap"> | 53 | + <select id="getListCount" parameterType="com.sincere.student.dto.yx.AddYxSchoolConsultVo" resultType="java.lang.Integer"> |
51 | select | 54 | select |
52 | count(1) | 55 | count(1) |
53 | from sys_yx_school_consult | 56 | from sys_yx_school_consult |
@@ -55,7 +58,7 @@ | @@ -55,7 +58,7 @@ | ||
55 | <if test="schoolId != null"> | 58 | <if test="schoolId != null"> |
56 | and school_id = #{schoolId} | 59 | and school_id = #{schoolId} |
57 | </if> | 60 | </if> |
58 | - <if test="titleDesc != null"> | 61 | + <if test="titleDesc != null and titleDesc !=''"> |
59 | and title_desc like #{titleDesc} | 62 | and title_desc like #{titleDesc} |
60 | </if> | 63 | </if> |
61 | </where> | 64 | </where> |
@@ -196,4 +199,53 @@ | @@ -196,4 +199,53 @@ | ||
196 | <update id="updateSort" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult"> | 199 | <update id="updateSort" parameterType="com.sincere.student.model.yx.SysYxSchoolConsult"> |
197 | update university_consult set sort = #{sort} where id=#{id} | 200 | update university_consult set sort = #{sort} where id=#{id} |
198 | </update> | 201 | </update> |
202 | + | ||
203 | + | ||
204 | + <select id="countConsultList" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultMap="BaseResultMap"> | ||
205 | + select | ||
206 | + ssc.*,ss.province,ss.city,ss.area | ||
207 | + from sys_yx_school_consult ssc | ||
208 | + left join sys_yx_school ss ON ssc.school_id = ss.id | ||
209 | + <where> | ||
210 | + <if test="province != null and province !=''"> | ||
211 | + and ss.provnice = #{provnice} | ||
212 | + </if> | ||
213 | + <if test="city != null and city !=''"> | ||
214 | + and ss.city = #{city} | ||
215 | + </if> | ||
216 | + <if test="area != null and area !=''"> | ||
217 | + and ss.area = #{area} | ||
218 | + </if> | ||
219 | + <if test="startTime != null and startTime.trim() !=''"> | ||
220 | + <![CDATA[ and ssc.create_time >= #{startTime} ]]> | ||
221 | + </if> | ||
222 | + <if test="endTime != null and endTime.trim() !=''"> | ||
223 | + <![CDATA[ and ssc.create_time < #{endTime} ]]> | ||
224 | + </if> | ||
225 | + </where> | ||
226 | + </select> | ||
227 | + | ||
228 | +<!-- <select id="getCountConsult" parameterType="com.sincere.student.dto.yx.QueryCountYxSchoolConsult" resultType="java.lang.Integer">--> | ||
229 | +<!-- select--> | ||
230 | +<!-- ssc.*,ss.province,ss.city,ss.area--> | ||
231 | +<!-- from sys_yx_school_consult ssc--> | ||
232 | +<!-- left join sys_yx_school ss ON ssc.school_id = ss.id--> | ||
233 | +<!-- <where>--> | ||
234 | +<!-- <if test="province != null and province !=''">--> | ||
235 | +<!-- and ss.provnice = #{provnice}--> | ||
236 | +<!-- </if>--> | ||
237 | +<!-- <if test="city != null and city !=''">--> | ||
238 | +<!-- and ss.city = #{city}--> | ||
239 | +<!-- </if>--> | ||
240 | +<!-- <if test="area != null and area !=''">--> | ||
241 | +<!-- and ss.area = #{area}--> | ||
242 | +<!-- </if>--> | ||
243 | +<!-- <if test="startTime != null and startTime.trim() !=''">--> | ||
244 | +<!-- <![CDATA[ and ssc.create_time >= #{startTime} ]]>--> | ||
245 | +<!-- </if>--> | ||
246 | +<!-- <if test="endTime != null and endTime.trim() !=''">--> | ||
247 | +<!-- <![CDATA[ and ssc.create_time < #{endTime} ]]>--> | ||
248 | +<!-- </if>--> | ||
249 | +<!-- </where>--> | ||
250 | +<!-- </select>--> | ||
199 | </mapper> | 251 | </mapper> |
200 | \ No newline at end of file | 252 | \ No newline at end of file |
src/main/resources/mapper/SysYxSchoolMapper.xml
@@ -5,10 +5,12 @@ | @@ -5,10 +5,12 @@ | ||
5 | <id column="id" jdbcType="INTEGER" property="id" /> | 5 | <id column="id" jdbcType="INTEGER" property="id" /> |
6 | <result column="school_name" jdbcType="VARCHAR" property="schoolName" /> | 6 | <result column="school_name" jdbcType="VARCHAR" property="schoolName" /> |
7 | <result column="school_type" jdbcType="INTEGER" property="schoolType" /> | 7 | <result column="school_type" jdbcType="INTEGER" property="schoolType" /> |
8 | - <result column="create_time" jdbcType="TIMESTAMP" property="createTime" /> | 8 | + <result column="province" jdbcType="VARCHAR" property="province" /> |
9 | + <result column="city" jdbcType="VARCHAR" property="city" /> | ||
10 | + <result column="area" jdbcType="VARCHAR" property="area" /> | ||
9 | </resultMap> | 11 | </resultMap> |
10 | <sql id="Base_Column_List"> | 12 | <sql id="Base_Column_List"> |
11 | - id, school_name, school_type, create_time | 13 | + id, school_name, school_type, create_time,province,city,area |
12 | </sql> | 14 | </sql> |
13 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> | 15 | <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap"> |
14 | select | 16 | select |
@@ -40,7 +42,7 @@ | @@ -40,7 +42,7 @@ | ||
40 | count(0) | 42 | count(0) |
41 | from sys_yx_school | 43 | from sys_yx_school |
42 | <where> | 44 | <where> |
43 | - <if test="schoolName != null"> | 45 | + <if test="schoolName != null and schoolName !=''"> |
44 | and school_name = #{schoolName} | 46 | and school_name = #{schoolName} |
45 | </if> | 47 | </if> |
46 | <if test="schoolType != null"> | 48 | <if test="schoolType != null"> |
@@ -64,6 +66,15 @@ | @@ -64,6 +66,15 @@ | ||
64 | <if test="createTime != null"> | 66 | <if test="createTime != null"> |
65 | create_time, | 67 | create_time, |
66 | </if> | 68 | </if> |
69 | + <if test="province != null"> | ||
70 | + province, | ||
71 | + </if> | ||
72 | + <if test="city != null"> | ||
73 | + city, | ||
74 | + </if> | ||
75 | + <if test="area != null"> | ||
76 | + area, | ||
77 | + </if> | ||
67 | </trim> | 78 | </trim> |
68 | <trim prefix="values (" suffix=")" suffixOverrides=","> | 79 | <trim prefix="values (" suffix=")" suffixOverrides=","> |
69 | <if test="id != null"> | 80 | <if test="id != null"> |
@@ -78,6 +89,15 @@ | @@ -78,6 +89,15 @@ | ||
78 | <if test="createTime != null"> | 89 | <if test="createTime != null"> |
79 | #{createTime,jdbcType=TIMESTAMP}, | 90 | #{createTime,jdbcType=TIMESTAMP}, |
80 | </if> | 91 | </if> |
92 | + <if test="province != null"> | ||
93 | + #{province,jdbcType=VARCHAR}, | ||
94 | + </if> | ||
95 | + <if test="city != null"> | ||
96 | + #{city,jdbcType=VARCHAR}, | ||
97 | + </if> | ||
98 | + <if test="area != null"> | ||
99 | + #{area,jdbcType=VARCHAR}, | ||
100 | + </if> | ||
81 | </trim> | 101 | </trim> |
82 | </insert> | 102 | </insert> |
83 | <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchool"> | 103 | <update id="updateByPrimaryKeySelective" parameterType="com.sincere.student.model.yx.SysYxSchool"> |
@@ -92,6 +112,15 @@ | @@ -92,6 +112,15 @@ | ||
92 | <if test="createTime != null"> | 112 | <if test="createTime != null"> |
93 | create_time = #{createTime,jdbcType=TIMESTAMP}, | 113 | create_time = #{createTime,jdbcType=TIMESTAMP}, |
94 | </if> | 114 | </if> |
115 | + <if test="province != null"> | ||
116 | + province = #{province,jdbcType=VARCHAR}, | ||
117 | + </if> | ||
118 | + <if test="city != null"> | ||
119 | + city = #{city,jdbcType=VARCHAR}, | ||
120 | + </if> | ||
121 | + <if test="area != null"> | ||
122 | + area = #{area,jdbcType=VARCHAR}, | ||
123 | + </if> | ||
95 | </set> | 124 | </set> |
96 | where id = #{id,jdbcType=INTEGER} | 125 | where id = #{id,jdbcType=INTEGER} |
97 | </update> | 126 | </update> |