diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b83d222 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..f4aedca --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# film + +使用blade框架开发的电影站点。 diff --git a/doc/film.sql b/doc/film.sql new file mode 100644 index 0000000..36d6950 --- /dev/null +++ b/doc/film.sql @@ -0,0 +1,99 @@ +/* +SQLyog Ultimate v11.11 (64 bit) +MySQL - 5.5.40 : Database - film +********************************************************************* +*/ + +/*!40101 SET NAMES utf8 */; + +/*!40101 SET SQL_MODE=''*/; + +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +CREATE DATABASE /*!32312 IF NOT EXISTS*/`film` /*!40100 DEFAULT CHARACTER SET utf8 */; + +/*Table structure for table `t_menu` */ + +DROP TABLE IF EXISTS `t_menu`; + +CREATE TABLE `t_menu` ( + `id` int(10) NOT NULL AUTO_INCREMENT, + `name` varchar(100) NOT NULL COMMENT '菜单名', + `slug` varchar(100) NOT NULL COMMENT '菜单缩略名', + `display_order` tinyint(4) NOT NULL COMMENT '菜单排序', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=6 DEFAULT CHARSET=utf8; + +/*Data for the table `t_menu` */ + +insert into `t_menu`(`id`,`name`,`slug`,`display_order`) values (1,'首页','/',0),(2,'高清电影','/gaoqingdianying',1),(3,'1080P','/1080P',2),(4,'720P','/720P',3),(5,'电视剧','/tv',4); + +/*Table structure for table `t_option` */ + +DROP TABLE IF EXISTS `t_option`; + +CREATE TABLE `t_option` ( + `opt_key` varchar(255) NOT NULL, + `opt_value` text NOT NULL, + PRIMARY KEY (`opt_key`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +/*Data for the table `t_option` */ + +/*Table structure for table `t_post` */ + +DROP TABLE IF EXISTS `t_post`; + +CREATE TABLE `t_post` ( + `pid` int(11) NOT NULL AUTO_INCREMENT, + `title` varchar(255) NOT NULL COMMENT '标题', + `slug` varchar(255) DEFAULT NULL COMMENT '缩略名', + `cover` varchar(255) NOT NULL COMMENT '封面', + `category_id` int(11) DEFAULT NULL COMMENT '所属分类', + `content` text NOT NULL COMMENT '内容', + `views` int(10) NOT NULL DEFAULT '0' COMMENT '浏览量', + `is_del` tinyint(1) NOT NULL DEFAULT '0' COMMENT '是否已经删除', + `dateline` int(11) NOT NULL COMMENT '发布日期', + PRIMARY KEY (`pid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; + +/*Data for the table `t_post` */ + +/*Table structure for table `t_tag` */ + +DROP TABLE IF EXISTS `t_tag`; + +CREATE TABLE `t_tag` ( + `id` int(11) NOT NULL AUTO_INCREMENT, + `name` varchar(50) NOT NULL COMMENT '标签', + `count` int(10) NOT NULL DEFAULT '0' COMMENT '标签下的文章个数', + PRIMARY KEY (`id`) +) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; + +/*Data for the table `t_tag` */ + +insert into `t_tag`(`id`,`name`,`count`) values (1,'2015',0),(2,'悬疑',0),(3,'惊悚',0),(4,'喜剧',0),(5,'爱情',0),(6,'华语',0),(7,'欧美',0),(8,'搞笑',0),(9,'科幻',0),(10,'动画',0); + +/*Table structure for table `t_user` */ + +DROP TABLE IF EXISTS `t_user`; + +CREATE TABLE `t_user` ( + `uid` int(10) NOT NULL AUTO_INCREMENT, + `login_name` varchar(100) NOT NULL COMMENT '登录名', + `pass_word` varchar(255) NOT NULL COMMENT '密码', + `avatar` varchar(255) DEFAULT NULL COMMENT '头像', + `is_admin` tinyint(1) NOT NULL COMMENT '是否是管理员', + `is_del` tinyint(1) NOT NULL COMMENT '是否删除', + `dateline` int(11) NOT NULL COMMENT '注册时间', + PRIMARY KEY (`uid`) +) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=utf8; + +/*Data for the table `t_user` */ + +insert into `t_user`(`uid`,`login_name`,`pass_word`,`avatar`,`is_admin`,`is_del`,`dateline`) values (1,'admin','BQlRvE7PKAX4b1waywkqD8Vom3yjeYGn',NULL,1,0,0); + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9ca182b --- /dev/null +++ b/pom.xml @@ -0,0 +1,79 @@ + + 4.0.0 + me.biezhi + film + war + 0.0.1 + film Maven Webapp + http://maven.apache.org + + + 1.6 + 1.6 + UTF-8 + + + + + com.bladejava + blade-core + 1.5.0-beta + + + com.bladejava + blade-sql2o + 1.3.0-alpha + + + com.github.subchen + jetbrick-template + 2.0.12 + + + com.alibaba + druid + 1.0.15 + + + mysql + mysql-connector-java + 5.1.35 + + + javax.servlet + javax.servlet-api + 3.0.1 + + + + + film + + + org.apache.maven.plugins + maven-compiler-plugin + 3.2 + + 1.6 + 1.6 + UTF8 + + + + org.eclipse.jetty + jetty-maven-plugin + 9.2.12.v20150709 + + 3 + + / + + + 9000 + + + + + + diff --git a/src/main/java/me/biezhi/film/App.java b/src/main/java/me/biezhi/film/App.java new file mode 100644 index 0000000..7155cc1 --- /dev/null +++ b/src/main/java/me/biezhi/film/App.java @@ -0,0 +1,62 @@ +package me.biezhi.film; + +import java.util.Properties; + +import javax.sql.DataSource; + +import jetbrick.template.JetEngine; +import jetbrick.template.JetGlobalContext; +import jetbrick.template.resolver.GlobalResolver; +import me.biezhi.film.func.Funcs; +import blade.kit.PropertyKit; +import blade.plugin.sql2o.Sql2oPlugin; + +import com.alibaba.druid.pool.DruidDataSourceFactory; +import com.blade.Blade; +import com.blade.Bootstrap; +import com.blade.render.JetbrickRender; +import com.blade.route.RouteHandler; +import com.blade.web.http.Request; +import com.blade.web.http.Response; + +public class App extends Bootstrap { + + @Override + public void init(Blade blade) { + // 加载配置文件 + blade.config("blade.conf"); + blade.routeConf("me.biezhi.film.controller", "route_front.conf"); + blade.routeConf("me.biezhi.film.controller.admin", "route_admin.conf"); + + // 设置模板引擎 + JetbrickRender jetbrickRender = new JetbrickRender(); + JetEngine jetEngine = jetbrickRender.getJetEngine(); + + JetGlobalContext globalContext = jetEngine.getGlobalContext(); + Const.CONTEXT = globalContext; + + GlobalResolver resolver = jetEngine.getGlobalResolver(); + resolver.registerFunctions(Funcs.class); + + blade.viewEngin(jetbrickRender); + + // 拦截器 + blade.before("/admin/.*", new RouteHandler() { + @Override + public void handle(Request request, Response response) { + + } + }); + + // 配置数据库 + try { + Properties props = PropertyKit.getProperty("ds.conf"); + DataSource dataSource = DruidDataSourceFactory.createDataSource(props); + Sql2oPlugin sql2oPlugin = blade.plugin(Sql2oPlugin.class); + sql2oPlugin.config(dataSource).run(); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + +} diff --git a/src/main/java/me/biezhi/film/Const.java b/src/main/java/me/biezhi/film/Const.java new file mode 100644 index 0000000..da679b0 --- /dev/null +++ b/src/main/java/me/biezhi/film/Const.java @@ -0,0 +1,12 @@ +package me.biezhi.film; + +import jetbrick.template.JetGlobalContext; + +public class Const { + + public static final String LOGIN_SESSION = "login_user"; + + public static JetGlobalContext CONTEXT = null; + + +} diff --git a/src/main/java/me/biezhi/film/Validator.java b/src/main/java/me/biezhi/film/Validator.java new file mode 100644 index 0000000..3b5ca7a --- /dev/null +++ b/src/main/java/me/biezhi/film/Validator.java @@ -0,0 +1,56 @@ +package me.biezhi.film; + +import java.util.HashMap; +import java.util.Map; + +import blade.kit.PropertyKit; + +public final class Validator { + + private static Map errorMsg = new HashMap(); + + static { + errorMsg = PropertyKit.getPropertyMap("validation.lang"); + } + + public static String required(String val){ + return String.format(errorMsg.get("required"), val); + } + + public static String email(String val){ + return String.format(errorMsg.get("email"), val); + } + + public static String date(String val){ + return String.format(errorMsg.get("date"), val); + } + + public static String number(String val){ + return String.format(errorMsg.get("number"), val); + } + + public static String phone(String val){ + return String.format(errorMsg.get("phone"), val); + } + + public static String url(String val){ + return String.format(errorMsg.get("url"), val); + } + + public static String min(Long val){ + return String.format(errorMsg.get("min"), val); + } + + public static String max(Long val){ + return String.format(errorMsg.get("max"), val); + } + + public static String minLen(Long val){ + return String.format(errorMsg.get("minLen"), val); + } + + public static String maxLen(Long val){ + return String.format(errorMsg.get("maxLen"), val); + } + +} diff --git a/src/main/java/me/biezhi/film/controller/BaseController.java b/src/main/java/me/biezhi/film/controller/BaseController.java new file mode 100644 index 0000000..8285f25 --- /dev/null +++ b/src/main/java/me/biezhi/film/controller/BaseController.java @@ -0,0 +1,68 @@ +package me.biezhi.film.controller; + +import me.biezhi.film.kit.SessionKit; +import me.biezhi.film.model.User; + +import com.blade.render.ModelAndView; +import com.blade.web.http.Request; + +public class BaseController { + + /** + * 默认分页条数 + */ + protected Integer pageSize = 10; + + /** + * 状态字段 + */ + protected String STATUS = "status"; + + /** + * 成功 + */ + protected String SUCCESS = "success"; + + /** + * 服务器异常 + */ + protected String ERROR = "error"; + + /** + * 已经存在 + */ + protected String EXIST = "exist"; + + /** + * 失败 + */ + protected String FAILURE = "failure"; + + protected ModelAndView getFront(String view){ + return new ModelAndView(view); + } + + protected ModelAndView getAdmin(String view){ + view = "admin/" + view; + return new ModelAndView(view); + } + + /** + * @return 返回是否登录 + */ + public boolean isSignin(Request request){ + return null != SessionKit.getLoginUser(request); + } + + /** + * @return 返回是否登录并且是管理员 + */ + public boolean isAdmin(Request request){ + User user= SessionKit.getLoginUser(request); + if(null != user && user.getIs_admin()){ + return true; + } + return false; + } + +} diff --git a/src/main/java/me/biezhi/film/controller/IndexController.java b/src/main/java/me/biezhi/film/controller/IndexController.java new file mode 100644 index 0000000..954b3db --- /dev/null +++ b/src/main/java/me/biezhi/film/controller/IndexController.java @@ -0,0 +1,98 @@ +package me.biezhi.film.controller; + +import me.biezhi.film.Validator; +import me.biezhi.film.kit.Errors; +import me.biezhi.film.kit.SessionKit; +import me.biezhi.film.model.Post; +import me.biezhi.film.model.User; +import me.biezhi.film.service.PostService; +import me.biezhi.film.service.UserService; +import blade.kit.StringKit; +import blade.plugin.sql2o.Page; +import blade.plugin.sql2o.WhereParam; + +import com.blade.annotation.Inject; +import com.blade.web.http.Request; +import com.blade.web.http.Response; + +public class IndexController extends BaseController { + + @Inject + private UserService userService; + + @Inject + private PostService postService; + + /** + * 首页 + */ + public void home(Request request, Response response){ + Integer page = request.paramAsInt("page"); + if(null == page || page < 1){ + page = 1; + } + Page pagePost = postService.getPageList(null, page, this.pageSize, "dateline desc"); + request.attribute("pagePost", pagePost); + response.render(this.getFront("home")); + } + + /** + * 显示登录页面 + * @param request + * @param response + */ + public void show_signin(Request request, Response response){ + response.render(this.getFront("signin")); + } + + /** + * 登录 + * @param request + * @param response + */ + public void signin(Request request, Response response){ + String login_name = request.query("login_name"); + String pass_word = request.query("pass_word"); + + Errors errors = Errors.empty(); + + if(StringKit.isBlank(login_name)){ + errors.add(Validator.required("用户名")); + } + if(StringKit.isBlank(pass_word)){ + errors.add(Validator.required("密码")); + } + User user = userService.signin(login_name, pass_word); + if (null == user) { + errors.add("用户名或密码错误"); + } + if(errors.hasError()){ + request.attribute("errors", errors.getErrors()); + } else { + SessionKit.setLoginUser(request, user); + response.go("/admin/index"); + } + } + + /** + * 显示详情页面 + * @param request + * @param response + */ + public void show_flim(Request request, Response response){ + String slug = request.param("slug"); + if(StringKit.isBlank(slug)){ + + } + WhereParam where = WhereParam.me(); + where.eq("slug", "slug"); + Post post = postService.getPost(where); + if(null == post){ + + } + request.attribute("film", post); + response.render(this.getFront("film_detail")); + } + + +} diff --git a/src/main/java/me/biezhi/film/controller/admin/IndexController.java b/src/main/java/me/biezhi/film/controller/admin/IndexController.java new file mode 100644 index 0000000..c0e4753 --- /dev/null +++ b/src/main/java/me/biezhi/film/controller/admin/IndexController.java @@ -0,0 +1,30 @@ +package me.biezhi.film.controller.admin; + +import me.biezhi.film.controller.BaseController; +import me.biezhi.film.kit.SessionKit; + +import com.blade.web.http.Request; +import com.blade.web.http.Response; + +public class IndexController extends BaseController { + + /** + * 首页 + */ + public void home(Request request, Response response){ + + } + + /** + * 注销 + * @param request + * @param response + */ + public void signin_out(Request request, Response response){ + SessionKit.removeLoginUser(request); + response.go("/"); + } + + + +} diff --git a/src/main/java/me/biezhi/film/func/Funcs.java b/src/main/java/me/biezhi/film/func/Funcs.java new file mode 100644 index 0000000..d9c2c0f --- /dev/null +++ b/src/main/java/me/biezhi/film/func/Funcs.java @@ -0,0 +1,114 @@ +package me.biezhi.film.func; + +import javax.servlet.ServletContext; + +import blade.kit.DateKit; +import blade.kit.StringKit; + +import com.blade.context.BladeWebContext; + +public class Funcs { + + /** + * 获取相对路径 + * @param path + * @return + */ + public static String base_url(String path) { + ServletContext servletContext = BladeWebContext.servletContext(); + String ctx = servletContext.getContextPath(); + if(StringKit.isBlank(path)){ + return ctx; + } + String val = ctx + "/" + path; + return val.replaceAll("//", "/"); + } + + /** + * 格式化日期 + * @param date + * @return + */ + public static String fmtdate(Integer date) { + if(null != date){ + return DateKit.formatDateByUnixTime(date, "yyyy-MM-dd"); + } + return ""; + } + + /** + * 格式化日期 + * @param date + * @param patten + * @return + */ + public static String fmtdate(Integer date, String patten) { + if(null != date){ + return DateKit.formatDateByUnixTime(date, patten); + } + return ""; + } + + /** + * 今天 + * @param patten + * @return + */ + public static String today(String patten){ + return fmtdate(DateKit.getCurrentUnixTime(), patten); + } + + /** + * 截取字符串个数 + * @param str + * @param count + * @return + */ + public static String str_count(String str, int count){ + if(StringKit.isNotBlank(str) && count > 0){ + if(str.length() <= count){ + return str; + } + return str.substring(0, count); + } + return ""; + } + + /** + * 显示时间,如果与当前时间差别小于一天,则自动用**秒(分,小时)前,如果大于一天则用format规定的格式显示 + * + * @param ctime时间 + * @return + */ + public static String timespan(Integer ctime) { + String r = ""; + if (ctime == null) + return r; + + long nowtimelong = System.currentTimeMillis(); + long ctimelong = ctime; + long result = Math.abs(nowtimelong - ctimelong); + + // 20秒内 + if (result < 20000){ + r = "刚刚"; + } else if (result >= 20000 && result < 60000) { + // 一分钟内 + long seconds = result / 1000; + r = seconds + "秒钟前"; + } else if (result >= 60000 && result < 3600000) { + // 一小时内 + long seconds = result / 60000; + r = seconds + "分钟前"; + } else if (result >= 3600000 && result < 86400000) { + // 一天内 + long seconds = result / 3600000; + r = seconds + "小时前"; + } else { + long days = result / 3600000 / 24; + r = days + "天前"; + } + return r; + } + +} diff --git a/src/main/java/me/biezhi/film/kit/Errors.java b/src/main/java/me/biezhi/film/kit/Errors.java new file mode 100644 index 0000000..94fe80d --- /dev/null +++ b/src/main/java/me/biezhi/film/kit/Errors.java @@ -0,0 +1,29 @@ +package me.biezhi.film.kit; + +import java.util.ArrayList; +import java.util.List; + +public class Errors { + + private List errors = new ArrayList(); + + public Errors() { + } + + public static Errors empty(){ + return new Errors(); + } + + public boolean hasError() { + return errors.size() > 0; + } + + public void add(String error_msg){ + errors.add(error_msg); + } + + public List getErrors() { + return errors; + } + +} diff --git a/src/main/java/me/biezhi/film/kit/SecretKit.java b/src/main/java/me/biezhi/film/kit/SecretKit.java new file mode 100644 index 0000000..3547e37 --- /dev/null +++ b/src/main/java/me/biezhi/film/kit/SecretKit.java @@ -0,0 +1,43 @@ +package me.biezhi.film.kit; + +import blade.kit.HashidKit; +import blade.kit.StringKit; + +/** + * + *

