Skip to content

Commit

Permalink
更新了一些页面
Browse files Browse the repository at this point in the history
还有些小问题。还有job表
  • Loading branch information
maybeTomorrow committed Apr 21, 2013
1 parent 242fec8 commit 1c21769
Show file tree
Hide file tree
Showing 14 changed files with 221 additions and 22 deletions.
4 changes: 3 additions & 1 deletion WebRoot/WEB-INF/classes/job_sql.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<sqlGroup name="job">

This comment has been minimized.

Copy link
@tidezyc

tidezyc Apr 24, 2013

怎么改到classes目录下去了

<sql id="findOneById">
select U.username authorname,J.*,R.views,R.comments from users U, job J left join job_record R on J.id=R.id where U.id=J.author and J.id= ?
</sql>
<sql id="findListForIndex">
select J.*,R.views,R.comments from job J left join job_record R on J.id=R.id order by J.id asc limit 0,10
</sql>
Expand Down
6 changes: 5 additions & 1 deletion WebRoot/WEB-INF/views/admin/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,15 @@ <h3>xxx
</div>
<div class="ui-box-container ui-box-content">
<ul class="ui-article-list">
<#if job??>
<#list job as job>
<li class="ui-article-item">
<a href="#">
LinkedIn 实时低延迟数据抓取系统 Databus 开源
${job.title}
</a>
</li>
</#list>
</#if>
<li class="ui-article-item">
<a href="#">
LinkedIn 实时低延迟数据抓取系统 Databus 开源
Expand Down
26 changes: 23 additions & 3 deletions WebRoot/WEB-INF/views/job/add.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<#include "/layout/_layout.html" /> <@head title="首页|四眼井|互联网人的乐园 ">
</@head> <@body> <#include "/layout/_nav.html" /><@nav 5/>
<div class="container clearfix">
</@head> <@body>
<div class=" clearfix">
<div class="ui-grid-19">
<div class="mgl-20">
<div class="ui-box">
Expand Down Expand Up @@ -31,7 +31,27 @@
type="text" name="job.recruiting_numbers">
</div>
<div class="ui-form-item">
<label class="ui-label"><span class="lable">职位类别:</span></label></label> <select
<label class="ui-label"><span class="lable">学历要求:</span></label><select
class="ui-select" name="job.education">
<option value="0"></option>
<option value="1">大专</option>
<option value="2">本科</option>
<option value="3">研究生</option>
<option value="4">硕士</option>
<option value="5">博士</option>
</select>
</div>
<div class="ui-form-item">
<label class="ui-label"><span class="lable">工作经验:</span></label><select
class="ui-select" name="job.experience">
<option value="0">无经验要求</option>
<option value="1">1~3年</option>
<option value="2">3~5年</option>
<option value="3">5~10年</option>
</select>
</div>
<div class="ui-form-item">
<label class="ui-label"><span class="lable">职位类别:</span></label><select
class="ui-select" name="job.type">
<option value="0">请选择职位类别:</option>
<option value="1">.NET程序员</option>
Expand Down
4 changes: 2 additions & 2 deletions WebRoot/WEB-INF/views/job/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<#include "/layout/_layout.html" /> <@head title="首页|四眼井|互联网人的乐园 ">
</@head> <@body> <#include "/layout/_nav.html" /><@nav 5/>
</@head> <@body>
<script type="text/javascript">
var type={"1":"NET程序员","2":"PHP程序员","3":"Java程序员",
"4":"C/C++程序员","19":"Python程序员","20":"Ruby程序员",
Expand All @@ -22,7 +22,7 @@
function dissalary(a){
document.write(salary[a]);
}</script>
<div class="container clearfix">
<div class="clearfix">
<div class="ui-grid-19">
<div class="mgl-20">
<div class="ui-box">
Expand Down
9 changes: 5 additions & 4 deletions WebRoot/WEB-INF/views/job/show.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ <h4>${job.title}</h4>
<li>
<strong style="margin-left: 13px">发布者:</strong>
<a href="http://my.oschina.net/u/1030362">
Tinky
${job.authorname}
</a>
</li>
<li>
<strong>发布日期:</strong>&nbsp;${job.createtime?string("yyyy-MM-dd")}
<strong>发布日期:</strong>&nbsp; ${job.createtime?string("yyyy-MM-dd")}
</li>
<li>
<strong>工作地点:</strong>
Expand Down Expand Up @@ -58,11 +58,11 @@ <h4>职位要求:</h4>
</li>
<li>
<strong>学历要求: </strong>
专科
<script>disedu('${job.education}');</script>
</li>
<li>
<strong>工作经验: </strong>
无经验要求
<script>disexp('${job.experience}');</script>
</li>
<li>
<strong>工作性质: </strong>
Expand Down Expand Up @@ -101,5 +101,6 @@ <h4>职位要求:</h4>
</div>
</div>
</div>
<#include "/layout/job/rightmoudle.html">
</div>
</@body>
68 changes: 68 additions & 0 deletions WebRoot/js/job.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
*display
*/
var type = {
"1": "NET程序员",
"2": "PHP程序员",
"3": "Java程序员",
"4": "C/C++程序员",
"19": "Python程序员",
"20": "Ruby程序员",
"5": "JavaScript程序员",
"6": "Flash程序员",
"7": "Delphi程序员",
"8": "前端开发工程师",
"9": "项目经理",
"10": "技术主管",
"11": "架构师",
"12": "技术总监",
"13": "测试工程师",
"14": "系统管理员",
"15": "数据库管理员",
"16": "售前工程师",
"17": "手机应用开发工程师",
"18": "其他"
};
var salary = {
"0000001000": "1000元以下",
"0100002000": "1000-2000元",
"0200104000": "2001-4000元",
"0400106000": "4001-6000元",
"0600108000": "6001-8000元",
"0800110000": "8001-10000元",
"1000115000": "10001-15000元",
"1500125000": "15000-25000元",
"2500199999": "25000元以上"
};
var exp={
"0":"无经验要求",
"1":"1~3年",
"2":"3~5年",
"3":"5~10年"
};
var edu={
"0":"无学历要求",
"1":"大专",
"2":"本科",
"3":"研究生",
"4":"硕士",
"5":"博士"
};
function distype(a){
document.write(type[a]);
}

function dissalary(a){
document.write(salary[a]);
}

function disexp(a){
document.write(exp[a]);
}

function disedu(a){
document.write(edu[a]);
}
/*
* end dis
*/
1 change: 1 addition & 0 deletions WebRoot/layout/_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<link rel="stylesheet" type="text/css" href="/css/module.css"/>
<link rel="stylesheet" type="text/css" href="/css/siyanjing.css"/>
<link rel="stylesheet" type="text/css" href="/css/validationEngine.jquery.css"/>
<script src="/js/job.js"></script>

This comment has been minimized.

Copy link
@tidezyc

tidezyc Apr 24, 2013

这个不要写在这里,可以写在当前页面的@Head标签里

<script src="http://libs.baidu.com/jquery/1.9.0/jquery.min.js"></script>
<!--[if lt IE 9]>
<script src="http://cdn.thinkjet.me/js/html5shiv.js"></script>
Expand Down
2 changes: 1 addition & 1 deletion WebRoot/layout/admin/_layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<tr>
<td width="100px" valign="top">
<div id="admin_sider">
<#include "_nav.html" />
<#include "/layout/admin/_nav.html" />
</div>
</td>
<td width="100%" valign="top">
Expand Down
24 changes: 24 additions & 0 deletions WebRoot/layout/job/rightmoudle.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<aside class="ui-grid-6">
<div class="job-panel">
<a href="/job/add" class="job-button job-button-blue">我要招聘</a>
</div>
<div class="job-panel">
<a href="#" class="job-button job-button-red">我要招聘</a>
</div>
</aside>
<div class="ui-grid-6">
<div class="ui-box">
<div class="ui-box-title">热门职位</div>
<div class="ui-box-content">
<ul class="">


<#list hotjobtype as hot>
<li class=""><a href="/job/search?type=${hot.type}"><script type="text/javascript">distype('${hot.type}');</script></a>(${hot.count!})</li>

</#list>

</ul>
</div>
</div>
</div>
66 changes: 66 additions & 0 deletions job.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
-- MySQL dump 10.13 Distrib 5.6.10, for Win64 (x86_64)
--
-- Host: localhost Database: siyanjing
-- ------------------------------------------------------
-- Server version 5.6.10

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_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 */;

--
-- Table structure for table `job`
--

DROP TABLE IF EXISTS `job`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `job` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`title` varchar(45) NOT NULL,
`content` varchar(255) NOT NULL,
`author` bigint(20) NOT NULL,
`type` int(11) DEFAULT NULL,
`salary` varchar(45) DEFAULT NULL,
`createtime` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
`city` varchar(45) DEFAULT NULL,
`company` varchar(45) DEFAULT NULL,
`name` varchar(45) DEFAULT NULL,
`recruiting_numbers` int(11) DEFAULT NULL,
`email` varchar(45) DEFAULT NULL,
`education` int(5) DEFAULT '0',
`experience` int(5) DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `id_UNIQUE` (`id`),
KEY `author_wglnfkp_idx` (`author`),
CONSTRAINT `author_wglnfkp` FOREIGN KEY (`author`) REFERENCES `users` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `job`
--

LOCK TABLES `job` WRITE;
/*!40000 ALTER TABLE `job` DISABLE KEYS */;
INSERT INTO `job` VALUES (4,'有钱','1、有钱\r\n2、有钱',1,4,'2500199999','2013-04-12 18:01:19','有钱','有钱','有钱',1,'有钱',0,0),(5,'纳尼','1/嘻嘻\r\n2/嘻嘻',6,17,'2500199999','2013-04-21 14:21:57','杭州','哈哈','工程师',5,'[email protected]',5,3);
/*!40000 ALTER TABLE `job` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2013-04-21 18:31:48
4 changes: 3 additions & 1 deletion sql/job_sql.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<sqlGroup name="job">

<sql id="findOneById">
select U.username authorname,J.*,R.views,R.comments from users U, job J left join job_record R on J.id=R.id where U.id=J.author and J.id= ?
</sql>
<sql id="findListForIndex">
select J.*,R.views,R.comments from job J left join job_record R on J.id=R.id order by J.id asc limit 0,10
</sql>
Expand Down
13 changes: 12 additions & 1 deletion src/me/thinkjet/controller/CommentController.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,24 @@ public void index() {
this.setAttr("comment_list", Comment.dao.paginateByCache("comment",
target + "_" + page, page, 6, "select c.*,u.avatar",
"as avatar from comment c left join users u "
+ "on c.target=? and c.comment_uname=u.username "
+ "on c.comment_uname=u.username "
+"where c.target=? "
+ "order by c.id asc", target));
this.setAttr(
"count",
Comment.dao.findByCache("comment", "count_" + target,
"select count(id) from comment where target=?", target)
.get(0).getAttrValues()[0]);
System.out.println(Comment.dao.paginateByCache("comment",
target + "_" + page, page, 6, "select c.*,u.avatar",
"as avatar from comment c left join users u "
+ "on c.target=? and c.comment_uname=u.username "
+ "order by c.id asc", target));
this.render("comment.html");
}
public void add(){
Comment comment = getModel(Comment.class);
comment.save();
}

}
14 changes: 7 additions & 7 deletions src/me/thinkjet/controller/JobController.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package me.thinkjet.controller;

import me.thinkjet.auth.AuthInterceptor;
import me.thinkjet.auth.AuthManager;
import me.thinkjet.interceptor.JobInterceptor;
import me.thinkjet.interceptor.JobRecordInterceptor;
import me.thinkjet.model.Job;
Expand All @@ -14,7 +16,6 @@
@ControllerBind(controllerKey = "/job", viewPath = "job")
@Before(JobInterceptor.class)
public class JobController extends Controller {
private static final String SESSION_ID = "syj_session_user";

@Before(CacheInterceptor.class)
@CacheName("job-index")
Expand All @@ -26,8 +27,7 @@ public void index() {

// 返回用户发布的所有招聘
public void findByUser() {
setAttr("joblist", Job.dao.find(SqlKit.sql("job.findByUser"), this
.getSession().getAttribute(SESSION_ID)));
setAttr("joblist", Job.dao.find(SqlKit.sql("job.findByUser"),AuthManager.getSession(this).getUser().getLong("id")));
render("job-user.html");
}

Expand All @@ -39,7 +39,7 @@ public void add() {
// 提交发布招聘
public void create() {
Job job = getModel(Job.class);
job.set("author", /* this.getSession().getAttribute(SESSION_ID) */1);
job.set("author", AuthManager.getSession(this).getUser().getLong("id"));
job.save();
render("index.html");
}
Expand All @@ -51,9 +51,9 @@ public void update() {
}

