Commit b6082059 authored by Quxl's avatar Quxl

x

parent 47cd5a13
package com.egolm.film.api.service;
import java.util.List;
import java.util.Map;
public interface FilmGroupService {
List<Map<String, Object>> queryFilmGroupList();
List<Map<String, Object>> queryFilmListByGroupId(Integer film_group_id);
void updateFilmGroupId(Integer film_id, Integer group_id);
}
package com.egolm.film.api.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.film.api.service.FilmGroupService;
@Service
public class FilmGroupServiceImpl implements FilmGroupService {
@Autowired
JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> queryFilmGroupList() {
return jdbcTemplate.queryForList("select * from fc_film_group");
}
@Override
public List<Map<String, Object>> queryFilmListByGroupId(Integer group_id) {
return jdbcTemplate.queryForList("select id, group_id, create_time, last_modify_time, film_no, en_name, cn_name from fc_member_film where group_id = ?", group_id);
}
@Override
public void updateFilmGroupId(Integer film_id, Integer group_id) {
jdbcTemplate.executeUpdate("update fc_member_film set group_id = ? where id = ?", group_id, film_id);
}
}
package com.egolm.film.api.web.admin;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.film.api.service.FilmGroupService;
import com.egolm.film.bean.Fc_film_group;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@Api
@Controller
@RequestMapping("admin/filmGroup")
public class FilmGroupController {
@Autowired
FilmGroupService filmGroupService;
@Autowired
JdbcTemplate jdbcTemplate;
@ResponseBody
@PostMapping("save")
@ApiOperation("保存分类")
public Object save(String group_name, Integer parent_id, Integer order_num) {
Fc_film_group g = new Fc_film_group();
g.setGroup_name(group_name);
g.setParent_id(parent_id);
g.setOrder_num(order_num);
jdbcTemplate.save(g);
return Rjx.jsonOk();
}
@ResponseBody
@PostMapping("getFilmGroupList")
@ApiOperation("保存分类")
public Object getFilmGroupList() {
List<Map<String, Object>> list = filmGroupService.queryFilmGroupList();
return Rjx.jsonOk().setData(list);
}
@ResponseBody
@PostMapping("getFilmListByGroupId")
@ApiOperation("保存分类")
public Object getFilmListByGroupId(Integer group_id) {
List<Map<String, Object>> list = filmGroupService.queryFilmListByGroupId(group_id);
return Rjx.jsonOk().setData(list);
}
@ResponseBody
@PostMapping("updateFilmGroupId")
@ApiOperation("保存分类")
public Object updateFilmGroupId(Integer film_id, Integer group_id) {
filmGroupService.updateFilmGroupId(film_id, group_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