Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
admin
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
曲欣亮
admin
Commits
1ec90c09
Commit
1ec90c09
authored
Aug 07, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
http://zhangyong@gitlab.egolm.com/key/admin.git
parents
d6edff1a
6c1dcca9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
385 additions
and
0 deletions
+385
-0
ThemeTemplateConfController.java
...m/egolm/admin/controller/ThemeTemplateConfController.java
+229
-0
ThemeTemplateService.java
...in/java/com/egolm/admin/service/ThemeTemplateService.java
+18
-0
ThemeTemplateServiceImpl.java
...om/egolm/admin/service/impl/ThemeTemplateServiceImpl.java
+138
-0
No files found.
src/main/java/com/egolm/admin/controller/ThemeTemplateConfController.java
0 → 100644
View file @
1ec90c09
package
com
.
egolm
.
admin
.
controller
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
javax.servlet.http.HttpServletRequest
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
org.springframework.web.bind.annotation.RestController
;
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
;
import
io.swagger.annotations.Api
;
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"
)
public
class
ThemeTemplateConfController
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
ThemeTemplateConfController
.
class
);
@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
=
"主题编号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"
)
public
Object
insert
(
String
sMemo
,
String
sThemeAuthor
,
String
sSnapshot1
,
String
sSnapshot2
,
String
sThemeNO
,
Integer
nTag
,
String
sCaption
,
String
sCreateUser
,
String
sThemeJson
,
String
sThemeName
,
String
sSnapshot3
)
{
Date
d
=
new
Date
();
TPlatformTheme
tPlatformTheme
=
new
TPlatformTheme
(
sMemo
,
d
,
sThemeAuthor
,
d
,
sSnapshot1
,
sSnapshot2
,
sThemeNO
,
nTag
,
sCaption
,
sCreateUser
,
sThemeJson
,
sThemeName
,
sCreateUser
,
d
,
sSnapshot3
);
logger
.
info
(
"新增主题》》》"
+
GsonUtil
.
toJson
(
tPlatformTheme
));
ttService
.
insert
(
tPlatformTheme
);
return
Rjx
.
jsonOk
().
set
(
"detail"
,
ttService
.
selectByNO
(
sThemeNO
)).
toString
();
}
/**
*
* @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
=
"主题编号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"
)
public
Object
update
(
String
sMemo
,
String
sThemeAuthor
,
String
sSnapshot1
,
String
sSnapshot2
,
String
sThemeNO
,
Integer
nTag
,
String
sCaption
,
String
sUpdateUser
,
String
sThemeJson
,
String
sThemeName
,
String
sSnapshot3
)
{
Date
d
=
new
Date
();
TPlatformTheme
tPlatformTheme
=
new
TPlatformTheme
(
sMemo
,
//sMemo备注
d
,
//dLastUpdateTime最后更新时间
sThemeAuthor
,
//sThemeAuthor作者
d
,
//dCreateDate创建时间
sSnapshot1
,
//sSnapshot1快照1
sSnapshot2
,
//sSnapshot2快照2
sThemeNO
,
//sThemeNO模板编号
nTag
,
//nTag状态
sCaption
,
//sCaption说明
sUpdateUser
,
//sUpdateUser修改人
sThemeJson
,
//sThemeJson模板配置
sThemeName
,
//sThemeName模板名称
sUpdateUser
,
//sCreateUser创建人
d
,
//dUpdateDate更新日期
sSnapshot3
//sSnapshot3快照3
);
logger
.
info
(
"修改主题》》》"
+
GsonUtil
.
toJson
(
tPlatformTheme
));
return
Rjx
.
jsonOk
().
set
(
"detail"
,
ttService
.
update
(
tPlatformTheme
)).
toString
();
}
/**
*
* @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
=
"页码"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"limit"
,
dataType
=
"long"
,
required
=
false
,
value
=
"每页显示记录条数"
),
})
@ResponseBody
@GetMapping
(
"/getThemeList"
)
public
Object
query
(
String
searchKey
,
Long
index
,
Long
limit
){
logger
.
info
(
"主题列表查询》》》searchKey: "
+
searchKey
+
", index: "
+
index
+
", limit: "
+
limit
);
if
(
StringUtil
.
isEmpty
(
index
)){
index
=
1L
;
}
if
(
StringUtil
.
isEmpty
(
limit
)){
limit
=
10L
;
}
Page
page
=
new
Page
();
page
.
setIndex
(
index
);
page
.
setLimit
(
limit
);
page
.
setLimitKey
(
" dLastUpdateTime desc "
);
List
<
Map
<
String
,
Object
>>
themeList
=
ttService
.
queryList
(
searchKey
,
page
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
themeList
).
setPage
(
page
).
toString
();
}
}
src/main/java/com/egolm/admin/service/ThemeTemplateService.java
0 → 100644
View file @
1ec90c09
package
com
.
egolm
.
admin
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.egolm.admin.pojo.TPlatformTheme
;
import
com.egolm.common.jdbc.Page
;
public
interface
ThemeTemplateService
{
public
TPlatformTheme
insert
(
TPlatformTheme
theme
);
public
TPlatformTheme
selectByNO
(
String
themeNO
);
public
TPlatformTheme
update
(
TPlatformTheme
theme
);
public
List
<
Map
<
String
,
Object
>>
queryList
(
String
searchKey
,
Page
page
);
}
src/main/java/com/egolm/admin/service/impl/ThemeTemplateServiceImpl.java
0 → 100644
View file @
1ec90c09
package
com
.
egolm
.
admin
.
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.admin.config.XException
;
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
{
@Autowired
private
JdbcTemplate
jdbcTemplate
;
/**
*
* @Title: insert
* @Description: TODO(新增主题模板)
* @param theme
* @return
* @throws
*/
@Override
public
TPlatformTheme
insert
(
TPlatformTheme
theme
)
{
try
{
jdbcTemplate
.
save
(
theme
);
}
catch
(
Exception
e
){
throw
new
XException
(
"新增失败"
,
e
);
}
return
selectByNO
(
theme
.
getsThemeNO
());
}
/**
*
* @Title: selectByNO
* @Description: TODO(查询主题模板)
* @param themeNO
* @return
* @throws
*/
@Override
public
TPlatformTheme
selectByNO
(
String
themeNO
)
{
try
{
String
sql
=
"select * from tPlatformTheme where sThemeNO = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
TPlatformTheme
.
class
,
themeNO
);
}
catch
(
Exception
e
){
throw
new
XException
(
"查询失败"
,
e
);
}
}
/**
*
* @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
,
theme
.
getsThemeName
(),
theme
.
getsThemeAuthor
(),
theme
.
getsCaption
(),
theme
.
getsThemeJson
(),
theme
.
getsSnapshot1
(),
theme
.
getsSnapshot2
(),
theme
.
getsSnapshot3
(),
theme
.
getsMemo
(),
theme
.
getnTag
(),
theme
.
getsUpdateUser
(),
theme
.
getdUpdateDate
(),
theme
.
getdLastUpdateTime
(),
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
{
String
sql
=
"select * from tPlatformTheme where nTag&1 = 0"
;
List
<
Map
<
String
,
Object
>>
themes
=
null
;
if
(
StringUtil
.
isNotEmpty
(
searchKey
)){
sql
+=
" and (sThemeNO like ? or sThemeName like ? or sThemeAuthor like ? or sCaption like ?)"
;
String
keyWord
=
"%"
+
searchKey
+
"%"
;
themes
=
jdbcTemplate
.
limit
(
sql
,
page
,
keyWord
,
keyWord
,
keyWord
,
keyWord
);
}
else
{
themes
=
jdbcTemplate
.
limit
(
sql
,
page
);
}
return
themes
;
}
catch
(
Exception
e
){
throw
new
XException
(
"查询失败"
,
e
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment