发表于: 2017-08-09 18:58:08
1 1074
今天完成的事:
找精英页面成功案例接口完成,公司在招职位页接口完成,测试通过。
明日计划:
把找职位页剩余的侧边职位标签和推荐公司接口完成。
遇到的问题:
1,找职位页有一个地方要显示在招职位数,
因为不想重复写SQL,所以就只能在原来的SQL基础上做一个判断:
public static Map<String, Object> getProfessionByCid(Long cid, Integer type, boolean bl) {
Map<String, Object> params = new HashMap<String, Object>();
if (DataUtils.isNotNullOrEmpty(cid)) {
params.put("c_id", cid);
}
if (DataUtils.isNotNullOrEmpty(type)) {
params.put("type ", type);
}
if (bl) {
params.put("@query", "count(id)");
} else {
params.put("@query", "id");
}
params.put("@table", "profession");
params.put("@order", "update_at desc ");
log.info("getProfessionByCid sql is " + SQLUtil.convert2Sql(params, 0, Integer.MAX_VALUE));
return params;
}
这里蓝色部分是用到了SQL的count函数。
2,成功案例那里显示的公司要保证在认证公司数量不足时有普通公司顶上。
所以在对认证与普通筛选时,我的做法是链表查询:
select p.id from profession p JOIN company c ON p.c_ic = c.id and c.approved = 0;
我看了一位师兄的做法是:
select id from profession where c_id in (select id from company where approved = 0);
从直观上看,他的做法是肯定对的,我的我想了想,自己也是试了试,应该没问题。唉,头有点懵,不想了。。。
收获:
进度:
职业部分前台还剩两个接口,发现后台公司还漏写了一个接口。
禅道:
评论