Commit 358385b2 authored by Quxl's avatar Quxl

x

parent 27952906
......@@ -7,6 +7,8 @@ import com.egolm.film.model.LoginToken;
public interface TokenService {
LoginToken getToken();
Object getTokenObj();
LoginToken doLogin(String username, String password);
......
......@@ -73,6 +73,13 @@ public class AdminTokenServiceImpl implements AdminTokenService {
LoginToken token = (LoginToken)session.getAttribute(TOKEN_NAME);
return token;
}
@Override
public Object getTokenObj() {
Integer id = (Integer)this.getToken().getId();
Fc_admin obj = jdbcTemplate.queryForBean("select * from fc_admin where adminid = ?", Fc_admin.class, id);
return obj;
}
@Override
public void doLogout() {
......@@ -114,5 +121,5 @@ public class AdminTokenServiceImpl implements AdminTokenService {
Object[] objs = new Object[]{LOG_TYPE, loginid, prefix, path, ip, content, user_agent, now};
jdbcTemplate.executeUpdate(sql, objs);
}
}
......@@ -497,14 +497,15 @@ public class FilmServiceImpl implements FilmService {
public List<Map<String, Object>> queryReviewList(String keyword, Integer enroll_type_id, Integer film_type_name,
Integer film_type_name_short, String film_country, Integer[] review_round, Integer[] review_state,
Page page) {
SqlWhere w1 = new SqlWhere()
.append("mf.film_type_name in (select film_type_id from fc_admin_group_filmtype where group_id = ?)", group_id)
.gt("mf.review_round", 0)
.lk(new String[]{"mf.en_name", "mf.cn_name"}, keyword)
.eq("mf.film_type_name", film_type_name)
.eq("mf.film_type_name_short", film_type_name_short)
.eq("mf.film_country", film_country)
.in("mf.review_round", review_round);
.in("mf.review_round", review_round)
;
String sql = "select mf.id, mf.review_round, mf.origion_name, mf.en_name, mf.cn_name, mf.film_type_name, mf.film_country, r.review_state, r.result_text, (select GROUP_CONCAT(mfd.playactor_name) from fc_member_film_playactor mfd where mfd.film_id = mf.id and mfd.playactor_type = 'director') director_name from fc_member_film mf left join fc_review r on r.film_id = mf.id and r.review_round = mf.review_round" + StringUtil.join(" and ", " where ", "", "", w1.getStringList());
if(enroll_type_id != null) {
sql = "select t.* from (" + sql + ") t, fc_member_film_enroll mfe where t.id = mfe.film_id and mfe.enroll_type_id = " + enroll_type_id;
......
......@@ -72,6 +72,13 @@ public class MemberTokenServiceImpl implements MemberTokenService {
LoginToken token = (LoginToken)session.getAttribute(TOKEN_NAME);
return token;
}
@Override
public Object getTokenObj() {
Integer id = (Integer)this.getToken().getId();
Fc_member obj = jdbcTemplate.queryForBean("select * from fc_member where id = ?", Fc_member.class, id);
return obj;
}
@Override
public void doLogout() {
......
......@@ -68,6 +68,13 @@ public class UserTokenServiceImpl implements UserTokenService {
LoginToken token = (LoginToken)session.getAttribute(TOKEN_NAME);
return token;
}
@Override
public Object getTokenObj() {
Integer id = (Integer)this.getToken().getId();
Fc_user obj = jdbcTemplate.queryForBean("select * from fc_user where uid = ?", Fc_user.class, id);
return obj;
}
@Override
public void doLogout() {
......
......@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
import com.egolm.film.api.service.AdminTokenService;
import com.egolm.film.api.service.FilmService;
import io.swagger.annotations.Api;
......@@ -25,6 +26,9 @@ public class AdminReviewController {
@Autowired
FilmService filmService;
@Autowired
AdminTokenService tokenService;
@ResponseBody
@PostMapping("list")
......@@ -44,6 +48,7 @@ public class AdminReviewController {
index = index == null ? 1 : index;
limit = limit == null ? 20 : limit;
Page page = new Page(index, limit);
Integer adminid = (Integer)tokenService.getToken().getId();
List<Map<String, Object>> list = filmService.queryReviewList(keyword, enroll_type_id, film_type_name, film_type_name_short, film_country, review_round, review_state, page);
return Rjx.jsonOk().setData(list).setPage(page);
}
......
......@@ -15,6 +15,14 @@ public class SqlWhere {
this.objList = new ArrayList<Object>();
}
public SqlWhere append(String where, Object obj) {
if(StringUtil.isNotBlank(where)) {
this.strList.add(where);
this.objList.add(obj);
}
return this;
}
public SqlWhere eq(String name, Object obj) {
if(StringUtil.isNotBlank(obj)) {
this.strList.add(name + " = ?");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment