Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
X
xt-danger
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
zhangjianqian
xt-danger
Commits
bc40851a
Commit
bc40851a
authored
Oct 26, 2021
by
jianqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增
parent
b278de0c
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
592 additions
and
5 deletions
+592
-5
EnterpriseInfoController.java
.../com/dcit/danger/controller/EnterpriseInfoController.java
+21
-4
MaterialController.java
...n/java/com/dcit/danger/controller/MaterialController.java
+93
-0
EnterpriseBasicInfoMapper.java
...n/java/com/dcit/danger/dao/EnterpriseBasicInfoMapper.java
+4
-0
MaterialInfoMapper.java
...src/main/java/com/dcit/danger/dao/MaterialInfoMapper.java
+23
-0
MaterialForm.java
.../src/main/java/com/dcit/danger/dto/form/MaterialForm.java
+24
-0
MaterialQuery.java
...rc/main/java/com/dcit/danger/dto/query/MaterialQuery.java
+22
-0
MaterialInfo.java
...ger/src/main/java/com/dcit/danger/model/MaterialInfo.java
+31
-0
SnowFlakeUtil.java
...er/src/main/java/com/dcit/danger/model/SnowFlakeUtil.java
+102
-0
EnterpriseInfoService.java
...n/java/com/dcit/danger/service/EnterpriseInfoService.java
+2
-0
Materialservice.java
...rc/main/java/com/dcit/danger/service/Materialservice.java
+19
-0
EnterpriseInfoServiceImpl.java
...m/dcit/danger/service/impl/EnterpriseInfoServiceImpl.java
+23
-0
MaterialServiceImpl.java
...ava/com/dcit/danger/service/impl/MaterialServiceImpl.java
+42
-0
EnterpriseBasicInfoMapper.xml
...r/src/main/resources/mapper/EnterpriseBasicInfoMapper.xml
+7
-1
MaterialInfoMapper.xml
...c-danger/src/main/resources/mapper/MaterialInfoMapper.xml
+179
-0
No files found.
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/controller/EnterpriseInfoController.java
View file @
bc40851a
package
com
.
dcit
.
danger
.
controller
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.ui.ModelMap
;
...
...
@@ -283,4 +280,24 @@ public class EnterpriseInfoController {
return
ResultVOUtil
.
success
(
list
);
}
/**
* 企业隐患 风险列表
* @return
*/
@ApiOperation
(
value
=
"查询企业风险隐患列表"
)
@PostMapping
(
"/enterpriseRiskInfo"
)
public
ResultVO
<
Object
>
enterpriseRiskInfo
(){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
try
{
map
=
enterpriseInfoService
.
enterpriseRiskInfo
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
log
.
error
(
"【查询企业风险列表】操作出错,error={}"
,
e
.
getMessage
());
throw
new
IOCException
(
ResultEnum
.
OPERATION_FAIL
);
}
return
ResultVOUtil
.
success
(
map
);
}
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/controller/MaterialController.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
controller
;
import
com.dcit.common.enums.ResultEnum
;
import
com.dcit.common.utils.ResultVOUtil
;
import
com.dcit.common.vo.ResultVO
;
import
com.dcit.danger.dto.PlanInfoDTO
;
import
com.dcit.danger.dto.form.MaterialForm
;
import
com.dcit.danger.dto.query.MaterialQuery
;
import
com.dcit.danger.dto.query.PlanInfoQuery
;
import
com.dcit.danger.exception.IOCException
;
import
com.dcit.danger.model.MaterialInfo
;
import
com.dcit.danger.model.SnowFlakeUtil
;
import
com.dcit.danger.service.Materialservice
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.ui.ModelMap
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
@Api
(
value
=
"应急物资管理"
)
@RestController
@RequestMapping
(
"material"
)
public
class
MaterialController
{
@Autowired
private
Materialservice
materialservice
;
/**
* 应急物资列表
* @param planInfoQuery
* @return
*/
@ApiOperation
(
value
=
"应急物资列表"
)
@PostMapping
(
"/materialInfoList"
)
public
ResultVO
<
Object
>
materialInfoList
(
@RequestBody
MaterialQuery
materialQuery
){
ModelMap
modelMap
=
new
ModelMap
();
try
{
PageHelper
.
offsetPage
(
materialQuery
.
getPage
(),
materialQuery
.
getSize
());
List
<
Map
<
String
,
Object
>>
dtoList
=
materialservice
.
materialInfoList
(
materialQuery
);
PageInfo
<
Map
<
String
,
Object
>>
pageList
=
new
PageInfo
<
Map
<
String
,
Object
>>(
dtoList
);
modelMap
.
addAttribute
(
"pageData"
,
pageList
.
getList
());
modelMap
.
addAttribute
(
"total"
,
pageList
.
getTotal
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
return
ResultVOUtil
.
success
(
modelMap
);
}
/**
* 添加应急物资
* @param materialForm
* @return
*/
@ApiOperation
(
value
=
"应急物资列表"
)
@PostMapping
(
"/addMaterInfo"
)
public
ResultVO
<
Object
>
addMaterInfo
(
@RequestBody
MaterialForm
materialForm
){
MaterialInfo
materialInfo
=
new
MaterialInfo
(
materialForm
);
if
(
materialInfo
.
getId
()!=
null
){
materialInfo
.
setUpdateTime
(
new
Date
());
materialservice
.
updateMaterInfo
(
materialInfo
);
}
else
{
materialInfo
.
setId
(
String
.
valueOf
(
SnowFlakeUtil
.
getFlowIdInstance
().
nextId
()));
materialInfo
.
setCreateTime
(
new
Date
());
materialservice
.
addMaterInfo
(
materialInfo
);
}
return
ResultVOUtil
.
success
();
}
@ApiOperation
(
value
=
"删除应急物资列表"
)
@GetMapping
(
"/deleteMaterial/{id}"
)
public
ResultVO
<
Object
>
deleteMaterial
(
@PathVariable
String
id
){
try
{
materialservice
.
deleteMaterial
(
id
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
throw
new
IOCException
(
ResultEnum
.
OPERATION_FAIL
);
}
return
ResultVOUtil
.
success
();
}
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/dao/EnterpriseBasicInfoMapper.java
View file @
bc40851a
...
...
@@ -40,4 +40,8 @@ public interface EnterpriseBasicInfoMapper {
EnterpriseRegDTO
selectEnterpriseRegInfoById
(
String
enterpriseId
);
List
<
EnterpriseDangerNumDTO
>
selectEnterpriseDangerNum
(
String
enterpriseId
);
List
<
Map
<
String
,
Object
>>
enterpriseRiskInfo
();
Map
<
String
,
Object
>
selectCount
(
String
id
);
}
\ No newline at end of file
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/dao/MaterialInfoMapper.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
dao
;
import
com.dcit.danger.dto.query.MaterialQuery
;
import
com.dcit.danger.model.MaterialInfo
;
import
java.util.List
;
import
java.util.Map
;
public
interface
MaterialInfoMapper
{
int
deleteByPrimaryKey
(
String
id
);
int
insert
(
MaterialInfo
record
);
int
insertSelective
(
MaterialInfo
record
);
MaterialInfo
selectByPrimaryKey
(
String
id
);
int
updateByPrimaryKeySelective
(
MaterialInfo
record
);
int
updateByPrimaryKey
(
MaterialInfo
record
);
List
<
Map
<
String
,
Object
>>
materialInfoList
(
MaterialQuery
record
);
}
\ No newline at end of file
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/dto/form/MaterialForm.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
dto
.
form
;
import
lombok.Data
;
@Data
public
class
MaterialForm
{
private
String
id
;
private
String
materialName
;
private
String
materialType
;
private
Integer
num
;
private
String
longitude
;
private
String
latitude
;
private
String
address
;
private
String
contacts
;
private
String
phone
;
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/dto/query/MaterialQuery.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
dto
.
query
;
import
com.dcit.common.page.PageBasic
;
import
lombok.Data
;
import
lombok.EqualsAndHashCode
;
@Data
@EqualsAndHashCode
(
callSuper
=
true
)
public
class
MaterialQuery
extends
PageBasic
{
/**
* 企业id
*/
private
String
materialType
;
/**
* 预案等级
*/
private
String
materialName
;
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/model/MaterialInfo.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
model
;
import
com.dcit.danger.dto.form.MaterialForm
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
java.util.Date
;
@Data
public
class
MaterialInfo
extends
MaterialForm
{
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
createTime
;
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd HH:mm:ss"
)
private
Date
updateTime
;
private
Integer
isDelete
;
public
MaterialInfo
(
MaterialForm
materialForm
){
this
.
setId
(
materialForm
.
getId
());
this
.
setMaterialName
(
materialForm
.
getMaterialName
());
this
.
setMaterialType
(
materialForm
.
getMaterialType
());
this
.
setAddress
(
materialForm
.
getAddress
());
this
.
setContacts
(
materialForm
.
getContacts
());
this
.
setLatitude
(
materialForm
.
getLatitude
());
this
.
setLongitude
(
materialForm
.
getLongitude
());
this
.
setPhone
(
materialForm
.
getPhone
());
this
.
setNum
(
materialForm
.
getNum
());
}
}
\ No newline at end of file
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/model/SnowFlakeUtil.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
model
;
import
lombok.extern.slf4j.Slf4j
;
@Slf4j
public
class
SnowFlakeUtil
{
private
final
long
id
;
/**
* 时间起始标记点,作为基准,一般取系统的最近时间
*/
private
final
long
epoch
=
1524291141010L
;
/**
* 机器标识位数
*/
private
final
long
workerIdBits
=
10L
;
/**
* 机器ID最大值: 1023
*/
private
final
long
maxWorkerId
=
-
1L
^
-
1L
<<
this
.
workerIdBits
;
/**
* 0,并发控制
*/
private
long
sequence
=
0L
;
/**
* 毫秒内自增位
*/
private
final
long
sequenceBits
=
12L
;
/**
* 12
*/
private
final
long
workerIdShift
=
this
.
sequenceBits
;
/**
* 22
*/
private
final
long
timestampLeftShift
=
this
.
sequenceBits
+
this
.
workerIdBits
;
/**
* 4095,111111111111,12位
*/
private
final
long
sequenceMask
=
-
1L
^
-
1L
<<
this
.
sequenceBits
;
private
long
lastTimestamp
=
-
1L
;
private
SnowFlakeUtil
(
long
id
)
{
if
(
id
>
this
.
maxWorkerId
||
id
<
0
)
{
throw
new
IllegalArgumentException
(
String
.
format
(
"worker Id can't be greater than %d or less than 0"
,
this
.
maxWorkerId
));
}
this
.
id
=
id
;
}
public
synchronized
long
nextId
()
{
long
timestamp
=
timeGen
();
if
(
this
.
lastTimestamp
==
timestamp
)
{
//如果上一个timestamp与新产生的相等,则sequence加一(0-4095循环); 对新的timestamp,sequence从0开始
this
.
sequence
=
this
.
sequence
+
1
&
this
.
sequenceMask
;
if
(
this
.
sequence
==
0
)
{
// 重新生成timestamp
timestamp
=
this
.
tilNextMillis
(
this
.
lastTimestamp
);
}
}
else
{
this
.
sequence
=
0
;
}
if
(
timestamp
<
this
.
lastTimestamp
)
{
log
.
error
(
String
.
format
(
"clock moved backwards.Refusing to generate id for %d milliseconds"
,
(
this
.
lastTimestamp
-
timestamp
)));
return
-
1
;
}
this
.
lastTimestamp
=
timestamp
;
return
timestamp
-
this
.
epoch
<<
this
.
timestampLeftShift
|
this
.
id
<<
this
.
workerIdShift
|
this
.
sequence
;
}
private
static
SnowFlakeUtil
flowIdWorker
=
new
SnowFlakeUtil
(
1
);
public
static
SnowFlakeUtil
getFlowIdInstance
()
{
return
flowIdWorker
;
}
/**
* 等待下一个毫秒的到来, 保证返回的毫秒数在参数lastTimestamp之后
*/
private
long
tilNextMillis
(
long
lastTimestamp
)
{
long
timestamp
=
timeGen
();
while
(
timestamp
<=
lastTimestamp
)
{
timestamp
=
timeGen
();
}
return
timestamp
;
}
/**
* 获得系统当前毫秒数
*/
private
static
long
timeGen
()
{
return
System
.
currentTimeMillis
();
}
public
static
void
main
(
String
[]
args
)
{
for
(
int
i
=
0
;
i
<
100
;
i
++){
SnowFlakeUtil
snowFlakeUtil
=
SnowFlakeUtil
.
getFlowIdInstance
();
System
.
out
.
println
(
snowFlakeUtil
.
nextId
());
}
}
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/service/EnterpriseInfoService.java
View file @
bc40851a
...
...
@@ -23,6 +23,8 @@ public interface EnterpriseInfoService {
List
<
EnterpriseRegDTO
>
selectEnterpriseRegInfo
(
EnterpriseInfoQuery
enterpriseInfoQuery
);
Map
<
String
,
Object
>
enterpriseRiskInfo
();
EnterpriseRegDTO
selectEnterpriseRegInfoById
(
String
enterpriseId
);
List
<
EnterpriseDangerNumDTO
>
selectEnterpriseDangerNum
(
String
enterpriseId
);
...
...
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/service/Materialservice.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
service
;
import
com.dcit.danger.dto.query.MaterialQuery
;
import
com.dcit.danger.model.MaterialInfo
;
import
java.util.List
;
import
java.util.Map
;
public
interface
Materialservice
{
Integer
addMaterInfo
(
MaterialInfo
materialInfo
);
Integer
updateMaterInfo
(
MaterialInfo
materialInfo
);
Integer
deleteMaterial
(
String
id
);
List
<
Map
<
String
,
Object
>>
materialInfoList
(
MaterialQuery
materialQuery
);
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/service/impl/EnterpriseInfoServiceImpl.java
View file @
bc40851a
package
com
.
dcit
.
danger
.
service
.
impl
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
com.google.common.collect.MapMaker
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -13,6 +15,7 @@ import com.dcit.danger.dto.query.EnterpriseInfoQuery;
import
com.dcit.danger.model.EnterpriseBasicInfo
;
import
com.dcit.danger.model.EnterpriseBasicInfoExample
;
import
com.dcit.danger.service.EnterpriseInfoService
;
import
org.thymeleaf.expression.Lists
;
@Service
public
class
EnterpriseInfoServiceImpl
implements
EnterpriseInfoService
{
...
...
@@ -74,4 +77,24 @@ public class EnterpriseInfoServiceImpl implements EnterpriseInfoService {
return
enterpriseBasicInfoMapper
.
countByRegulation
();
}
@Override
public
Map
<
String
,
Object
>
enterpriseRiskInfo
(){
List
<
Map
<
String
,
Object
>>
list
=
enterpriseBasicInfoMapper
.
enterpriseRiskInfo
();
String
[]
company
=
new
String
[
list
.
size
()];
Integer
[]
risk
=
new
Integer
[
list
.
size
()];
Integer
[]
trouble
=
new
Integer
[
list
.
size
()];
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++){
Map
<
String
,
Object
>
newMap
=
enterpriseBasicInfoMapper
.
selectCount
((
String
)
list
.
get
(
i
).
get
(
"id"
));
company
[
i
]=
(
String
)
list
.
get
(
i
).
get
(
"company"
);
Integer
b
=
Integer
.
parseInt
(
String
.
valueOf
(
newMap
.
get
(
"risk"
)));
risk
[
i
]=
b
;
trouble
[
i
]=
Integer
.
parseInt
(
String
.
valueOf
(
newMap
.
get
(
"trouble"
)));
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"company"
,
company
);
map
.
put
(
"risk"
,
risk
);
map
.
put
(
"trouble"
,
trouble
);
return
map
;
}
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/java/com/dcit/danger/service/impl/MaterialServiceImpl.java
0 → 100644
View file @
bc40851a
package
com
.
dcit
.
danger
.
service
.
impl
;
import
com.dcit.danger.dao.MaterialInfoMapper
;
import
com.dcit.danger.dto.form.MaterialForm
;
import
com.dcit.danger.dto.query.MaterialQuery
;
import
com.dcit.danger.model.MaterialInfo
;
import
com.dcit.danger.service.Materialservice
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.List
;
import
java.util.Map
;
@Service
public
class
MaterialServiceImpl
implements
Materialservice
{
@Autowired
private
MaterialInfoMapper
materialInfoMapper
;
@Override
public
Integer
addMaterInfo
(
MaterialInfo
materialInfo
){
return
materialInfoMapper
.
insert
(
materialInfo
);
}
@Override
public
Integer
updateMaterInfo
(
MaterialInfo
materialInfo
){
return
materialInfoMapper
.
updateByPrimaryKeySelective
(
materialInfo
);
}
@Override
public
List
<
Map
<
String
,
Object
>>
materialInfoList
(
MaterialQuery
materialQuery
){
return
materialInfoMapper
.
materialInfoList
(
materialQuery
);
}
@Override
public
Integer
deleteMaterial
(
String
id
){
MaterialInfo
materialInfo
=
new
MaterialInfo
(
new
MaterialForm
());
materialInfo
.
setId
(
id
);
materialInfo
.
setIsDelete
(
1
);
return
materialInfoMapper
.
updateByPrimaryKeySelective
(
materialInfo
);
}
}
zzz2017-ioc-ioc-master/ioc-danger/src/main/resources/mapper/EnterpriseBasicInfoMapper.xml
View file @
bc40851a
...
...
@@ -1587,5 +1587,11 @@
GROUP BY
c.`code`
</select>
<select
id=
"enterpriseRiskInfo"
resultType=
"java.util.HashMap"
>
SELECT id,unit_name AS company FROM enterprise_basic_info
</select>
<select
id=
"selectCount"
resultType=
"java.util.HashMap"
>
SELECT (SELECT COUNT(id) FROM t_control_risk WHERE enterprise_id =#{id})as risk,
(SELECT COUNT(id) FROM t_hidden_trouble WHERE enterprise_id =#{id}) as trouble
</select>
</mapper>
\ No newline at end of file
zzz2017-ioc-ioc-master/ioc-danger/src/main/resources/mapper/MaterialInfoMapper.xml
0 → 100644
View file @
bc40851a
<?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" >
<mapper
namespace=
"com.dcit.danger.dao.MaterialInfoMapper"
>
<resultMap
id=
"BaseResultMap"
type=
"com.dcit.danger.model.MaterialInfo"
>
<id
column=
"id"
property=
"id"
jdbcType=
"VARCHAR"
/>
<result
column=
"material_name"
property=
"materialName"
jdbcType=
"VARCHAR"
/>
<result
column=
"material_type"
property=
"materialType"
jdbcType=
"VARCHAR"
/>
<result
column=
"num"
property=
"num"
jdbcType=
"INTEGER"
/>
<result
column=
"Longitude"
property=
"longitude"
jdbcType=
"VARCHAR"
/>
<result
column=
"latitude"
property=
"latitude"
jdbcType=
"VARCHAR"
/>
<result
column=
"address"
property=
"address"
jdbcType=
"VARCHAR"
/>
<result
column=
"contacts"
property=
"contacts"
jdbcType=
"VARCHAR"
/>
<result
column=
"phone"
property=
"phone"
jdbcType=
"VARCHAR"
/>
<result
column=
"create_time"
property=
"createTime"
jdbcType=
"TIMESTAMP"
/>
<result
column=
"update_time"
property=
"updateTime"
jdbcType=
"TIMESTAMP"
/>
</resultMap>
<sql
id=
"Base_Column_List"
>
id, material_name, material_type, num, Longitude, latitude, address, contacts, phone,
create_time, update_time
</sql>
<select
id=
"selectByPrimaryKey"
resultMap=
"BaseResultMap"
parameterType=
"java.lang.String"
>
select
<include
refid=
"Base_Column_List"
/>
from material_info
where id = #{id,jdbcType=VARCHAR}
</select>
<delete
id=
"deleteByPrimaryKey"
parameterType=
"java.lang.String"
>
delete from material_info
where id = #{id,jdbcType=VARCHAR}
</delete>
<insert
id=
"insert"
parameterType=
"com.dcit.danger.model.MaterialInfo"
>
insert into material_info (id, material_name, material_type,
num, Longitude, latitude,
address, contacts, phone,
create_time, update_time)
values (#{id,jdbcType=VARCHAR}, #{materialName,jdbcType=VARCHAR}, #{materialType,jdbcType=VARCHAR},
#{num,jdbcType=INTEGER}, #{longitude,jdbcType=VARCHAR}, #{latitude,jdbcType=VARCHAR},
#{address,jdbcType=VARCHAR}, #{contacts,jdbcType=VARCHAR}, #{phone,jdbcType=VARCHAR},
#{createTime,jdbcType=TIMESTAMP}, #{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert
id=
"insertSelective"
parameterType=
"com.dcit.danger.model.MaterialInfo"
>
insert into material_info
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
id,
</if>
<if
test=
"materialName != null"
>
material_name,
</if>
<if
test=
"materialType != null"
>
material_type,
</if>
<if
test=
"num != null"
>
num,
</if>
<if
test=
"longitude != null"
>
Longitude,
</if>
<if
test=
"latitude != null"
>
latitude,
</if>
<if
test=
"address != null"
>
address,
</if>
<if
test=
"contacts != null"
>
contacts,
</if>
<if
test=
"phone != null"
>
phone,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"id != null"
>
#{id,jdbcType=VARCHAR},
</if>
<if
test=
"materialName != null"
>
#{materialName,jdbcType=VARCHAR},
</if>
<if
test=
"materialType != null"
>
#{materialType,jdbcType=VARCHAR},
</if>
<if
test=
"num != null"
>
#{num,jdbcType=INTEGER},
</if>
<if
test=
"longitude != null"
>
#{longitude,jdbcType=VARCHAR},
</if>
<if
test=
"latitude != null"
>
#{latitude,jdbcType=VARCHAR},
</if>
<if
test=
"address != null"
>
#{address,jdbcType=VARCHAR},
</if>
<if
test=
"contacts != null"
>
#{contacts,jdbcType=VARCHAR},
</if>
<if
test=
"phone != null"
>
#{phone,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
#{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
#{updateTime,jdbcType=TIMESTAMP},
</if>
</trim>
</insert>
<update
id=
"updateByPrimaryKeySelective"
parameterType=
"com.dcit.danger.model.MaterialInfo"
>
update material_info
<set
>
<if
test=
"materialName != null"
>
material_name = #{materialName,jdbcType=VARCHAR},
</if>
<if
test=
"materialType != null"
>
material_type = #{materialType,jdbcType=VARCHAR},
</if>
<if
test=
"num != null"
>
num = #{num,jdbcType=INTEGER},
</if>
<if
test=
"longitude != null"
>
Longitude = #{longitude,jdbcType=VARCHAR},
</if>
<if
test=
"latitude != null"
>
latitude = #{latitude,jdbcType=VARCHAR},
</if>
<if
test=
"address != null"
>
address = #{address,jdbcType=VARCHAR},
</if>
<if
test=
"contacts != null"
>
contacts = #{contacts,jdbcType=VARCHAR},
</if>
<if
test=
"phone != null"
>
phone = #{phone,jdbcType=VARCHAR},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime,jdbcType=TIMESTAMP},
</if>
<if
test=
"isDelete != null"
>
is_delete = #{isDelete,jdbcType=INTEGER},
</if>
</set>
where id = #{id,jdbcType=VARCHAR}
</update>
<update
id=
"updateByPrimaryKey"
parameterType=
"com.dcit.danger.model.MaterialInfo"
>
update material_info
set material_name = #{materialName,jdbcType=VARCHAR},
material_type = #{materialType,jdbcType=VARCHAR},
num = #{num,jdbcType=INTEGER},
Longitude = #{longitude,jdbcType=VARCHAR},
latitude = #{latitude,jdbcType=VARCHAR},
address = #{address,jdbcType=VARCHAR},
contacts = #{contacts,jdbcType=VARCHAR},
phone = #{phone,jdbcType=VARCHAR},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where id = #{id,jdbcType=VARCHAR}
</update>
<select
id=
"materialInfoList"
resultType=
"java.util.HashMap"
>
SELECT id,material_name as materialName,material_type as materialType,num,longitude,latitude,address,contacts,phone,
date_format(create_time,'%Y-%m-%d %H:%m:%s') as createTime,date_format(update_time,'%Y-%m-%d %H:%m:%s') as updateTime FROM material_info
WHERE is_delete = 0
<if
test=
"materialName!=null"
>
AND material_name LIKE concat('%',#{materialName},'%')
</if>
<if
test=
"materialType!=null"
>
AND material_type LIKE concat('%',#{materialType},'%')
</if>
order BY create_time DESC
</select>
</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