+ * 加密解密类 + *

+ * + * @author biezhi + * @since 1.0 + */ +public class SecretKit { + + /** + * 生成用户密码 + * @param login_name + * @param pass_word + * @return + */ + public static String password(String login_name, String pass_word){ + if(StringKit.isNotBlank(login_name) && StringKit.isNotBlank(pass_word)){ + HashidKit hashidKit = new HashidKit(login_name + pass_word, 32); + return hashidKit.encode( login_name.length() ); + } + return null; + } + + public static String createAttachId(String key){ + HashidKit hashidKit = new HashidKit(key, 12); + return hashidKit.encode( System.currentTimeMillis() ); + } + + public static void main(String[] args) { + String login_name = "admin"; + String pass_word = "123456"; + + System.out.println(password(login_name, pass_word)); + + } +} diff --git a/src/main/java/me/biezhi/film/kit/SessionKit.java b/src/main/java/me/biezhi/film/kit/SessionKit.java new file mode 100644 index 0000000..52b0c05 --- /dev/null +++ b/src/main/java/me/biezhi/film/kit/SessionKit.java @@ -0,0 +1,21 @@ +package me.biezhi.film.kit; + +import me.biezhi.film.Const; +import me.biezhi.film.model.User; + +import com.blade.web.http.Request; + +public class SessionKit { + + public static User getLoginUser(Request request){ + return request.session().attribute(Const.LOGIN_SESSION); + } + + public static void setLoginUser(Request request, User user){ + request.session().attribute(Const.LOGIN_SESSION, user); + } + + public static void removeLoginUser(Request request){ + request.session().removeAttribute(Const.LOGIN_SESSION); + } +} diff --git a/src/main/java/me/biezhi/film/model/Menu.java b/src/main/java/me/biezhi/film/model/Menu.java new file mode 100644 index 0000000..9b29488 --- /dev/null +++ b/src/main/java/me/biezhi/film/model/Menu.java @@ -0,0 +1,60 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * Menu对象 + */ +@Table(value = "t_menu", PK = "id") +public class Menu implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + //菜单名 + private String name; + + //菜单缩略名 + private String slug; + + //菜单排序 + private Integer display_order; + + public Menu(){} + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getSlug() { + return slug; + } + + public void setSlug(String slug) { + this.slug = slug; + } + + public Integer getDisplay_order() { + return display_order; + } + + public void setDisplay_order(Integer display_order) { + this.display_order = display_order; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/model/Option.java b/src/main/java/me/biezhi/film/model/Option.java new file mode 100644 index 0000000..e5e4329 --- /dev/null +++ b/src/main/java/me/biezhi/film/model/Option.java @@ -0,0 +1,37 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * Option对象 + */ +@Table(value = "t_option", PK = "opt_key") +public class Option implements Serializable { + + private static final long serialVersionUID = 1L; + + private String opt_key; + + private String opt_value; + + public Option(){} + + public String getOpt_key() { + return opt_key; + } + + public void setOpt_key(String opt_key) { + this.opt_key = opt_key; + } + + public String getOpt_value() { + return opt_value; + } + + public void setOpt_value(String opt_value) { + this.opt_value = opt_value; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/model/Post.java b/src/main/java/me/biezhi/film/model/Post.java new file mode 100644 index 0000000..af5908e --- /dev/null +++ b/src/main/java/me/biezhi/film/model/Post.java @@ -0,0 +1,115 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * Post对象 + */ +@Table(value = "t_post", PK = "pid") +public class Post implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer pid; + + //标题 + private String title; + + //缩略名 + private String slug; + + //封面 + private String cover; + + //所属分类 + private Integer category_id; + + //内容 + private String content; + + //浏览量 + private Integer views; + + //是否已经删除 + private Boolean is_del; + + //发布日期 + private Integer dateline; + + public Post(){} + + public Integer getPid() { + return pid; + } + + public void setPid(Integer pid) { + this.pid = pid; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getSlug() { + return slug; + } + + public void setSlug(String slug) { + this.slug = slug; + } + + public String getCover() { + return cover; + } + + public void setCover(String cover) { + this.cover = cover; + } + + public Integer getCategory_id() { + return category_id; + } + + public void setCategory_id(Integer category_id) { + this.category_id = category_id; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public Integer getViews() { + return views; + } + + public void setViews(Integer views) { + this.views = views; + } + + public Boolean getIs_del() { + return is_del; + } + + public void setIs_del(Boolean is_del) { + this.is_del = is_del; + } + + public Integer getDateline() { + return dateline; + } + + public void setDateline(Integer dateline) { + this.dateline = dateline; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/model/Recomm.java b/src/main/java/me/biezhi/film/model/Recomm.java new file mode 100644 index 0000000..77477b3 --- /dev/null +++ b/src/main/java/me/biezhi/film/model/Recomm.java @@ -0,0 +1,104 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * Recomm对象 + */ +@Table(value = "t_recomm", PK = "id") +public class Recomm implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + //标题 + private String title; + + //链接 + private String link; + + //内容 + private String content; + + //封面图 + private String cover; + + //排序 + private Integer display_order; + + //是否删除 + private Boolean is_del; + + //发布时间 + private Integer dateline; + + public Recomm(){} + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } + + public String getContent() { + return content; + } + + public void setContent(String content) { + this.content = content; + } + + public String getCover() { + return cover; + } + + public void setCover(String cover) { + this.cover = cover; + } + + public Integer getDisplay_order() { + return display_order; + } + + public void setDisplay_order(Integer display_order) { + this.display_order = display_order; + } + + public Boolean getIs_del() { + return is_del; + } + + public void setIs_del(Boolean is_del) { + this.is_del = is_del; + } + + public Integer getDateline() { + return dateline; + } + + public void setDateline(Integer dateline) { + this.dateline = dateline; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/model/Tag.java b/src/main/java/me/biezhi/film/model/Tag.java new file mode 100644 index 0000000..79f329c --- /dev/null +++ b/src/main/java/me/biezhi/film/model/Tag.java @@ -0,0 +1,49 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * Tag对象 + */ +@Table(value = "t_tag", PK = "id") +public class Tag implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer id; + + //标签 + private String name; + + //标签下的文章个数 + private Integer count; + + public Tag(){} + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Integer getCount() { + return count; + } + + public void setCount(Integer count) { + this.count = count; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/model/User.java b/src/main/java/me/biezhi/film/model/User.java new file mode 100644 index 0000000..3a2dff3 --- /dev/null +++ b/src/main/java/me/biezhi/film/model/User.java @@ -0,0 +1,93 @@ +package me.biezhi.film.model; + +import java.io.Serializable; + +import blade.plugin.sql2o.Table; + +/** + * User对象 + */ +@Table(value = "t_user", PK = "uid") +public class User implements Serializable { + + private static final long serialVersionUID = 1L; + + private Integer uid; + + //登录名 + private String login_name; + + //密码 + private String pass_word; + + //头像 + private String avatar; + + //是否是管理员 + private Boolean is_admin; + + //是否删除 + private Boolean is_del; + + //注册时间 + private Integer dateline; + + public User(){} + + public Integer getUid() { + return uid; + } + + public void setUid(Integer uid) { + this.uid = uid; + } + + public String getLogin_name() { + return login_name; + } + + public void setLogin_name(String login_name) { + this.login_name = login_name; + } + + public String getPass_word() { + return pass_word; + } + + public void setPass_word(String pass_word) { + this.pass_word = pass_word; + } + + public String getAvatar() { + return avatar; + } + + public void setAvatar(String avatar) { + this.avatar = avatar; + } + + public Boolean getIs_admin() { + return is_admin; + } + + public void setIs_admin(Boolean is_admin) { + this.is_admin = is_admin; + } + + public Boolean getIs_del() { + return is_del; + } + + public void setIs_del(Boolean is_del) { + this.is_del = is_del; + } + + public Integer getDateline() { + return dateline; + } + + public void setDateline(Integer dateline) { + this.dateline = dateline; + } + +} \ No newline at end of file diff --git a/src/main/java/me/biezhi/film/service/MenuService.java b/src/main/java/me/biezhi/film/service/MenuService.java new file mode 100644 index 0000000..8a2abfa --- /dev/null +++ b/src/main/java/me/biezhi/film/service/MenuService.java @@ -0,0 +1,24 @@ +package me.biezhi.film.service; + +import java.util.List; + +import blade.plugin.sql2o.Page; +import blade.plugin.sql2o.WhereParam; + +import me.biezhi.film.model.Menu; + +public interface MenuService { + + public Menu getMenu(Integer id); + + public Menu getMenu(WhereParam where); + + public List getMenuList(WhereParam where); + + public Page getPageList(WhereParam where, Integer page, Integer pageSize, String order); + + public boolean save( String name, String slug, Integer displayOrder ); + + public boolean delete(Integer id); + +} diff --git a/src/main/java/me/biezhi/film/service/OptionService.java b/src/main/java/me/biezhi/film/service/OptionService.java new file mode 100644 index 0000000..17c26a5 --- /dev/null +++ b/src/main/java/me/biezhi/film/service/OptionService.java @@ -0,0 +1,24 @@ +package me.biezhi.film.service; + +import java.util.List; + +import blade.plugin.sql2o.Page; +import blade.plugin.sql2o.WhereParam; + +import me.biezhi.film.model.Option; + +public interface OptionService { + + public Option getOption(String optKey); + + public Option getOption(WhereParam where); + + public List