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
e1bc9c7f
Commit
e1bc9c7f
authored
Oct 13, 2018
by
zhangyong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
72feb32f
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
365 additions
and
51 deletions
+365
-51
BannerController.java
...ain/java/com/egolm/admin/controller/BannerController.java
+191
-0
TBanner.java
src/main/java/com/egolm/admin/pojo/TBanner.java
+75
-51
BannerService.java
src/main/java/com/egolm/admin/service/BannerService.java
+16
-0
BannerServiceImpl.java
.../java/com/egolm/admin/service/impl/BannerServiceImpl.java
+79
-0
messages_en.properties
src/main/resources/messages_en.properties
+2
-0
messages_zh_CN.properties
src/main/resources/messages_zh_CN.properties
+2
-0
No files found.
src/main/java/com/egolm/admin/controller/BannerController.java
0 → 100644
View file @
e1bc9c7f
package
com
.
egolm
.
admin
.
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.admin.pojo.TBanner
;
import
com.egolm.admin.service.BannerService
;
import
com.egolm.admin.util.AdminContstrant
;
import
com.egolm.admin.util.I18NUtils
;
import
com.egolm.common.DateUtil
;
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
;
@Api
(
tags
={
"Banner配置管理"
})
@RestController
@RequestMapping
(
"banner"
)
public
class
BannerController
{
@Autowired
private
BannerService
bannerService
;
@ApiOperation
(
"新增"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"idx"
,
dataType
=
"int"
,
required
=
true
,
value
=
"序号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"title"
,
dataType
=
"String"
,
required
=
true
,
value
=
"标题"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"imagePath"
,
dataType
=
"String"
,
required
=
true
,
value
=
"图片地址"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"linkType"
,
dataType
=
"String"
,
required
=
true
,
value
=
"链接类型"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"linkPath"
,
dataType
=
"String"
,
required
=
false
,
value
=
"链接地址"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"startTime"
,
dataType
=
"String"
,
required
=
true
,
value
=
"开始时间"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"endTime"
,
dataType
=
"String"
,
required
=
true
,
value
=
"结束时间"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orgList"
,
dataType
=
"String"
,
required
=
true
,
value
=
"组织机构(多个以逗号分隔)"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"userNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"创建人"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
@RequestMapping
(
value
=
"/save"
,
method
=
RequestMethod
.
POST
)
public
String
save
(
HttpServletRequest
request
)
{
String
idx
=
request
.
getParameter
(
"idx"
);
String
title
=
request
.
getParameter
(
"title"
);
String
imagePath
=
request
.
getParameter
(
"imagePath"
);
String
linkType
=
request
.
getParameter
(
"linkType"
);
String
linkPath
=
request
.
getParameter
(
"linkPath"
);
String
orgList
=
request
.
getParameter
(
"orgList"
);
String
startTime
=
request
.
getParameter
(
"startTime"
);
String
endTime
=
request
.
getParameter
(
"endTime"
);
String
userNO
=
request
.
getParameter
(
"userNO"
);
String
langID
=
request
.
getParameter
(
"langID"
);
if
(!
StringUtil
.
isNotEmpty
(
idx
,
title
,
imagePath
,
linkType
,
userNO
,
orgList
,
startTime
,
endTime
,
langID
))
{
return
Rjx
.
json
().
setCode
(-
1
).
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_Parameter_empty"
)).
toJson
();
}
TBanner
banner
=
new
TBanner
();
banner
.
setnIdx
(
Integer
.
valueOf
(
idx
));
banner
.
setsTitle
(
title
);
banner
.
setsImagePath
(
imagePath
);
banner
.
setsLinkType
(
linkType
);
banner
.
setsLinkPath
(
linkPath
);
banner
.
setsOrgList
(
orgList
);
banner
.
setdStartTime
(
DateUtil
.
parse
(
startTime
,
DateUtil
.
FMT_DATE
));
banner
.
setdEndTime
(
DateUtil
.
parse
(
endTime
,
DateUtil
.
FMT_DATE
));
banner
.
setsCreateUser
(
userNO
);
banner
.
setsUpdateUser
(
userNO
);
Rjx
rjx
=
bannerService
.
save
(
banner
);
Rjx
result
=
Rjx
.
json
();
result
.
setCode
(
rjx
.
getCode
());
result
.
setMessage
(
I18NUtils
.
getMessage
(
langID
,
rjx
.
get
(
AdminContstrant
.
I18n_KEY
)+
""
));
return
result
.
toJson
();
}
@ApiOperation
(
"编辑"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"itemId"
,
dataType
=
"int"
,
required
=
true
,
value
=
"主键"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"idx"
,
dataType
=
"int"
,
required
=
true
,
value
=
"序号"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"title"
,
dataType
=
"String"
,
required
=
true
,
value
=
"标题"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"imagePath"
,
dataType
=
"String"
,
required
=
true
,
value
=
"图片地址"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"linkType"
,
dataType
=
"String"
,
required
=
true
,
value
=
"链接类型"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"linkPath"
,
dataType
=
"String"
,
required
=
false
,
value
=
"链接地址"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"startTime"
,
dataType
=
"String"
,
required
=
true
,
value
=
"开始时间"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"endTime"
,
dataType
=
"String"
,
required
=
true
,
value
=
"结束时间"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"userNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"修改人"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
@RequestMapping
(
value
=
"/modify"
,
method
=
RequestMethod
.
POST
)
public
String
modify
(
HttpServletRequest
request
)
{
String
itemId
=
request
.
getParameter
(
"itemId"
);
String
idx
=
request
.
getParameter
(
"idx"
);
String
title
=
request
.
getParameter
(
"title"
);
String
imagePath
=
request
.
getParameter
(
"imagePath"
);
String
linkType
=
request
.
getParameter
(
"linkType"
);
String
linkPath
=
request
.
getParameter
(
"linkPath"
);
String
startTime
=
request
.
getParameter
(
"startTime"
);
String
endTime
=
request
.
getParameter
(
"endTime"
);
String
userNO
=
request
.
getParameter
(
"userNO"
);
String
langID
=
request
.
getParameter
(
"langID"
);
if
(!
StringUtil
.
isNotEmpty
(
itemId
,
idx
,
title
,
imagePath
,
linkType
,
userNO
,
startTime
,
endTime
,
langID
))
{
return
Rjx
.
json
().
setCode
(-
1
).
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_Parameter_empty"
)).
toJson
();
}
TBanner
banner
=
bannerService
.
getBannerById
(
itemId
);
if
(
banner
!=
null
)
{
banner
.
setnIdx
(
Integer
.
valueOf
(
idx
));
banner
.
setsTitle
(
title
);
banner
.
setsImagePath
(
imagePath
);
banner
.
setsLinkType
(
linkType
);
banner
.
setsLinkPath
(
linkPath
);
banner
.
setdStartTime
(
DateUtil
.
parse
(
startTime
,
DateUtil
.
FMT_DATE
));
banner
.
setdEndTime
(
DateUtil
.
parse
(
endTime
,
DateUtil
.
FMT_DATE
));
banner
.
setsUpdateUser
(
userNO
);
Rjx
rjx
=
bannerService
.
update
(
banner
);
Rjx
result
=
Rjx
.
jsonOk
();
result
.
setMessage
(
I18NUtils
.
getMessage
(
langID
,
rjx
.
get
(
AdminContstrant
.
I18n_KEY
)+
""
));
return
result
.
toJson
();
}
else
{
return
Rjx
.
jsonErr
().
setCode
(-
100
).
setMessage
(
"数据不存在"
).
toJson
();
}
}
@ApiOperation
(
"删除"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"itemId"
,
dataType
=
"int"
,
required
=
true
,
value
=
"主键"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"userNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"修改人"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"langID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
})
@RequestMapping
(
value
=
"/delete"
,
method
=
RequestMethod
.
GET
)
public
String
delete
(
HttpServletRequest
request
)
{
String
itemId
=
request
.
getParameter
(
"itemId"
);
String
userNO
=
request
.
getParameter
(
"userNO"
);
String
langID
=
request
.
getParameter
(
"langID"
);
if
(!
StringUtil
.
isNotEmpty
(
itemId
,
userNO
,
langID
))
{
return
Rjx
.
json
().
setCode
(-
1
).
setMessage
(
I18NUtils
.
getMessage
(
langID
,
"Msg_Parameter_empty"
)).
toJson
();
}
Rjx
result
=
bannerService
.
delete
(
Integer
.
valueOf
(
itemId
),
userNO
);
Rjx
rjx
=
result
.
json
();
rjx
.
setMessage
(
I18NUtils
.
getMessage
(
langID
,
result
.
get
(
AdminContstrant
.
I18n_KEY
)+
""
));
return
rjx
.
toJson
();
}
@ApiOperation
(
"查询"
)
@ApiImplicitParams
({
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"orgNO"
,
dataType
=
"String"
,
required
=
true
,
value
=
"组织机构"
,
defaultValue
=
""
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"LangID"
,
dataType
=
"String"
,
required
=
true
,
value
=
"语言"
,
defaultValue
=
"936"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"index"
,
dataType
=
"int"
,
required
=
true
,
value
=
"页码"
,
defaultValue
=
"1"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"limit"
,
dataType
=
"int"
,
required
=
true
,
value
=
"每页显示数"
,
defaultValue
=
"10"
),
})
@RequestMapping
(
value
=
"/list"
,
method
=
RequestMethod
.
GET
)
public
String
list
(
HttpServletRequest
request
)
{
String
orgNO
=
request
.
getParameter
(
"orgNO"
);
String
langID
=
request
.
getParameter
(
"langID"
);
String
index
=
request
.
getParameter
(
"index"
);
String
limit
=
request
.
getParameter
(
"limit"
);
Map
<
String
,
Object
>
params
=
new
HashMap
<
String
,
Object
>();
params
.
put
(
"orgNO"
,
orgNO
);
params
.
put
(
"langID"
,
langID
);
Page
page
=
new
Page
();
page
.
setIndex
(
Long
.
valueOf
(
index
));
page
.
setLimit
(
Long
.
valueOf
(
limit
));
page
.
setLimitKey
(
" nIdx desc "
);
List
<
Map
<
String
,
Object
>>
list
=
bannerService
.
query
(
params
,
page
);
return
Rjx
.
jsonOk
().
set
(
"list"
,
list
).
toJson
();
}
}
src/main/java/com/egolm/admin/pojo/TBanner.java
View file @
e1bc9c7f
...
...
@@ -8,7 +8,7 @@ import java.util.Date;
/**
* @author 曲欣亮
* @since 2018-
08-06
* @since 2018-
10-13
* @version v-1.0
*/
@Entity
(
name
=
"tBanner"
)
...
...
@@ -16,32 +16,36 @@ public class TBanner implements java.io.Serializable {
private
static
final
long
serialVersionUID
=
1L
;
private
String
sCreateUser
;
private
String
sOrgList
;
private
Date
dLastUpdateTime
;
private
String
sTitle
;
private
Date
d
Upd
ateDate
;
private
Date
d
Cre
ateDate
;
private
String
sLinkPath
;
private
String
sOrgList
;
private
Date
dStartTime
;
@Id
private
Integer
nItem
;
private
Date
dCreateDate
;
private
Integer
nTag
;
private
String
sImagePath
;
private
Date
dLastUpdateTime
;
private
String
sUpdateUser
;
private
String
sLinkType
;
private
Integer
nIdx
;
private
String
s
Upd
ateUser
;
private
String
s
Cre
ateUser
;
private
Integer
nTag
;
private
Date
dUpdateDate
;
private
Date
dEndTime
;
/**
...
...
@@ -53,42 +57,54 @@ public class TBanner implements java.io.Serializable {
/**
* 全参数构造方法
* @param sCreateUser
* @param sOrgList
* @param dLastUpdateTime
* @param sTitle
* @param d
Upd
ateDate
* @param d
Cre
ateDate
* @param sLinkPath
* @param
sOrgList
* @param
dStartTime
* @param nItem
* @param
dCreateDate
* @param
nTag
* @param sImagePath
* @param
dLastUpdateTime
* @param
sUpdateUser
* @param sLinkType
* @param nIdx
* @param sUpdateUser
* @param nTag
* @param sCreateUser
* @param dUpdateDate
* @param dEndTime
*/
public
TBanner
(
String
sCreateUser
,
String
sTitle
,
Date
dUpdateDate
,
String
sLinkPath
,
String
sOrgList
,
Integer
nItem
,
Date
dCreateDate
,
String
sImagePath
,
Date
dLastUpdateTime
,
String
sLinkType
,
Integer
nIdx
,
String
sUpdateUser
,
Integer
nTag
)
{
this
.
sCreateUser
=
sCreateUser
;
public
TBanner
(
String
sOrgList
,
Date
dLastUpdateTime
,
String
sTitle
,
Date
dCreateDate
,
String
sLinkPath
,
Date
dStartTime
,
Integer
nItem
,
Integer
nTag
,
String
sImagePath
,
String
sUpdateUser
,
String
sLinkType
,
Integer
nIdx
,
String
sCreateUser
,
Date
dUpdateDate
,
Date
dEndTime
)
{
this
.
sOrgList
=
sOrgList
;
this
.
dLastUpdateTime
=
dLastUpdateTime
;
this
.
sTitle
=
sTitle
;
this
.
d
UpdateDate
=
dUpd
ateDate
;
this
.
d
CreateDate
=
dCre
ateDate
;
this
.
sLinkPath
=
sLinkPath
;
this
.
sOrgList
=
sOrgList
;
this
.
dStartTime
=
dStartTime
;
this
.
nItem
=
nItem
;
this
.
dCreateDate
=
dCreateDate
;
this
.
nTag
=
nTag
;
this
.
sImagePath
=
sImagePath
;
this
.
dLastUpdateTime
=
dLastUpdateTime
;
this
.
sUpdateUser
=
sUpdateUser
;
this
.
sLinkType
=
sLinkType
;
this
.
nIdx
=
nIdx
;
this
.
sUpdateUser
=
sUpdateUser
;
this
.
nTag
=
nTag
;
this
.
sCreateUser
=
sCreateUser
;
this
.
dUpdateDate
=
dUpdateDate
;
this
.
dEndTime
=
dEndTime
;
}
public
void
sets
CreateUser
(
String
sCreateUser
)
{
this
.
s
CreateUser
=
sCreateUser
;
public
void
sets
OrgList
(
String
sOrgList
)
{
this
.
s
OrgList
=
sOrgList
;
}
public
String
getsCreateUser
()
{
return
sCreateUser
;
public
String
getsOrgList
()
{
return
sOrgList
;
}
public
void
setdLastUpdateTime
(
Date
dLastUpdateTime
)
{
this
.
dLastUpdateTime
=
dLastUpdateTime
;
}
public
Date
getdLastUpdateTime
()
{
return
dLastUpdateTime
;
}
public
void
setsTitle
(
String
sTitle
)
{
...
...
@@ -99,12 +115,12 @@ public class TBanner implements java.io.Serializable {
return
sTitle
;
}
public
void
setd
UpdateDate
(
Date
dUpd
ateDate
)
{
this
.
d
UpdateDate
=
dUpd
ateDate
;
public
void
setd
CreateDate
(
Date
dCre
ateDate
)
{
this
.
d
CreateDate
=
dCre
ateDate
;
}
public
Date
getd
Upd
ateDate
()
{
return
d
Upd
ateDate
;
public
Date
getd
Cre
ateDate
()
{
return
d
Cre
ateDate
;
}
public
void
setsLinkPath
(
String
sLinkPath
)
{
...
...
@@ -115,12 +131,12 @@ public class TBanner implements java.io.Serializable {
return
sLinkPath
;
}
public
void
set
sOrgList
(
String
sOrgList
)
{
this
.
sOrgList
=
sOrgList
;
public
void
set
dStartTime
(
Date
dStartTime
)
{
this
.
dStartTime
=
dStartTime
;
}
public
String
getsOrgList
()
{
return
sOrgList
;
public
Date
getdStartTime
()
{
return
dStartTime
;
}
public
void
setnItem
(
Integer
nItem
)
{
...
...
@@ -131,12 +147,12 @@ public class TBanner implements java.io.Serializable {
return
nItem
;
}
public
void
set
dCreateDate
(
Date
dCreateDate
)
{
this
.
dCreateDate
=
dCreateDate
;
public
void
set
nTag
(
Integer
nTag
)
{
this
.
nTag
=
nTag
;
}
public
Date
getdCreateDate
()
{
return
dCreateDate
;
public
Integer
getnTag
()
{
return
nTag
;
}
public
void
setsImagePath
(
String
sImagePath
)
{
...
...
@@ -147,12 +163,12 @@ public class TBanner implements java.io.Serializable {
return
sImagePath
;
}
public
void
set
dLastUpdateTime
(
Date
dLastUpdateTime
)
{
this
.
dLastUpdateTime
=
dLastUpdateTime
;
public
void
set
sUpdateUser
(
String
sUpdateUser
)
{
this
.
sUpdateUser
=
sUpdateUser
;
}
public
Date
getdLastUpdateTime
()
{
return
dLastUpdateTime
;
public
String
getsUpdateUser
()
{
return
sUpdateUser
;
}
public
void
setsLinkType
(
String
sLinkType
)
{
...
...
@@ -171,20 +187,28 @@ public class TBanner implements java.io.Serializable {
return
nIdx
;
}
public
void
sets
UpdateUser
(
String
sUpd
ateUser
)
{
this
.
s
UpdateUser
=
sUpd
ateUser
;
public
void
sets
CreateUser
(
String
sCre
ateUser
)
{
this
.
s
CreateUser
=
sCre
ateUser
;
}
public
String
gets
Upd
ateUser
()
{
return
s
Upd
ateUser
;
public
String
gets
Cre
ateUser
()
{
return
s
Cre
ateUser
;
}
public
void
set
nTag
(
Integer
nTag
)
{
this
.
nTag
=
nTag
;
public
void
set
dUpdateDate
(
Date
dUpdateDate
)
{
this
.
dUpdateDate
=
dUpdateDate
;
}
public
Integer
getnTag
()
{
return
nTag
;
public
Date
getdUpdateDate
()
{
return
dUpdateDate
;
}
public
void
setdEndTime
(
Date
dEndTime
)
{
this
.
dEndTime
=
dEndTime
;
}
public
Date
getdEndTime
()
{
return
dEndTime
;
}
}
...
...
src/main/java/com/egolm/admin/service/BannerService.java
0 → 100644
View file @
e1bc9c7f
package
com
.
egolm
.
admin
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.egolm.admin.pojo.TBanner
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.Page
;
public
interface
BannerService
{
public
Rjx
save
(
TBanner
banner
);
public
TBanner
getBannerById
(
String
id
)
;
public
Rjx
update
(
TBanner
banner
);
public
Rjx
delete
(
int
id
,
String
userNO
);
public
List
<
Map
<
String
,
Object
>>
query
(
Map
<
String
,
Object
>
params
,
Page
page
);
}
src/main/java/com/egolm/admin/service/impl/BannerServiceImpl.java
0 → 100644
View file @
e1bc9c7f
package
com
.
egolm
.
admin
.
service
.
impl
;
import
java.util.Date
;
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.beans.factory.annotation.Qualifier
;
import
org.springframework.stereotype.Service
;
import
com.egolm.admin.pojo.TBanner
;
import
com.egolm.admin.service.BannerService
;
import
com.egolm.admin.util.AdminContstrant
;
import
com.egolm.common.DateUtil
;
import
com.egolm.common.bean.Rjx
;
import
com.egolm.common.jdbc.JdbcTemplate
;
import
com.egolm.common.jdbc.Page
;
@Service
public
class
BannerServiceImpl
implements
BannerService
{
private
static
final
Log
logger
=
LogFactory
.
getLog
(
BannerServiceImpl
.
class
);
@Autowired
@Qualifier
(
"shopJdbcTemplate"
)
private
JdbcTemplate
jdbcTemplate
;
public
Rjx
save
(
TBanner
banner
)
{
banner
.
setnTag
(
0
);
banner
.
setdCreateDate
(
new
Date
());
banner
.
setdUpdateDate
(
new
Date
());
banner
.
setdLastUpdateTime
(
new
Date
());
int
i
=
jdbcTemplate
.
save
(
banner
);
if
(
i
>
0
)
{
return
Rjx
.
jsonOk
().
set
(
AdminContstrant
.
I18n_KEY
,
"Msg_Save_Success"
);
// .setMessage("保存成功");
}
return
Rjx
.
jsonErr
().
setCode
(-
100
).
set
(
AdminContstrant
.
I18n_KEY
,
"Msg_Save_Error"
);
// .setMessage("保存失败");
}
public
TBanner
getBannerById
(
String
id
)
{
try
{
String
sql
=
"SELECT * FROM tBanner WHERE nTag&1=0 AND nItem = ?"
;
return
jdbcTemplate
.
queryForBean
(
sql
,
TBanner
.
class
,
id
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
null
;
}
}
public
Rjx
update
(
TBanner
banner
)
{
banner
.
setdUpdateDate
(
new
Date
());
banner
.
setdLastUpdateTime
(
new
Date
());
int
i
=
jdbcTemplate
.
update
(
banner
);
if
(
i
>
0
)
{
return
Rjx
.
jsonOk
().
set
(
AdminContstrant
.
I18n_KEY
,
"Msg_Update_Success"
);
//.setMessage("更新成功");
}
return
Rjx
.
jsonErr
().
setCode
(-
100
).
set
(
AdminContstrant
.
I18n_KEY
,
"Msg_Update_Error"
);
//.setMessage("更新失败");
}
public
Rjx
delete
(
int
id
,
String
userNO
)
{
String
sql
=
"UPDATE tBanner SET nTag = 1 ,sUpdateUser = ? ,dUpdateDate = getdate(), dLastUpdateTime = getdate() WHERE nItem = ?"
;
int
i
=
jdbcTemplate
.
update
(
sql
,
userNO
,
id
);
return
Rjx
.
jsonOk
().
set
(
AdminContstrant
.
I18n_KEY
,
"Msg_Del_Success"
);
}
public
List
<
Map
<
String
,
Object
>>
query
(
Map
<
String
,
Object
>
params
,
Page
page
){
String
nowDate
=
DateUtil
.
format
(
new
Date
(),
DateUtil
.
FMT_DATE
);
String
orgNO
=
params
.
get
(
"orgNO"
)+
""
;
List
<
Map
<
String
,
Object
>>
list
=
null
;
String
sql
=
"SELECT * FROM tBanner WHERE nTag&1=0 and dStartTime <= ? AND dEndTime >= ? "
;
if
(!
orgNO
.
equals
(
"-1"
))
{
sql
+=
" AND sOrgList LIKE '%"
+
orgNO
+
"%' "
;
}
list
=
jdbcTemplate
.
limit
(
sql
,
page
,
nowDate
,
nowDate
);
return
list
;
}
}
src/main/resources/messages_en.properties
View file @
e1bc9c7f
...
...
@@ -6,6 +6,8 @@ Msg_Save_Success= Save success
Msg_Save_Error
=
Save failure
Msg_Update_Success
=
Update success
Msg_Update_Error
=
Update failure
Msg_Del_Success
=
Delete success
Msg_Del_Error
=
Delete failure
Msg_Layout_exists
=
There is a platform theme that is not allowed to add
#qu
Msg_Query_Error
=
Query failure
...
...
src/main/resources/messages_zh_CN.properties
View file @
e1bc9c7f
...
...
@@ -6,6 +6,8 @@ Msg_Save_Success=\u4FDD\u5B58\u6210\u529F
Msg_Save_Error
=
\u
4FDD
\u
5B58
\u5931\u
8D25
Msg_Update_Success
=
\u
66F4
\u
65B0
\u6210\u
529F
Msg_Update_Error
=
\u
66F4
\u
65B0
\u5931\u
8D25
Msg_Del_Success
=
\u5220\u9664\u6210\u
529F
Msg_Del_Error
=
\u5220\u9664\u5931\u
8D25
Msg_Layout_exists
=
\u
5DF2
\u
5B58
\u5728\u
5E73
\u
53F0
\u
4E3B
\u9898
,
\u
4E0D
\u5141\u
8BB8
\u
65B0
\u
589E
#qu
...
...
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