Commit 589c11aba45d0fb9e74d9b478b6e4c31eedd95e0

Authored by 王言钊
1 parent 76d28cbd

优化1

src/main/java/com/cnlive/shenhe/controller/VideosController.java
... ... @@ -250,7 +250,8 @@ public class VideosController extends BaseController {
250 250 yuming = ks_domain + "/";
251 251 }
252 252 detailsContent.setAttr_tags(CommonUtils.isEmpty(detailsContent.getAttr_tags()) ? "" : detailsContent.getAttr_tags());
253   -
  253 + List<ShyActivity> activityList = shyActivityImpl.selectAll();
  254 + //model.addAttribute("activityList", activityList);
254 255 ShySites shySites = sitesService.findspidDescByspid(detailsContent.getSpid());
255 256 if (CommonUtils.isNotNull(shySites)) {
256 257 if (CommonUtils.isNotEmpty(detailsContent.getCategory()) && detailsContent.getCategory().equals(CommonConst.CATEGORY_WITNESS)) {
... ... @@ -259,13 +260,11 @@ public class VideosController extends BaseController {
259 260  
260 261 //如果source1不等于null;直接查询
261 262 if (CommonUtils.isNotEmpty(source1)) {
262   - List<ShyActivity> activityList = shyActivityImpl.selectAll();
263   - model.addAttribute("activityList", activityList);
264   - //遍历集合拿到集合中的每一个对象
265 263 for (ShyActivity activity : activityList) {
266   - //从对象中获取属性值set给videos对象
267   - detailsContent.setSpid_desc(activity.getActivity());
268   -
  264 + if (activity.getId().equals(Integer.valueOf(source1))) {
  265 + detailsContent.setSpid_desc(activity.getActivity());
  266 + break;
  267 + }
269 268 }
270 269 }
271 270  
... ...
src/main/resources/templates/page/video.html
... ... @@ -135,21 +135,22 @@
135 135 </div>
136 136 </div>
137 137  
138   - <th:block th:text="${source}"></th:block>
  138 +
139 139 <div class="col-md-6" style="padding: 0;width: 25%;">
140 140 <label for="state" class="control-label cb-toolbar">分类:</label>
141 141 <div class="col-sm-10" style="padding: 0;">
142 142 <select class="form-control" id="source" name="source">
143   - <option value="" th:selected="selected">全部</option>
144 143  
145   - <option th:selected="${activitys.id eq source}"
146   - th:each="activitys : ${activityList}"
147   - th:value="${activitys.id}">
148   - <th:block th:text="${activitys.activity}"></th:block>
  144 + <option value="" >全部</option>
  145 + <option th:each="activitys : ${activityList}"
  146 + th:selected="${source}==${activitys.id}"
  147 + th:value="${activitys.id}"
  148 + th:text="${activitys.activity}">
149 149 </option>
150 150  
151 151 </select>
152   - <!--<input class="form-control" name="video_priority" type="text" id="video_priority">-->
  152 +
  153 + <!--< input class="form-control" name="video_priority" type="text" id="video_priority">-->
153 154 </div>
154 155 </div>
155 156 </div>
... ...