| @@ -6,6 +6,7 @@ import com.iformall.common.Result; | |||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.controller.base.BaseController; | import com.iformall.controller.base.BaseController; | ||||
| import com.iformall.domain.dto.KwMerchantMeterDto; | |||||
| import com.iformall.domain.dto.KwMeterDataDto; | import com.iformall.domain.dto.KwMeterDataDto; | ||||
| import com.iformall.domain.po.KwMerchantMeter; | import com.iformall.domain.po.KwMerchantMeter; | ||||
| import com.iformall.enums.EnumMerchantMeterStatus; | import com.iformall.enums.EnumMerchantMeterStatus; | ||||
| @@ -40,11 +41,11 @@ public class KwMerchantMeterController extends BaseController { | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | ||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true)}) | ||||
| @SystemControllerLog(description = "电表设备-设备列表") | @SystemControllerLog(description = "电表设备-设备列表") | ||||
| public Result list(@ModelAttribute KwMerchantMeter kwMerchantMeter, Integer pageNum, Integer pageSize) { | |||||
| if (kwMerchantMeter == null) kwMerchantMeter = new KwMerchantMeter(); | |||||
| kwMerchantMeter.setTenantId(getTenantId()); | |||||
| kwMerchantMeter.setStatus(EnumMerchantMeterStatus.VALID.getCode()); | |||||
| return new ResultData(kwMerchantMeterService.listAsPage(kwMerchantMeter, pageNum, pageSize)); | |||||
| public Result list(@ModelAttribute KwMerchantMeterDto kwMerchantMeterDto, Integer pageNum, Integer pageSize) { | |||||
| if (kwMerchantMeterDto == null) kwMerchantMeterDto = new KwMerchantMeterDto(); | |||||
| kwMerchantMeterDto.setTenantId(getTenantId()); | |||||
| kwMerchantMeterDto.setStatus(EnumMerchantMeterStatus.VALID.getCode()); | |||||
| return new ResultData(kwMerchantMeterService.listVoAsPage(kwMerchantMeterDto, pageNum, pageSize)); | |||||
| } | } | ||||
| @ApiOperation("绑定设备") | @ApiOperation("绑定设备") | ||||
| @@ -13,6 +13,7 @@ import java.util.List; | |||||
| @Data | @Data | ||||
| public class KwMerchantMeterDto extends BaseEntity { | public class KwMerchantMeterDto extends BaseEntity { | ||||
| private String tenantId; | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | ||||
| private String merchantName; | private String merchantName; | ||||
| @@ -23,9 +24,6 @@ public class KwMerchantMeterDto extends BaseEntity { | |||||
| @io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone") | @io.swagger.annotations.ApiModelProperty(value="联系方式",name="linkPhone") | ||||
| private String linkPhone; | private String linkPhone; | ||||
| @io.swagger.annotations.ApiModelProperty(value="状态0使用1作废",name="status") | |||||
| private Integer status; | |||||
| @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") | @io.swagger.annotations.ApiModelProperty(value="经营业态ID:参照wx_business表",name="businessId") | ||||
| private Integer businessId; | private Integer businessId; | ||||
| @@ -33,6 +31,10 @@ public class KwMerchantMeterDto extends BaseEntity { | |||||
| private Integer subBusinessId; | private Integer subBusinessId; | ||||
| @io.swagger.annotations.ApiModelProperty(value="状态0使用1作废",name="status") | |||||
| private Integer status; | |||||
| protected String sortColumns; | protected String sortColumns; | ||||
| @Override | @Override | ||||
| @@ -10,14 +10,27 @@ import java.util.List; | |||||
| * @author gongbiao | * @author gongbiao | ||||
| */ | */ | ||||
| @Data | @Data | ||||
| public class KwMerchantMeterVo extends KwMeter { | |||||
| public class KwMerchantMeterVo { | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | ||||
| private String merchantName; | private String merchantName; | ||||
| @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | @io.swagger.annotations.ApiModelProperty(value="商户联系方式",name="linkPhone") | ||||
| private String merchantLinkPhone; | private String merchantLinkPhone; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "店铺列表", name = "shopVoList") | @io.swagger.annotations.ApiModelProperty(value = "店铺列表", name = "shopVoList") | ||||
| private List<WxShopVo> shopVoList; | private List<WxShopVo> shopVoList; | ||||
| @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") | |||||
| private Integer meterCount; | |||||
| @io.swagger.annotations.ApiModelProperty(value = "电表列表", name = "meterList") | |||||
| private List<KwMeter> meterList; | |||||
| public Integer getMeterCount() { | |||||
| if (meterList.isEmpty()) | |||||
| return 0; | |||||
| else | |||||
| return meterList.size(); | |||||
| } | |||||
| } | } | ||||
| @@ -1,6 +1,7 @@ | |||||
| package com.iformall.mapper; | package com.iformall.mapper; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.dto.KwMerchantMeterDto; | |||||
| import com.iformall.domain.po.KwMerchantMeter; | import com.iformall.domain.po.KwMerchantMeter; | ||||
| import com.iformall.domain.vo.KwMerchantMeterVo; | import com.iformall.domain.vo.KwMerchantMeterVo; | ||||
| @@ -8,8 +9,7 @@ import java.util.List; | |||||
| public interface KwMerchantMeterMapper extends CommonMapper<KwMerchantMeter, Long> { | public interface KwMerchantMeterMapper extends CommonMapper<KwMerchantMeter, Long> { | ||||
| List<KwMerchantMeter> findList(KwMerchantMeter param); | |||||
| List<KwMerchantMeterVo> findListVo(KwMerchantMeter param); | |||||
| List<KwMerchantMeterVo> findListVo(KwMerchantMeterDto param); | |||||
| int unbindBatch(KwMerchantMeter param); | int unbindBatch(KwMerchantMeter param); | ||||
| } | } | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service.kw; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.KwMerchantMeterDto; | |||||
| import com.iformall.domain.po.KwMerchantMeter; | import com.iformall.domain.po.KwMerchantMeter; | ||||
| import com.iformall.domain.vo.KwMerchantMeterVo; | import com.iformall.domain.vo.KwMerchantMeterVo; | ||||
| @@ -20,7 +21,7 @@ public interface KwMerchantMeterService { | |||||
| * @param pageSize | * @param pageSize | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<KwMerchantMeterVo> listAsPage(KwMerchantMeter record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<KwMerchantMeterVo> listVoAsPage(KwMerchantMeterDto record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| @@ -45,8 +46,7 @@ public interface KwMerchantMeterService { | |||||
| * @param record | * @param record | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| List<KwMerchantMeter> findList(KwMerchantMeter record); | |||||
| List<KwMerchantMeterVo> findListVo(KwMerchantMeter record); | |||||
| List<KwMerchantMeterVo> findListVo(KwMerchantMeterDto record); | |||||
| int selectCount(KwMerchantMeter record); | int selectCount(KwMerchantMeter record); | ||||
| int unbindBatch(KwMerchantMeter record); | int unbindBatch(KwMerchantMeter record); | ||||
| @@ -5,6 +5,7 @@ import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ErrorCode; | import com.iformall.common.ErrorCode; | ||||
| import com.iformall.common.IdWorker; | import com.iformall.common.IdWorker; | ||||
| import com.iformall.common.ResultData; | import com.iformall.common.ResultData; | ||||
| import com.iformall.domain.dto.KwMerchantMeterDto; | |||||
| import com.iformall.domain.dto.KwMeterDataDto; | import com.iformall.domain.dto.KwMeterDataDto; | ||||
| import com.iformall.domain.po.KwMerchantMeter; | import com.iformall.domain.po.KwMerchantMeter; | ||||
| import com.iformall.domain.vo.KwMerchantMeterVo; | import com.iformall.domain.vo.KwMerchantMeterVo; | ||||
| @@ -35,7 +36,7 @@ public class KwMerchantMeterServiceImpl implements KwMerchantMeterService { | |||||
| KwMeterDataMapper kwMeterDataMapper; | KwMeterDataMapper kwMeterDataMapper; | ||||
| @Override | @Override | ||||
| public PageInfo<KwMerchantMeterVo> listAsPage(KwMerchantMeter record, Integer pageIndex, Integer pageSize) { | |||||
| public PageInfo<KwMerchantMeterVo> listVoAsPage(KwMerchantMeterDto record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> kwMerchantMeterMapper.findListVo(record)); | return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> kwMerchantMeterMapper.findListVo(record)); | ||||
| } | } | ||||
| @@ -59,14 +60,8 @@ public class KwMerchantMeterServiceImpl implements KwMerchantMeterService { | |||||
| } | } | ||||
| } | } | ||||
| @Override | |||||
| public List<KwMerchantMeter> findList(KwMerchantMeter record) { | |||||
| return kwMerchantMeterMapper.findList(record); | |||||
| } | |||||
| @Override | @Override | ||||
| public List<KwMerchantMeterVo> findListVo(KwMerchantMeter record) { | |||||
| public List<KwMerchantMeterVo> findListVo(KwMerchantMeterDto record) { | |||||
| return kwMerchantMeterMapper.findListVo(record); | return kwMerchantMeterMapper.findListVo(record); | ||||
| } | } | ||||
| @@ -74,17 +74,56 @@ | |||||
| javaType="java.util.List" | javaType="java.util.List" | ||||
| select="com.iformall.mapper.WxShopMapper.findShopVoList"> | select="com.iformall.mapper.WxShopMapper.findShopVoList"> | ||||
| </collection> | </collection> | ||||
| <collection column="{merchantId=id}" property="shopVoList" | |||||
| ofType="com.iformall.domain.vo.WxShopVo" | |||||
| javaType="java.util.List" | |||||
| select="com.iformall.mapper.WxShopMapper.findShopVoList"> | |||||
| </collection> | |||||
| </resultMap> | </resultMap> | ||||
| <sql id="allColumnsVo"> | <sql id="allColumnsVo"> | ||||
| `id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`, `name`, `link_phone` | `id`,`tenant_id`,`meter_id`,`merchant_id`,`status`,`create_time`,`update_time`, `name`, `link_phone` | ||||
| </sql> | </sql> | ||||
| <select id="findListVo" parameterType="com.iformall.domain.po.KwMerchantMeter" resultMap="BaseResultMap"> | |||||
| <sql id="dynamicWhereConditionsVo"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != tenantId "> | |||||
| and `tenant_id` = #{tenantId} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and `merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != meterId "> | |||||
| and `meter_id` = #{meterId} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and `status` = #{status} | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="findListVo" parameterType="com.iformall.domain.dto.KwMerchantMeterDto" resultMap="BaseResultMap"> | |||||
| select | select | ||||
| <include refid="allColumnsVo"/> | <include refid="allColumnsVo"/> | ||||
| from kw_merchant_meter, wx_merchant | from kw_merchant_meter, wx_merchant | ||||
| <include refid="dynamicWhereConditions"/> | |||||
| <include refid="dynamicWhereConditionsVo"/> | |||||
| </select> | </select> | ||||
| <update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter"> | <update id="unbindBatch" parameterType="com.iformall.domain.po.KwMerchantMeter"> | ||||
| @@ -89,10 +89,10 @@ | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | ||||
| #{idItem} | #{idItem} | ||||
| </foreach> | </foreach> | ||||
| <if test=" 1 = onlineStatus "> | |||||
| <if test=" 1 == onlineStatus "> | |||||
| and `online_status` = 0 | and `online_status` = 0 | ||||
| </if> | </if> | ||||
| <if test=" 0 = onlineStatus "> | |||||
| <if test=" 0 == onlineStatus "> | |||||
| and `online_status` = 1 | and `online_status` = 1 | ||||
| </if> | </if> | ||||
| </update> | </update> | ||||