一、项目简述
功能: 前后用户的登录注册,婚纱照片分类,查看,摄影师预 订,后台订单管理,图片管理等等。
二、项目运行
环境配置: Jdk1.8 + Tomcat8.5 + mysql + Eclispe (IntelliJ IDEA,Eclispe,MyEclispe,Sts 都支持)
项目技术: Jdbc+ Servlert + html+ css + JavaScript + JQuery + Ajax + Fileupload
适用
课程设计,大作业,毕业设计,项目练习,学习演示等
page.getRows());
if (!results.isEmpty() && results != null) {
int total = Integer.valueOf(worksService.selectBySQL(countSql.toString()).get(0).get("total").toString());
int rows = page.getRows();
rows = rows == 0 ? 10 : rows;
resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
resultMap.put("page", page.getPage());
resultMap.put("records", total);
resultMap.put("rows", results);
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
}
}catch (Exception e) {
logger.error("分页获取works失败" + e);
}
return returnResult;
resultMap.put("rows", results);
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
}
} catch (Exception e) {
logger.error("分页获取photographer失败" + e);
}
return returnResult;
}
/**
* 分页获取启用的photographer
*
* @return
*/
@RequestMapping(value = "getPhotographerListByPageStatus", method = RequestMethod.POST)
/**
* 分页获取works
* @return
*/
@RequestMapping(value = "getWorksListByPage", method = RequestMethod.POST)
@ResponseBody
public ReturnResult getWorksListByPage(PageVO page,String photographerId,String spotsId,String status) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
Map<String, Object> resultMap = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("SELECT a.*,b.`name` AS photographer,c.`name` AS spots FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
StringBuffer countSql = new StringBuffer("SELECT COUNT(*) AS total FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
if(StringUtils.isNotBlank(photographerId)){
sql.append(" AND b.id="+photographerId);
countSql.append(" AND b.id="+photographerId);
}
if(StringUtils.isNotBlank(spotsId)){
sql.append(" AND c.id="+spotsId);
countSql.append(" AND c.id="+spotsId);
}
if(StringUtils.isNotBlank(status)){
}
/**
* 分页获取works
* @return
*/
@RequestMapping(value = "getWorksListByPage", method = RequestMethod.POST)
@ResponseBody
public ReturnResult getWorksListByPage(PageVO page,String photographerId,String spotsId,String status) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
Map<String, Object> resultMap = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("SELECT a.*,b.`name` AS photographer,c.`name` AS spots FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
StringBuffer countSql = new StringBuffer("SELECT COUNT(*) AS total FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
if(StringUtils.isNotBlank(photographerId)){
sql.append(" AND b.id="+photographerId);
countSql.append(" AND b.id="+photographerId);
}
if(StringUtils.isNotBlank(spotsId)){
sql.append(" AND c.id="+spotsId);
countSql.append(" AND c.id="+spotsId);
}
if(StringUtils.isNotBlank(status)){
sql.append(" AND a.status="+status);
countSql.append(" AND a.status="+status);
}
List<Map<String, Object>> results = worksService.selectPageBySQL(sql.toString(), page.getPage() - 1,
return returnResult;
}
/**
* 修改photographer的name和summary
*
* @param photographer
* @return
*/
@RequestMapping(value = "updatePhotographer", method = RequestMethod.POST)
@ResponseBody
public ReturnResult updatePhotographer(TPhotographer photographer, Integer labelId, Integer levelId,
Integer spotsId) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
photographerService.updateBySQL("UPDATE t_photographer SET name='" + photographer.getName() + "',summary='"
+ photographer.getSummary() + "',status=" + photographer.getStatus() + " WHERE id="
+ photographer.getId());
photographerLabelService.updateBySQL("UPDATE t_photographer_label SET labelId=" + labelId
+ " WHERE photographerId=" + photographer.getId());
photographerLevelService.updateBySQL("UPDATE t_photographer_level SET levelId=" + levelId
+ " WHERE photographer=" + photographer.getId());
photographerSpotsService.updateBySQL("UPDATE t_photographer_spots SET spotsId=" + spotsId
@ResponseBody
public ReturnResult getWorksById(Integer id) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(worksService.selectByPrimaryKey(id));
} catch (Exception e) {
logger.error("根据id获取Works失败" + e);
}
return returnResult;
}
/**
* 根据id获取Works 用户视图
* @param Works
* @return
*/
@RequestMapping(value = "getWorks")
@ResponseBody
public ReturnResult getWorks(Integer id) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(worksService.getWorks(id));
}
return returnResult;
}
/**
* 根据id获取Works
* @param Works
* @return
*/
@RequestMapping(value = "getWorksById")
@ResponseBody
public ReturnResult getWorksById(Integer id) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(worksService.selectByPrimaryKey(id));
} catch (Exception e) {
logger.error("根据id获取Works失败" + e);
}
return returnResult;
}
/**
* 根据id获取Works 用户视图
* @param Works
* @return
*/
@RequestMapping(value = "getWorksListByPage", method = RequestMethod.POST)
@ResponseBody
public ReturnResult getWorksListByPage(PageVO page,String photographerId,String spotsId,String status) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
Map<String, Object> resultMap = new HashMap<String, Object>();
StringBuffer sql = new StringBuffer("SELECT a.*,b.`name` AS photographer,c.`name` AS spots FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
StringBuffer countSql = new StringBuffer("SELECT COUNT(*) AS total FROM t_works a,t_photographer b,t_spots c WHERE a.photographerId=b.id AND a.spotsId=c.id");
if(StringUtils.isNotBlank(photographerId)){
sql.append(" AND b.id="+photographerId);
countSql.append(" AND b.id="+photographerId);
}
if(StringUtils.isNotBlank(spotsId)){
sql.append(" AND c.id="+spotsId);
countSql.append(" AND c.id="+spotsId);
}
if(StringUtils.isNotBlank(status)){
rows = rows == 0 ? 10 : rows;
resultMap.put("total", (total % rows != 0 ? (total / rows + 1) : (total / rows)));
resultMap.put("page", page.getPage());
resultMap.put("records", total);
resultMap.put("rows", results);
returnResult.setStatus(ReturnCodeType.SUCCESS).setData(resultMap);
}
}catch (Exception e) {
logger.error("分页获取works失败" + e);
}
return returnResult;
}
/**
* 分页获取启用的works
* @return
*/
@RequestMapping(value = "getWorksListByPageStatus", method = RequestMethod.POST)
@ResponseBody
public ReturnResult getWorksListByPageStatus(String sord,String spotsId) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
String sql = "SELECT * FROM t_works WHERE status=0";
if(StringUtils.isNotBlank(sord)){
sql="SELECT * FROM t_works WHERE status=0 ORDER BY id DESC";
}
@ResponseBody
public ReturnResult getPhotographer(Integer id) {
returnResult.setStatus(ReturnCodeType.FAILURE);
try {
returnResult.setStatus(ReturnCodeType.SUCCESS)
.setData(photographerService.selectBySQL(
"SELECT a.name,a.head,a.summary,d.`name` AS level,e.`name` AS spots FROM t_photographer a,t_photographer_level b,t_photographer_spots c,t_level d,t_spots e WHERE a.id="+id+" AND b.photographer="+id+" AND c.photographerId="+id+" AND d.id=b.levelId AND e.id = c.spotsId AND a.`status`=0")
.get(0));
} catch (Exception e) {
logger.error("根据id获取Photographer失败" + e);
}
return returnResult;
}
/**
* 分页获取photographer
*
* @return