| @@ -0,0 +1,64 @@ | |||||
| package com.iformall.controller.device; | |||||
| import com.iformall.annotation.SystemControllerLog; | |||||
| import com.iformall.common.ErrorCode; | |||||
| import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.controller.base.BaseController; | |||||
| import com.iformall.domain.po.KwMerchantMeter; | |||||
| import com.iformall.service.kw.KwMerchantMeterService; | |||||
| import io.swagger.annotations.Api; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("kwMerchantMeter") | |||||
| @Api(description="电表设备") | |||||
| public class KwMerchantMeterController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| private KwMerchantMeterService kwMerchantMeterService; | |||||
| @ApiOperation("设备列表") | |||||
| @GetMapping("list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | |||||
| @SystemControllerLog(description = "电表设备-设备列表") | |||||
| public Result list(@ModelAttribute KwMerchantMeter kwMerchantMeter, Integer pageNum, Integer pageSize) { | |||||
| if (kwMerchantMeter == null) kwMerchantMeter = new KwMerchantMeter(); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("绑定设备") | |||||
| @PostMapping("bind") | |||||
| @SystemControllerLog(description = "电表设备-绑定设备") | |||||
| public Result bind(@RequestBody KwMerchantMeter kwMerchantMeter) { | |||||
| if (kwMerchantMeter == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| return new ResultData(); | |||||
| } | |||||
| @ApiOperation("解绑定设备") | |||||
| @PostMapping("unbind") | |||||
| @SystemControllerLog(description = "电表设备-解绑定设备") | |||||
| public Result unbind(@RequestBody KwMerchantMeter kwMerchantMeter) { | |||||
| if (kwMerchantMeter == null) | |||||
| return new ResultData(ErrorCode.SYS_PARAMETER_ERROR); | |||||
| return new ResultData(); | |||||
| } | |||||
| } | |||||
| @@ -19,7 +19,7 @@ import java.util.List; | |||||
| @ToString(callSuper = true) | @ToString(callSuper = true) | ||||
| @EqualsAndHashCode(callSuper = true) | @EqualsAndHashCode(callSuper = true) | ||||
| public class KwMeterData extends BaseEntity { | public class KwMeterData extends BaseEntity { | ||||
| @Id | |||||
| protected Long id; | protected Long id; | ||||
| @Transient | @Transient | ||||
| protected List<Long> ids; | protected List<Long> ids; | ||||
| @@ -0,0 +1,57 @@ | |||||
| package com.iformall.service.kw; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.KwMerchantMeter; | |||||
| import java.util.List; | |||||
| public interface KwMerchantMeterService { | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @param pageIndex | |||||
| * @param pageSize | |||||
| * @return | |||||
| */ | |||||
| PageInfo<KwMerchantMeter> listAsPage(KwMerchantMeter record, Integer pageIndex, Integer pageSize); | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| KwMerchantMeter getById(Long id); | |||||
| /** | |||||
| * 保存或更新实体 | |||||
| * | |||||
| * @param record | |||||
| */ | |||||
| ResultData saveOrUpdate(KwMerchantMeter record); | |||||
| /** | |||||
| * 根据Id删除实体 | |||||
| * | |||||
| * @param id | |||||
| */ | |||||
| void deleteById(Long id); | |||||
| /** | |||||
| * 根据实体查询分页列表 | |||||
| * | |||||
| * @param record | |||||
| * @return | |||||
| */ | |||||
| List<KwMerchantMeter> findList(KwMerchantMeter record); | |||||
| } | |||||
| @@ -0,0 +1,60 @@ | |||||
| package com.iformall.service.kw.impl; | |||||
| import com.github.pagehelper.PageHelper; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.IdWorker; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.KwMerchantMeter; | |||||
| import com.iformall.mapper.KwMerchantMeterMapper; | |||||
| import com.iformall.service.kw.KwMerchantMeterService; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class KwMerchantMeterServiceImpl implements KwMerchantMeterService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| KwMerchantMeterMapper kwMerchantMeterMapper; | |||||
| @Override | |||||
| public PageInfo<KwMerchantMeter> listAsPage(KwMerchantMeter record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> kwMerchantMeterMapper.findList(record)); | |||||
| } | |||||
| @Override | |||||
| public KwMerchantMeter getById(Long id) { | |||||
| return kwMerchantMeterMapper.selectByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public ResultData saveOrUpdate(KwMerchantMeter record) { | |||||
| if (record.getId() == null) { | |||||
| final IdWorker idWorker = IdWorker.get(); | |||||
| record.setId(idWorker.nextId()); | |||||
| kwMerchantMeterMapper.insertSelective(record); | |||||
| } else { | |||||
| kwMerchantMeterMapper.updateByPrimaryKeySelective(record); | |||||
| } | |||||
| return new ResultData(); | |||||
| } | |||||
| @Override | |||||
| public void deleteById(Long id) { | |||||
| kwMerchantMeterMapper.deleteByPrimaryKey(id); | |||||
| } | |||||
| @Override | |||||
| public List<KwMerchantMeter> findList(KwMerchantMeter record) { | |||||
| return kwMerchantMeterMapper.findList(record); | |||||
| } | |||||
| } | |||||