Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
indicators
Overview
Overview
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
zhangkb
indicators
Commits
589d6ffc
Commit
589d6ffc
authored
Apr 16, 2020
by
zhangkb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交分析指标curd操作接口
parent
7710f241
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
152 additions
and
3 deletions
+152
-3
IndAcsDefCtrl.java
...va/com/keymobile/indicators/api/cmbkpi/IndAcsDefCtrl.java
+2
-0
IndAnaDefCtrl.java
...va/com/keymobile/indicators/api/cmbkpi/IndAnaDefCtrl.java
+59
-0
IndAnaDefMapper.java
...om/keymobile/indicators/model/mapper/IndAnaDefMapper.java
+11
-2
IndAnaDefService.java
...keymobile/indicators/service/cmbkpi/IndAnaDefService.java
+52
-0
DateUtils.java
src/main/java/com/keymobile/indicators/utils/DateUtils.java
+13
-0
IndAnaDefMapper.xml
src/main/resources/mybatis/mapping/IndAnaDefMapper.xml
+15
-1
No files found.
src/main/java/com/keymobile/indicators/api/cmbkpi/IndAcsDefCtrl.java
View file @
589d6ffc
...
@@ -13,8 +13,10 @@ import com.keymobile.indicators.model.entity.IndAcsDef;
...
@@ -13,8 +13,10 @@ import com.keymobile.indicators.model.entity.IndAcsDef;
import
com.keymobile.indicators.service.cmbkpi.GeneralParmService
;
import
com.keymobile.indicators.service.cmbkpi.GeneralParmService
;
import
com.keymobile.indicators.service.cmbkpi.IndAcsDefService
;
import
com.keymobile.indicators.service.cmbkpi.IndAcsDefService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"考核指标接口"
})
@RestController
@RestController
@RequestMapping
(
value
=
"/indAcs"
)
@RequestMapping
(
value
=
"/indAcs"
)
public
class
IndAcsDefCtrl
{
public
class
IndAcsDefCtrl
{
...
...
src/main/java/com/keymobile/indicators/api/cmbkpi/IndAnaDefCtrl.java
0 → 100644
View file @
589d6ffc
package
com
.
keymobile
.
indicators
.
api
.
cmbkpi
;
import
java.util.Date
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.keymobile.indicators.model.entity.IndAnaDef
;
import
com.keymobile.indicators.service.cmbkpi.IndAnaDefService
;
import
com.keymobile.indicators.utils.DateUtils
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
@Api
(
tags
={
"分析指标接口"
})
@RestController
@RequestMapping
(
value
=
"/indAna"
)
public
class
IndAnaDefCtrl
{
@Autowired
private
IndAnaDefService
indAnaDefService
;
@ApiOperation
(
value
=
"保存或修改分析指标(defTime和updTime格式:yyyy-MM-dd HH:mm:ss)"
,
notes
=
"保存或修改分析指标(defTime和updTime格式:yyyy-MM-dd HH:mm:ss)"
)
@PostMapping
(
value
=
"/saveOrUpdate"
)
public
String
saveOrUpdate
(
@RequestBody
IndAnaDef
indAnaDef
,
@RequestParam
(
required
=
false
)
String
defTime
,
@RequestParam
(
required
=
false
)
String
updTime
)
throws
Exception
{
if
(
StringUtils
.
isNotBlank
(
defTime
))
{
Date
defDate
=
DateUtils
.
getDate
(
defTime
,
"yyyy-MM-dd HH:mm:ss"
);
indAnaDef
.
setDefTime
(
defDate
);
}
if
(
StringUtils
.
isNotBlank
(
updTime
))
{
Date
updDate
=
DateUtils
.
getDate
(
updTime
,
"yyyy-MM-dd HH:mm:ss"
);
indAnaDef
.
setUpdTime
(
updDate
);
}
return
indAnaDefService
.
saveOrUpdate
(
indAnaDef
);
}
@ApiOperation
(
value
=
"删除分析指标"
,
notes
=
"删除分析指标"
)
@PostMapping
(
value
=
"/delete"
)
public
void
delete
(
@RequestParam
String
indId
)
throws
Exception
{
indAnaDefService
.
delete
(
indId
);
}
@ApiOperation
(
value
=
"根据关键字分页获取分析指标列表(page:0 开始)"
,
notes
=
"根据关键字分页获取分析指标列表(page:0 开始)"
)
@PostMapping
(
value
=
"/getPageListByKeyword"
)
public
Map
<
String
,
Object
>
getPageListByKeyword
(
@RequestParam
(
required
=
false
)
String
keyword
,
@RequestParam
int
page
,
@RequestParam
int
rows
)
throws
Exception
{
return
indAnaDefService
.
getByPageAndKeyword
(
keyword
,
page
,
rows
);
}
}
src/main/java/com/keymobile/indicators/model/mapper/IndAnaDefMapper.java
View file @
589d6ffc
package
com
.
keymobile
.
indicators
.
model
.
mapper
;
package
com
.
keymobile
.
indicators
.
model
.
mapper
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Mapper
;
@Mapper
import
com.keymobile.indicators.model.entity.IndAnaDef
;
public
interface
IndAnaDefMapper
{
import
tk.mybatis.mapper.common.BaseMapper
;
@Mapper
public
interface
IndAnaDefMapper
extends
BaseMapper
<
IndAnaDef
>{
public
List
<
IndAnaDef
>
getPageByKeyword
(
Map
<
String
,
Object
>
param
);
public
int
getByKeywordCount
(
Map
<
String
,
Object
>
param
);
}
}
src/main/java/com/keymobile/indicators/service/cmbkpi/IndAnaDefService.java
View file @
589d6ffc
package
com
.
keymobile
.
indicators
.
service
.
cmbkpi
;
package
com
.
keymobile
.
indicators
.
service
.
cmbkpi
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
org.apache.commons.lang.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
com.keymobile.indicators.model.entity.IndAnaDef
;
import
com.keymobile.indicators.model.mapper.IndAnaDefMapper
;
import
com.keymobile.indicators.model.mapper.IndAnaDefMapper
;
@Service
@Service
public
class
IndAnaDefService
{
public
class
IndAnaDefService
{
@Autowired
@Autowired
private
IndAnaDefMapper
indAnaDefMapper
;
private
IndAnaDefMapper
indAnaDefMapper
;
public
String
saveOrUpdate
(
IndAnaDef
indAnaDef
)
throws
Exception
{
if
(
StringUtils
.
isBlank
(
indAnaDef
.
getIndId
()))
{
return
"indId can not be null"
;
}
//根据指标编号判断分析指标是否已存在
IndAnaDef
dbIndAnaDef
=
this
.
getById
(
indAnaDef
.
getIndId
());
if
(
dbIndAnaDef
==
null
)
{
indAnaDefMapper
.
insert
(
indAnaDef
);
}
else
{
indAnaDefMapper
.
updateByPrimaryKey
(
indAnaDef
);
}
return
indAnaDef
.
getIndId
();
}
public
void
delete
(
String
indId
)
throws
Exception
{
indAnaDefMapper
.
deleteByPrimaryKey
(
indId
);
}
public
IndAnaDef
getById
(
String
id
)
throws
Exception
{
IndAnaDef
anaDef
=
new
IndAnaDef
();
anaDef
.
setIndId
(
id
);
return
indAnaDefMapper
.
selectOne
(
anaDef
);
}
public
Map
<
String
,
Object
>
getByPageAndKeyword
(
String
keyword
,
int
page
,
int
rows
)
throws
Exception
{
Map
<
String
,
Object
>
paramMap
=
new
HashMap
<>();
Map
<
String
,
Object
>
resultMap
=
new
HashMap
<>();
if
(
StringUtils
.
isBlank
(
keyword
))
{
paramMap
.
put
(
"keyword"
,
null
);
}
else
{
paramMap
.
put
(
"keyword"
,
"%"
+
keyword
+
"%"
);
}
//计算总数
int
count
=
indAnaDefMapper
.
getByKeywordCount
(
paramMap
);
//计算start
int
start
=
page
*
rows
;
paramMap
.
put
(
"start"
,
start
);
paramMap
.
put
(
"end"
,
rows
);
List
<
IndAnaDef
>
resultList
=
indAnaDefMapper
.
getPageByKeyword
(
paramMap
);
resultMap
.
put
(
"resultList"
,
resultList
);
resultMap
.
put
(
"total"
,
count
);
return
resultMap
;
}
}
}
src/main/java/com/keymobile/indicators/utils/DateUtils.java
0 → 100644
View file @
589d6ffc
package
com
.
keymobile
.
indicators
.
utils
;
import
java.text.SimpleDateFormat
;
import
java.util.Date
;
public
class
DateUtils
{
public
static
Date
getDate
(
String
dateStr
,
String
format
)
throws
Exception
{
SimpleDateFormat
simpleDateFormat
=
new
SimpleDateFormat
(
format
);
Date
date
=
simpleDateFormat
.
parse
(
dateStr
);
return
date
;
}
}
src/main/resources/mybatis/mapping/IndAnaDefMapper.xml
View file @
589d6ffc
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.keymobile.indicators.model.mapper.IndAnaDefMapper"
>
<mapper
namespace=
"com.keymobile.indicators.model.mapper.IndAnaDefMapper"
>
<select
id=
"getPageByKeyword"
parameterType=
"map"
resultType=
"com.keymobile.indicators.model.entity.IndAnaDef"
>
select * from ind_ana_ind_def_inf
<if
test=
"keyword!=null"
>
where ind_name like #{keyword} or ind_id like #{keyword}
</if>
limit #{start},#{end}
</select>
<select
id=
"getByKeywordCount"
parameterType=
"map"
resultType=
"java.lang.Integer"
>
select count(1) from ind_ana_ind_def_inf
<if
test=
"keyword!=null"
>
where ind_name like #{keyword} or ind_id like #{keyword}
</if>
</select>
</mapper>
</mapper>
\ No newline at end of file
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