// 显示单条记录
@Before({ JobRecordInterceptor.class, CacheInterceptor.class })
@Before(JobRecordInterceptor.class)
public void show() {
setAttr("job", Job.dao.findById(getPara("id")));
setAttr("job", Job.dao.findFirst(SqlKit.sql("job.findOneById"),getPara("id")));
}

// 修改
Expand All @@ -64,7 +64,7 @@ public void edit() {
// 搜索岗位
public void search() {
StringBuffer sql = new StringBuffer(
"select J.*,R.views,R.comments from job J left join jobrecord R on J.id=R.id where 1=1");
"select J.*,R.views,R.comments from job J left join job_record R on J.id=R.id where 1=1");
if (this.getPara("name") != null && !this.getPara("name").equals(""))
sql.append(" and J.name like '%" + this.getPara("name") + "%'");
if (this.getPara("type") != null && !this.getPara("type").equals(""))
Expand Down
2 changes: 1 addition & 1 deletion src/me/thinkjet/controller/RegisterController.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void pass() {
users.set("verify", null).set("verified", 1).update();
else
this.render("error.html");
this.render("/WEB-INF/views/login.html");
this.render("/WEB-INF/views/profile/login.html");

This comment has been minimized.

Copy link
@tidezyc

tidezyc Apr 24, 2013

这里适合用redirect方法,this.redirect("/login");

}

}

0 comments on commit 1c21769

Please sign in to comment.