Commit a5f2b0bd by wnb0128

车家智能数据服务开发 场景指令条件开发--think.wang

1 parent e041c7c1
package com.glsx.smart.controller;
import com.alibaba.fastjson.JSON;
import com.glsx.smart.dao.entity.SmartScenceSupstatus;
import com.glsx.smart.service.SmartScenceSupstatusService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Title: IndexController.java
* @Description:获取场景指令触发条件
* @author think.wang
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
@RequestMapping("/condition")
public class ConditionController {
@Autowired
private SmartScenceSupstatusService statusService;
@ResponseBody
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartScenceSupstatus> getList(@RequestBody SmartScenceSupstatus record){
log.info("请求参数:{}", JSON.toJSONString(record));
return statusService.getList(record);
}
}
package com.glsx.smart.controller;
import com.alibaba.fastjson.JSON;
import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.service.SmartDeviceOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Title: IndexController.java
* @Description:获取场景指令执行内容
* @author think.wang
* @version V1.0
* @Company: Didihu.com.cn
* @Copyright Copyright (c) 2017
*/
@Slf4j
@RestController
@RequestMapping("/content")
public class ContentController {
@Autowired
private SmartDeviceOrderService orderService;
@ResponseBody
@RequestMapping(value = "/getList", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartDeviceOrder> getList(@RequestBody SmartDeviceOrder record){
log.info("请求参数:{}", JSON.toJSONString(record));
return orderService.getList(record);
}
}
package com.glsx.smart.controller; package com.glsx.smart.controller;
import java.util.List;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -13,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping; ...@@ -13,6 +12,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* <p>Description: 产品类型业务 * <p>Description: 产品类型业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -83,4 +84,24 @@ public class ProductTypeController { ...@@ -83,4 +84,24 @@ public class ProductTypeController {
log.info("$$$$ /productType/getShopTagList ..."); log.info("$$$$ /productType/getShopTagList ...");
return productTypeService.getShopTagList(); return productTypeService.getShopTagList();
} }
/**
* 根据id列表获取指令执行内容
*
* @return 结果
*/
@RequestMapping(value = "/getListAndContent", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartProductType> getListAndContent(@RequestBody List<Long> list) {
return productTypeService.getListAndContent(list);
}
/**
* 根据id列表获取指令条件
*
* @return 结果
*/
@RequestMapping(value = "/getListAndCondition", method = {RequestMethod.GET, RequestMethod.POST})
public List<SmartProductType> getListAndCondition(@RequestBody List<Long> list) {
return productTypeService.getListAndCondition(list);
}
} }
package com.glsx.smart.dao.entity; package com.glsx.smart.dao.entity;
import com.glsx.smart.pojo.BaseDTO;
import lombok.Data;
import javax.persistence.GeneratedValue; import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType; import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.Table; import javax.persistence.Table;
import java.util.Date; import java.util.Date;
import com.glsx.smart.pojo.BaseDTO; import java.util.List;
import lombok.Data;
/** /**
* <p>Description: * <p>Description:
...@@ -69,4 +71,14 @@ public class SmartProductType extends BaseDTO { ...@@ -69,4 +71,14 @@ public class SmartProductType extends BaseDTO {
* 更新人 * 更新人
*/ */
private Long updateBy; private Long updateBy;
/**
* 内容列表
*/
private List<SmartDeviceOrder> contentList;
/**
* 条件列表
*/
private List<SmartScenceSupstatus> conditionList;
} }
...@@ -2,6 +2,9 @@ package com.glsx.smart.dao.mapper; ...@@ -2,6 +2,9 @@ package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartDeviceOrder; import com.glsx.smart.dao.entity.SmartDeviceOrder;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -13,4 +16,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface SmartDeviceOrderMapper extends tk.mybatis.mapper.common.Mapper<SmartDeviceOrder> { public interface SmartDeviceOrderMapper extends tk.mybatis.mapper.common.Mapper<SmartDeviceOrder> {
List<SmartDeviceOrder> getListByProductId(@Param("productId") String productId);
} }
\ No newline at end of file \ No newline at end of file
package com.glsx.smart.dao.mapper; package com.glsx.smart.dao.mapper;
import java.util.List;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -21,4 +22,9 @@ public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper< ...@@ -21,4 +22,9 @@ public interface SmartProductTypeMapper extends tk.mybatis.mapper.common.Mapper<
int countByProductTypeName(String typeName); int countByProductTypeName(String typeName);
List<SmartProductType> getAllList(); List<SmartProductType> getAllList();
List<SmartProductType> getListAndContent(List<Long> list);
List<SmartProductType> getListAndCondition(List<Long> list);
} }
...@@ -2,6 +2,9 @@ package com.glsx.smart.dao.mapper; ...@@ -2,6 +2,9 @@ package com.glsx.smart.dao.mapper;
import com.glsx.smart.dao.entity.SmartScenceSupstatus; import com.glsx.smart.dao.entity.SmartScenceSupstatus;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
...@@ -14,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -14,4 +17,6 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper @Mapper
public interface SmartScenceSupstatusMapper public interface SmartScenceSupstatusMapper
extends tk.mybatis.mapper.common.Mapper<SmartScenceSupstatus> { extends tk.mybatis.mapper.common.Mapper<SmartScenceSupstatus> {
List<SmartScenceSupstatus> getListByProductId(@Param("productId") String productId);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
/** import com.glsx.smart.dao.entity.SmartDeviceOrder;
import java.util.List;
/**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
* *
...@@ -10,5 +14,6 @@ package com.glsx.smart.service; ...@@ -10,5 +14,6 @@ package com.glsx.smart.service;
public interface SmartDeviceOrderService{ public interface SmartDeviceOrderService{
List<SmartDeviceOrder> getList(SmartDeviceOrder record);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import java.util.List;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.glsx.smart.dao.entity.SmartProductType; import com.glsx.smart.dao.entity.SmartProductType;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -23,4 +24,8 @@ public interface SmartProductTypeService { ...@@ -23,4 +24,8 @@ public interface SmartProductTypeService {
Boolean save(SmartProductType productType); Boolean save(SmartProductType productType);
List<String> getShopTagList(); List<String> getShopTagList();
List<SmartProductType> getListAndContent(List<Long> list);
List<SmartProductType> getListAndCondition(List<Long> list);
} }
package com.glsx.smart.service; package com.glsx.smart.service;
import com.glsx.smart.dao.entity.SmartScenceSupstatus;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -10,5 +14,6 @@ package com.glsx.smart.service; ...@@ -10,5 +14,6 @@ package com.glsx.smart.service;
public interface SmartScenceSupstatusService { public interface SmartScenceSupstatusService {
List<SmartScenceSupstatus> getList(SmartScenceSupstatus record);
} }
package com.glsx.smart.service.impl; package com.glsx.smart.service.impl;
import javax.annotation.Resource; import com.glsx.smart.dao.entity.SmartDeviceOrder;
import com.glsx.smart.dao.mapper.SmartDeviceOrderMapper; import com.glsx.smart.dao.mapper.SmartDeviceOrderMapper;
import com.glsx.smart.service.SmartDeviceOrderService; import com.glsx.smart.service.SmartDeviceOrderService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -16,6 +20,10 @@ import org.springframework.stereotype.Service; ...@@ -16,6 +20,10 @@ import org.springframework.stereotype.Service;
public class SmartDeviceOrderServiceImpl implements SmartDeviceOrderService{ public class SmartDeviceOrderServiceImpl implements SmartDeviceOrderService{
@Resource @Resource
private SmartDeviceOrderMapper smartDeviceOrderMapper; private SmartDeviceOrderMapper deviceOrderMapper;
@Override
public List<SmartDeviceOrder> getList(SmartDeviceOrder record) {
return deviceOrderMapper.select(record);
}
} }
package com.glsx.smart.service.impl; package com.glsx.smart.service.impl;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference; import com.alibaba.fastjson.TypeReference;
...@@ -20,6 +14,9 @@ import lombok.extern.slf4j.Slf4j; ...@@ -20,6 +14,9 @@ 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;
import javax.annotation.Resource;
import java.util.*;
/** /**
* <p>Description: 产品类型业务 * <p>Description: 产品类型业务
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -137,6 +134,16 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro ...@@ -137,6 +134,16 @@ public class SmartProductTypeServiceImpl extends BaseService implements SmartPro
return success; return success;
} }
@Override
public List<SmartProductType> getListAndContent(List<Long> list) {
return productTypeMapper.getListAndContent(list);
}
@Override
public List<SmartProductType> getListAndCondition(List<Long> list) {
return productTypeMapper.getListAndCondition(list);
}
/** /**
* 获取商城标签。 * 获取商城标签。
* *
......
package com.glsx.smart.service.impl; package com.glsx.smart.service.impl;
import javax.annotation.Resource; import com.glsx.smart.dao.entity.SmartScenceSupstatus;
import com.glsx.smart.dao.mapper.SmartScenceSupstatusMapper; import com.glsx.smart.dao.mapper.SmartScenceSupstatusMapper;
import com.glsx.smart.service.SmartScenceSupstatusService; import com.glsx.smart.service.SmartScenceSupstatusService;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/** /**
* <p>Description: * <p>Description:
* <p>Project: chejia-smart * <p>Project: chejia-smart
...@@ -17,6 +20,10 @@ import org.springframework.stereotype.Service; ...@@ -17,6 +20,10 @@ import org.springframework.stereotype.Service;
public class SmartScenceSupstatusServiceImpl implements SmartScenceSupstatusService { public class SmartScenceSupstatusServiceImpl implements SmartScenceSupstatusService {
@Resource @Resource
private SmartScenceSupstatusMapper smartScenceSupstatusMapper; private SmartScenceSupstatusMapper supstatusMapper;
@Override
public List<SmartScenceSupstatus> getList(SmartScenceSupstatus record) {
return supstatusMapper.select(record);
}
} }
...@@ -15,4 +15,9 @@ ...@@ -15,4 +15,9 @@
<!--@mbg.generated generated on Wed Mar 17 10:38:04 CST 2021.--> <!--@mbg.generated generated on Wed Mar 17 10:38:04 CST 2021.-->
id, product_id, order_code, order_value, order_type id, product_id, order_code, order_value, order_type
</sql> </sql>
<select id="getListByProductId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from smart_device_order t where t.product_id = #{productId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
...@@ -15,6 +15,16 @@ ...@@ -15,6 +15,16 @@
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
<result column="update_by" jdbcType="BIGINT" property="updateBy"/> <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
</resultMap> </resultMap>
<resultMap id="BaseConditionMap" type="com.glsx.smart.dao.entity.SmartProductType" extends="BaseResultMap">
<collection property="conditionList" column="id" ofType="com.glsx.smart.dao.entity.SmartProductType" fetchType="eager"
select="com.glsx.smart.dao.mapper.SmartScenceSupstatusMapper.getListByProductId">
</collection>
</resultMap>
<resultMap id="BaseContentMap" type="com.glsx.smart.dao.entity.SmartProductType" extends="BaseResultMap">
<collection property="contentList" column="id" ofType="com.glsx.smart.dao.entity.SmartProductType" fetchType="eager"
select="com.glsx.smart.dao.mapper.SmartDeviceOrderMapper.getListByProductId">
</collection>
</resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
<!--@mbg.generated--> <!--@mbg.generated-->
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,
...@@ -33,6 +43,24 @@ ...@@ -33,6 +43,24 @@
order by spt.create_time desc order by spt.create_time desc
</select> </select>
<select id="getListAndContent" parameterType="java.util.List" resultMap="BaseContentMap">
select <include refid="Base_Column_List" />
from smart_product_type where id in
<foreach collection="list" open="(" close=")" separator="," index="index" item="item">
#{item,jdbcType=BIGINT}
</foreach>
order by create_time desc
</select>
<select id="getListAndCondition" parameterType="java.util.List" resultMap="BaseConditionMap">
select <include refid="Base_Column_List" />
from smart_product_type where id in
<foreach collection="list" open="(" close=")" separator="," index="index" item="item">
#{item,jdbcType=BIGINT}
</foreach>
order by create_time desc
</select>
<select id="getById" resultMap="BaseResultMap"> <select id="getById" resultMap="BaseResultMap">
select spt.id, spt.type_name, spt.category_key, spt.shop_tag, spt.remark, spt.create_time, 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 spt.create_by, spt.update_time, spt.update_by
......
...@@ -17,4 +17,9 @@ ...@@ -17,4 +17,9 @@
id, scene_supstatus_code, scene_supstatus_value, product_id, order_code, order_value, id, scene_supstatus_code, scene_supstatus_value, product_id, order_code, order_value,
`type` `type`
</sql> </sql>
<select id="getListByProductId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
from smart_scence_supstatus t where t.product_id = #{productId,jdbcType=VARCHAR}
</select>
</mapper> </mapper>
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!