Commit b41ca105 by tyfanchz

车家智能功能开发

1 parent 62c502ac
Showing 33 changed files with 374 additions and 1290 deletions
...@@ -6,17 +6,17 @@ import com.glsx.plat.common.utils.StringUtils; ...@@ -6,17 +6,17 @@ 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.BusinessException;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
import com.glsx.smart.pojo.SmartProductReq;
import com.glsx.smart.service.SmartProductService; import com.glsx.smart.service.SmartProductService;
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.validation.annotation.Validated;
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;
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;
/** /**
* <p>Description: * <p>Description: 产品列表业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
* *
* @author wbh * @author wbh
...@@ -29,41 +29,76 @@ public class ProductController { ...@@ -29,41 +29,76 @@ public class ProductController {
@Autowired @Autowired
private SmartProductService productService; private SmartProductService productService;
/**
* 获取产品列表。
*
* @param req 请求体
* @return 结果
*/
@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(SmartProduct req) {
log.info("/product/getList param: {}", JSON.toJSONString(req)); log.info("$$$$ /product/getList param: {}", JSON.toJSONString(req));
return productService.getList(req); return productService.getList(req);
} }
/**
* 根据 id 查询产品详情。
*
* @param id 产品 id
* @return 结果
*/
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
public SmartProduct getById(Long id) { public SmartProduct getById(Long id) {
return productService.getById(id); return productService.getById(id);
} }
/**
* 保存产品。无则插入,有则更新。
*
* @param product 产品
*/
@RequestMapping(value = "/save", method = {RequestMethod.POST}) @RequestMapping(value = "/save", method = {RequestMethod.POST})
public void save(@RequestBody SmartProduct product) { public void save(@RequestBody @Validated SmartProduct product) {
log.info("$$$$ /product/save param: {}", JSON.toJSONString(product)); log.info("$$$$ /product/save param: {}", JSON.toJSONString(product));
productService.save(product); productService.save(product);
} }
/**
* 根据产品 id 获取指令集。
*
* @param id 产品 id
*/
@RequestMapping(value = "/getCommandSetById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getCommandSetById", method = {RequestMethod.GET, RequestMethod.POST})
public void getCommandSetById(Long id) { public void getCommandSetById(Long id) {
log.info("$$$$ /product/getCommandSetById param: {}", id);
if (id == null) { if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR); throw new BusinessException(ResultEnum.PARAM_ERROR);
} }
productService.getCommandSetById(id); productService.getCommandSetById(id);
} }
/**
* 校验商城商品 id。
*
* @param shopProductId 商品 id
*/
@RequestMapping(value = "/checkShopProductId", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/checkShopProductId", method = {RequestMethod.GET, RequestMethod.POST})
public void checkShopProductId(String shopProductId) { public boolean checkShopProductId(String shopProductId) {
log.info("$$$$ /product/checkShopProductId param: {}", shopProductId);
if (StringUtils.isBlank(shopProductId)) { if (StringUtils.isBlank(shopProductId)) {
throw new BusinessException(ResultEnum.PARAM_ERROR); throw new BusinessException(ResultEnum.PARAM_ERROR);
} }
productService.checkShopProductId(shopProductId); return productService.checkShopProductId(shopProductId);
} }
/**
* 上下架产品。
*
* @param id 产品 id
*/
@RequestMapping(value = "/putOnOff", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/putOnOff", method = {RequestMethod.GET, RequestMethod.POST})
public void putOnOff(Long id) { public void putOnOff(Long id) {
log.info("$$$$ /product/putOnOff param: {}", id);
if (id == null) { if (id == null) {
throw new BusinessException(ResultEnum.PARAM_ERROR); throw new BusinessException(ResultEnum.PARAM_ERROR);
} }
......
package com.glsx.smart.controller; package com.glsx.smart.controller;
import java.util.List; import java.util.List;
import com.alibaba.fastjson.JSON;
import com.github.pagehelper.PageInfo;
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 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.validation.annotation.Validated;
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;
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;
/** /**
* <p>Description: * <p>Description: 产品类型业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
* *
* @author wbh * @author wbh
...@@ -24,9 +27,16 @@ public class ProductTypeController { ...@@ -24,9 +27,16 @@ public class ProductTypeController {
@Autowired @Autowired
private SmartProductTypeService productTypeService; private SmartProductTypeService productTypeService;
/**
* 获取产品类型列表。
*
* @param req 请求
* @return 结果
*/
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartProductType> getList(SmartProductType productType) { public PageInfo<SmartProductType> getList(SmartProductType req) {
return productTypeService.getList(productType); log.info("$$$$ /productType/getList param: {}", JSON.toJSONString(req));
return productTypeService.getList(req);
} }
@RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST}) @RequestMapping(value = "/getById", method = {RequestMethod.GET, RequestMethod.POST})
...@@ -34,8 +44,25 @@ public class ProductTypeController { ...@@ -34,8 +44,25 @@ public class ProductTypeController {
return productTypeService.getById(id); return productTypeService.getById(id);
} }
/**
* 保存产品类型。
*
* @param productType 产品类型
*/
@RequestMapping(value = "/save", method = {RequestMethod.POST}) @RequestMapping(value = "/save", method = {RequestMethod.POST})
public void save(@RequestBody SmartProductType productType) { public void save(@RequestBody @Validated SmartProductType productType) {
log.info("$$$$ /productType/save param: {}", JSON.toJSONString(productType));
productTypeService.save(productType); productTypeService.save(productType);
} }
/**
* 获取商城标签
*
* @return 结果
*/
@RequestMapping(value = "/getShopTagList", method = {RequestMethod.GET, RequestMethod.POST})
public List<String> getShopTagList() {
log.info("$$$$ /productType/getShopTagList ...");
return productTypeService.getShopTagList();
}
} }
...@@ -3,7 +3,6 @@ package com.glsx.smart.controller; ...@@ -3,7 +3,6 @@ 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.smart.dao.entity.SmartSysCode; import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq;
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;
...@@ -26,7 +25,7 @@ public class SysCodeController { ...@@ -26,7 +25,7 @@ public class SysCodeController {
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(SmartSysCode req) {
log.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req)); log.info("$$$$ /sysCode/getList param: {}", JSON.toJSONString(req));
return sysCodeService.getList(req); return sysCodeService.getList(req);
} }
......
...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -13,6 +14,7 @@ import java.util.Date; ...@@ -13,6 +14,7 @@ import java.util.Date;
* @author wbh * @author wbh
* @date 2021-03-15 * @date 2021-03-15
*/ */
@Data
@Table(name = "smart_devide_status") @Table(name = "smart_devide_status")
public class SmartDevideStatus { public class SmartDevideStatus {
@Id @Id
...@@ -53,86 +55,4 @@ public class SmartDevideStatus { ...@@ -53,86 +55,4 @@ public class SmartDevideStatus {
* 产品id * 产品id
*/ */
private String productKey; private String productKey;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getUid() {
return uid;
}
public void setUid(String uid) {
this.uid = uid;
}
public String getDeviceOrderCode() {
return deviceOrderCode;
}
public void setDeviceOrderCode(String deviceOrderCode) {
this.deviceOrderCode = deviceOrderCode;
}
public String getDeviceOrderValue() {
return deviceOrderValue;
}
public void setDeviceOrderValue(String deviceOrderValue) {
this.deviceOrderValue = deviceOrderValue;
}
public Date getCreatetime() {
return createtime;
}
public void setCreatetime(Date createtime) {
this.createtime = createtime;
}
public Date getUpdatetime() {
return updatetime;
}
public void setUpdatetime(Date updatetime) {
this.updatetime = updatetime;
}
public String getProductKey() {
return productKey;
}
public void setProductKey(String productKey) {
this.productKey = productKey;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", deviceId=").append(deviceId);
sb.append(", uid=").append(uid);
sb.append(", deviceOrderCode=").append(deviceOrderCode);
sb.append(", deviceOrderValue=").append(deviceOrderValue);
sb.append(", createtime=").append(createtime);
sb.append(", updatetime=").append(updatetime);
sb.append(", productKey=").append(productKey);
sb.append("]");
return sb.toString();
}
} }
...@@ -5,7 +5,10 @@ import javax.persistence.GenerationType; ...@@ -5,7 +5,10 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import javax.persistence.Transient; import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date; import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -19,8 +22,15 @@ import java.util.Date; ...@@ -19,8 +22,15 @@ import java.util.Date;
/** /**
* 车家智能产品数据表 * 车家智能产品数据表
*/ */
@Data
@Table(name = "smart_product") @Table(name = "smart_product")
public class SmartProduct { public class SmartProduct extends BaseDTO {
/**
* 图标 url
*/
@Transient
private String iconUrl;
/** /**
* 产品类型名称 * 产品类型名称
*/ */
...@@ -50,6 +60,7 @@ public class SmartProduct { ...@@ -50,6 +60,7 @@ public class SmartProduct {
/** /**
* 产品名称 * 产品名称
*/ */
@NotBlank
private String productName; private String productName;
/** /**
...@@ -111,163 +122,4 @@ public class SmartProduct { ...@@ -111,163 +122,4 @@ public class SmartProduct {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getPlatformName() {
return platformName;
}
public void setPlatformName(String platformName) {
this.platformName = platformName;
}
public String getNetworkName() {
return networkName;
}
public void setNetworkName(String networkName) {
this.networkName = networkName;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
public Long getIcon() {
return icon;
}
public void setIcon(Long icon) {
this.icon = icon;
}
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public String getShopProductId() {
return shopProductId;
}
public void setShopProductId(String shopProductId) {
this.shopProductId = shopProductId;
}
public String getPlatformKey() {
return platformKey;
}
public void setPlatformKey(String platformKey) {
this.platformKey = platformKey;
}
public String getPlatformProductId() {
return platformProductId;
}
public void setPlatformProductId(String platformProductId) {
this.platformProductId = platformProductId;
}
public String getNetworkKey() {
return networkKey;
}
public void setNetworkKey(String networkKey) {
this.networkKey = networkKey;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateBy() {
return createBy;
}
public void setCreateBy(Long createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Long updateBy) {
this.updateBy = updateBy;
}
@Override
public String toString() {
return "SmartProduct{" +
"typeName='" + typeName + '\'' +
", platformName='" + platformName + '\'' +
", networkName='" + networkName + '\'' +
", id=" + id +
", productName='" + productName + '\'' +
", icon=" + icon +
", typeId=" + typeId +
", shopProductId='" + shopProductId + '\'' +
", platformKey='" + platformKey + '\'' +
", platformProductId='" + platformProductId + '\'' +
", networkKey='" + networkKey + '\'' +
", status=" + status +
", remark='" + remark + '\'' +
", createTime=" + createTime +
", createBy=" + createBy +
", updateTime=" + updateTime +
", updateBy=" + updateBy +
"} " + super.toString();
}
} }
...@@ -4,7 +4,11 @@ import javax.persistence.GeneratedValue; ...@@ -4,7 +4,11 @@ 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 javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import java.util.Date; import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,8 +22,22 @@ import java.util.Date; ...@@ -18,8 +22,22 @@ import java.util.Date;
/** /**
* 车家智能产品类型表 * 车家智能产品类型表
*/ */
@Data
@Table(name = "smart_product_type") @Table(name = "smart_product_type")
public class SmartProductType { public class SmartProductType extends BaseDTO {
/**
* 一级分类名
*/
@Transient
private String categoryName1;
/**
* 二级分类名
*/
@Transient
private String categoryName2;
/** /**
* 标识ID * 标识ID
*/ */
...@@ -30,6 +48,7 @@ public class SmartProductType { ...@@ -30,6 +48,7 @@ public class SmartProductType {
/** /**
* 类型名称 * 类型名称
*/ */
@NotBlank
private String typeName; private String typeName;
/** /**
...@@ -66,95 +85,4 @@ public class SmartProductType { ...@@ -66,95 +85,4 @@ public class SmartProductType {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getTypeName() {
return typeName;
}
public void setTypeName(String typeName) {
this.typeName = typeName;
}
public String getCategoryKey() {
return categoryKey;
}
public void setCategoryKey(String categoryKey) {
this.categoryKey = categoryKey;
}
public String getShopTag() {
return shopTag;
}
public void setShopTag(String shopTag) {
this.shopTag = shopTag;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateBy() {
return createBy;
}
public void setCreateBy(Long createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Long updateBy) {
this.updateBy = updateBy;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", typeName=").append(typeName);
sb.append(", categoryKey=").append(categoryKey);
sb.append(", shopTag=").append(shopTag);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", createBy=").append(createBy);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateBy=").append(updateBy);
sb.append("]");
return sb.toString();
}
} }
...@@ -13,10 +13,12 @@ import javax.persistence.GeneratedValue; ...@@ -13,10 +13,12 @@ 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 lombok.Data;
/** /**
* 车家智能产品类型参数表 * 车家智能产品类型参数表
*/ */
@Data
@Table(name = "smart_product_type_param") @Table(name = "smart_product_type_param")
public class SmartProductTypeParam { public class SmartProductTypeParam {
/** /**
...@@ -50,68 +52,4 @@ public class SmartProductTypeParam { ...@@ -50,68 +52,4 @@ public class SmartProductTypeParam {
* 指令集取值类型 * 指令集取值类型
*/ */
private String devideOrderValuetype; private String devideOrderValuetype;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTypeId() {
return typeId;
}
public void setTypeId(Long typeId) {
this.typeId = typeId;
}
public String getDevideOrderCode() {
return devideOrderCode;
}
public void setDevideOrderCode(String devideOrderCode) {
this.devideOrderCode = devideOrderCode;
}
public String getDevideOrderName() {
return devideOrderName;
}
public void setDevideOrderName(String devideOrderName) {
this.devideOrderName = devideOrderName;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public String getDevideOrderValuetype() {
return devideOrderValuetype;
}
public void setDevideOrderValuetype(String devideOrderValuetype) {
this.devideOrderValuetype = devideOrderValuetype;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", typeId=").append(typeId);
sb.append(", devideOrderCode=").append(devideOrderCode);
sb.append(", devideOrderName=").append(devideOrderName);
sb.append(", status=").append(status);
sb.append(", devideOrderValuetype=").append(devideOrderValuetype);
sb.append("]");
return sb.toString();
}
} }
...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
/** /**
* 车家智能用户场景表 * 车家智能用户场景表
*/ */
@Data
@Table(name = "smart_scene") @Table(name = "smart_scene")
public class SmartScene { public class SmartScene {
/** /**
...@@ -91,140 +93,4 @@ public class SmartScene { ...@@ -91,140 +93,4 @@ public class SmartScene {
* 更新时间 * 更新时间
*/ */
private Date updateTime; private Date updateTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getUserId() {
return userId;
}
public void setUserId(Long userId) {
this.userId = userId;
}
public String getScenesName() {
return scenesName;
}
public void setScenesName(String scenesName) {
this.scenesName = scenesName;
}
public String getTypeKey() {
return typeKey;
}
public void setTypeKey(String typeKey) {
this.typeKey = typeKey;
}
public Long getIcon() {
return icon;
}
public void setIcon(Long icon) {
this.icon = icon;
}
public Long getBackPic() {
return backPic;
}
public void setBackPic(Long backPic) {
this.backPic = backPic;
}
public Long getViewTimes() {
return viewTimes;
}
public void setViewTimes(Long viewTimes) {
this.viewTimes = viewTimes;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Byte getConditionRule() {
return conditionRule;
}
public void setConditionRule(Byte conditionRule) {
this.conditionRule = conditionRule;
}
public Byte getExecuteCycle() {
return executeCycle;
}
public void setExecuteCycle(Byte executeCycle) {
this.executeCycle = executeCycle;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", userId=").append(userId);
sb.append(", scenesName=").append(scenesName);
sb.append(", typeKey=").append(typeKey);
sb.append(", icon=").append(icon);
sb.append(", backPic=").append(backPic);
sb.append(", viewTimes=").append(viewTimes);
sb.append(", description=").append(description);
sb.append(", conditionRule=").append(conditionRule);
sb.append(", executeCycle=").append(executeCycle);
sb.append(", status=").append(status);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", updateTime=").append(updateTime);
sb.append("]");
return sb.toString();
}
} }
...@@ -13,10 +13,12 @@ import javax.persistence.GeneratedValue; ...@@ -13,10 +13,12 @@ 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 lombok.Data;
/** /**
* 车家智能用户场景数据表 * 车家智能用户场景数据表
*/ */
@Data
@Table(name = "smart_scene_data") @Table(name = "smart_scene_data")
public class SmartSceneData { public class SmartSceneData {
/** /**
...@@ -50,64 +52,4 @@ public class SmartSceneData { ...@@ -50,64 +52,4 @@ public class SmartSceneData {
* 参数值 数组对象 * 参数值 数组对象
*/ */
private String paramValue; private String paramValue;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getSceneId() {
return sceneId;
}
public void setSceneId(Long sceneId) {
this.sceneId = sceneId;
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public Byte getSort() {
return sort;
}
public void setSort(Byte sort) {
this.sort = sort;
}
public String getParamKey() {
return paramKey;
}
public void setParamKey(String paramKey) {
this.paramKey = paramKey;
}
public String getParamValue() {
return paramValue;
}
public void setParamValue(String paramValue) {
this.paramValue = paramValue;
}
@Override
public String toString() {
return "SmartSceneData{" +
"id=" + id +
", sceneId=" + sceneId +
", type=" + type +
", sort=" + sort +
", paramKey='" + paramKey + '\'' +
", paramValue='" + paramValue + '\'' +
'}';
}
} }
...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
/** /**
* 车家智能场景模板表 * 车家智能场景模板表
*/ */
@Data
@Table(name = "smart_scene_template") @Table(name = "smart_scene_template")
public class SmartSceneTemplate { public class SmartSceneTemplate {
/** /**
...@@ -96,149 +98,4 @@ public class SmartSceneTemplate { ...@@ -96,149 +98,4 @@ public class SmartSceneTemplate {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getSceneName() {
return sceneName;
}
public void setSceneName(String sceneName) {
this.sceneName = sceneName;
}
public String getTypeKey() {
return typeKey;
}
public void setTypeKey(String typeKey) {
this.typeKey = typeKey;
}
public Long getIcon() {
return icon;
}
public void setIcon(Long icon) {
this.icon = icon;
}
public Long getBackPic() {
return backPic;
}
public void setBackPic(Long backPic) {
this.backPic = backPic;
}
public Long getViewTimes() {
return viewTimes;
}
public void setViewTimes(Long viewTimes) {
this.viewTimes = viewTimes;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
public Byte getConditionRule() {
return conditionRule;
}
public void setConditionRule(Byte conditionRule) {
this.conditionRule = conditionRule;
}
public Byte getExecuteCycle() {
return executeCycle;
}
public void setExecuteCycle(Byte executeCycle) {
this.executeCycle = executeCycle;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateBy() {
return createBy;
}
public void setCreateBy(Long createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Long updateBy) {
this.updateBy = updateBy;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", scenesName=").append(sceneName);
sb.append(", typeKey=").append(typeKey);
sb.append(", icon=").append(icon);
sb.append(", backPic=").append(backPic);
sb.append(", viewTimes=").append(viewTimes);
sb.append(", description=").append(description);
sb.append(", conditionRule=").append(conditionRule);
sb.append(", executeCycle=").append(executeCycle);
sb.append(", status=").append(status);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", createBy=").append(createBy);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateBy=").append(updateBy);
sb.append("]");
return sb.toString();
}
} }
...@@ -5,6 +5,8 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,8 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,8 +20,9 @@ import java.util.Date; ...@@ -18,8 +20,9 @@ import java.util.Date;
/** /**
* 车家智能系统代码集表 * 车家智能系统代码集表
*/ */
@Data
@Table(name = "smart_sys_code") @Table(name = "smart_sys_code")
public class SmartSysCode { public class SmartSysCode extends BaseDTO {
/** /**
* 标识ID * 标识ID
*/ */
...@@ -86,131 +89,4 @@ public class SmartSysCode { ...@@ -86,131 +89,4 @@ public class SmartSysCode {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictKey() {
return dictKey;
}
public void setDictKey(String dictKey) {
this.dictKey = dictKey;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getParentKey() {
return parentKey;
}
public void setParentKey(String 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;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public Long getCreateBy() {
return createBy;
}
public void setCreateBy(Long createBy) {
this.createBy = createBy;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public Long getUpdateBy() {
return updateBy;
}
public void setUpdateBy(Long updateBy) {
this.updateBy = updateBy;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", dictType=").append(dictType);
sb.append(", dictKey=").append(dictKey);
sb.append(", dictValue=").append(dictValue);
sb.append(", parentKey=").append(parentKey);
sb.append(", sort=").append(sort);
sb.append(", status=").append(status);
sb.append(", level=").append(level);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append(", createBy=").append(createBy);
sb.append(", updateTime=").append(updateTime);
sb.append(", updateBy=").append(updateBy);
sb.append("]");
return sb.toString();
}
} }
...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
/** /**
* 车家智能系统文件表 * 车家智能系统文件表
*/ */
@Data
@Table(name = "smart_sys_file") @Table(name = "smart_sys_file")
public class SmartSysFile { public class SmartSysFile {
/** /**
...@@ -46,59 +48,4 @@ public class SmartSysFile { ...@@ -46,59 +48,4 @@ public class SmartSysFile {
* 创建时间 * 创建时间
*/ */
private Date createTime; private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", url=").append(url);
sb.append(", type=").append(type);
sb.append(", createTime=").append(createTime);
sb.append("]");
return sb.toString();
}
} }
...@@ -13,10 +13,12 @@ import javax.persistence.GeneratedValue; ...@@ -13,10 +13,12 @@ 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 lombok.Data;
/** /**
* 车家智能场景模板参数表 * 车家智能场景模板参数表
*/ */
@Data
@Table(name = "smart_template_param") @Table(name = "smart_template_param")
public class SmartTemplateParam { public class SmartTemplateParam {
/** /**
...@@ -50,68 +52,4 @@ public class SmartTemplateParam { ...@@ -50,68 +52,4 @@ public class SmartTemplateParam {
* 模板值 数组对象 * 模板值 数组对象
*/ */
private String paramValue; private String paramValue;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public Long getTemplateId() {
return templateId;
}
public void setTemplateId(Long templateId) {
this.templateId = templateId;
}
public Byte getType() {
return type;
}
public void setType(Byte type) {
this.type = type;
}
public Byte getSort() {
return sort;
}
public void setSort(Byte sort) {
this.sort = sort;
}
public String getParamKey() {
return paramKey;
}
public void setParamKey(String paramKey) {
this.paramKey = paramKey;
}
public String getParamValue() {
return paramValue;
}
public void setParamValue(String paramValue) {
this.paramValue = paramValue;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", templateId=").append(templateId);
sb.append(", type=").append(type);
sb.append(", sort=").append(sort);
sb.append(", paramKey=").append(paramKey);
sb.append(", paramValue=").append(paramValue);
sb.append("]");
return sb.toString();
}
} }
package com.glsx.smart.dao.entity;
import java.util.Date;
import lombok.Data;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
/**
* 车家智能用户设备数据表
*/
@Data
public class SmartUserDeviceData {
/**
* 标识ID
*/
private Long id;
/**
* 用户ID 关联smart_user_relation中id
*/
private Long userId;
/**
* 设备ID
*/
private String deviceId;
/**
* 查看次数
*/
private Long viewTimes;
/**
* 创建时间
*/
private Date createTime;
/**
* 更新时间
*/
private Date updateTime;
}
...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType; ...@@ -5,6 +5,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -18,6 +19,7 @@ import java.util.Date; ...@@ -18,6 +19,7 @@ import java.util.Date;
/** /**
* 车家智能用户平台注册信息表 * 车家智能用户平台注册信息表
*/ */
@Data
@Table(name = "smart_user_relation") @Table(name = "smart_user_relation")
public class SmartUserRelation { public class SmartUserRelation {
/** /**
...@@ -66,95 +68,4 @@ public class SmartUserRelation { ...@@ -66,95 +68,4 @@ public class SmartUserRelation {
* 创建时间 * 创建时间
*/ */
private Date createTime; private Date createTime;
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPhone() {
return phone;
}
public void setPhone(String phone) {
this.phone = phone;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public Byte getChannel() {
return channel;
}
public void setChannel(Byte channel) {
this.channel = channel;
}
public String getThirdId() {
return thirdId;
}
public void setThirdId(String thirdId) {
this.thirdId = thirdId;
}
public Byte getStatus() {
return status;
}
public void setStatus(Byte status) {
this.status = status;
}
public String getRemark() {
return remark;
}
public void setRemark(String remark) {
this.remark = remark;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(getClass().getSimpleName());
sb.append(" [");
sb.append("Hash = ").append(hashCode());
sb.append(", id=").append(id);
sb.append(", name=").append(name);
sb.append(", phone=").append(phone);
sb.append(", password=").append(password);
sb.append(", channel=").append(channel);
sb.append(", thirdId=").append(thirdId);
sb.append(", status=").append(status);
sb.append(", remark=").append(remark);
sb.append(", createTime=").append(createTime);
sb.append("]");
return sb.toString();
}
} }
...@@ -2,7 +2,6 @@ package com.glsx.smart.dao.mapper; ...@@ -2,7 +2,6 @@ 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 com.glsx.smart.pojo.SmartProductReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -16,7 +15,9 @@ import org.apache.ibatis.annotations.Param; ...@@ -16,7 +15,9 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<SmartProduct> { public interface SmartProductMapper extends tk.mybatis.mapper.common.Mapper<SmartProduct> {
List<SmartProduct> getList(SmartProductReq req); List<SmartProduct> getList(SmartProduct req);
int countByProductName(String productName);
int insertOrUpdate(SmartProduct record); int insertOrUpdate(SmartProduct record);
......
...@@ -15,6 +15,9 @@ import org.apache.ibatis.annotations.Param; ...@@ -15,6 +15,9 @@ import org.apache.ibatis.annotations.Param;
@Mapper @Mapper
public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper<SmartProductType> { public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper<SmartProductType> {
List<SmartProductType> getList(SmartProductType req);
int insertOrUpdate(SmartProductType record); int insertOrUpdate(SmartProductType record);
int insertOrUpdateSelective(SmartProductType record); int insertOrUpdateSelective(SmartProductType record);
......
...@@ -2,7 +2,6 @@ package com.glsx.smart.dao.mapper; ...@@ -2,7 +2,6 @@ package com.glsx.smart.dao.mapper;
import java.util.List; import java.util.List;
import com.glsx.smart.dao.entity.SmartSysCode; import com.glsx.smart.dao.entity.SmartSysCode;
import com.glsx.smart.pojo.SmartSysCodeReq;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
...@@ -16,7 +15,7 @@ import org.apache.ibatis.annotations.Param; ...@@ -16,7 +15,7 @@ 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(SmartSysCodeReq req); List<SmartSysCode> getList(SmartSysCode req);
int insertOrUpdate(SmartSysCode record); int insertOrUpdate(SmartSysCode record);
......
package com.glsx.smart.pojo; package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartUserDeviceData;
import org.apache.ibatis.annotations.Mapper;
/** /**
* <p>Description: * <p>Description:
...@@ -7,6 +10,8 @@ package com.glsx.smart.pojo; ...@@ -7,6 +10,8 @@ package com.glsx.smart.pojo;
* @author wbh * @author wbh
* @date 2021-03-16 * @date 2021-03-16
*/ */
public class SmartProductReq extends BaseDTO {
@Mapper
public interface SmartUserDeviceDataMapper
extends tk.mybatis.mapper.common.Mapper<SmartUserDeviceData> {
} }
...@@ -14,6 +14,9 @@ public enum ResultEnum { ...@@ -14,6 +14,9 @@ public enum ResultEnum {
PARAM_ERROR(1001, "参数错误"), PARAM_ERROR(1001, "参数错误"),
ID_NOT_FOUND(1002, "ID不存在"), ID_NOT_FOUND(1002, "ID不存在"),
PRODUCT_NOT_FOUND(2001, "产品ID未找到"), PRODUCT_NOT_FOUND(2001, "产品ID未找到"),
PRODUCT_NAME_DUPLICATE(2002, "产品名称重复"),
PRODUCT_TYPE_NOT_FOUND(3001, "产品类型ID未找到"),
; ;
private final Integer code; private final Integer code;
......
package com.glsx.smart.pojo; package com.glsx.smart.pojo;
import javax.persistence.Transient; import javax.persistence.Transient;
import lombok.Data;
/** /**
* @author think.wang * @author think.wang
...@@ -10,6 +11,7 @@ import javax.persistence.Transient; ...@@ -10,6 +11,7 @@ import javax.persistence.Transient;
* @Description 公共参数vo * @Description 公共参数vo
* @date 2020/9/4 * @date 2020/9/4
*/ */
@Data
public class BaseDTO { public class BaseDTO {
/** /**
* 第几页 * 第几页
...@@ -52,61 +54,4 @@ public class BaseDTO { ...@@ -52,61 +54,4 @@ public class BaseDTO {
*/ */
@Transient @Transient
private Long uid; private Long uid;
public int getPageIndex() {
return pageIndex;
}
public void setPageIndex(int pageIndex) {
this.pageIndex = pageIndex;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public String getSearchKey() {
return searchKey;
}
public void setSearchKey(String searchKey) {
this.searchKey = searchKey;
}
public Long getUid() {
return uid;
}
public void setUid(Long uid) {
this.uid = uid;
}
public String getOrderBy() {
return orderBy;
}
public void setOrderBy(String orderBy) {
this.orderBy = orderBy;
}
public String getStartTime() {
return startTime;
}
public void setStartTime(String startTime) {
this.startTime = startTime;
}
public String getEndTime() {
return endTime;
}
public void setEndTime(String endTime) {
this.endTime = endTime;
}
} }
package com.glsx.smart.pojo;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public class SmartSysCodeReq extends BaseDTO {
/**
* 字典类型
*/
private String dictType;
/**
* 字典键值
*/
private String dictKey;
/**
* 字典值
*/
private String dictValue;
/**
* 父级键值
*/
private String parentKey;
/**
* 排序
*/
private Byte sort;
/**
* 状态:0下线 1上线
*/
private Byte status;
/**
* 分级
*/
private Byte level;
public String getDictType() {
return dictType;
}
public void setDictType(String dictType) {
this.dictType = dictType;
}
public String getDictKey() {
return dictKey;
}
public void setDictKey(String dictKey) {
this.dictKey = dictKey;
}
public String getDictValue() {
return dictValue;
}
public void setDictValue(String dictValue) {
this.dictValue = dictValue;
}
public String getParentKey() {
return parentKey;
}
public void setParentKey(String 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
public String toString() {
return "SmartSysCodeReq{" +
"dictType='" + dictType + '\'' +
", dictKey='" + dictKey + '\'' +
", dictValue='" + dictValue + '\'' +
", parentKey='" + parentKey + '\'' +
", sort=" + sort +
", status=" + status +
", level=" + level +
"} " + super.toString();
}
}
...@@ -2,7 +2,6 @@ package com.glsx.smart.service; ...@@ -2,7 +2,6 @@ package com.glsx.smart.service;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.pojo.SmartProductReq;
/** /**
* <p>Description: * <p>Description:
...@@ -13,7 +12,7 @@ import com.glsx.smart.pojo.SmartProductReq; ...@@ -13,7 +12,7 @@ import com.glsx.smart.pojo.SmartProductReq;
*/ */
public interface SmartProductService { public interface SmartProductService {
PageInfo<SmartProduct> getList(SmartProductReq req); PageInfo<SmartProduct> getList(SmartProduct req);
SmartProduct getById(Long id); SmartProduct getById(Long id);
...@@ -21,7 +20,7 @@ public interface SmartProductService { ...@@ -21,7 +20,7 @@ public interface SmartProductService {
void getCommandSetById(Long id); void getCommandSetById(Long id);
void checkShopProductId(String shopProductId); boolean checkShopProductId(String shopProductId);
void putOnOff(Long id); void putOnOff(Long id);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List; import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
/** /**
...@@ -12,7 +13,7 @@ import com.glsx.smart.dao.entity.SmartProductType; ...@@ -12,7 +13,7 @@ import com.glsx.smart.dao.entity.SmartProductType;
*/ */
public interface SmartProductTypeService { public interface SmartProductTypeService {
List<SmartProductType> getList(SmartProductType productType); PageInfo<SmartProductType> getList(SmartProductType req);
SmartProductType getById(Long id); SmartProductType getById(Long id);
......
...@@ -3,7 +3,6 @@ package com.glsx.smart.service; ...@@ -3,7 +3,6 @@ package com.glsx.smart.service;
import java.util.List; import java.util.List;
import com.github.pagehelper.PageInfo; 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;
/** /**
* <p>Description: * <p>Description:
...@@ -14,7 +13,7 @@ import com.glsx.smart.pojo.SmartSysCodeReq; ...@@ -14,7 +13,7 @@ import com.glsx.smart.pojo.SmartSysCodeReq;
*/ */
public interface SmartSysCodeService { public interface SmartSysCodeService {
PageInfo<SmartSysCode> getList(SmartSysCodeReq req); PageInfo<SmartSysCode> getList(SmartSysCode req);
int deleteByPrimaryKey(Long id); int deleteByPrimaryKey(Long id);
......
package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartUserDeviceData;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
public interface SmartUserDeviceDataService{
int deleteByPrimaryKey(Long id);
int insertSelective(SmartUserDeviceData record);
SmartUserDeviceData selectByPrimaryKey(Long id);
int updateByPrimaryKeySelective(SmartUserDeviceData record);
}
package com.glsx.smart.service.impl; package com.glsx.smart.service.impl;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Date;
import java.util.List; import java.util.List;
import cn.hutool.core.util.RandomUtil;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProduct; import com.glsx.smart.dao.entity.SmartProduct;
import com.glsx.smart.dao.mapper.SmartProductMapper; import com.glsx.smart.dao.mapper.SmartProductMapper;
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.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 lombok.extern.slf4j.Slf4j;
...@@ -15,7 +16,7 @@ import org.springframework.stereotype.Service; ...@@ -15,7 +16,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
/** /**
* <p>Description: * <p>Description: 产品列表业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
* *
* @author wbh * @author wbh
...@@ -34,7 +35,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -34,7 +35,7 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
* @return 结果 * @return 结果
*/ */
@Override @Override
public PageInfo<SmartProduct> getList(SmartProductReq req) { public PageInfo<SmartProduct> getList(SmartProduct req) {
super.startPagination(req); super.startPagination(req);
List<SmartProduct> productList = productMapper.getList(req); List<SmartProduct> productList = productMapper.getList(req);
PageInfo<SmartProduct> pageInfo = PageInfo.of(productList); PageInfo<SmartProduct> pageInfo = PageInfo.of(productList);
...@@ -61,7 +62,16 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -61,7 +62,16 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
@Override @Override
@Transactional @Transactional
public void save(SmartProduct product) { public void save(SmartProduct product) {
Date now = new Date();
product.setUpdateTime(now);
int nameCount = productMapper.countByProductName(product.getProductName());
if (nameCount > 0) {
throw new BusinessException(ResultEnum.PRODUCT_NAME_DUPLICATE);
}
if (product.getId() == null) { if (product.getId() == null) {
product.setCreateTime(now);
productMapper.insertSelective(product); productMapper.insertSelective(product);
} else { } else {
SmartProduct record = productMapper.selectByPrimaryKey(product.getId()); SmartProduct record = productMapper.selectByPrimaryKey(product.getId());
...@@ -73,16 +83,32 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct ...@@ -73,16 +83,32 @@ public class SmartProductServiceImpl extends BaseService implements SmartProduct
} }
} }
/**
* 根据产品 id 获取指令集。
*
* @param id 产品 id
*/
@Override @Override
public void getCommandSetById(Long id) { public void getCommandSetById(Long id) {
} }
/**
* 校验商城商品 id。
*
* @param shopProductId 商品 id
* @return 商品 id 是否合法
*/
@Override @Override
public void checkShopProductId(String shopProductId) { public boolean checkShopProductId(String shopProductId) {
return RandomUtil.randomBoolean();
} }
/**
* 上下架产品。
*
* @param id 产品 id
*/
@Override @Override
public void putOnOff(Long id) { public void putOnOff(Long id) {
SmartProduct product = productMapper.selectByPrimaryKey(id); SmartProduct product = productMapper.selectByPrimaryKey(id);
......
...@@ -2,17 +2,21 @@ package com.glsx.smart.service.impl; ...@@ -2,17 +2,21 @@ package com.glsx.smart.service.impl;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Arrays; import java.util.Arrays;
import java.util.Date;
import java.util.List; import java.util.List;
import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import com.glsx.smart.dao.mapper.SmartProductTypeMapper; 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.BaseService;
import com.glsx.smart.service.SmartProductTypeService; import com.glsx.smart.service.SmartProductTypeService;
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;
/** /**
* <p>Description: * <p>Description: 产品类型业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
* *
* @author wbh * @author wbh
...@@ -20,13 +24,22 @@ import org.springframework.stereotype.Service; ...@@ -20,13 +24,22 @@ import org.springframework.stereotype.Service;
*/ */
@Slf4j @Slf4j
@Service @Service
public class SmartProductTypeServiceImpl implements SmartProductTypeService { public class SmartProductTypeServiceImpl extends BaseService implements SmartProductTypeService {
@Resource @Resource
private SmartProductTypeMapper productTypeMapper; private SmartProductTypeMapper productTypeMapper;
/**
* 获取产品类型列表。
*
* @param req 请求
* @return 结果
*/
@Override @Override
public List<SmartProductType> getList(SmartProductType productType) { public PageInfo<SmartProductType> getList(SmartProductType req) {
return productTypeMapper.selectByExample(productType); super.startPagination(req);
List<SmartProductType> productTypeList = productTypeMapper.getList(req);
PageInfo<SmartProductType> pageInfo = PageInfo.of(productTypeList);
return pageInfo;
} }
@Override @Override
...@@ -34,20 +47,35 @@ public class SmartProductTypeServiceImpl implements SmartProductTypeService { ...@@ -34,20 +47,35 @@ public class SmartProductTypeServiceImpl implements SmartProductTypeService {
return productTypeMapper.selectByPrimaryKey(id); return productTypeMapper.selectByPrimaryKey(id);
} }
/**
* 保存产品类型。
*
* @param productType 产品类型
*/
@Override @Override
@Transactional
public void save(SmartProductType productType) { public void save(SmartProductType productType) {
Date now = new Date();
productType.setUpdateTime(now);
if (productType.getId() == null) { if (productType.getId() == null) {
productType.setCreateTime(now);
productTypeMapper.insertSelective(productType); productTypeMapper.insertSelective(productType);
} else { } else {
SmartProductType record = productTypeMapper.selectByPrimaryKey(productType.getId()); SmartProductType record = productTypeMapper.selectByPrimaryKey(productType.getId());
if (record != null) { if (record != null) {
productTypeMapper.updateByPrimaryKeySelective(productType); productTypeMapper.updateByPrimaryKeySelective(productType);
} else { } else {
throw new BusinessException(ResultEnum.ID_NOT_FOUND); throw new BusinessException(ResultEnum.PRODUCT_TYPE_NOT_FOUND);
} }
} }
} }
/**
* 获取商城标签
*
* @return 结果
*/
@Override @Override
public List<String> getShopTagList() { public List<String> getShopTagList() {
return Arrays.asList("牛逼", "干翻苹果"); return Arrays.asList("牛逼", "干翻苹果");
......
...@@ -7,7 +7,6 @@ import com.glsx.smart.dao.entity.SmartSysCode; ...@@ -7,7 +7,6 @@ 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;
import com.glsx.smart.exception.ResultEnum; import com.glsx.smart.exception.ResultEnum;
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 lombok.extern.slf4j.Slf4j;
...@@ -33,7 +32,7 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode ...@@ -33,7 +32,7 @@ public class SmartSysCodeServiceImpl extends BaseService implements SmartSysCode
* @return 结果 * @return 结果
*/ */
@Override @Override
public PageInfo<SmartSysCode> getList(SmartSysCodeReq req) { public PageInfo<SmartSysCode> getList(SmartSysCode req) {
super.startPagination(req); super.startPagination(req);
List<SmartSysCode> sysCodeList = sysCodeMapper.getList(req); List<SmartSysCode> sysCodeList = sysCodeMapper.getList(req);
PageInfo<SmartSysCode> pageInfo = new PageInfo<>(sysCodeList); PageInfo<SmartSysCode> pageInfo = new PageInfo<>(sysCodeList);
......
package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import com.glsx.smart.dao.entity.SmartUserDeviceData;
import com.glsx.smart.dao.mapper.SmartUserDeviceDataMapper;
import com.glsx.smart.service.SmartUserDeviceDataService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
/**
* <p>Description:
* <p>Project: chejia-smart
*
* @author wbh
* @date 2021-03-16
*/
@Slf4j
@Service
public class SmartUserDeviceDataServiceImpl implements SmartUserDeviceDataService{
@Resource
private SmartUserDeviceDataMapper smartUserDeviceDataMapper;
@Override
public int deleteByPrimaryKey(Long id) {
return smartUserDeviceDataMapper.deleteByPrimaryKey(id);
}
@Override
public int insertSelective(SmartUserDeviceData record) {
return smartUserDeviceDataMapper.insertSelective(record);
}
@Override
public SmartUserDeviceData selectByPrimaryKey(Long id) {
return smartUserDeviceDataMapper.selectByPrimaryKey(id);
}
@Override
public int updateByPrimaryKeySelective(SmartUserDeviceData record) {
return smartUserDeviceDataMapper.updateByPrimaryKeySelective(record);
}
}
...@@ -30,24 +30,29 @@ ...@@ -30,24 +30,29 @@
select sp.id, sp.product_name, sp.icon, sp.type_id, sp.shop_product_id, sp.platform_key, select sp.id, sp.product_name, sp.icon, sp.type_id, sp.shop_product_id, sp.platform_key,
sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time, sp.platform_product_id, sp.network_key, sp.status, sp.remark, sp.create_time,
sp.create_by, sp.update_time, sp.update_by, sp.create_by, sp.update_time, sp.update_by,
ssf.url iconUrl,
spt.type_name typeName, spt.type_name typeName,
sscp.dict_value platformName, sscp.dict_value platformName,
sscn.dict_value networkName sscn.dict_value networkName
from smart_product sp from smart_product sp
left join smart_sys_file ssf on ssf.id = sp.icon
left join smart_product_type spt on spt.id = sp.type_id left join smart_product_type spt on spt.id = sp.type_id
left join smart_sys_code sscp on sscp.dict_key = sp.platform_key left join smart_sys_code sscp on sscp.dict_key = sp.platform_key
left join smart_sys_code sscn on sscn.dict_key = sp.network_key left join smart_sys_code sscn on sscn.dict_key = sp.network_key
<where> <where>
<if test="startTime != null and startTime != ''"> <if test="productName != null and productName != ''">
and sp.product_name like concat('%', #{productName,jdbcType=VARCHAR}, '%')
</if>
<if test="endTime != null and endTime != ''">
</if> </if>
</where> </where>
order by sp.create_time desc order by sp.create_time desc
</select> </select>
<select id="countByProductName" resultType="integer">
select count(0)
from smart_product
where product_name = #{productName,jdbcType=VARCHAR}
</select>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
......
...@@ -20,6 +20,24 @@ ...@@ -20,6 +20,24 @@
id, type_name, category_key, shop_tag, remark, create_time, create_by, update_time, id, type_name, category_key, shop_tag, remark, create_time, create_by, update_time,
update_by update_by
</sql> </sql>
<select id="getList" resultMap="BaseResultMap">
select spt.id, spt.type_name, spt.category_key, spt.shop_tag, spt.remark, spt.create_time,
spt.create_by, spt.update_time, spt.update_by,
ssc2.dict_value categoryName2,
ssc1.dict_value categoryName1
from smart_product_type spt
left join smart_sys_code ssc2 on ssc2.dict_key = spt.category_key
left join smart_sys_code ssc1 on ssc1.dict_key = ssc2.parent_key
<where>
<if test="typeName != null and typeName != ''">
and spt.type_name like concat('%', #{typeName,jdbcType=VARCHAR}, '%')
</if>
</where>
order by spt.create_time desc
</select>
<update id="updateBatch" parameterType="java.util.List"> <update id="updateBatch" parameterType="java.util.List">
<!--@mbg.generated--> <!--@mbg.generated-->
update smart_product_type update smart_product_type
......
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.glsx.smart.dao.mapper.SmartUserDeviceDataMapper">
<resultMap id="BaseResultMap" type="com.glsx.smart.dao.entity.SmartUserDeviceData">
<!--@mbg.generated-->
<!--@Table smart_user_device_data-->
<id column="id" jdbcType="BIGINT" property="id"/>
<result column="user_id" jdbcType="BIGINT" property="userId"/>
<result column="device_id" jdbcType="VARCHAR" property="deviceId"/>
<result column="view_times" jdbcType="BIGINT" property="viewTimes"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, user_id, device_id, view_times, create_time, update_time
</sql>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!