Commit 62c502ac by tyfanchz

产品列表功能开发

1 parent 586fc239
Showing 25 changed files with 159 additions and 106 deletions
...@@ -2,11 +2,13 @@ package com.glsx.smart.controller; ...@@ -2,11 +2,13 @@ package com.glsx.smart.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.plat.common.utils.StringUtils;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.exception.BusinessException;
import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartProductReq; import com.glsx.smart.pojo.SmartProductReq;
import com.glsx.smart.service.SmartProductService; import com.glsx.smart.service.SmartProductService;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
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;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -20,17 +22,16 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -20,17 +22,16 @@ import org.springframework.web.bind.annotation.RestController;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/product") @RequestMapping("/product")
public class ProductController { public class ProductController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SmartProductService productService; private SmartProductService productService;
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public PageInfo<SmartProduct> getList(SmartProductReq req) { public PageInfo<SmartProduct> getList(SmartProductReq req) {
logger.info("/product/getList param: {}", JSON.toJSONString(req)); log.info("/product/getList param: {}", JSON.toJSONString(req));
return productService.getList(req); return productService.getList(req);
} }
...@@ -41,6 +42,31 @@ public class ProductController { ...@@ -41,6 +42,31 @@ public class ProductController {
@RequestMapping(value = "/save", method = {RequestMethod.POST}) @RequestMapping(value = "/save", method = {RequestMethod.POST})
public void save(@RequestBody SmartProduct product) { public void save(@RequestBody SmartProduct product) {
log.info("$$$$ /product/save param: {}", JSON.toJSONString(product));
productService.save(product); productService.save(product);
} }
@RequestMapping(value = "/getCommandSetById", method = {RequestMethod.GET, RequestMethod.POST})
public void getCommandSetById(Long id) {
if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
}
productService.getCommandSetById(id);
}
@RequestMapping(value = "/checkShopProductId", method = {RequestMethod.GET, RequestMethod.POST})
public void checkShopProductId(String shopProductId) {
if (StringUtils.isBlank(shopProductId)) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
}
productService.checkShopProductId(shopProductId);
}
@RequestMapping(value = "/putOnOff", method = {RequestMethod.GET, RequestMethod.POST})
public void putOnOff(Long id) {
if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR);
}
productService.putOnOff(id);
}
} }
...@@ -3,8 +3,7 @@ package com.glsx.smart.controller; ...@@ -3,8 +3,7 @@ package com.glsx.smart.controller;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.service.SmartProductTypeService; import com.glsx.smart.service.SmartProductTypeService;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
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;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -18,11 +17,10 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,11 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/productType") @RequestMapping("/productType")
public class ProductTypeController { public class ProductTypeController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SmartProductTypeService productTypeService; private SmartProductTypeService productTypeService;
......
...@@ -3,8 +3,7 @@ package com.glsx.smart.controller; ...@@ -3,8 +3,7 @@ package com.glsx.smart.controller;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartScene; import com.glsx.smart.dao.entity.SmartScene;
import com.glsx.smart.service.SmartSceneService; import com.glsx.smart.service.SmartSceneService;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
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;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -18,11 +17,10 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,11 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/scene") @RequestMapping("/scene")
public class SceneController { public class SceneController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SmartSceneService sceneService; private SmartSceneService sceneService;
......
...@@ -3,8 +3,7 @@ package com.glsx.smart.controller; ...@@ -3,8 +3,7 @@ package com.glsx.smart.controller;
import java.util.List; import java.util.List;
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 org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
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;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
...@@ -18,10 +17,10 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -18,10 +17,10 @@ import org.springframework.web.bind.annotation.RestController;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/sceneTemplate")
public class SceneTemplateController { public class SceneTemplateController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SmartSceneTemplateService sceneTemplateService; private SmartSceneTemplateService sceneTemplateService;
......
...@@ -5,8 +5,7 @@ import com.github.pagehelper.PageInfo; ...@@ -5,8 +5,7 @@ import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartSysCode; import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq; import com.glsx.smart.pojo.SmartSysCodeReq;
import com.glsx.smart.service.SmartSysCodeService; import com.glsx.smart.service.SmartSysCodeService;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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;
...@@ -19,17 +18,16 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -19,17 +18,16 @@ import org.springframework.web.bind.annotation.RestController;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/sysCode") @RequestMapping("/sysCode")
public class SysCodeController { public class SysCodeController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@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(SmartSysCodeReq req) { public PageInfo<SmartSysCode> getList(SmartSysCodeReq req) {
this.logger.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req)); log.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req));
return sysCodeService.getList(req); return sysCodeService.getList(req);
} }
} }
...@@ -2,8 +2,7 @@ package com.glsx.smart.controller; ...@@ -2,8 +2,7 @@ package com.glsx.smart.controller;
import com.glsx.smart.dao.entity.SmartSysFile; import com.glsx.smart.dao.entity.SmartSysFile;
import com.glsx.smart.service.SmartSysFileService; import com.glsx.smart.service.SmartSysFileService;
import org.slf4j.Logger; import lombok.extern.slf4j.Slf4j;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
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;
...@@ -18,11 +17,10 @@ import org.springframework.web.multipart.MultipartFile; ...@@ -18,11 +17,10 @@ import org.springframework.web.multipart.MultipartFile;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@RestController @RestController
@RequestMapping("/sysFile") @RequestMapping("/sysFile")
public class SysFileController { public class SysFileController {
private final Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired @Autowired
private SmartSysFileService sysFileService; private SmartSysFileService sysFileService;
......
...@@ -29,7 +29,7 @@ public class SmartSceneData { ...@@ -29,7 +29,7 @@ public class SmartSceneData {
/** /**
* 场景ID 关联smart_scene中id * 场景ID 关联smart_scene中id
*/ */
private Long templateId; private Long sceneId;
/** /**
* 类型 1触发条件 2执行内容 * 类型 1触发条件 2执行内容
...@@ -59,12 +59,12 @@ public class SmartSceneData { ...@@ -59,12 +59,12 @@ public class SmartSceneData {
this.id = id; this.id = id;
} }
public Long getTemplateId() { public Long getSceneId() {
return templateId; return sceneId;
} }
public void setTemplateId(Long templateId) { public void setSceneId(Long sceneId) {
this.templateId = templateId; this.sceneId = sceneId;
} }
public Byte getType() { public Byte getType() {
...@@ -101,17 +101,13 @@ public class SmartSceneData { ...@@ -101,17 +101,13 @@ public class SmartSceneData {
@Override @Override
public String toString() { public String toString() {
StringBuilder sb = new StringBuilder(); return "SmartSceneData{" +
sb.append(getClass().getSimpleName()); "id=" + id +
sb.append(" ["); ", sceneId=" + sceneId +
sb.append("Hash = ").append(hashCode()); ", type=" + type +
sb.append(", id=").append(id); ", sort=" + sort +
sb.append(", templateId=").append(templateId); ", paramKey='" + paramKey + '\'' +
sb.append(", type=").append(type); ", paramValue='" + paramValue + '\'' +
sb.append(", sort=").append(sort); '}';
sb.append(", paramKey=").append(paramKey);
sb.append(", paramValue=").append(paramValue);
sb.append("]");
return sb.toString();
} }
} }
...@@ -18,6 +18,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -18,6 +18,7 @@ import org.apache.ibatis.annotations.Param;
public interface SmartSysCodeMapper extends tk.mybatis.mapper.common.Mapper<SmartSysCode> { public interface SmartSysCodeMapper extends tk.mybatis.mapper.common.Mapper<SmartSysCode> {
List<SmartSysCode> getList(SmartSysCodeReq req); List<SmartSysCode> getList(SmartSysCodeReq req);
int insertOrUpdate(SmartSysCode record); int insertOrUpdate(SmartSysCode record);
int insertOrUpdateSelective(SmartSysCode record); int insertOrUpdateSelective(SmartSysCode record);
......
...@@ -13,11 +13,16 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; ...@@ -13,11 +13,16 @@ import org.springframework.web.bind.annotation.RestControllerAdvice;
* @date 2021-03-16 * @date 2021-03-16
*/ */
@RestControllerAdvice @RestControllerAdvice
public class BusinessExceptionHandler { public class GlobalExceptionHandler {
private final Logger logger = LoggerFactory.getLogger(this.getClass()); private final Logger logger = LoggerFactory.getLogger(this.getClass());
@ExceptionHandler(BusinessException.class) @ExceptionHandler(BusinessException.class)
public void handleBusinessException(BusinessException e) { public void handleBusinessException(BusinessException e) {
logger.error("!!!! ERROR", e); logger.error("!!!! 业务异常", e);
}
@ExceptionHandler(Exception.class)
public void handleException(Exception e) {
logger.error("!!!! 未知异常", e);
} }
} }
...@@ -28,6 +28,21 @@ public class SmartSysCodeReq extends BaseDTO { ...@@ -28,6 +28,21 @@ public class SmartSysCodeReq extends BaseDTO {
*/ */
private String parentKey; private String parentKey;
/**
* 排序
*/
private Byte sort;
/**
* 状态:0下线 1上线
*/
private Byte status;
/**
* 分级
*/
private Byte level;
public String getDictType() { public String getDictType() {
return dictType; return dictType;
} }
...@@ -60,6 +75,30 @@ public class SmartSysCodeReq extends BaseDTO { ...@@ -60,6 +75,30 @@ public class SmartSysCodeReq extends BaseDTO {
this.parentKey = parentKey; this.parentKey = parentKey;
} }
public Byte getSort() {
return sort;
}
public void setSort(Byte sort) {
this.sort = sort;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public Byte getLevel() {
return level;
}
public void setLevel(Byte level) {
this.level = level;
}
@Override @Override
public String toString() { public String toString() {
return "SmartSysCodeReq{" + return "SmartSysCodeReq{" +
...@@ -67,6 +106,9 @@ public class SmartSysCodeReq extends BaseDTO { ...@@ -67,6 +106,9 @@ public class SmartSysCodeReq extends BaseDTO {
", dictKey='" + dictKey + '\'' + ", dictKey='" + dictKey + '\'' +
", dictValue='" + dictValue + '\'' + ", dictValue='" + dictValue + '\'' +
", parentKey='" + parentKey + '\'' + ", parentKey='" + parentKey + '\'' +
", sort=" + sort +
", status=" + status +
", level=" + level +
"} " + super.toString(); "} " + super.toString();
} }
} }
...@@ -2,8 +2,6 @@ package com.glsx.smart.service; ...@@ -2,8 +2,6 @@ package com.glsx.smart.service;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.glsx.smart.pojo.BaseDTO; import com.glsx.smart.pojo.BaseDTO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/** /**
* <p>Description: 公共 Service 业务 * <p>Description: 公共 Service 业务
...@@ -13,8 +11,6 @@ import org.slf4j.LoggerFactory; ...@@ -13,8 +11,6 @@ import org.slf4j.LoggerFactory;
* @date 2021-03-15 * @date 2021-03-15
*/ */
public abstract class BaseService { public abstract class BaseService {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());
/** /**
* 按需开启分页,调用此方法后需紧跟查询 sql,否则分页将不生效 * 按需开启分页,调用此方法后需紧跟查询 sql,否则分页将不生效
* *
......
package com.glsx.smart.service;
import org.springframework.stereotype.Service;
/**
* @author deployer name
* @version V1.0
* @Title: DemoService.java
* @Description:
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Service
public class DemoService {
}
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.glsx.smart.dao.entity.SmartDevideStatus; import com.glsx.smart.dao.entity.SmartDevideStatus;
import com.glsx.smart.dao.mapper.SmartDevideStatusMapper; import com.glsx.smart.dao.mapper.SmartDevideStatusMapper;
import com.glsx.smart.service.SmartDevideStatusService; import com.glsx.smart.service.SmartDevideStatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -14,10 +15,9 @@ import org.springframework.stereotype.Service; ...@@ -14,10 +15,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartDevideStatusServiceImpl implements SmartDevideStatusService { public class SmartDevideStatusServiceImpl implements SmartDevideStatusService {
@Resource @Resource
private SmartDevideStatusMapper smartDevideStatusMapper; private SmartDevideStatusMapper smartDevideStatusMapper;
......
...@@ -10,6 +10,7 @@ import com.glsx.smart.exception.ResultEnum; ...@@ -10,6 +10,7 @@ import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartProductReq; import com.glsx.smart.pojo.SmartProductReq;
import com.glsx.smart.service.BaseService; import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartProductService; import com.glsx.smart.service.SmartProductService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -20,7 +21,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -20,7 +21,7 @@ import org.springframework.transaction.annotation.Transactional;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartProductServiceImpl extends BaseService implements SmartProductService { public class SmartProductServiceImpl extends BaseService implements SmartProductService {
@Resource @Resource
...@@ -61,10 +62,8 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -61,10 +62,8 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
@Transactional @Transactional
public void save(SmartProduct product) { public void save(SmartProduct product) {
if (product.getId() == null) { if (product.getId() == null) {
super.logger.info("$$$$ Starting inserting...");
productMapper.insertSelective(product); productMapper.insertSelective(product);
} else { } else {
super.logger.info("$$$$ Starting updating...");
SmartProduct record = productMapper.selectByPrimaryKey(product.getId()); SmartProduct record = productMapper.selectByPrimaryKey(product.getId());
if (record != null) { if (record != null) {
productMapper.updateByPrimaryKeySelective(product); productMapper.updateByPrimaryKeySelective(product);
...@@ -86,6 +85,11 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -86,6 +85,11 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
@Override @Override
public void putOnOff(Long id) { public void putOnOff(Long id) {
SmartProduct product = productMapper.selectByPrimaryKey(id);
if (product == null) {
throw new BusinessException(ResultEnum.PRODUCT_NOT_FOUND);
}
product.setStatus((byte) (product.getStatus() ^ 0b00000001));
productMapper.updateByPrimaryKeySelective(product);
} }
} }
...@@ -5,6 +5,7 @@ import java.util.List; ...@@ -5,6 +5,7 @@ import java.util.List;
import com.glsx.smart.dao.entity.SmartProductTypeParam; import com.glsx.smart.dao.entity.SmartProductTypeParam;
import com.glsx.smart.dao.mapper.SmartProductTypeParamMapper; import com.glsx.smart.dao.mapper.SmartProductTypeParamMapper;
import com.glsx.smart.service.SmartProductTypeParamService; import com.glsx.smart.service.SmartProductTypeParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -14,10 +15,9 @@ import org.springframework.stereotype.Service; ...@@ -14,10 +15,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartProductTypeParamServiceImpl implements SmartProductTypeParamService { public class SmartProductTypeParamServiceImpl implements SmartProductTypeParamService {
@Resource @Resource
private SmartProductTypeParamMapper smartProductTypeParamMapper; private SmartProductTypeParamMapper smartProductTypeParamMapper;
......
...@@ -8,6 +8,7 @@ import com.glsx.smart.dao.mapper.SmartProductTypeMapper; ...@@ -8,6 +8,7 @@ import com.glsx.smart.dao.mapper.SmartProductTypeMapper;
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.SmartProductTypeService; import com.glsx.smart.service.SmartProductTypeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -17,7 +18,7 @@ import org.springframework.stereotype.Service; ...@@ -17,7 +18,7 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartProductTypeServiceImpl implements SmartProductTypeService { public class SmartProductTypeServiceImpl implements SmartProductTypeService {
@Resource @Resource
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSceneDataMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSceneDataMapper;
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.SmartSceneDataService; import com.glsx.smart.service.SmartSceneDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartSceneDataServiceImpl implements SmartSceneDataService { public class SmartSceneDataServiceImpl implements SmartSceneDataService {
@Resource @Resource
private SmartSceneDataMapper smartSceneDataMapper; private SmartSceneDataMapper smartSceneDataMapper;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSceneMapper; ...@@ -7,6 +7,7 @@ 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.SmartSceneService; import com.glsx.smart.service.SmartSceneService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartSceneServiceImpl implements SmartSceneService { public class SmartSceneServiceImpl implements SmartSceneService {
@Resource @Resource
private SmartSceneMapper smartSceneMapper; private SmartSceneMapper smartSceneMapper;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSceneTemplateMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSceneTemplateMapper;
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.SmartSceneTemplateService; import com.glsx.smart.service.SmartSceneTemplateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService { public class SmartSceneTemplateServiceImpl implements SmartSceneTemplateService {
@Resource @Resource
private SmartSceneTemplateMapper smartSceneTemplateMapper; private SmartSceneTemplateMapper smartSceneTemplateMapper;
......
...@@ -10,6 +10,7 @@ import com.glsx.smart.exception.ResultEnum; ...@@ -10,6 +10,7 @@ import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartSysCodeReq; import com.glsx.smart.pojo.SmartSysCodeReq;
import com.glsx.smart.service.BaseService; import com.glsx.smart.service.BaseService;
import com.glsx.smart.service.SmartSysCodeService; import com.glsx.smart.service.SmartSysCodeService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -19,10 +20,9 @@ import org.springframework.stereotype.Service; ...@@ -19,10 +20,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCodeService { public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCodeService {
@Resource @Resource
private SmartSysCodeMapper sysCodeMapper; private SmartSysCodeMapper sysCodeMapper;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSysFileMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartSysFileMapper;
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.SmartSysFileService; import com.glsx.smart.service.SmartSysFileService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartSysFileServiceImpl implements SmartSysFileService { public class SmartSysFileServiceImpl implements SmartSysFileService {
@Resource @Resource
private SmartSysFileMapper smartSysFileMapper; private SmartSysFileMapper smartSysFileMapper;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartTemplateParamMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartTemplateParamMapper;
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.SmartTemplateParamService; import com.glsx.smart.service.SmartTemplateParamService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartTemplateParamServiceImpl implements SmartTemplateParamService { public class SmartTemplateParamServiceImpl implements SmartTemplateParamService {
@Resource @Resource
private SmartTemplateParamMapper smartTemplateParamMapper; private SmartTemplateParamMapper smartTemplateParamMapper;
......
...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartUserRelationMapper; ...@@ -7,6 +7,7 @@ import com.glsx.smart.dao.mapper.SmartUserRelationMapper;
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.SmartUserRelationService; import com.glsx.smart.service.SmartUserRelationService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
/** /**
...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service; ...@@ -16,10 +17,9 @@ import org.springframework.stereotype.Service;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Slf4j
@Service @Service
public class SmartUserRelationServiceImpl implements SmartUserRelationService { public class SmartUserRelationServiceImpl implements SmartUserRelationService {
@Resource @Resource
private SmartUserRelationMapper smartUserRelationMapper; private SmartUserRelationMapper smartUserRelationMapper;
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<!--@mbg.generated--> <!--@mbg.generated-->
<!--@Table smart_scene_data--> <!--@Table smart_scene_data-->
<id column="id" jdbcType="BIGINT" property="id"/> <id column="id" jdbcType="BIGINT" property="id"/>
<result column="template_id" jdbcType="BIGINT" property="templateId"/> <result column="scene_id" jdbcType="BIGINT" property="sceneId"/>
<result column="type" jdbcType="TINYINT" property="type"/> <result column="type" jdbcType="TINYINT" property="type"/>
<result column="sort" jdbcType="TINYINT" property="sort"/> <result column="sort" jdbcType="TINYINT" property="sort"/>
<result column="param_key" jdbcType="VARCHAR" property="paramKey"/> <result column="param_key" jdbcType="VARCHAR" property="paramKey"/>
...@@ -14,15 +14,15 @@ ...@@ -14,15 +14,15 @@
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
id, template_id, `type`, sort, param_key, param_value id, scene_id, `type`, sort, param_key, param_value
</sql> </sql>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update smart_scene_data update smart_scene_data
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="template_id = case" suffix="end,"> <trim prefix="scene_id = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
when id = #{item.id,jdbcType=BIGINT} then #{item.templateId,jdbcType=BIGINT} when id = #{item.id,jdbcType=BIGINT} then #{item.sceneId,jdbcType=BIGINT}
</foreach> </foreach>
</trim> </trim>
<trim prefix="`type` = case" suffix="end,"> <trim prefix="`type` = case" suffix="end,">
...@@ -55,10 +55,10 @@ ...@@ -55,10 +55,10 @@
<!--@mbg.generated--> <!--@mbg.generated-->
update smart_scene_data update smart_scene_data
<trim prefix="set" suffixOverrides=","> <trim prefix="set" suffixOverrides=",">
<trim prefix="template_id = case" suffix="end,"> <trim prefix="scene_id = case" suffix="end,">
<foreach collection="list" index="index" item="item"> <foreach collection="list" index="index" item="item">
<if test="item.templateId != null"> <if test="item.sceneId != null">
when id = #{item.id,jdbcType=BIGINT} then #{item.templateId,jdbcType=BIGINT} when id = #{item.id,jdbcType=BIGINT} then #{item.sceneId,jdbcType=BIGINT}
</if> </if>
</foreach> </foreach>
</trim> </trim>
...@@ -101,10 +101,10 @@ ...@@ -101,10 +101,10 @@
useGeneratedKeys="true"> useGeneratedKeys="true">
<!--@mbg.generated--> <!--@mbg.generated-->
insert into smart_scene_data insert into smart_scene_data
(template_id, `type`, sort, param_key, param_value) (scene_id, `type`, sort, param_key, param_value)
values values
<foreach collection="list" item="item" separator=","> <foreach collection="list" item="item" separator=",">
(#{item.templateId,jdbcType=BIGINT}, #{item.type,jdbcType=TINYINT}, (#{item.sceneId,jdbcType=BIGINT}, #{item.type,jdbcType=TINYINT},
#{item.sort,jdbcType=TINYINT}, #{item.sort,jdbcType=TINYINT},
#{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR}) #{item.paramKey,jdbcType=VARCHAR}, #{item.paramValue,jdbcType=VARCHAR})
</foreach> </foreach>
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
template_id, scene_id,
`type`, `type`,
sort, sort,
param_key, param_key,
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id,jdbcType=BIGINT},
</if> </if>
#{templateId,jdbcType=BIGINT}, #{sceneId,jdbcType=BIGINT},
#{type,jdbcType=TINYINT}, #{type,jdbcType=TINYINT},
#{sort,jdbcType=TINYINT}, #{sort,jdbcType=TINYINT},
#{paramKey,jdbcType=VARCHAR}, #{paramKey,jdbcType=VARCHAR},
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
<if test="id != null"> <if test="id != null">
id = #{id,jdbcType=BIGINT}, id = #{id,jdbcType=BIGINT},
</if> </if>
template_id = #{templateId,jdbcType=BIGINT}, scene_id = #{sceneId,jdbcType=BIGINT},
`type` = #{type,jdbcType=TINYINT}, `type` = #{type,jdbcType=TINYINT},
sort = #{sort,jdbcType=TINYINT}, sort = #{sort,jdbcType=TINYINT},
param_key = #{paramKey,jdbcType=VARCHAR}, param_key = #{paramKey,jdbcType=VARCHAR},
...@@ -154,8 +154,8 @@ ...@@ -154,8 +154,8 @@
<if test="id != null"> <if test="id != null">
id, id,
</if> </if>
<if test="templateId != null"> <if test="sceneId != null">
template_id, scene_id,
</if> </if>
<if test="type != null"> <if test="type != null">
`type`, `type`,
...@@ -175,8 +175,8 @@ ...@@ -175,8 +175,8 @@
<if test="id != null"> <if test="id != null">
#{id,jdbcType=BIGINT}, #{id,jdbcType=BIGINT},
</if> </if>
<if test="templateId != null"> <if test="sceneId != null">
#{templateId,jdbcType=BIGINT}, #{sceneId,jdbcType=BIGINT},
</if> </if>
<if test="type != null"> <if test="type != null">
#{type,jdbcType=TINYINT}, #{type,jdbcType=TINYINT},
...@@ -196,8 +196,8 @@ ...@@ -196,8 +196,8 @@
<if test="id != null"> <if test="id != null">
id = #{id,jdbcType=BIGINT}, id = #{id,jdbcType=BIGINT},
</if> </if>
<if test="templateId != null"> <if test="sceneId != null">
template_id = #{templateId,jdbcType=BIGINT}, scene_id = #{sceneId,jdbcType=BIGINT},
</if> </if>
<if test="type != null"> <if test="type != null">
`type` = #{type,jdbcType=TINYINT}, `type` = #{type,jdbcType=TINYINT},
......
...@@ -32,6 +32,13 @@ ...@@ -32,6 +32,13 @@
<if test="dictType != null and dictType != ''"> <if test="dictType != null and dictType != ''">
and ssc.dict_type = #{dictType,jdbcType=VARCHAR} and ssc.dict_type = #{dictType,jdbcType=VARCHAR}
</if> </if>
<if test="parentKey != null and parentKey != ''">
and ssc.parent_key = #{parentKey,jdbcType=VARCHAR}
</if>
<if test="level != null">
and ssc.level = #{level,jdbcType=TINYINT}
</if>
and ssc.status = 1
</where> </where>
order by ssc.create_time desc, ssc.sort asc order by ssc.create_time desc, ssc.sort asc
</select> </select>
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!