Commit eb4daa0e by zzrdark

1.渠道号管理

parent 8fb0aca4
...@@ -12,4 +12,5 @@ import org.apache.ibatis.annotations.Mapper; ...@@ -12,4 +12,5 @@ import org.apache.ibatis.annotations.Mapper;
**/ **/
@Mapper @Mapper
public interface DeviceInfoChannelDao extends BaseMapper<DeviceInfoChannelEntity> { public interface DeviceInfoChannelDao extends BaseMapper<DeviceInfoChannelEntity> {
} }
package com.mx.cneeds.common.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @ClassName DeviceChannelEntity
* @Author zzrdark
* @Date 2020-05-09 15:28
* @Description TODO
**/
@Data
public class DeviceChannelDto implements Serializable {
/**
* 渠道号Id
*/
private Long channelId;
/**
* 渠道号
*/
private String channelNum;
/**
* 品牌
*/
private String brand;
/**
* 更新时间
*/
private Date updateTime;
}
package com.mx.cneeds.common.dto;
import lombok.Data;
import java.io.Serializable;
/**
* @ClassName DeviceInfoChannelEntity
* @Author zzrdark
* @Date 2020-05-09 16:07
* @Description TODO
**/
@Data
public class DeviceInfoChannelDto implements Serializable {
private Long id;
/**
* 设备信息表Id
*/
private Long deviceId;
/**
* 渠道号表Id
*/
private Long channelId;
}
...@@ -202,6 +202,9 @@ public class DeviceController { ...@@ -202,6 +202,9 @@ public class DeviceController {
public R queryDeviceByImei(@RequestBody DeviceInfoDto dto){ public R queryDeviceByImei(@RequestBody DeviceInfoDto dto){
log.debug("queryDeviceByImei: imei:" + dto.getImei()); log.debug("queryDeviceByImei: imei:" + dto.getImei());
DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei()); DeviceInfoDto deviceInfoDto = deviceClient.queryDeviceByImei(dto.getImei());
if (deviceInfoDto == null){
R.error(ResultCode.NOTFOUND_IMEI,"没有该imei的设备");
}
return R.ok().put("data",deviceInfoDto); return R.ok().put("data",deviceInfoDto);
} }
......
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.server.entity.DeviceChannelEntity;
import com.mx.cneeds.server.entity.ProductSeriesEntity;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/**
*
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-03-18 14:44:30
*/
public interface DeviceChannelService extends IService<DeviceChannelEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package com.mx.cneeds.server.device.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mx.cneeds.server.entity.DeviceInfoChannelEntity;
/**
*
*
* @author Mark
* @email sunlightcs@gmail.com
* @date 2020-03-18 14:44:30
*/
public interface DeviceInfoChannelService extends IService<DeviceInfoChannelEntity> {
}
package com.mx.cneeds.server.device.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.pager.Query;
import com.mx.cneeds.server.dao.DeviceChannelDao;
import com.mx.cneeds.server.device.service.DeviceChannelService;
import com.mx.cneeds.server.entity.DeviceChannelEntity;
import org.springframework.stereotype.Service;
import java.util.Map;
@Service("deviceChannelService")
public class DeviceChannelServiceImpl extends ServiceImpl<DeviceChannelDao, DeviceChannelEntity> implements DeviceChannelService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
IPage<DeviceChannelEntity> page = this.page(
new Query<DeviceChannelEntity>().getPage(params),
new QueryWrapper<DeviceChannelEntity>()
);
return new PageUtils(page);
}
}
package com.mx.cneeds.server.device.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.mx.cneeds.server.dao.DeviceInfoChannelDao;
import com.mx.cneeds.server.device.service.DeviceInfoChannelService;
import com.mx.cneeds.server.entity.DeviceInfoChannelEntity;
import org.springframework.stereotype.Service;
@Service("deviceInfoChannelService")
public class DeviceInfoChannelServiceImpl extends ServiceImpl<DeviceInfoChannelDao, DeviceInfoChannelEntity> implements DeviceInfoChannelService {
}
package com.mx.cneeds.server.device.web;
import com.mx.cneeds.common.dto.DeviceChannelDto;
import com.mx.cneeds.common.dto.SeriesDto;
import com.mx.cneeds.common.pager.PageUtils;
import com.mx.cneeds.common.result.R;
import com.mx.cneeds.common.validator.ValidatorUtils;
import com.mx.cneeds.server.device.service.DeviceChannelService;
import com.mx.cneeds.server.device.service.DeviceInfoChannelService;
import com.mx.cneeds.server.entity.DeviceChannelEntity;
import com.mx.cneeds.server.entity.DeviceInfoEntity;
import com.mx.cneeds.server.entity.ProductSeriesEntity;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
/**
* @ClassName DeviceChannelController
* @Author zzrdark
* @Date 2020-05-11 17:51
* @Description TODO
**/
@RestController
@RequestMapping("/devicechannel")
public class DeviceChannelController {
@Autowired
private DeviceChannelService deviceChannelService;
@Autowired
private DeviceInfoChannelService deviceInfoChannelService;
/**
* 列表
*/
@RequestMapping("/list")
public PageUtils list(@RequestParam Map<String, Object> params){
PageUtils page = deviceChannelService.queryPage(params);
List<SeriesDto> list = new ArrayList<SeriesDto>();
for (Object entity : page.getList()){
SeriesDto dto = new SeriesDto();
ProductSeriesEntity seriesEntity = (ProductSeriesEntity) entity;
BeanUtils.copyProperties(seriesEntity,dto);
list.add(dto);
}
return page;
}
/**
* 保存
*/
@RequestMapping("/save")
public R save(@RequestBody DeviceChannelDto deviceChannelDto){
DeviceChannelEntity deviceChannelEntity = new DeviceChannelEntity();
BeanUtils.copyProperties(deviceChannelDto,deviceChannelEntity);
deviceChannelService.save(deviceChannelEntity);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
public R update(@RequestBody DeviceChannelDto deviceChannelDto){
ValidatorUtils.validateEntity(deviceChannelDto);
DeviceChannelEntity deviceChannelEntity = new DeviceChannelEntity();
BeanUtils.copyProperties(deviceChannelDto,deviceChannelEntity);
deviceChannelService.updateById(deviceChannelEntity);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
public R delete(@RequestBody Long[] deviceIds){
deviceChannelService.removeByIds(Arrays.asList(deviceIds));
return R.ok();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment