Commit 4cbe97dc authored by zhangyong's avatar zhangyong

1

parent 3c3834bb
package com.egolm.shop.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.shop.service.PageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
@Api(tags={"页面相关接口"})
@RestController
@RequestMapping("page")
public class PageController {
@Autowired
private PageService pageService;
@ApiOperation("查询(只有一条)")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言", defaultValue = "936"),
})
@RequestMapping(value = "/query",method=RequestMethod.GET)
public String query(HttpServletRequest request) {
String LangID = request.getParameter("LangID");
if(!StringUtil.isNotEmpty(LangID)) {
return Rjx.json().setCode(-1).setMessage("参数不能为空").toJson();
}
Map<String,Object> params = new HashMap<String,Object>();
List<Map<String,Object>> layoutList = pageService.query(params);
if(layoutList != null && layoutList.size() >0) {
return Rjx.jsonOk().set("detail", layoutList.get(0)).toString();
}else {
return Rjx.jsonOk().set("detail", new HashMap<String,Object>()).toString();
}
}
}
package com.egolm.shop.service;
import java.util.List;
import java.util.Map;
public interface PageService {
public List<Map<String, Object>> query(Map<String, Object> params);
}
package com.egolm.shop.service.impl;
import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.shop.service.PageService;
@Service
public class PageServiceImpl implements PageService {
@Autowired
private JdbcTemplate jdbcTemplate;
@Override
public List<Map<String, Object>> query(Map<String, Object> params) {
String sql = "SELECT sPlatformNO platformNO,sPlatformName platformName,sLogoPath1 logoPath1 ,sLogoPath2 logoPath2,sLogoPath3 logoPath3,sThemeNO themeNO,sThemeJson themeJson,sMemo memo,dLastUpdateTime lastUpdateTime "
+ " FROM tPlatformLayout " + "WHERE nTag &1=0 ORDER BY dLastUpdateTime DESC ";
return jdbcTemplate.queryForList(sql);
}
}
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