Commit d758c712 authored by Quxl's avatar Quxl

x

parent b1d20437
package com.egolm.film.api.service;
import java.util.List;
public interface CommonService {
void merge(Object obj);
void save(Object obj);
void update(Object obj);
void delete(Object id, Class<?> type);
<T> T queryById(Object id, Class<T> type);
void batchSave(List<Object> objs);
<T> List<T> queryAll(Class<T> requiredType);
}
package com.egolm.film.api.service.impl;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.dialect.bean.Desc;
import com.egolm.film.api.service.CommonService;
import com.egolm.film.config.XRException;
@Service
public class CommonServiceImpl implements CommonService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public void merge(Object obj) {
this.jdbcTemplate.merge(obj);
}
@Override
public void save(Object obj) {
this.jdbcTemplate.save(obj);
}
@Override
public void delete(Object id, Class<?> type) {
this.jdbcTemplate.delete(id, type);
}
@Override
public <T> T queryById(Object id, Class<T> type) {
Desc desc = new Desc(type);
String tableName = desc.getName();
String[] pkNames = desc.getColumnPkNames();
if(pkNames.length != 1) {
throw new XRException("不存在唯一主键");
}
return jdbcTemplate.queryForBean("select * from " + tableName + " where " + pkNames[0] + " = ?", type, id);
}
@Override
public void update(Object obj) {
this.jdbcTemplate.update(obj);
}
@Override
public void batchSave(List<Object> objs) {
this.jdbcTemplate.batchSave(objs);
}
@Override
public <T> List<T> queryAll(Class<T> requiredType) {
Desc desc = new Desc(requiredType);
String tableName = desc.getName();
return jdbcTemplate.queryForList("select * from " + tableName, requiredType);
}
}
package com.egolm.film.bean.model;
import javax.persistence.Entity;
import javax.persistence.Id;
import io.swagger.annotations.ApiModelProperty;
@Entity(name="fc_cinema")
public class Fc_cinema_model implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@ApiModelProperty("影院放映厅ID")
private Integer id;
@ApiModelProperty("影院编号")
private String no;
@ApiModelProperty("影院名称")
private String cinema_name;
@ApiModelProperty("影院英文名字")
private String cinema_en_name;
@ApiModelProperty("影院地址中文")
private String cinema_address;
@ApiModelProperty("影院英文地址")
private String cinema_en_address;
@ApiModelProperty("影院电话")
private String telphone;
@ApiModelProperty("影厅名称")
private String halls_name;
@ApiModelProperty("影厅名称(英文)")
private String halls_en_name;
@ApiModelProperty("状态 0正常 1关闭 2删除")
private Integer status;
@ApiModelProperty("排序")
private Integer sort;
public void setId(Integer id) {
this.id = id;
}
public Integer getId() {
return id;
}
public void setNo(String no) {
this.no = no;
}
public String getNo() {
return no;
}
public void setCinema_name(String cinema_name) {
this.cinema_name = cinema_name;
}
public String getCinema_name() {
return cinema_name;
}
public void setCinema_en_name(String cinema_en_name) {
this.cinema_en_name = cinema_en_name;
}
public String getCinema_en_name() {
return cinema_en_name;
}
public void setCinema_address(String cinema_address) {
this.cinema_address = cinema_address;
}
public String getCinema_address() {
return cinema_address;
}
public void setCinema_en_address(String cinema_en_address) {
this.cinema_en_address = cinema_en_address;
}
public String getCinema_en_address() {
return cinema_en_address;
}
public void setTelphone(String telphone) {
this.telphone = telphone;
}
public String getTelphone() {
return telphone;
}
public void setHalls_name(String halls_name) {
this.halls_name = halls_name;
}
public String getHalls_name() {
return halls_name;
}
public void setHalls_en_name(String halls_en_name) {
this.halls_en_name = halls_en_name;
}
public String getHalls_en_name() {
return halls_en_name;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getStatus() {
return status;
}
public void setSort(Integer sort) {
this.sort = sort;
}
public Integer getSort() {
return sort;
}
}
package com.egolm.film.bean.model;
import java.math.BigDecimal;
import javax.persistence.Entity;
import javax.persistence.Id;
import io.swagger.annotations.ApiModelProperty;
@Entity(name = "fc_cinema_showtime")
public class Fc_cinema_showtime_model implements java.io.Serializable {
private static final long serialVersionUID = 1L;
@Id
@ApiModelProperty("场次ID")
private Integer id;
@ApiModelProperty("场次编号")
private Integer showtime_no;
@ApiModelProperty("影片ID")
private Integer film_id;
@ApiModelProperty("票价")
private BigDecimal ticket_price;
@ApiModelProperty("状态 0正常 1关闭 2删除")
private Integer status;
@ApiModelProperty("是否重点场次 1是 0不是")
private Integer is_important;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getShowtime_no() {
return showtime_no;
}
public void setShowtime_no(Integer showtime_no) {
this.showtime_no = showtime_no;
}
public Integer getFilm_id() {
return film_id;
}
public void setFilm_id(Integer film_id) {
this.film_id = film_id;
}
public BigDecimal getTicket_price() {
return ticket_price;
}
public void setTicket_price(BigDecimal ticket_price) {
this.ticket_price = ticket_price;
}
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
public Integer getIs_important() {
return is_important;
}
public void setIs_important(Integer is_important) {
this.is_important = is_important;
}
public static long getSerialversionuid() {
return serialVersionUID;
}
}
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