Commit 19bc0833 authored by 曲欣红's avatar 曲欣红

修改

parent 20095e65
......@@ -20,6 +20,7 @@ import com.egolm.admin.config.XException;
import com.egolm.admin.pojo.TPlatformTheme;
import com.egolm.admin.service.ThemeTemplateService;
import com.egolm.admin.service.impl.ThemeTemplateServiceImpl;
import com.egolm.common.GsonUtil;
import com.egolm.common.StringUtil;
import com.egolm.common.bean.Rjx;
import com.egolm.common.jdbc.Page;
......@@ -29,6 +30,13 @@ import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
*
* @author qu133
* @date 2018年8月7日
* @className ThemeTemplateConfController
* @Description 主题模板配置
*/
@Api(tags={"主题模板配置"})
@RestController
@RequestMapping("theme")
......@@ -39,20 +47,40 @@ public class ThemeTemplateConfController {
@Autowired
private ThemeTemplateService ttService;
/**
*
* @Title: insert
* @Description: TODO(新增主题)
* @return Object 返回类型
* @param sMemo
* @param sThemeAuthor
* @param sSnapshot1
* @param sSnapshot2
* @param sThemeNO
* @param nTag
* @param sCaption
* @param sCreateUser
* @param sThemeJson
* @param sThemeName
* @param sSnapshot3
* @return
* @throws
*/
@ApiOperation("新增主题")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态"),
@ApiImplicitParam(paramType = "query", name = "sCreateUser", dataType = "String", required = true, value = "创建人"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称varchar(100)"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置text(0)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态int(0)"),
@ApiImplicitParam(paramType = "query", name = "sCreateUser", dataType = "String", required = true, value = "创建人varchar(30)"),
})
@ResponseBody
@PostMapping(value = "/insert")
......@@ -87,24 +115,44 @@ public class ThemeTemplateConfController {
d,
sSnapshot3
);
logger.info("新增主题》》》"+GsonUtil.toJson(tPlatformTheme));
ttService.insert(tPlatformTheme);
return Rjx.jsonOk().set("detail", ttService.selectByNO(sThemeNO)).toString();
}
@ApiOperation("新增主题")
/**
*
* @Title: update
* @Description: TODO(修改主题)
* @return Object 返回类型
* @param sMemo
* @param sThemeAuthor
* @param sSnapshot1
* @param sSnapshot2
* @param sThemeNO
* @param nTag
* @param sCaption
* @param sUpdateUser
* @param sThemeJson
* @param sThemeName
* @param sSnapshot3
* @return
* @throws
*/
@ApiOperation("修改主题")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "LangID", dataType = "String", required = true, value = "语言"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态"),
@ApiImplicitParam(paramType = "query", name = "sUpdateUser", dataType = "String", required = true, value = "修改人"),
@ApiImplicitParam(paramType = "query", name = "sThemeNO", dataType = "String", required = true, value = "主题编号varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sThemeName", dataType = "String", required = true, value = "主题名称varchar(100)"),
@ApiImplicitParam(paramType = "query", name = "sThemeAuthor", dataType = "String", required = true, value = "主题作者varchar(50)"),
@ApiImplicitParam(paramType = "query", name = "sCaption", dataType = "String", required = true, value = "主题说明varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sThemeJson", dataType = "String", required = true, value = "主题配置text(0)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot1", dataType = "String", required = true, value = "主题快照1varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot2", dataType = "String", required = true, value = "主题快照2varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sSnapshot3", dataType = "String", required = true, value = "主题快照3varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "sMemo", dataType = "String", required = true, value = "备注varchar(300)"),
@ApiImplicitParam(paramType = "query", name = "nTag", dataType = "int", required = true, value = "状态int(0)"),
@ApiImplicitParam(paramType = "query", name = "sUpdateUser", dataType = "String", required = true, value = "修改人varchar(30)"),
})
@ResponseBody
@PostMapping(value = "/update")
......@@ -139,10 +187,22 @@ public class ThemeTemplateConfController {
d,//dUpdateDate更新日期
sSnapshot3//sSnapshot3快照3
);
logger.info("修改主题》》》"+GsonUtil.toJson(tPlatformTheme));
return Rjx.jsonOk().set("detail", ttService.update(tPlatformTheme)).toString();
}
@ApiOperation("用户列表查询")
/**
*
* @Title: query
* @Description: TODO(主题列表查询)
* @return Object 返回类型
* @param searchKey
* @param index
* @param limit
* @return
* @throws
*/
@ApiOperation("主题列表查询")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "searchKey", dataType = "String", required = false, value = "用户编码/名称"),
@ApiImplicitParam(paramType = "query", name = "index", dataType = "long", required = false, value = "页码"),
......@@ -151,6 +211,7 @@ public class ThemeTemplateConfController {
@ResponseBody
@GetMapping("/getUserList")
public Object query(String searchKey, Long index, Long limit){
logger.info("主题列表查询》》》searchKey: "+searchKey+", index: "+index+", limit: "+limit);
if(StringUtil.isEmpty(index)){
index = 1L;
}
......
......@@ -3,27 +3,37 @@ package com.egolm.admin.service.impl;
import java.util.List;
import java.util.Map;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.egolm.admin.config.XException;
import com.egolm.admin.controller.OSSFileController;
import com.egolm.admin.pojo.TPlatformTheme;
import com.egolm.admin.service.ThemeTemplateService;
import com.egolm.common.StringUtil;
import com.egolm.common.jdbc.JdbcTemplate;
import com.egolm.common.jdbc.Page;
/**
*
* @author qu133
* @date 2018年8月7日
* @className ThemeTemplateServiceImpl
* @Description 主题模板管理相关业务逻辑
*/
@Service
public class ThemeTemplateServiceImpl implements ThemeTemplateService{
private static final Log logger = LogFactory.getLog(ThemeTemplateServiceImpl.class);
@Autowired
private JdbcTemplate jdbcTemplate;
/**
*
* @Title: insert
* @Description: TODO(新增主题模板)
* @param theme
* @return
* @throws
*/
@Override
public TPlatformTheme insert(TPlatformTheme theme) {
try{
......@@ -34,6 +44,14 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
return selectByNO(theme.getsThemeNO());
}
/**
*
* @Title: selectByNO
* @Description: TODO(查询主题模板)
* @param themeNO
* @return
* @throws
*/
@Override
public TPlatformTheme selectByNO(String themeNO) {
try{
......@@ -44,9 +62,22 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
}
}
/**
*
* @Title: update
* @Description: TODO(修改主题模板)
* @param theme
* @return
* @throws
*/
@Override
public TPlatformTheme update(TPlatformTheme theme) {
try{
String sThemeNO = theme.getsThemeNO();
boolean haveTheme = haveTheme(sThemeNO);
if(!haveTheme){
throw new XException("无此模板:"+sThemeNO);
}
String sql = "update tPlatformTheme set sThemeName = ?, sThemeAuthor = ?, sCaption = ?, sThemeJson = ?, sSnapshot1 = ?, sSnapshot2 = ?, sSnapshot3 = ?, sMemo = ?, nTag = ?, sUpdateUser = ?, dUpdateDate = ?, dLastUpdateTime = ? where sThemeNO = ?";
jdbcTemplate.update(
sql,
......@@ -62,14 +93,29 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
theme.getsUpdateUser(),
theme.getdUpdateDate(),
theme.getdLastUpdateTime(),
theme.getsThemeNO()
sThemeNO
);
}catch(Exception e){
throw new XException("修改失败", e);
}
return selectByNO(theme.getsThemeNO());
}
private boolean haveTheme(String sThemeNO){
String sql = "select count(1) from tPlatformTheme where sThemeNO = ? and nTag&1 = 0";
Integer count = jdbcTemplate.queryForInt(sql, sThemeNO);
return count>0;
}
/**
*
* @Title: queryList
* @Description: TODO(查询主题模板列表)
* @param searchKey
* @param page
* @return
* @throws
*/
@Override
public List<Map<String, Object>> queryList(String searchKey, Page page) {
try{
......@@ -84,7 +130,7 @@ public class ThemeTemplateServiceImpl implements ThemeTemplateService{
}
return themes;
}catch(Exception e){
throw new XException("修改失败", e);
throw new XException("查询失败", e);
}
}
......
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