Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
open-source
/
chejia-smart-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 52498b81
authored
Mar 18, 2021
by
wnb0128
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
车家智能V1.0.0开发 场景数据--think.wang
1 parent
40179c25
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
417 additions
and
152 deletions
src/main/java/com/glsx/smart/controller/IndexController.java
src/main/java/com/glsx/smart/controller/SceneController.java
src/main/java/com/glsx/smart/controller/SceneTemplateController.java
src/main/java/com/glsx/smart/controller/SysCodeController.java
src/main/java/com/glsx/smart/dao/entity/SmartScene.java
src/main/java/com/glsx/smart/dao/entity/SmartSceneTemplate.java
src/main/java/com/glsx/smart/dao/mapper/SmartProductMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartSceneDataMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartSceneMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartSceneTemplateMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartSysCodeMapper.java
src/main/java/com/glsx/smart/dao/mapper/SmartTemplateParamMapper.java
src/main/java/com/glsx/smart/exception/BusinessException.java
src/main/java/com/glsx/smart/exception/GlobalExceptionHandler.java
src/main/java/com/glsx/smart/service/SmartSceneDataService.java
src/main/java/com/glsx/smart/service/SmartSceneService.java
src/main/java/com/glsx/smart/service/SmartSceneTemplateService.java
src/main/java/com/glsx/smart/service/SmartSysCodeService.java
src/main/java/com/glsx/smart/service/SmartTemplateParamService.java
src/main/java/com/glsx/smart/service/impl/SmartSceneDataServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartSceneTemplateServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartSysCodeServiceImpl.java
src/main/java/com/glsx/smart/service/impl/SmartTemplateParamServiceImpl.java
src/main/resources/mapper/SmartSceneDataMapper.xml
src/main/resources/mapper/SmartSceneMapper.xml
src/main/resources/mapper/SmartSceneTemplateMapper.xml
src/main/resources/mapper/SmartSysCodeMapper.xml
src/main/resources/mapper/SmartTemplateParamMapper.xml
src/main/java/com/glsx/smart/controller/IndexController.java
View file @
52498b8
package
com
.
glsx
.
smart
.
controller
;
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.glsx.smart.dao.entity.SmartProduct
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.*
;
/**
* @Title: IndexController.java
...
...
@@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
public
class
IndexController
{
...
...
@@ -22,4 +22,11 @@ public class IndexController {
return
"hello, welcome to home!"
;
}
@ResponseBody
@RequestMapping
(
value
=
"/getProduct"
,
method
=
{
RequestMethod
.
POST
})
public
String
getProduct
(
@RequestBody
SmartProduct
product
){
log
.
info
(
"获取参数:{}"
,
product
.
toString
());
return
product
.
getIconUrl
();
}
}
src/main/java/com/glsx/smart/controller/SceneController.java
View file @
52498b8
package
com
.
glsx
.
smart
.
controller
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.service.SmartSceneDataService
;
import
com.glsx.smart.service.SmartSceneService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -21,21 +24,38 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/scene"
)
public
class
SceneController
{
@Autowired
private
SmartSceneService
sceneService
;
@Autowired
private
SmartSceneDataService
sceneDataService
;
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
List
<
SmartScene
>
getList
(
SmartScene
scene
)
{
return
sceneService
.
selectByExample
(
scene
);
public
List
<
SmartScene
>
getList
(
@RequestBody
SmartScene
scene
)
{
log
.
info
(
"/scene/getList param: {}"
,
JSON
.
toJSONString
(
scene
));
return
sceneService
.
getList
(
scene
);
}
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
SmartScene
getById
(
Long
id
)
{
return
sceneService
.
selectByPrimaryKey
(
id
);
log
.
info
(
"/scene/getById param: {}"
,
id
);
SmartScene
scene
=
sceneService
.
getById
(
id
);
if
(
scene
!=
null
){
scene
.
setDataList
(
sceneDataService
.
getBySceneId
(
id
));
}
return
scene
;
}
@RequestMapping
(
value
=
"/add"
,
method
=
{
RequestMethod
.
POST
})
public
boolean
save
(
@RequestBody
SmartScene
scene
)
{
log
.
info
(
"用户新增调用/scene/add param: {}"
,
JSON
.
toJSONString
(
scene
));
return
sceneService
.
insert
(
scene
)
>
0
?
true
:
false
;
}
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
public
void
save
(
@RequestBody
SmartScene
scene
)
{
sceneService
.
insertOrUpdate
(
scene
);
@RequestMapping
(
value
=
"/update"
,
method
=
{
RequestMethod
.
POST
})
public
boolean
update
(
@RequestBody
SmartScene
scene
)
{
log
.
info
(
"用户更新调用/scene/update param: {}"
,
JSON
.
toJSONString
(
scene
));
return
sceneService
.
update
(
scene
)
>
0
?
true
:
false
;
}
}
src/main/java/com/glsx/smart/controller/SceneTemplateController.java
View file @
52498b8
package
com
.
glsx
.
smart
.
controller
;
import
java.util.List
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.smart.dao.entity.SmartSceneTemplate
;
import
com.glsx.smart.service.SmartSceneTemplateService
;
import
com.glsx.smart.service.SmartTemplateParamService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
...
...
@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -21,21 +25,53 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/sceneTemplate"
)
public
class
SceneTemplateController
{
@Autowired
private
SmartSceneTemplateService
sceneTemplateService
;
@Autowired
private
SmartTemplateParamService
templateParamService
;
@RequestMapping
(
value
=
"/getPageList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
PageInfo
<
SmartSceneTemplate
>
getPageList
(
SmartSceneTemplate
sceneTemplate
)
{
log
.
info
(
"/sceneTemplate/getList param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
List
<
SmartSceneTemplate
>
sceneList
=
sceneTemplateService
.
getList
(
sceneTemplate
);
PageInfo
<
SmartSceneTemplate
>
pageInfo
=
PageInfo
.
of
(
sceneList
);
return
pageInfo
;
}
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
List
<
SmartSceneTemplate
>
getList
(
SmartSceneTemplate
sceneTemplate
)
{
return
sceneTemplateService
.
selectByExample
(
sceneTemplate
);
log
.
info
(
"/sceneTemplate/getList param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
return
sceneTemplateService
.
getList
(
sceneTemplate
);
}
@RequestMapping
(
value
=
"/getById"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
SmartSceneTemplate
getById
(
Long
id
)
{
return
sceneTemplateService
.
selectByPrimaryKey
(
id
);
log
.
info
(
"/sceneTemplate/getById param: {}"
,
id
);
SmartSceneTemplate
template
=
sceneTemplateService
.
getById
(
id
);
if
(
template
!=
null
){
template
.
setTemplateList
(
templateParamService
.
getByTemplateId
(
id
));
}
return
template
;
}
@RequestMapping
(
value
=
"/add"
,
method
=
{
RequestMethod
.
POST
})
public
boolean
save
(
@RequestBody
SmartSceneTemplate
sceneTemplate
)
{
log
.
info
(
"新增调用/sceneTemplate/add param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
return
sceneTemplateService
.
insert
(
sceneTemplate
)
>
0
?
true
:
false
;
}
@RequestMapping
(
value
=
"/save"
,
method
=
{
RequestMethod
.
POST
})
public
void
save
(
@RequestBody
SmartSceneTemplate
sceneTemplate
)
{
sceneTemplateService
.
insertOrUpdate
(
sceneTemplate
);
@RequestMapping
(
value
=
"/update"
,
method
=
{
RequestMethod
.
POST
})
public
boolean
update
(
@RequestBody
SmartSceneTemplate
sceneTemplate
)
{
log
.
info
(
"更新调用/sceneTemplate/update param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
return
sceneTemplateService
.
update
(
sceneTemplate
)
>
0
?
true
:
false
;
}
@RequestMapping
(
value
=
"/updateParam"
,
method
=
{
RequestMethod
.
POST
})
public
boolean
updateParam
(
@RequestBody
SmartSceneTemplate
sceneTemplate
)
{
log
.
info
(
"更新主表调用/sceneTemplate/updateParam param: {}"
,
JSON
.
toJSONString
(
sceneTemplate
));
return
sceneTemplateService
.
updateByPrimaryKeySelective
(
sceneTemplate
)
>
0
?
true
:
false
;
}
}
src/main/java/com/glsx/smart/controller/SysCodeController.java
View file @
52498b8
package
com
.
glsx
.
smart
.
controller
;
import
com.alibaba.fastjson.JSON
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.plat.common.utils.StringUtils
;
import
com.glsx.plat.core.web.R
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.service.SmartSysCodeService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RestController
;
...
...
@@ -21,12 +25,17 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping
(
"/sysCode"
)
public
class
SysCodeController
{
@Autowired
private
SmartSysCodeService
sysCodeService
;
@RequestMapping
(
value
=
"/getList"
,
method
=
{
RequestMethod
.
GET
,
RequestMethod
.
POST
})
public
PageInfo
<
SmartSysCode
>
getList
(
SmartSysCode
req
)
{
log
.
info
(
"$$$$ /sysCode/getList param: {}"
,
JSON
.
toJSONString
(
req
));
return
sysCodeService
.
getList
(
req
);
public
R
getList
(
@RequestBody
SmartSysCode
code
)
{
log
.
info
(
"/sysCode/getList param: {}"
,
JSON
.
toJSONString
(
code
));
if
(
StringUtils
.
isEmpty
(
code
.
getDictType
())
||
StringUtils
.
isEmpty
(
code
.
getParentKey
())){
throw
BusinessException
.
create
(
ResultEnum
.
PARAM_ERROR
);
}
return
R
.
ok
().
data
(
sysCodeService
.
getList
(
code
));
}
}
src/main/java/com/glsx/smart/dao/entity/SmartScene.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
entity
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
import
java.util.List
;
/**
* <p>Description:
...
...
@@ -21,7 +24,7 @@ import lombok.Data;
*/
@Data
@Table
(
name
=
"smart_scene"
)
public
class
SmartScene
{
public
class
SmartScene
implements
Serializable
{
/**
* 标识ID
*/
...
...
@@ -50,11 +53,21 @@ public class SmartScene {
private
Long
icon
;
/**
* 场景图标
*/
private
String
iconUrl
;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private
Long
backPic
;
/**
* 场景背景图
*/
private
String
backPicUrl
;
/**
* 查看次数
*/
private
Long
viewTimes
;
...
...
@@ -93,4 +106,9 @@ public class SmartScene {
* 更新时间
*/
private
Date
updateTime
;
/**
* 场景关系数据
*/
private
List
<
SmartSceneData
>
dataList
;
}
src/main/java/com/glsx/smart/dao/entity/SmartSceneTemplate.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
entity
;
import
com.glsx.smart.pojo.BaseDTO
;
import
lombok.Data
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.GenerationType
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
import
java.util.List
;
/**
* <p>Description:
...
...
@@ -21,7 +25,7 @@ import lombok.Data;
*/
@Data
@Table
(
name
=
"smart_scene_template"
)
public
class
SmartSceneTemplate
{
public
class
SmartSceneTemplate
extends
BaseDTO
implements
Serializable
{
/**
* 标识ID
*/
...
...
@@ -45,11 +49,21 @@ public class SmartSceneTemplate {
private
Long
icon
;
/**
* 场景图标
*/
private
String
iconUrl
;
/**
* 场景背景图ID 关联smart_sys_file中id
*/
private
Long
backPic
;
/**
* 场景背景图
*/
private
String
backPicUrl
;
/**
* 查看次数
*/
private
Long
viewTimes
;
...
...
@@ -98,4 +112,9 @@ public class SmartSceneTemplate {
* 更新人
*/
private
Long
updateBy
;
/**
* 场景关系数据
*/
private
List
<
SmartTemplateParam
>
templateList
;
}
src/main/java/com/glsx/smart/dao/mapper/SmartProductMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartProduct
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -15,11 +16,11 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public
interface
SmartProductMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
SmartProduct
>
{
List
<
SmartProduct
>
getList
(
SmartProduct
req
);
int
countByProductName
(
String
productName
);
int
insertOrUpdate
(
SmartProduct
record
);
int
insertOrUpdateSelective
(
SmartProduct
record
);
...
...
src/main/java/com/glsx/smart/dao/mapper/SmartSceneDataMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -17,6 +18,8 @@ import org.apache.ibatis.annotations.Param;
public
interface
SmartSceneDataMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
SmartSceneData
>
{
int
insertOrUpdate
(
SmartSceneData
record
);
int
deleteBySceneId
(
Long
id
);
int
insertOrUpdateSelective
(
SmartSceneData
record
);
int
updateBatch
(
List
<
SmartSceneData
>
list
);
...
...
@@ -24,4 +27,6 @@ public interface SmartSceneDataMapper extends tk.mybatis.mapper.common.Mapper<Sm
int
updateBatchSelective
(
List
<
SmartSceneData
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartSceneData
>
list
);
List
<
SmartSceneData
>
getBySceneId
(
@Param
(
"sceneId"
)
Long
sceneId
);
}
src/main/java/com/glsx/smart/dao/mapper/SmartSceneMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -24,4 +25,9 @@ public interface SmartSceneMapper extends tk.mybatis.mapper.common.Mapper<SmartS
int
updateBatchSelective
(
List
<
SmartScene
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartScene
>
list
);
List
<
SmartScene
>
getList
(
SmartScene
record
);
SmartScene
getById
(
Long
id
);
}
src/main/java/com/glsx/smart/dao/mapper/SmartSceneTemplateMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneTemplate
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -16,6 +17,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public
interface
SmartSceneTemplateMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
SmartSceneTemplate
>
{
int
insertOrUpdate
(
SmartSceneTemplate
record
);
int
insertOrUpdateSelective
(
SmartSceneTemplate
record
);
...
...
@@ -25,4 +27,9 @@ public interface SmartSceneTemplateMapper
int
updateBatchSelective
(
List
<
SmartSceneTemplate
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartSceneTemplate
>
list
);
List
<
SmartSceneTemplate
>
getList
(
SmartSceneTemplate
record
);
SmartSceneTemplate
getById
(
Long
id
);
}
src/main/java/com/glsx/smart/dao/mapper/SmartSysCodeMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -15,8 +16,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public
interface
SmartSysCodeMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
SmartSysCode
>
{
List
<
SmartSysCode
>
getList
(
SmartSysCode
req
);
List
<
SmartSysCode
>
getList
(
SmartSysCode
req
);
int
insertOrUpdate
(
SmartSysCode
record
);
...
...
src/main/java/com/glsx/smart/dao/mapper/SmartTemplateParamMapper.java
View file @
52498b8
package
com
.
glsx
.
smart
.
dao
.
mapper
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartTemplateParam
;
import
org.apache.ibatis.annotations.Mapper
;
import
org.apache.ibatis.annotations.Param
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -18,6 +19,8 @@ public interface SmartTemplateParamMapper
extends
tk
.
mybatis
.
mapper
.
common
.
Mapper
<
SmartTemplateParam
>
{
int
insertOrUpdate
(
SmartTemplateParam
record
);
int
deleteByTemplateId
(
Long
id
);
int
insertOrUpdateSelective
(
SmartTemplateParam
record
);
int
updateBatch
(
List
<
SmartTemplateParam
>
list
);
...
...
@@ -25,4 +28,6 @@ public interface SmartTemplateParamMapper
int
updateBatchSelective
(
List
<
SmartTemplateParam
>
list
);
int
batchInsert
(
@Param
(
"list"
)
List
<
SmartTemplateParam
>
list
);
List
<
SmartTemplateParam
>
getByTemplateId
(
@Param
(
"templateId"
)
Long
templateId
);
}
src/main/java/com/glsx/smart/exception/BusinessException.java
View file @
52498b8
...
...
@@ -34,4 +34,15 @@ public class BusinessException extends RuntimeException {
public
void
setMessage
(
String
message
)
{
this
.
message
=
message
;
}
public
static
BusinessException
create
(
int
code
,
String
message
){
BusinessException
businessException
=
new
BusinessException
();
businessException
.
code
=
code
;
businessException
.
message
=
message
;
return
businessException
;
}
public
static
BusinessException
create
(
ResultEnum
resultEnum
)
{
return
create
(
resultEnum
.
getCode
(),
resultEnum
.
getMessage
());
}
}
src/main/java/com/glsx/smart/exception/GlobalExceptionHandler.java
View file @
52498b8
package
com
.
glsx
.
smart
.
exception
;
import
com.glsx.plat.core.web.R
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.validation.BindException
;
import
org.springframework.web.bind.MethodArgumentNotValidException
;
...
...
@@ -17,22 +18,23 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public
class
GlobalExceptionHandler
{
@ExceptionHandler
({
BusinessException
.
class
})
public
String
handleBusinessException
(
BusinessException
e
)
{
log
.
error
(
"
!!!! 业务异常
"
,
e
);
return
e
.
getMessage
(
);
public
R
handleBusinessException
(
BusinessException
e
)
{
log
.
error
(
"
业务异常:{}
"
,
e
);
return
R
.
error
(
e
.
getMessage
()
);
}
@ExceptionHandler
({
ServletRequestBindingException
.
class
,
MethodArgumentNotValidException
.
class
,
BindException
.
class
})
public
String
handleBindException
(
Exception
e
)
{
log
.
error
(
"
!!!! 参数错误
"
,
e
);
return
R
esultEnum
.
PARAM_ERROR
.
getMessage
(
);
public
R
handleBindException
(
Exception
e
)
{
log
.
error
(
"
参数错误:{}
"
,
e
);
return
R
.
error
(
ResultEnum
.
PARAM_ERROR
.
getCode
(),
ResultEnum
.
PARAM_ERROR
.
getMessage
()
);
}
@ExceptionHandler
(
Exception
.
class
)
public
String
handleException
(
Exception
e
)
{
log
.
error
(
"
!!!! 未知异常
"
,
e
);
return
R
esultEnum
.
ERROR
.
getMessage
(
);
public
R
handleException
(
Exception
e
)
{
log
.
error
(
"
未知异常:{}
"
,
e
);
return
R
.
error
(
e
.
getMessage
()
);
}
}
src/main/java/com/glsx/smart/service/SmartSceneDataService.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -18,7 +19,7 @@ public interface SmartSceneDataService {
int
insertSelective
(
SmartSceneData
record
);
List
<
SmartSceneData
>
selectByExample
(
SmartSceneData
example
);
List
<
SmartSceneData
>
getBySceneId
(
Long
sceneId
);
SmartSceneData
selectByPrimaryKey
(
Long
id
);
...
...
src/main/java/com/glsx/smart/service/SmartSceneService.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -18,14 +19,15 @@ public interface SmartSceneService {
int
insertSelective
(
SmartScene
record
);
List
<
SmartScene
>
selectByExample
(
SmartScene
example
);
int
insert
(
SmartScene
record
);
SmartScene
selectByPrimaryKey
(
Long
i
d
);
int
update
(
SmartScene
recor
d
);
int
updateByPrimaryKeySelective
(
SmartScene
record
);
List
<
SmartScene
>
getList
(
SmartScene
record
);
SmartScene
getById
(
Long
id
);
int
updateB
atchSelective
(
List
<
SmartScene
>
list
);
int
updateB
yPrimaryKeySelective
(
SmartScene
record
);
int
batchInsert
(
List
<
SmartScene
>
list
);
}
src/main/java/com/glsx/smart/service/SmartSceneTemplateService.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneTemplate
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -14,18 +15,16 @@ import com.glsx.smart.dao.entity.SmartSceneTemplate;
public
interface
SmartSceneTemplateService
{
int
deleteByPrimaryKey
(
Long
id
);
int
insert
OrUpdate
(
SmartSceneTemplate
record
);
int
insert
(
SmartSceneTemplate
record
);
int
insertSelectiv
e
(
SmartSceneTemplate
record
);
int
updat
e
(
SmartSceneTemplate
record
);
List
<
SmartSceneTemplate
>
selectByExample
(
SmartSceneTemplate
example
);
List
<
SmartSceneTemplate
>
getList
(
SmartSceneTemplate
record
);
SmartSceneTemplate
selectByPrimaryKey
(
Long
id
);
SmartSceneTemplate
getById
(
Long
id
);
int
updateByPrimaryKeySelective
(
SmartSceneTemplate
record
);
int
updateBatchSelective
(
List
<
SmartSceneTemplate
>
list
);
int
batchInsert
(
List
<
SmartSceneTemplate
>
list
);
int
getTotalCount
(
SmartSceneTemplate
record
);
}
src/main/java/com/glsx/smart/service/SmartSysCodeService.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -13,8 +13,8 @@ import com.glsx.smart.dao.entity.SmartSysCode;
*/
public
interface
SmartSysCodeService
{
PageInfo
<
SmartSysCode
>
getList
(
SmartSysCode
req
);
List
<
SmartSysCode
>
getList
(
SmartSysCode
req
);
int
deleteByPrimaryKey
(
Long
id
);
...
...
@@ -22,8 +22,6 @@ public interface SmartSysCodeService {
int
insertSelective
(
SmartSysCode
record
);
List
<
SmartSysCode
>
selectByExample
(
SmartSysCode
example
);
SmartSysCode
selectByPrimaryKey
(
Long
id
);
int
updateByPrimaryKeySelective
(
SmartSysCode
record
);
...
...
src/main/java/com/glsx/smart/service/SmartTemplateParamService.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartTemplateParam
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -18,7 +19,7 @@ public interface SmartTemplateParamService {
int
insertSelective
(
SmartTemplateParam
record
);
List
<
SmartTemplateParam
>
selectByExample
(
SmartTemplateParam
example
);
List
<
SmartTemplateParam
>
getByTemplateId
(
Long
templateId
);
SmartTemplateParam
selectByPrimaryKey
(
Long
id
);
...
...
src/main/java/com/glsx/smart/service/impl/SmartSceneDataServiceImpl.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.mapper.SmartSceneDataMapper
;
import
com.glsx.smart.exception.BusinessException
;
...
...
@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartSceneDataService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public
class
SmartSceneDataServiceImpl
implements
SmartSceneDataService
{
@Resource
private
SmartSceneDataMapper
smartSceneDataMapper
;
...
...
@@ -48,8 +50,8 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
}
@Override
public
List
<
SmartSceneData
>
selectByExample
(
SmartSceneData
example
)
{
return
smartSceneDataMapper
.
select
(
example
);
public
List
<
SmartSceneData
>
getBySceneId
(
Long
sceneId
)
{
return
smartSceneDataMapper
.
getBySceneId
(
sceneId
);
}
@Override
...
...
src/main/java/com/glsx/smart/service/impl/SmartSceneServiceImpl.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartScene
;
import
com.glsx.smart.dao.entity.SmartSceneData
;
import
com.glsx.smart.dao.mapper.SmartSceneDataMapper
;
import
com.glsx.smart.dao.mapper.SmartSceneMapper
;
import
com.glsx.smart.exception.BusinessException
;
import
com.glsx.smart.exception.ResultEnum
;
import
com.glsx.smart.service.BaseService
;
import
com.glsx.smart.service.SmartSceneService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>Description:
...
...
@@ -19,23 +24,32 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
public
class
SmartSceneServiceImpl
implements
SmartSceneService
{
public
class
SmartSceneServiceImpl
extends
BaseService
implements
SmartSceneService
{
@Resource
private
SmartSceneMapper
sceneMapper
;
@Resource
private
SmartSceneMapper
smartSceneMapper
;
private
SmartSceneDataMapper
sceneDataMapper
;
@Override
public
List
<
SmartScene
>
getList
(
SmartScene
record
)
{
return
sceneMapper
.
getList
(
record
);
}
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
return
s
martS
ceneMapper
.
deleteByPrimaryKey
(
id
);
return
sceneMapper
.
deleteByPrimaryKey
(
id
);
}
@Override
public
int
insertOrUpdate
(
SmartScene
scene
)
{
if
(
scene
.
getId
()
==
null
)
{
return
s
martS
ceneMapper
.
insertSelective
(
scene
);
return
sceneMapper
.
insertSelective
(
scene
);
}
else
{
SmartScene
record
=
s
martS
ceneMapper
.
selectByPrimaryKey
(
scene
.
getId
());
SmartScene
record
=
sceneMapper
.
selectByPrimaryKey
(
scene
.
getId
());
if
(
record
!=
null
)
{
return
s
martS
ceneMapper
.
updateByPrimaryKeySelective
(
scene
);
return
sceneMapper
.
updateByPrimaryKeySelective
(
scene
);
}
else
{
throw
new
BusinessException
(
ResultEnum
.
ID_NOT_FOUND
);
}
...
...
@@ -44,32 +58,53 @@ public class SmartSceneServiceImpl implements SmartSceneService {
@Override
public
int
insertSelective
(
SmartScene
scene
)
{
return
s
martS
ceneMapper
.
insertSelective
(
scene
);
return
sceneMapper
.
insertSelective
(
scene
);
}
@Override
public
List
<
SmartScene
>
selectByExample
(
SmartScene
example
)
{
return
smartSceneMapper
.
select
(
example
);
}
@Override
public
SmartScene
selectByPrimaryKey
(
Long
id
)
{
return
smartSceneMapper
.
selectByPrimaryKey
(
id
);
@Transactional
public
int
insert
(
SmartScene
record
)
{
int
i
=
sceneMapper
.
insertSelective
(
record
);
Long
id
=
record
.
getId
();
log
.
info
(
"保存用户场景数据生成id:{}"
,
record
.
getId
());
if
(
i
>
0
){
List
<
SmartSceneData
>
list
=
record
.
getDataList
();
if
(!
list
.
isEmpty
()){
for
(
SmartSceneData
data
:
list
)
{
data
.
setSceneId
(
id
);
}
sceneDataMapper
.
batchInsert
(
list
);
}
}
return
i
;
}
@Override
public
int
updateByPrimaryKeySelective
(
SmartScene
record
)
{
return
smartSceneMapper
.
updateByPrimaryKeySelective
(
record
);
@Transactional
public
int
update
(
SmartScene
record
)
{
Long
id
=
record
.
getId
();
int
i
=
sceneMapper
.
updateByPrimaryKeySelective
(
record
);
if
(
i
>
0
){
sceneDataMapper
.
deleteBySceneId
(
id
);
List
<
SmartSceneData
>
list
=
record
.
getDataList
();
if
(!
list
.
isEmpty
()){
for
(
SmartSceneData
data
:
list
)
{
data
.
setSceneId
(
id
);
}
sceneDataMapper
.
batchInsert
(
list
);
}
}
return
i
;
}
@Override
public
int
updateBatchSelective
(
List
<
SmartScene
>
list
)
{
return
s
martSceneMapper
.
updateBatchSelective
(
list
);
public
SmartScene
getById
(
Long
id
)
{
return
s
ceneMapper
.
getById
(
id
);
}
@Override
public
int
batchInsert
(
List
<
SmartScene
>
list
)
{
return
s
martSceneMapper
.
batchInsert
(
list
);
public
int
updateByPrimaryKeySelective
(
SmartScene
record
)
{
return
s
ceneMapper
.
updateByPrimaryKeySelective
(
record
);
}
}
src/main/java/com/glsx/smart/service/impl/SmartSceneTemplateServiceImpl.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartSceneTemplate
;
import
com.glsx.smart.dao.entity.SmartTemplateParam
;
import
com.glsx.smart.dao.mapper.SmartSceneTemplateMapper
;
import
com.glsx.smart.
exception.BusinessException
;
import
com.glsx.smart.
exception.ResultEnum
;
import
com.glsx.smart.
dao.mapper.SmartTemplateParamMapper
;
import
com.glsx.smart.
service.BaseService
;
import
com.glsx.smart.service.SmartSceneTemplateService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>Description:
...
...
@@ -19,58 +22,73 @@ import org.springframework.stereotype.Service;
*/
@Slf4j
@Service
public
class
SmartSceneTemplateServiceImpl
implements
SmartSceneTemplateService
{
public
class
SmartSceneTemplateServiceImpl
extends
BaseService
implements
SmartSceneTemplateService
{
@Resource
private
SmartSceneTemplateMapper
sceneTemplateMapper
;
@Resource
private
Smart
SceneTemplateMapper
smartSceneTemplate
Mapper
;
private
Smart
TemplateParamMapper
param
Mapper
;
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
return
s
martS
ceneTemplateMapper
.
deleteByPrimaryKey
(
id
);
return
sceneTemplateMapper
.
deleteByPrimaryKey
(
id
);
}
@Override
public
int
insertOrUpdate
(
SmartSceneTemplate
sceneTemplate
)
{
if
(
sceneTemplate
.
getId
()
==
null
)
{
return
smartSceneTemplateMapper
.
insertSelective
(
sceneTemplate
);
}
else
{
SmartSceneTemplate
record
=
smartSceneTemplateMapper
.
selectByPrimaryKey
(
sceneTemplate
.
getId
());
if
(
record
!=
null
)
{
return
smartSceneTemplateMapper
.
updateByPrimaryKeySelective
(
sceneTemplate
);
}
else
{
throw
new
BusinessException
(
ResultEnum
.
ID_NOT_FOUND
);
@Transactional
public
int
insert
(
SmartSceneTemplate
record
)
{
int
i
=
sceneTemplateMapper
.
insertSelective
(
record
);
Long
id
=
record
.
getId
();
log
.
info
(
"保存模板数据生成id:{}"
,
record
.
getId
());
if
(
i
>
0
){
List
<
SmartTemplateParam
>
list
=
record
.
getTemplateList
();
if
(!
list
.
isEmpty
()){
for
(
SmartTemplateParam
param
:
list
)
{
param
.
setTemplateId
(
id
);
}
paramMapper
.
batchInsert
(
list
);
}
}
return
i
;
}
@Override
public
int
insertSelective
(
SmartSceneTemplate
record
)
{
return
smartSceneTemplateMapper
.
insertSelective
(
record
);
@Transactional
public
int
update
(
SmartSceneTemplate
record
)
{
Long
id
=
record
.
getId
();
int
i
=
sceneTemplateMapper
.
updateByPrimaryKeySelective
(
record
);
if
(
i
>
0
){
paramMapper
.
deleteByTemplateId
(
id
);
List
<
SmartTemplateParam
>
list
=
record
.
getTemplateList
();
if
(!
list
.
isEmpty
()){
for
(
SmartTemplateParam
param
:
list
)
{
param
.
setTemplateId
(
id
);
}
paramMapper
.
batchInsert
(
list
);
}
}
return
i
;
}
@Override
public
List
<
SmartSceneTemplate
>
selectByExample
(
SmartSceneTemplate
example
)
{
return
smartSceneTemplateMapper
.
select
(
example
);
public
List
<
SmartSceneTemplate
>
getList
(
SmartSceneTemplate
record
)
{
super
.
startPagination
(
record
);
return
sceneTemplateMapper
.
getList
(
record
);
}
@Override
public
SmartSceneTemplate
selectByPrimaryKey
(
Long
id
)
{
return
s
martSceneTemplateMapper
.
selectByPrimaryKey
(
id
);
public
SmartSceneTemplate
getById
(
Long
id
)
{
return
s
ceneTemplateMapper
.
getById
(
id
);
}
@Override
public
int
updateByPrimaryKeySelective
(
SmartSceneTemplate
record
)
{
return
s
martS
ceneTemplateMapper
.
updateByPrimaryKeySelective
(
record
);
return
sceneTemplateMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
updateBatchSelective
(
List
<
SmartSceneTemplate
>
list
)
{
return
s
martSceneTemplateMapper
.
updateBatchSelective
(
list
);
public
int
getTotalCount
(
SmartSceneTemplate
record
)
{
return
s
ceneTemplateMapper
.
selectCount
(
record
);
}
@Override
public
int
batchInsert
(
List
<
SmartSceneTemplate
>
list
)
{
return
smartSceneTemplateMapper
.
batchInsert
(
list
);
}
}
src/main/java/com/glsx/smart/service/impl/SmartSysCodeServiceImpl.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
com.github.pagehelper.PageInfo
;
import
com.glsx.smart.dao.entity.SmartSysCode
;
import
com.glsx.smart.dao.mapper.SmartSysCodeMapper
;
import
com.glsx.smart.exception.BusinessException
;
...
...
@@ -12,6 +9,9 @@ import com.glsx.smart.service.SmartSysCodeService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -28,15 +28,12 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
/**
* 获取代码集列表
*
* @param
req
请求
* @param
code
请求
* @return 结果
*/
@Override
public
PageInfo
<
SmartSysCode
>
getList
(
SmartSysCode
req
)
{
super
.
startPagination
(
req
);
List
<
SmartSysCode
>
sysCodeList
=
sysCodeMapper
.
getList
(
req
);
PageInfo
<
SmartSysCode
>
pageInfo
=
new
PageInfo
<>(
sysCodeList
);
return
pageInfo
;
public
List
<
SmartSysCode
>
getList
(
SmartSysCode
code
)
{
return
sysCodeMapper
.
getList
(
code
);
}
...
...
@@ -66,11 +63,6 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
}
@Override
public
List
<
SmartSysCode
>
selectByExample
(
SmartSysCode
example
)
{
return
sysCodeMapper
.
select
(
example
);
}
@Override
public
SmartSysCode
selectByPrimaryKey
(
Long
id
)
{
return
sysCodeMapper
.
selectByPrimaryKey
(
id
);
}
...
...
src/main/java/com/glsx/smart/service/impl/SmartTemplateParamServiceImpl.java
View file @
52498b8
package
com
.
glsx
.
smart
.
service
.
impl
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
com.glsx.smart.dao.entity.SmartTemplateParam
;
import
com.glsx.smart.dao.mapper.SmartTemplateParamMapper
;
import
com.glsx.smart.exception.BusinessException
;
...
...
@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartTemplateParamService;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
java.util.List
;
/**
* <p>Description:
* <p>Project: chejia-smart
...
...
@@ -20,23 +21,24 @@ import org.springframework.stereotype.Service;
@Slf4j
@Service
public
class
SmartTemplateParamServiceImpl
implements
SmartTemplateParamService
{
@Resource
private
SmartTemplateParamMapper
smartT
emplateParamMapper
;
private
SmartTemplateParamMapper
t
emplateParamMapper
;
@Override
public
int
deleteByPrimaryKey
(
Long
id
)
{
return
smartT
emplateParamMapper
.
deleteByPrimaryKey
(
id
);
return
t
emplateParamMapper
.
deleteByPrimaryKey
(
id
);
}
@Override
public
int
insertOrUpdate
(
SmartTemplateParam
templateParam
)
{
if
(
templateParam
.
getId
()
==
null
)
{
return
smartT
emplateParamMapper
.
insertSelective
(
templateParam
);
return
t
emplateParamMapper
.
insertSelective
(
templateParam
);
}
else
{
SmartTemplateParam
record
=
smartT
emplateParamMapper
.
selectByPrimaryKey
(
SmartTemplateParam
record
=
t
emplateParamMapper
.
selectByPrimaryKey
(
templateParam
.
getId
());
if
(
record
!=
null
)
{
return
smartT
emplateParamMapper
.
updateByPrimaryKeySelective
(
templateParam
);
return
t
emplateParamMapper
.
updateByPrimaryKeySelective
(
templateParam
);
}
else
{
throw
new
BusinessException
(
ResultEnum
.
ID_NOT_FOUND
);
}
...
...
@@ -45,32 +47,32 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
@Override
public
int
insertSelective
(
SmartTemplateParam
record
)
{
return
smartT
emplateParamMapper
.
insertSelective
(
record
);
return
t
emplateParamMapper
.
insertSelective
(
record
);
}
@Override
public
List
<
SmartTemplateParam
>
selectByExample
(
SmartTemplateParam
example
)
{
return
smartTemplateParamMapper
.
select
(
example
);
public
List
<
SmartTemplateParam
>
getByTemplateId
(
Long
templateId
)
{
return
templateParamMapper
.
getByTemplateId
(
templateId
);
}
@Override
public
SmartTemplateParam
selectByPrimaryKey
(
Long
id
)
{
return
smartT
emplateParamMapper
.
selectByPrimaryKey
(
id
);
return
t
emplateParamMapper
.
selectByPrimaryKey
(
id
);
}
@Override
public
int
updateByPrimaryKeySelective
(
SmartTemplateParam
record
)
{
return
smartT
emplateParamMapper
.
updateByPrimaryKeySelective
(
record
);
return
t
emplateParamMapper
.
updateByPrimaryKeySelective
(
record
);
}
@Override
public
int
updateBatchSelective
(
List
<
SmartTemplateParam
>
list
)
{
return
smartT
emplateParamMapper
.
updateBatchSelective
(
list
);
return
t
emplateParamMapper
.
updateBatchSelective
(
list
);
}
@Override
public
int
batchInsert
(
List
<
SmartTemplateParam
>
list
)
{
return
smartT
emplateParamMapper
.
batchInsert
(
list
);
return
t
emplateParamMapper
.
batchInsert
(
list
);
}
}
src/main/resources/mapper/SmartSceneDataMapper.xml
View file @
52498b8
...
...
@@ -109,6 +109,14 @@
#{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
</foreach>
</insert>
<delete
id=
"deleteBySceneId"
parameterType=
"java.lang.Long"
>
delete from smart_scene_data
where scene_id = #{id,jdbcType=BIGINT}
</delete>
<select
id=
"getBySceneId"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_scene_data
where scene_id = #{sceneId,jdbcType=BIGINT}
</select>
<insert
id=
"insertOrUpdate"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.smart.dao.entity.SmartSceneData"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
...
...
src/main/resources/mapper/SmartSceneMapper.xml
View file @
52498b8
...
...
@@ -20,6 +20,14 @@
<result
column=
"create_time"
jdbcType=
"TIMESTAMP"
property=
"createTime"
/>
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
</resultMap>
<resultMap
id=
"DetailResultMap"
type=
"com.glsx.smart.dao.entity.SmartScene"
extends=
"BaseResultMap"
>
<collection
property=
"iconUrl"
column=
"icon"
ofType=
"com.glsx.smart.dao.entity.SmartScene"
fetchType=
"eager"
select=
"com.glsx.smart.dao.mapper.SmartSysFileMapper.selectUrlById"
>
</collection>
<collection
property=
"backPicUrl"
column=
"back_pic"
ofType=
"com.glsx.smart.dao.entity.SmartScene"
fetchType=
"eager"
select=
"com.glsx.smart.dao.mapper.SmartSysFileMapper.selectUrlById"
>
</collection>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, user_id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule,
...
...
@@ -426,4 +434,21 @@
</if>
</trim>
</insert>
<select
id=
"getList"
parameterType=
"com.glsx.smart.dao.entity.SmartScene"
resultMap=
"DetailResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_scene t
<where>
<if
test=
"typeKey != null and typeKey != ''"
>
and t.type_key = #{typeKey,jdbcType=VARCHAR}
</if>
</where>
order by t.create_time desc
</select>
<select
id=
"getById"
parameterType=
"java.lang.Long"
resultMap=
"DetailResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_scene
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>
src/main/resources/mapper/SmartSceneTemplateMapper.xml
View file @
52498b8
...
...
@@ -21,6 +21,14 @@
<result
column=
"update_time"
jdbcType=
"TIMESTAMP"
property=
"updateTime"
/>
<result
column=
"update_by"
jdbcType=
"BIGINT"
property=
"updateBy"
/>
</resultMap>
<resultMap
id=
"DetailResultMap"
type=
"com.glsx.smart.dao.entity.SmartSceneTemplate"
extends=
"BaseResultMap"
>
<collection
property=
"iconUrl"
column=
"icon"
ofType=
"com.glsx.smart.dao.entity.SmartSceneTemplate"
fetchType=
"eager"
select=
"com.glsx.smart.dao.mapper.SmartSysFileMapper.selectUrlById"
>
</collection>
<collection
property=
"backPicUrl"
column=
"back_pic"
ofType=
"com.glsx.smart.dao.entity.SmartSceneTemplate"
fetchType=
"eager"
select=
"com.glsx.smart.dao.mapper.SmartSysFileMapper.selectUrlById"
>
</collection>
</resultMap>
<sql
id=
"Base_Column_List"
>
<!--@mbg.generated-->
id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule,
...
...
@@ -453,4 +461,23 @@
</if>
</trim>
</insert>
<select
id=
"getList"
parameterType=
"com.glsx.smart.dao.entity.SmartSceneTemplate"
resultMap=
"DetailResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_scene_template t
<where>
<if
test=
"typeKey != null and typeKey != ''"
>
and t.type_key = #{typeKey,jdbcType=VARCHAR}
</if>
</where>
order by t.create_time desc
</select>
<select
id=
"getById"
parameterType=
"java.lang.Long"
resultMap=
"DetailResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_scene_template
where id = #{id,jdbcType=BIGINT}
</select>
</mapper>
src/main/resources/mapper/SmartSysCodeMapper.xml
View file @
52498b8
...
...
@@ -40,7 +40,7 @@
</if>
and ssc.status = 1
</where>
order by ssc.
create_time desc, ssc.sort a
sc
order by ssc.
sort asc, ssc.create_time de
sc
</select>
...
...
src/main/resources/mapper/SmartTemplateParamMapper.xml
View file @
52498b8
...
...
@@ -146,6 +146,14 @@
param_value = #{paramValue,jdbcType=VARCHAR},
</trim>
</insert>
<delete
id=
"deleteByTemplateId"
parameterType=
"java.lang.Long"
>
delete from smart_template_param
where template_id = #{id,jdbcType=BIGINT}
</delete>
<select
id=
"getByTemplateId"
parameterType=
"java.lang.Long"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from smart_template_param
where template_id = #{templateId,jdbcType=BIGINT}
</select>
<insert
id=
"insertOrUpdateSelective"
keyColumn=
"id"
keyProperty=
"id"
parameterType=
"com.glsx.smart.dao.entity.SmartTemplateParam"
useGeneratedKeys=
"true"
>
<!--@mbg.generated-->
...
...
Write
Preview
Markdown
is supported
Attach a file
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 post a comment