Commit 1f05e85c by 杨林龙

格式化 yangll

1 parent 704c1abb
......@@ -3,5 +3,5 @@ package cn.com.glsx.openplatform.service;
import java.util.Map;
public interface IceOpenApiService {
Map<String, Integer> getDataView(int userId);
Map<String, Integer> getDataView(int userId, int deviceType);
}
......@@ -34,7 +34,7 @@ public interface PlatformDeviceMapper extends OreMapper<PlatformDevice> {
List<Map<String, Object>> getDeviceActivationStatistic(@Param("startTime") Date startTime, @Param("endTime") Date endTime, @Param("customerName") String customerName);
int getDeviceCountByCustomerId(@Param("customerId") int customerId);
int getDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr);
int getacticveDeviceCountByCustomerId(@Param("customerId") int customerId);
int getacticveDeviceCountByCustomerId(@Param("customerId") int customerId, @Param("deviceTypeStr") String deviceTypeStr);
}
\ No newline at end of file
......@@ -24,12 +24,27 @@ public class IceOpenApiServiceImpl implements IceOpenApiService {
private PlatformUserMapper userMapper;
@Override
public Map<String, Integer> getDataView(int userId) {
public Map<String, Integer> getDataView(int userId, int deviceType) {
HashMap<String, Integer> hashMap = new HashMap<>();
String deviceTypeStr;
switch (deviceType) {
case 1:
deviceTypeStr = "模组";
break;
case 2:
deviceTypeStr = "核心板";
break;
case 3:
deviceTypeStr = "完整板";
break;
default:
deviceTypeStr = "";
}
int customerId = userMapper.getCustomerId(userId);
int deviceCount = deviceMapper.getDeviceCountByCustomerId(customerId);
int deviceCount = deviceMapper.getDeviceCountByCustomerId(customerId, deviceTypeStr);
int userCount = userMapper.getUserCountByCustomerId(customerId);
int acticveDeviceCount = deviceMapper.getacticveDeviceCountByCustomerId(customerId);
int acticveDeviceCount = deviceMapper.getacticveDeviceCountByCustomerId(customerId, deviceTypeStr);
hashMap.put("totaldevice", deviceCount);
hashMap.put("totalusers", userCount);
hashMap.put("onlinedevices", acticveDeviceCount);
......
......@@ -116,12 +116,18 @@
select count(1)
from t_platform_device
where customer_id = #{customerId,jdbcType=INTEGER}
<if test="deviceTypeStr != null and deviceTypeStr != ''">
and device_type = #{deviceTypeStr,jdbcType=VARCHAR}
</if>
</select>
<select id="getacticveDeviceCountByCustomerId" resultType="java.lang.Integer">
select count(1)
from t_platform_device
where status = 1
and customer_id = #{customerId,jdbcType=INTEGER}
and customer_id = #{customerId,jdbcType=INTEGER}
<if test="deviceTypeStr != null and deviceTypeStr != ''">
and device_type = #{deviceTypeStr,jdbcType=VARCHAR}
</if>
</select>
</mapper>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!