Commit 6c4c5889 by tyfanchz

Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	src/main/java/com/glsx/smart/dao/mapper/SmartProductMapper.java
#	src/main/java/com/glsx/smart/exception/GlobalExceptionHandler.java
2 parents faf4a49c 48b6e762
Showing 31 changed files with 420 additions and 145 deletions
package com.glsx.smart.controller; package com.glsx.smart.controller;
import org.springframework.web.bind.annotation.RequestMapping; import com.glsx.smart.dao.entity.SmartProduct;
import org.springframework.web.bind.annotation.RequestMethod; import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RestController;
/** /**
* @Title: IndexController.java * @Title: IndexController.java
...@@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -13,6 +12,7 @@ import org.springframework.web.bind.annotation.RestController;
* @Company: Didihu.com.cn * @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017 * @Copyright Copyright (c) 2017
*/ */
@Slf4j
@RestController @RestController
public class IndexController { public class IndexController {
...@@ -22,4 +22,11 @@ public class IndexController { ...@@ -22,4 +22,11 @@ public class IndexController {
return "hello, welcome to home!"; 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();
}
} }
package com.glsx.smart.controller; 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.dao.entity.SmartScene;
import com.glsx.smart.service.SmartSceneDataService;
import com.glsx.smart.service.SmartSceneService; import com.glsx.smart.service.SmartSceneService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -10,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -21,21 +24,38 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,21 +24,38 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/scene") @RequestMapping("/scene")
public class SceneController { public class SceneController {
@Autowired @Autowired
private SmartSceneService sceneService; private SmartSceneService sceneService;
@Autowired
private SmartSceneDataService sceneDataService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartScene> getList(SmartScene scene) { public List<SmartScene> getList(@RequestBody SmartScene scene) {
return sceneService.selectByExample(scene); log.info("/scene/getList param: {}", JSON.toJSONString(scene));
return sceneService.getList(scene);
} }
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartScene getById(Long id) { 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}) @RequestMapping(value = "/update", method = {RequestMethod.POST})
public void save(@RequestBody SmartScene scene) { public boolean update(@RequestBody SmartScene scene) {
sceneService.insertOrUpdate(scene); log.info("用户更新调用/scene/update param: {}", JSON.toJSONString(scene));
return sceneService.update(scene) > 0 ? true : false;
} }
} }
package com.glsx.smart.controller; 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.dao.entity.SmartSceneTemplate;
import com.glsx.smart.service.SmartSceneTemplateService; import com.glsx.smart.service.SmartSceneTemplateService;
import com.glsx.smart.service.SmartTemplateParamService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -10,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -21,21 +25,53 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,21 +25,53 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/sceneTemplate") @RequestMapping("/sceneTemplate")
public class SceneTemplateController { public class SceneTemplateController {
@Autowired @Autowired
private SmartSceneTemplateService sceneTemplateService; 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}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartSceneTemplate> getList(SmartSceneTemplate sceneTemplate) { 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}) @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartSceneTemplate getById(Long id) { 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}) @RequestMapping(value = "/update", method = {RequestMethod.POST})
public void save(@RequestBody SmartSceneTemplate sceneTemplate) { public boolean update(@RequestBody SmartSceneTemplate sceneTemplate) {
sceneTemplateService.insertOrUpdate(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;
}
} }
package com.glsx.smart.controller; package com.glsx.smart.controller;
import com.alibaba.fastjson.JSON; 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.dao.entity.SmartSysCode;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.SmartSysCodeService; import com.glsx.smart.service.SmartSysCodeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; 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.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
...@@ -21,12 +25,17 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -21,12 +25,17 @@ import org.springframework.web.bind.annotation.RestController;
@RestController @RestController
@RequestMapping("/sysCode") @RequestMapping("/sysCode")
public class SysCodeController { public class SysCodeController {
@Autowired @Autowired
private SmartSysCodeService sysCodeService; private SmartSysCodeService sysCodeService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartSysCode> getList(SmartSysCode req) { public R getList(@RequestBody SmartSysCode code) {
log.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req)); log.info("/sysCode/getList param: {}", JSON.toJSONString(code));
return sysCodeService.getList(req); if(StringUtils.isEmpty(code.getDictType())
|| StringUtils.isEmpty(code.getParentKey())){
throw BusinessException.create(ResultEnum.PARAM_ERROR);
}
return R.ok().data(sysCodeService.getList(code));
} }
} }
package com.glsx.smart.dao.entity; package com.glsx.smart.dao.entity;
import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -21,7 +24,7 @@ import lombok.Data; ...@@ -21,7 +24,7 @@ import lombok.Data;
*/ */
@Data @Data
@Table(name = "smart_scene") @Table(name = "smart_scene")
public class SmartScene { public class SmartScene implements Serializable {
/** /**
* 标识ID * 标识ID
*/ */
...@@ -50,11 +53,21 @@ public class SmartScene { ...@@ -50,11 +53,21 @@ public class SmartScene {
private Long icon; private Long icon;
/** /**
* 场景图标
*/
private String iconUrl;
/**
* 场景背景图ID 关联smart_sys_file中id * 场景背景图ID 关联smart_sys_file中id
*/ */
private Long backPic; private Long backPic;
/** /**
* 场景背景图
*/
private String backPicUrl;
/**
* 查看次数 * 查看次数
*/ */
private Long viewTimes; private Long viewTimes;
...@@ -93,4 +106,9 @@ public class SmartScene { ...@@ -93,4 +106,9 @@ public class SmartScene {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
/**
* 场景关系数据
*/
private List<SmartSceneData> dataList;
} }
package com.glsx.smart.dao.entity; package com.glsx.smart.dao.entity;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.io.Serializable;
import java.util.Date; import java.util.Date;
import lombok.Data; import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -21,7 +25,7 @@ import lombok.Data; ...@@ -21,7 +25,7 @@ import lombok.Data;
*/ */
@Data @Data
@Table(name = "smart_scene_template") @Table(name = "smart_scene_template")
public class SmartSceneTemplate { public class SmartSceneTemplate extends BaseDTO implements Serializable {
/** /**
* 标识ID * 标识ID
*/ */
...@@ -45,11 +49,21 @@ public class SmartSceneTemplate { ...@@ -45,11 +49,21 @@ public class SmartSceneTemplate {
private Long icon; private Long icon;
/** /**
* 场景图标
*/
private String iconUrl;
/**
* 场景背景图ID 关联smart_sys_file中id * 场景背景图ID 关联smart_sys_file中id
*/ */
private Long backPic; private Long backPic;
/** /**
* 场景背景图
*/
private String backPicUrl;
/**
* 查看次数 * 查看次数
*/ */
private Long viewTimes; private Long viewTimes;
...@@ -98,4 +112,9 @@ public class SmartSceneTemplate { ...@@ -98,4 +112,9 @@ public class SmartSceneTemplate {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
/**
* 场景关系数据
*/
private List<SmartTemplateParam> templateList;
} }
...@@ -3,6 +3,7 @@ package com.glsx.smart.dao.mapper; ...@@ -3,6 +3,7 @@ package com.glsx.smart.dao.mapper;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
/** /**
* <p>Description: * <p>Description:
...@@ -17,4 +18,15 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar ...@@ -17,4 +18,15 @@ public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<Smar
List<SmartProduct> getList(SmartProduct req); List<SmartProduct> getList(SmartProduct req);
int countByProductName(String productName); int countByProductName(String productName);
int insertOrUpdate(SmartProduct record);
int insertOrUpdateSelective(SmartProduct record);
int updateBatch(List<SmartProduct> list);
int updateBatchSelective(List<SmartProduct> list);
int batchInsert(@Param("list") List<SmartProduct> list);
} }
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneData; import com.glsx.smart.dao.entity.SmartSceneData;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -17,6 +18,8 @@ import org.apache.ibatis.annotations.Param; ...@@ -17,6 +18,8 @@ import org.apache.ibatis.annotations.Param;
public interface SmartSceneDataMapper extends tk.mybatis.mapper.common.Mapper<SmartSceneData> { public interface SmartSceneDataMapper extends tk.mybatis.mapper.common.Mapper<SmartSceneData> {
int insertOrUpdate(SmartSceneData record); int insertOrUpdate(SmartSceneData record);
int deleteBySceneId(Long id);
int insertOrUpdateSelective(SmartSceneData record); int insertOrUpdateSelective(SmartSceneData record);
int updateBatch(List<SmartSceneData> list); int updateBatch(List<SmartSceneData> list);
...@@ -24,4 +27,6 @@ public interface SmartSceneDataMapper extends tk.mybatis.mapper.common.Mapper<Sm ...@@ -24,4 +27,6 @@ public interface SmartSceneDataMapper extends tk.mybatis.mapper.common.Mapper<Sm
int updateBatchSelective(List<SmartSceneData> list); int updateBatchSelective(List<SmartSceneData> list);
int batchInsert(@Param("list") List<SmartSceneData> list); int batchInsert(@Param("list") List<SmartSceneData> list);
List<SmartSceneData> getBySceneId(@Param("sceneId") Long sceneId);
} }
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartScene; import com.glsx.smart.dao.entity.SmartScene;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -24,4 +25,9 @@ public interface SmartSceneMapper extends tk.mybatis.mapper.common.Mapper<SmartS ...@@ -24,4 +25,9 @@ public interface SmartSceneMapper extends tk.mybatis.mapper.common.Mapper<SmartS
int updateBatchSelective(List<SmartScene> list); int updateBatchSelective(List<SmartScene> list);
int batchInsert(@Param("list") List<SmartScene> list); int batchInsert(@Param("list") List<SmartScene> list);
List<SmartScene> getList(SmartScene record);
SmartScene getById(Long id);
} }
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneTemplate; import com.glsx.smart.dao.entity.SmartSceneTemplate;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -16,6 +17,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -16,6 +17,7 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface SmartSceneTemplateMapper public interface SmartSceneTemplateMapper
extends tk.mybatis.mapper.common.Mapper<SmartSceneTemplate> { extends tk.mybatis.mapper.common.Mapper<SmartSceneTemplate> {
int insertOrUpdate(SmartSceneTemplate record); int insertOrUpdate(SmartSceneTemplate record);
int insertOrUpdateSelective(SmartSceneTemplate record); int insertOrUpdateSelective(SmartSceneTemplate record);
...@@ -25,4 +27,9 @@ public interface SmartSceneTemplateMapper ...@@ -25,4 +27,9 @@ public interface SmartSceneTemplateMapper
int updateBatchSelective(List<SmartSceneTemplate> list); int updateBatchSelective(List<SmartSceneTemplate> list);
int batchInsert(@Param("list") List<SmartSceneTemplate> list); int batchInsert(@Param("list") List<SmartSceneTemplate> list);
List<SmartSceneTemplate> getList(SmartSceneTemplate record);
SmartSceneTemplate getById(Long id);
} }
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysCode; import com.glsx.smart.dao.entity.SmartSysCode;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -15,8 +16,8 @@ import org.apache.ibatis.annotations.Param; ...@@ -15,8 +16,8 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface SmartSysCodeMapper extends tk.mybatis.mapper.common.Mapper<SmartSysCode> { public interface SmartSysCodeMapper extends tk.mybatis.mapper.common.Mapper<SmartSysCode> {
List<SmartSysCode> getList(SmartSysCode req);
List<SmartSysCode> getList(SmartSysCode req);
int insertOrUpdate(SmartSysCode record); int insertOrUpdate(SmartSysCode record);
......
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSysFile; import com.glsx.smart.dao.entity.SmartSysFile;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -25,5 +26,5 @@ public interface SmartSysFileMapper extends tk.mybatis.mapper.common.Mapper<Smar ...@@ -25,5 +26,5 @@ public interface SmartSysFileMapper extends tk.mybatis.mapper.common.Mapper<Smar
int batchInsert(@Param("list") List<SmartSysFile> list); int batchInsert(@Param("list") List<SmartSysFile> list);
List<SmartSysFile> findByType(String type); List<SmartSysFile> findByType(@Param("type") Byte type);
} }
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartTemplateParam; import com.glsx.smart.dao.entity.SmartTemplateParam;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -18,6 +19,8 @@ public interface SmartTemplateParamMapper ...@@ -18,6 +19,8 @@ public interface SmartTemplateParamMapper
extends tk.mybatis.mapper.common.Mapper<SmartTemplateParam> { extends tk.mybatis.mapper.common.Mapper<SmartTemplateParam> {
int insertOrUpdate(SmartTemplateParam record); int insertOrUpdate(SmartTemplateParam record);
int deleteByTemplateId(Long id);
int insertOrUpdateSelective(SmartTemplateParam record); int insertOrUpdateSelective(SmartTemplateParam record);
int updateBatch(List<SmartTemplateParam> list); int updateBatch(List<SmartTemplateParam> list);
...@@ -25,4 +28,6 @@ public interface SmartTemplateParamMapper ...@@ -25,4 +28,6 @@ public interface SmartTemplateParamMapper
int updateBatchSelective(List<SmartTemplateParam> list); int updateBatchSelective(List<SmartTemplateParam> list);
int batchInsert(@Param("list") List<SmartTemplateParam> list); int batchInsert(@Param("list") List<SmartTemplateParam> list);
List<SmartTemplateParam> getByTemplateId(@Param("templateId") Long templateId);
} }
...@@ -34,4 +34,15 @@ public class BusinessException extends RuntimeException { ...@@ -34,4 +34,15 @@ public class BusinessException extends RuntimeException {
public void setMessage(String message) { public void setMessage(String message) {
this.message = 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());
}
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneData; import com.glsx.smart.dao.entity.SmartSceneData;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -18,7 +19,7 @@ public interface SmartSceneDataService { ...@@ -18,7 +19,7 @@ public interface SmartSceneDataService {
int insertSelective(SmartSceneData record); int insertSelective(SmartSceneData record);
List<SmartSceneData> selectByExample(SmartSceneData example); List<SmartSceneData> getBySceneId(Long sceneId);
SmartSceneData selectByPrimaryKey(Long id); SmartSceneData selectByPrimaryKey(Long id);
......
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartScene; import com.glsx.smart.dao.entity.SmartScene;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -18,14 +19,15 @@ public interface SmartSceneService { ...@@ -18,14 +19,15 @@ public interface SmartSceneService {
int insertSelective(SmartScene record); int insertSelective(SmartScene record);
List<SmartScene> selectByExample(SmartScene example); int insert(SmartScene record);
SmartScene selectByPrimaryKey(Long id); int update(SmartScene record);
int updateByPrimaryKeySelective(SmartScene record); List<SmartScene> getList(SmartScene record);
SmartScene getById(Long id);
int updateBatchSelective(List<SmartScene> list); int updateByPrimaryKeySelective(SmartScene record);
int batchInsert(List<SmartScene> list);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartSceneTemplate; import com.glsx.smart.dao.entity.SmartSceneTemplate;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -14,18 +15,16 @@ import com.glsx.smart.dao.entity.SmartSceneTemplate; ...@@ -14,18 +15,16 @@ import com.glsx.smart.dao.entity.SmartSceneTemplate;
public interface SmartSceneTemplateService { public interface SmartSceneTemplateService {
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
int insertOrUpdate(SmartSceneTemplate record); int insert(SmartSceneTemplate record);
int insertSelective(SmartSceneTemplate record); int update(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 updateByPrimaryKeySelective(SmartSceneTemplate record);
int updateBatchSelective(List<SmartSceneTemplate> list); int getTotalCount(SmartSceneTemplate record);
int batchInsert(List<SmartSceneTemplate> list);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartSysCode; import com.glsx.smart.dao.entity.SmartSysCode;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -13,8 +13,8 @@ import com.glsx.smart.dao.entity.SmartSysCode; ...@@ -13,8 +13,8 @@ import com.glsx.smart.dao.entity.SmartSysCode;
*/ */
public interface SmartSysCodeService { public interface SmartSysCodeService {
PageInfo<SmartSysCode> getList(SmartSysCode req);
List<SmartSysCode> getList(SmartSysCode req);
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
...@@ -22,8 +22,6 @@ public interface SmartSysCodeService { ...@@ -22,8 +22,6 @@ public interface SmartSysCodeService {
int insertSelective(SmartSysCode record); int insertSelective(SmartSysCode record);
List<SmartSysCode> selectByExample(SmartSysCode example);
SmartSysCode selectByPrimaryKey(Long id); SmartSysCode selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(SmartSysCode record); int updateByPrimaryKeySelective(SmartSysCode record);
......
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.glsx.smart.dao.entity.SmartTemplateParam; import com.glsx.smart.dao.entity.SmartTemplateParam;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -18,7 +19,7 @@ public interface SmartTemplateParamService { ...@@ -18,7 +19,7 @@ public interface SmartTemplateParamService {
int insertSelective(SmartTemplateParam record); int insertSelective(SmartTemplateParam record);
List<SmartTemplateParam> selectByExample(SmartTemplateParam example); List<SmartTemplateParam> getByTemplateId(Long templateId);
SmartTemplateParam selectByPrimaryKey(Long id); SmartTemplateParam selectByPrimaryKey(Long id);
......
package com.glsx.smart.service.impl; 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.entity.SmartSceneData;
import com.glsx.smart.dao.mapper.SmartSceneDataMapper; import com.glsx.smart.dao.mapper.SmartSceneDataMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
...@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartSceneDataService; ...@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartSceneDataService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service; ...@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@Service @Service
public class SmartSceneDataServiceImpl implements SmartSceneDataService { public class SmartSceneDataServiceImpl implements SmartSceneDataService {
@Resource @Resource
private SmartSceneDataMapper smartSceneDataMapper; private SmartSceneDataMapper smartSceneDataMapper;
...@@ -48,8 +50,8 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService { ...@@ -48,8 +50,8 @@ public class SmartSceneDataServiceImpl implements SmartSceneDataService {
} }
@Override @Override
public List<SmartSceneData> selectByExample(SmartSceneData example) { public List<SmartSceneData> getBySceneId(Long sceneId) {
return smartSceneDataMapper.select(example); return smartSceneDataMapper.getBySceneId(sceneId);
} }
@Override @Override
......
package com.glsx.smart.service.impl; 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.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.dao.mapper.SmartSceneMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartSceneService; import com.glsx.smart.service.SmartSceneService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -19,23 +24,32 @@ import org.springframework.stereotype.Service; ...@@ -19,23 +24,32 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
public class SmartSceneServiceImpl implements SmartSceneService { public class SmartSceneServiceImpl extends BaseService implements SmartSceneService {
@Resource
private SmartSceneMapper sceneMapper;
@Resource @Resource
private SmartSceneMapper smartSceneMapper; private SmartSceneDataMapper sceneDataMapper;
@Override
public List<SmartScene> getList(SmartScene record) {
return sceneMapper.getList(record);
}
@Override @Override
public int deleteByPrimaryKey(Long id) { public int deleteByPrimaryKey(Long id) {
return smartSceneMapper.deleteByPrimaryKey(id); return sceneMapper.deleteByPrimaryKey(id);
} }
@Override @Override
public int insertOrUpdate(SmartScene scene) { public int insertOrUpdate(SmartScene scene) {
if (scene.getId() == null) { if (scene.getId() == null) {
return smartSceneMapper.insertSelective(scene); return sceneMapper.insertSelective(scene);
} else { } else {
SmartScene record = smartSceneMapper.selectByPrimaryKey(scene.getId()); SmartScene record = sceneMapper.selectByPrimaryKey(scene.getId());
if (record != null) { if (record != null) {
return smartSceneMapper.updateByPrimaryKeySelective(scene); return sceneMapper.updateByPrimaryKeySelective(scene);
} else { } else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND); throw new BusinessException(ResultEnum.ID_NOT_FOUND);
} }
...@@ -44,32 +58,53 @@ public class SmartSceneServiceImpl implements SmartSceneService { ...@@ -44,32 +58,53 @@ public class SmartSceneServiceImpl implements SmartSceneService {
@Override @Override
public int insertSelective(SmartScene scene) { public int insertSelective(SmartScene scene) {
return smartSceneMapper.insertSelective(scene); return sceneMapper.insertSelective(scene);
} }
@Override @Override
public List<SmartScene> selectByExample(SmartScene example) { @Transactional
return smartSceneMapper.select(example); public int insert(SmartScene record) {
} int i = sceneMapper.insertSelective(record);
Long id = record.getId();
@Override log.info("保存用户场景数据生成id:{}", record.getId());
public SmartScene selectByPrimaryKey(Long id) { if(i > 0){
return smartSceneMapper.selectByPrimaryKey(id); List<SmartSceneData> list = record.getDataList();
if(!list.isEmpty()){
for (SmartSceneData data : list) {
data.setSceneId(id);
}
sceneDataMapper.batchInsert(list);
}
}
return i;
} }
@Override @Override
public int updateByPrimaryKeySelective(SmartScene record) { @Transactional
return smartSceneMapper.updateByPrimaryKeySelective(record); 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 @Override
public int updateBatchSelective(List<SmartScene> list) { public SmartScene getById(Long id) {
return smartSceneMapper.updateBatchSelective(list); return sceneMapper.getById(id);
} }
@Override @Override
public int batchInsert(List<SmartScene> list) { public int updateByPrimaryKeySelective(SmartScene record) {
return smartSceneMapper.batchInsert(list); return sceneMapper.updateByPrimaryKeySelective(record);
} }
} }
package com.glsx.smart.service.impl; 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.SmartSceneTemplate;
import com.glsx.smart.dao.entity.SmartTemplateParam;
import com.glsx.smart.dao.mapper.SmartSceneTemplateMapper; import com.glsx.smart.dao.mapper.SmartSceneTemplateMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.dao.mapper.SmartTemplateParamMapper;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartSceneTemplateService; import com.glsx.smart.service.SmartSceneTemplateService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -19,58 +22,73 @@ import org.springframework.stereotype.Service; ...@@ -19,58 +22,73 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService { public class SmartSceneTemplateServiceImpl extends BaseService implements SmartSceneTemplateService {
@Resource
private SmartSceneTemplateMapper sceneTemplateMapper;
@Resource @Resource
private SmartSceneTemplateMapper smartSceneTemplateMapper; private SmartTemplateParamMapper paramMapper;
@Override @Override
public int deleteByPrimaryKey(Long id) { public int deleteByPrimaryKey(Long id) {
return smartSceneTemplateMapper.deleteByPrimaryKey(id); return sceneTemplateMapper.deleteByPrimaryKey(id);
} }
@Override @Override
public int insertOrUpdate(SmartSceneTemplate sceneTemplate) { @Transactional
if (sceneTemplate.getId() == null) { public int insert(SmartSceneTemplate record) {
return smartSceneTemplateMapper.insertSelective(sceneTemplate); int i = sceneTemplateMapper.insertSelective(record);
} else { Long id = record.getId();
SmartSceneTemplate record = smartSceneTemplateMapper.selectByPrimaryKey( log.info("保存模板数据生成id:{}", record.getId());
sceneTemplate.getId()); if(i > 0){
if (record != null) { List<SmartTemplateParam> list = record.getTemplateList();
return smartSceneTemplateMapper.updateByPrimaryKeySelective(sceneTemplate); if(!list.isEmpty()){
} else { for (SmartTemplateParam param : list) {
throw new BusinessException(ResultEnum.ID_NOT_FOUND); param.setTemplateId(id);
}
paramMapper.batchInsert(list);
} }
} }
return i;
} }
@Override @Override
public int insertSelective(SmartSceneTemplate record) { @Transactional
return smartSceneTemplateMapper.insertSelective(record); 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 @Override
public List<SmartSceneTemplate> selectByExample(SmartSceneTemplate example) { public List<SmartSceneTemplate> getList(SmartSceneTemplate record) {
return smartSceneTemplateMapper.select(example); super.startPagination(record);
return sceneTemplateMapper.getList(record);
} }
@Override @Override
public SmartSceneTemplate selectByPrimaryKey(Long id) { public SmartSceneTemplate getById(Long id) {
return smartSceneTemplateMapper.selectByPrimaryKey(id); return sceneTemplateMapper.getById(id);
} }
@Override @Override
public int updateByPrimaryKeySelective(SmartSceneTemplate record) { public int updateByPrimaryKeySelective(SmartSceneTemplate record) {
return smartSceneTemplateMapper.updateByPrimaryKeySelective(record); return sceneTemplateMapper.updateByPrimaryKeySelective(record);
} }
@Override @Override
public int updateBatchSelective(List<SmartSceneTemplate> list) { public int getTotalCount(SmartSceneTemplate record) {
return smartSceneTemplateMapper.updateBatchSelective(list); return sceneTemplateMapper.selectCount(record);
} }
@Override
public int batchInsert(List<SmartSceneTemplate> list) {
return smartSceneTemplateMapper.batchInsert(list);
}
} }
package com.glsx.smart.service.impl; 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.entity.SmartSysCode;
import com.glsx.smart.dao.mapper.SmartSysCodeMapper; import com.glsx.smart.dao.mapper.SmartSysCodeMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
...@@ -12,6 +9,9 @@ import com.glsx.smart.service.SmartSysCodeService; ...@@ -12,6 +9,9 @@ import com.glsx.smart.service.SmartSysCodeService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -28,15 +28,12 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode ...@@ -28,15 +28,12 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
/** /**
* 获取代码集列表 * 获取代码集列表
* *
* @param req 请求 * @param code 请求
* @return 结果 * @return 结果
*/ */
@Override @Override
public PageInfo<SmartSysCode> getList(SmartSysCode req) { public List<SmartSysCode> getList(SmartSysCode code) {
super.startPagination(req); return sysCodeMapper.getList(code);
List<SmartSysCode> sysCodeList = sysCodeMapper.getList(req);
PageInfo<SmartSysCode> pageInfo = new PageInfo<>(sysCodeList);
return pageInfo;
} }
...@@ -66,11 +63,6 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode ...@@ -66,11 +63,6 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
} }
@Override @Override
public List<SmartSysCode> selectByExample(SmartSysCode example) {
return sysCodeMapper.select(example);
}
@Override
public SmartSysCode selectByPrimaryKey(Long id) { public SmartSysCode selectByPrimaryKey(Long id) {
return sysCodeMapper.selectByPrimaryKey(id); return sysCodeMapper.selectByPrimaryKey(id);
} }
......
package com.glsx.smart.service.impl; 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.entity.SmartTemplateParam;
import com.glsx.smart.dao.mapper.SmartTemplateParamMapper; import com.glsx.smart.dao.mapper.SmartTemplateParamMapper;
import com.glsx.smart.exception.BusinessException; import com.glsx.smart.exception.BusinessException;
...@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartTemplateParamService; ...@@ -10,6 +8,9 @@ import com.glsx.smart.service.SmartTemplateParamService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -20,23 +21,24 @@ import org.springframework.stereotype.Service; ...@@ -20,23 +21,24 @@ import org.springframework.stereotype.Service;
@Slf4j @Slf4j
@Service @Service
public class SmartTemplateParamServiceImpl implements SmartTemplateParamService { public class SmartTemplateParamServiceImpl implements SmartTemplateParamService {
@Resource @Resource
private SmartTemplateParamMapper smartTemplateParamMapper; private SmartTemplateParamMapper templateParamMapper;
@Override @Override
public int deleteByPrimaryKey(Long id) { public int deleteByPrimaryKey(Long id) {
return smartTemplateParamMapper.deleteByPrimaryKey(id); return templateParamMapper.deleteByPrimaryKey(id);
} }
@Override @Override
public int insertOrUpdate(SmartTemplateParam templateParam) { public int insertOrUpdate(SmartTemplateParam templateParam) {
if (templateParam.getId() == null) { if (templateParam.getId() == null) {
return smartTemplateParamMapper.insertSelective(templateParam); return templateParamMapper.insertSelective(templateParam);
} else { } else {
SmartTemplateParam record = smartTemplateParamMapper.selectByPrimaryKey( SmartTemplateParam record = templateParamMapper.selectByPrimaryKey(
templateParam.getId()); templateParam.getId());
if (record != null) { if (record != null) {
return smartTemplateParamMapper.updateByPrimaryKeySelective(templateParam); return templateParamMapper.updateByPrimaryKeySelective(templateParam);
} else { } else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND); throw new BusinessException(ResultEnum.ID_NOT_FOUND);
} }
...@@ -45,32 +47,32 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService ...@@ -45,32 +47,32 @@ public class SmartTemplateParamServiceImpl implements SmartTemplateParamService
@Override @Override
public int insertSelective(SmartTemplateParam record) { public int insertSelective(SmartTemplateParam record) {
return smartTemplateParamMapper.insertSelective(record); return templateParamMapper.insertSelective(record);
} }
@Override @Override
public List<SmartTemplateParam> selectByExample(SmartTemplateParam example) { public List<SmartTemplateParam> getByTemplateId(Long templateId) {
return smartTemplateParamMapper.select(example); return templateParamMapper.getByTemplateId(templateId);
} }
@Override @Override
public SmartTemplateParam selectByPrimaryKey(Long id) { public SmartTemplateParam selectByPrimaryKey(Long id) {
return smartTemplateParamMapper.selectByPrimaryKey(id); return templateParamMapper.selectByPrimaryKey(id);
} }
@Override @Override
public int updateByPrimaryKeySelective(SmartTemplateParam record) { public int updateByPrimaryKeySelective(SmartTemplateParam record) {
return smartTemplateParamMapper.updateByPrimaryKeySelective(record); return templateParamMapper.updateByPrimaryKeySelective(record);
} }
@Override @Override
public int updateBatchSelective(List<SmartTemplateParam> list) { public int updateBatchSelective(List<SmartTemplateParam> list) {
return smartTemplateParamMapper.updateBatchSelective(list); return templateParamMapper.updateBatchSelective(list);
} }
@Override @Override
public int batchInsert(List<SmartTemplateParam> list) { public int batchInsert(List<SmartTemplateParam> list) {
return smartTemplateParamMapper.batchInsert(list); return templateParamMapper.batchInsert(list);
} }
} }
...@@ -109,6 +109,14 @@ ...@@ -109,6 +109,14 @@
#{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR}) #{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
</foreach> </foreach>
</insert> </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" <insert id="insertOrUpdate" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.dao.entity.SmartSceneData" useGeneratedKeys="true"> parameterType="com.glsx.smart.dao.entity.SmartSceneData" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
......
...@@ -20,6 +20,14 @@ ...@@ -20,6 +20,14 @@
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap> </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"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, user_id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule, id, user_id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule,
...@@ -426,4 +434,21 @@ ...@@ -426,4 +434,21 @@
</if> </if>
</trim> </trim>
</insert> </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> </mapper>
...@@ -21,6 +21,14 @@ ...@@ -21,6 +21,14 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/> <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
</resultMap> </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"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule, id, scene_name, type_key, icon, back_pic, view_times, description, condition_rule,
...@@ -453,4 +461,23 @@ ...@@ -453,4 +461,23 @@
</if> </if>
</trim> </trim>
</insert> </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> </mapper>
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
</if> </if>
and ssc.status = 1 and ssc.status = 1
</where> </where>
order by ssc.create_time desc, ssc.sort asc order by ssc.sort asc, ssc.create_time desc
</select> </select>
......
...@@ -88,9 +88,9 @@ ...@@ -88,9 +88,9 @@
</foreach> </foreach>
</update> </update>
<select id="findByType" resultType="com.glsx.smart.dao.entity.SmartSysFile"> <select id="findByType" resultType="com.glsx.smart.dao.entity.SmartSysFile">
SELECT * FROM smart_sys_file select * from smart_sys_file
<if test="type != null"> <if test="type != null">
WHERE TYPE=#{TYPE} where `type` = #{type,jdbcType=TINYINT}
</if> </if>
</select> </select>
<insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map" <insert id="batchInsert" keyColumn="id" keyProperty="id" parameterType="map"
......
...@@ -146,6 +146,14 @@ ...@@ -146,6 +146,14 @@
param_value = #{paramValue,jdbcType=VARCHAR}, param_value = #{paramValue,jdbcType=VARCHAR},
</trim> </trim>
</insert> </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" <insert id="insertOrUpdateSelective" keyColumn="id" keyProperty="id"
parameterType="com.glsx.smart.dao.entity.SmartTemplateParam" useGeneratedKeys="true"> parameterType="com.glsx.smart.dao.entity.SmartTemplateParam" useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!