Commit 3f3296de authored by 曲欣红's avatar 曲欣红

1

parent 97619627
...@@ -143,9 +143,12 @@ public class FilmReportServiceImpl implements FilmReportService { ...@@ -143,9 +143,12 @@ public class FilmReportServiceImpl implements FilmReportService {
String sql = "select * from (select count(1) count, t.playactor_name playactor_name, max(t.create_time) create_time from (select fmfp.playactor_name, fmf.create_time from fc_member_film_playactor fmfp, fc_member_film fmf where fmfp.film_id = fmf.id order by fmf.create_time desc) t group by t.playactor_name) t2 where t2.playactor_name like ? order by t2.create_time desc"; String sql = "select * from (select count(1) count, t.playactor_name playactor_name, max(t.create_time) create_time from (select fmfp.playactor_name, fmf.create_time from fc_member_film_playactor fmfp, fc_member_film fmf where fmfp.film_id = fmf.id order by fmf.create_time desc) t group by t.playactor_name) t2 where t2.playactor_name like ? order by t2.create_time desc";
List<Map<String, Object>> res = jdbcTemplate.limit(sql, page, "%"+playactor_name+"%"); List<Map<String, Object>> res = jdbcTemplate.limit(sql, page, "%"+playactor_name+"%");
List<String> directors = new ArrayList<>(); List<String> directors = new ArrayList<>();
List<String> placeholders = new ArrayList();
for (Map<String, Object> map : res) { for (Map<String, Object> map : res) {
directors.add("'"+(String)map.get("playactor_name")+"'"); directors.add((String)map.get("playactor_name"));
placeholders.add("?");
} }
String sql2 = "select " String sql2 = "select "
+ "fmf.origion_name origion_name, " + "fmf.origion_name origion_name, "
+ "fmf.en_name en_name, " + "fmf.en_name en_name, "
...@@ -159,9 +162,9 @@ public class FilmReportServiceImpl implements FilmReportService { ...@@ -159,9 +162,9 @@ public class FilmReportServiceImpl implements FilmReportService {
+ "and " + "and "
+ "fmfp.playactor_name " + "fmfp.playactor_name "
+ "in ( " + "in ( "
+ StringUtil.join(", ", directors) + StringUtil.join(", ", placeholders)
+ ")"; + ")";
List<Map<String, Object>> list = jdbcTemplate.queryForList(sql2); List<Map<String, Object>> list = jdbcTemplate.queryForList(sql2, directors.toArray());
for (Map<String, Object> map : res) { for (Map<String, Object> map : res) {
String playactoName = (String)map.get("playactor_name"); String playactoName = (String)map.get("playactor_name");
List<Map<String, Object>> itemList = new ArrayList<>(); List<Map<String, Object>> itemList = new ArrayList<>();
......
...@@ -64,8 +64,8 @@ public class FilmReportController { ...@@ -64,8 +64,8 @@ public class FilmReportController {
@ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"), @ApiImplicitParam(paramType="query", dataType="long", required=true, name="limit", value="分页大小"),
}) })
public Object directorList(String playactor_name, Long index, Long limit) { public Object directorList(String playactor_name, Long index, Long limit) {
index = index == null ? 1L : index; index = (index == null || index <= 0L)? 1L : index;
limit = limit == null ? 20L : limit; limit = (limit == null || limit <= 0L)? 20L : limit;
System.out.println(index); System.out.println(index);
System.out.println(limit); System.out.println(limit);
Page page = new Page(index, limit); Page page = new Page(index, limit);
......
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