Commit afe2e558 authored by Quxl's avatar Quxl

x

parent 02a6f052
package com.egolm.film.api.service; package com.egolm.film.api.service;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -15,4 +16,10 @@ public interface CinemaService { ...@@ -15,4 +16,10 @@ public interface CinemaService {
List<Map<String, Object>> queryShowtimeList(Integer cinemaId); List<Map<String, Object>> queryShowtimeList(Integer cinemaId);
void deleteShowtimeByShowtime(Integer cinema_id, String show_time);
void deleteShowtimeByShowdate(Integer cinema_id, Date show_date);
void deleteShowtimeById(Integer id);
} }
...@@ -46,7 +46,7 @@ public class CinemaServiceImpl implements CinemaService { ...@@ -46,7 +46,7 @@ public class CinemaServiceImpl implements CinemaService {
@Override @Override
public List<Map<String, Object>> getCinemaList(String keyword, Page page) { public List<Map<String, Object>> getCinemaList(String keyword, Page page) {
SqlWhere where = new SqlWhere().lk(new String[] {"cinema_no", "cinema_name", "cinema_en_name"}, keyword); SqlWhere where = new SqlWhere().eq("status", 0).lk(new String[] {"cinema_no", "cinema_name", "cinema_en_name"}, keyword);
String sql = "select * from fc_cinema " + StringUtil.join(" and ", " where ", " ", " ", where.getStringList()); String sql = "select * from fc_cinema " + StringUtil.join(" and ", " where ", " ", " ", where.getStringList());
return jdbcTemplate.limit(sql, page, where.getObjectArray()); return jdbcTemplate.limit(sql, page, where.getObjectArray());
} }
...@@ -55,9 +55,9 @@ public class CinemaServiceImpl implements CinemaService { ...@@ -55,9 +55,9 @@ public class CinemaServiceImpl implements CinemaService {
public void setTmpData(Integer showtimeId) { public void setTmpData(Integer showtimeId) {
String sql = "select cinema_id from fc_cinema_showtime where id = ?"; String sql = "select cinema_id from fc_cinema_showtime where id = ?";
Integer cinema_id = jdbcTemplate.queryForInt(sql, showtimeId); Integer cinema_id = jdbcTemplate.queryForInt(sql, showtimeId);
String sql_tmp_count_show = "select count(*) from fc_cinema_showtime where cinema_id = ? and showtime_no is not null and showtime_no != ''"; String sql_tmp_count_show = "select count(*) from fc_cinema_showtime where cinema_id = ? and showtime_no is not null and showtime_no != '' and status = 0";
Integer tmp_count_show = jdbcTemplate.queryForInt(sql_tmp_count_show, cinema_id); Integer tmp_count_show = jdbcTemplate.queryForInt(sql_tmp_count_show, cinema_id);
String sql_tmp_count_film = "select count(film_id) from fc_cinema_showtime where cinema_id = ? and film_id is not null group by film_id"; String sql_tmp_count_film = "select count(film_id) from fc_cinema_showtime where cinema_id = ? and film_id is not null and status = 0 group by film_id";
Integer tmp_count_film = jdbcTemplate.queryForInt(sql_tmp_count_film, cinema_id); Integer tmp_count_film = jdbcTemplate.queryForInt(sql_tmp_count_film, cinema_id);
jdbcTemplate.executeUpdate("update fc_cinema set tmp_count_show = ?, tmp_count_film = ? where id = ?", tmp_count_show, tmp_count_film, cinema_id); jdbcTemplate.executeUpdate("update fc_cinema set tmp_count_show = ?, tmp_count_film = ? where id = ?", tmp_count_show, tmp_count_film, cinema_id);
} }
...@@ -65,8 +65,23 @@ public class CinemaServiceImpl implements CinemaService { ...@@ -65,8 +65,23 @@ public class CinemaServiceImpl implements CinemaService {
@Override @Override
public List<Map<String, Object>> queryShowtimeList(Integer cinemaId) { public List<Map<String, Object>> queryShowtimeList(Integer cinemaId) {
Date dodayStart = DateUtil.start(new Date()); Date dodayStart = DateUtil.start(new Date());
String sql = "select * from fc_cinema_showtime where show_date >= ? and cinema_id = ?"; String sql = "select * from fc_cinema_showtime where show_date >= ? and cinema_id = ? and status = 0";
return jdbcTemplate.queryForList(sql, dodayStart, cinemaId); return jdbcTemplate.queryForList(sql, dodayStart, cinemaId);
} }
@Override
public void deleteShowtimeByShowtime(Integer cinema_id, String show_time) {
jdbcTemplate.executeUpdate("delete from fc_cinema_showtime where cinema_id = ? and show_time = ?", cinema_id, show_time);
}
@Override
public void deleteShowtimeByShowdate(Integer cinema_id, Date show_date) {
jdbcTemplate.executeUpdate("delete from fc_cinema_showtime where cinema_id = ? and show_date = ?", cinema_id, DateUtil.start(show_date));
}
@Override
public void deleteShowtimeById(Integer id) {
jdbcTemplate.executeUpdate("update fc_cinema_showtime set status = 2 where id = ?", id);
}
} }
...@@ -109,8 +109,8 @@ public class CinemaController { ...@@ -109,8 +109,8 @@ public class CinemaController {
} }
@ResponseBody @ResponseBody
@PostMapping("updateShowtime") @PostMapping("getShowtimeList")
@ApiOperation("编辑场次") @ApiOperation("查询场次列表")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType="query", name="cinema_id", value="影院放映厅ID"), @ApiImplicitParam(paramType="query", name="cinema_id", value="影院放映厅ID"),
}) })
...@@ -140,4 +140,28 @@ public class CinemaController { ...@@ -140,4 +140,28 @@ public class CinemaController {
} }
return Rjx.jsonOk().set("dates", dates).set("times", times).setData(new TreeMap<String, List<Map<String, Object>>>(datas)); return Rjx.jsonOk().set("dates", dates).set("times", times).setData(new TreeMap<String, List<Map<String, Object>>>(datas));
} }
@ResponseBody
@PostMapping("deleteShowtimeByShowtime")
@ApiOperation("编辑场次")
public Object deleteShowtimeByShowtime(Integer cinema_id, String show_time) {
service.deleteShowtimeByShowtime(cinema_id, show_time);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("deleteShowtimeByShowdate")
@ApiOperation("编辑场次")
public Object deleteShowtimeByShowdate(Integer cinema_id, @DateTimeFormat(pattern="yyyy-MM-dd")Date show_date) {
service.deleteShowtimeByShowdate(cinema_id, show_date);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("deleteShowtimeById")
@ApiOperation("编辑场次")
public Object deleteShowtimeById(Integer id) {
service.deleteShowtimeById(id);
return Rjx.jsonOk();
}
} }
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