Commit 54013b144d1210eab6d45b57a137fede85d35bf3

Authored by 周伟鹏
1 parent a98301b9

优化代码

src/main/java/com/cnlive/shenhe/serviceImpl/VideosServiceImpl.java
... ... @@ -6,6 +6,7 @@ import com.cnlive.shenhe.entity.ShyVideos;
6 6 import com.cnlive.shenhe.mapper.ShySitesMapper;
7 7 import com.cnlive.shenhe.mapper.ShyUsersMapper;
8 8 import com.cnlive.shenhe.mapper.ShyVideosMapper;
  9 +import com.cnlive.shenhe.utils.CommonConst;
9 10 import com.cnlive.shenhe.utils.CommonUtils;
10 11 import com.github.pagehelper.PageHelper;
11 12 import com.github.pagehelper.PageInfo;
... ... @@ -46,7 +47,7 @@ public class VideosServiceImpl {
46 47 }
47 48  
48 49 public List<ShyVideos> findshyVideo(ShyVideos shyVideos) {
49   - List<ShyVideos> shyVideoslist = shyVideosMapper.selectByRowBounds(shyVideos,new RowBounds(0,100));
  50 + List<ShyVideos> shyVideoslist = shyVideosMapper.selectByRowBounds(shyVideos, new RowBounds(0, 100));
50 51 return shyVideoslist;
51 52 }
52 53  
... ... @@ -110,19 +111,21 @@ public class VideosServiceImpl {
110 111 }
111 112  
112 113 public ShyVideos getDetailsContent(Integer id) {
113   - ShyVideos DetailsshyVideos = shyVideosMapper.selectByPrimaryKey(id);
114   - String auditorName = "白名单";
115   - String auditor_id = DetailsshyVideos.getAuditor_id();
116   - if (CommonUtils.isNotEmpty(auditor_id)) {
117   - ShyUsers user = new ShyUsers();
118   - user.setUser_id(auditor_id);
119   - user = shyUsersMapper.selectOne(user);
120   - String userName = CommonUtils.isEmpty(user.getUsername())?"":user.getUsername();
121   - String email = CommonUtils.isEmpty(user.getEmail())?"":user.getEmail();
122   - auditorName = userName + email;
  114 + ShyVideos shyVideos = shyVideosMapper.selectByPrimaryKey(id);
  115 + if (shyVideos.getState() != CommonConst.AUDIT_INTT) {
  116 + String auditorName = "白名单";
  117 + String auditor_id = shyVideos.getAuditor_id();
  118 + if(CommonUtils.isNotEmpty(auditor_id)){
  119 + ShyUsers user = new ShyUsers();
  120 + user.setUser_id(auditor_id);
  121 + user = shyUsersMapper.selectOne(user);
  122 + String userName = CommonUtils.isEmpty(user.getUsername()) ? "" : user.getUsername();
  123 + String email = CommonUtils.isEmpty(user.getEmail()) ? "" : user.getEmail();
  124 + auditorName = userName + email;
  125 + }
  126 + shyVideos.setAuditor(auditorName);
123 127 }
124   - DetailsshyVideos.setAuditor(auditorName);
125   - return DetailsshyVideos;
  128 + return shyVideos;
126 129 }
127 130  
128 131 }
... ...