| @@ -0,0 +1,23 @@ | |||
| package com.iformall.domain.dto; | |||
| import lombok.Data; | |||
| import java.io.Serializable; | |||
| /** | |||
| * Created by Stormeye on 2018/8/10. | |||
| * mall 楼座,楼层 | |||
| */ | |||
| @Data | |||
| public class WxMallBuildingFloorDto implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @io.swagger.annotations.ApiModelProperty(value="mallId",name="mallId") | |||
| private Long mallId; | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座",name="building") | |||
| private String building; | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座",name="floors") | |||
| private String floors; | |||
| } | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import lombok.Data; | |||
| import javax.persistence.Id; | |||
| import javax.persistence.Table; | |||
| import javax.persistence.Transient; | |||
| @@ -8,6 +10,7 @@ import java.util.Date; | |||
| import java.util.List; | |||
| @Table(name = "wx_mall_building") | |||
| @Data | |||
| public class WxMallBuilding implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -18,102 +21,31 @@ public class WxMallBuilding implements Serializable { | |||
| protected List<String> ids; | |||
| @Transient | |||
| protected String sortColumns; | |||
| public Long getId() { | |||
| return id; | |||
| } | |||
| public void setId(Long id) { | |||
| this.id = id; | |||
| } | |||
| public String getSortColumns() { | |||
| return sortColumns; | |||
| } | |||
| public List<String> getIds() { | |||
| return ids; | |||
| } | |||
| public void setIds(List<String> ids) { | |||
| this.ids = ids; | |||
| } | |||
| @Transient | |||
| protected List<WxMallFloor> floors; | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*商场id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商场id",name="mallId") | |||
| private Long mallId; | |||
| /*楼座名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座名",name="name") | |||
| private String name; | |||
| /*楼层数**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼层数",name="floorNumber") | |||
| private Integer floorNumber; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getMallId() { | |||
| return mallId; | |||
| } | |||
| public void setMallId(Long _mallId) { | |||
| mallId = _mallId; | |||
| } | |||
| public String getName() { | |||
| return name; | |||
| } | |||
| public void setName(String _name) { | |||
| name = _name; | |||
| } | |||
| public Integer getFloorNumber() { | |||
| return floorNumber; | |||
| } | |||
| public void setFloorNumber(Integer _floorNumber) { | |||
| floorNumber = _floorNumber; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public List<WxMallFloor> getFloors() { | |||
| return floors; | |||
| } | |||
| public void setFloors(List<WxMallFloor> floors) { | |||
| this.floors = floors; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,MallId_ASC("`mallId` ASC"),MallId_DESC("`mallId` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,MallId_ASC("`mall_id` ASC"),MallId_DESC("`mall_id` DESC") | |||
| ,Name_ASC("`name` ASC"),Name_DESC("`name` DESC") | |||
| ,FloorNumber_ASC("`floorNumber` ASC"),FloorNumber_DESC("`floorNumber` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ,FloorNumber_ASC("`floor_number` ASC"),FloorNumber_DESC("`floor_number` DESC") | |||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -1,5 +1,7 @@ | |||
| package com.iformall.domain.po; | |||
| import lombok.Data; | |||
| import javax.persistence.*; | |||
| import java.util.*; | |||
| import javax.persistence.Transient; | |||
| @@ -8,6 +10,7 @@ import javax.persistence.Id; | |||
| import java.io.Serializable; | |||
| @Table(name = "wx_mall_floor") | |||
| @Data | |||
| public class WxMallFloor implements Serializable { | |||
| private static final long serialVersionUID = 1L; | |||
| @@ -38,87 +41,32 @@ public class WxMallFloor implements Serializable { | |||
| this.ids = ids; | |||
| } | |||
| /*租户ID**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId") | |||
| private String tenantId; | |||
| /*商场id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="商场id",name="mallId") | |||
| private Long mallId; | |||
| /*楼座id**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼座id",name="buildingId") | |||
| private Long buildingId; | |||
| /*楼层名**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="楼层名",name="floorName") | |||
| private String floorName; | |||
| /*底图路径**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="底图路径",name="backgroundImg") | |||
| private String backgroundImg; | |||
| /*创建时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate") | |||
| private Date createDate; | |||
| /*更新时间**/ | |||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate") | |||
| private Date updateDate; | |||
| @Transient | |||
| protected List<WxMallFloor> floors; | |||
| public String getTenantId() { | |||
| return tenantId; | |||
| } | |||
| public void setTenantId(String _tenantId) { | |||
| tenantId = _tenantId; | |||
| } | |||
| public Long getMallId() { | |||
| return mallId; | |||
| } | |||
| public void setMallId(Long _mallId) { | |||
| mallId = _mallId; | |||
| } | |||
| public Long getBuildingId() { | |||
| return buildingId; | |||
| } | |||
| public void setBuildingId(Long _buildingId) { | |||
| buildingId = _buildingId; | |||
| } | |||
| public String getFloorName() { | |||
| return floorName; | |||
| } | |||
| public void setFloorName(String _floorName) { | |||
| floorName = _floorName; | |||
| } | |||
| public String getBackgroundImg() { | |||
| return backgroundImg; | |||
| } | |||
| public void setBackgroundImg(String _backgroundImg) { | |||
| backgroundImg = _backgroundImg; | |||
| } | |||
| public Date getCreateDate() { | |||
| return createDate; | |||
| } | |||
| public void setCreateDate(Date _createDate) { | |||
| createDate = _createDate; | |||
| } | |||
| public Date getUpdateDate() { | |||
| return updateDate; | |||
| } | |||
| public void setUpdateDate(Date _updateDate) { | |||
| updateDate = _updateDate; | |||
| } | |||
| public static enum Field | |||
| { | |||
| Id_ASC("`id` ASC"),Id_DESC("`id` DESC") | |||
| ,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC") | |||
| ,MallId_ASC("`mallId` ASC"),MallId_DESC("`mallId` DESC") | |||
| ,BuildingId_ASC("`buildingId` ASC"),BuildingId_DESC("`buildingId` DESC") | |||
| ,FloorName_ASC("`floorName` ASC"),FloorName_DESC("`floorName` DESC") | |||
| ,BackgroundImg_ASC("`backgroundImg` ASC"),BackgroundImg_DESC("`backgroundImg` DESC") | |||
| ,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC") | |||
| ,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` DESC") | |||
| ,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC") | |||
| ,MallId_ASC("`mall_id` ASC"),MallId_DESC("`mall_id` DESC") | |||
| ,BuildingId_ASC("`building_id` ASC"),BuildingId_DESC("`building_id` DESC") | |||
| ,FloorName_ASC("`floor_name` ASC"),FloorName_DESC("`floor_name` DESC") | |||
| ,BackgroundImg_ASC("`background_img` ASC"),BackgroundImg_DESC("`background_img` DESC") | |||
| ,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC") | |||
| ,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC") | |||
| ; | |||
| private String value; | |||
| Field(String value){ | |||
| @@ -2,29 +2,30 @@ package com.iformall.service; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMallBuildingFloorDto; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| public interface WxMallBuildingService { | |||
| /** | |||
| /** | |||
| * 根据实体查询分页列表 | |||
| * | |||
| * @param record | |||
| * @param offset | |||
| * @param limit | |||
| * @param pageIndex | |||
| * @param pageSize | |||
| * @return | |||
| */ | |||
| PageInfo<WxMallBuilding> listAsPage(WxMallBuilding record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| PageInfo<WxMallBuilding> listAsPage(WxMallBuilding record, Integer pageIndex, Integer pageSize); | |||
| /** | |||
| * 根据Id获得实体 | |||
| * | |||
| * @param id | |||
| * @return | |||
| */ | |||
| WxMallBuilding getById(Long id); | |||
| /** | |||
| /** | |||
| * 保存或更新实体 | |||
| * | |||
| * @param record | |||
| @@ -43,4 +44,11 @@ public interface WxMallBuildingService { | |||
| ResultData getbuildingfloorlist(String tenantId); | |||
| /** | |||
| * 新增楼层楼座 | |||
| * | |||
| * @param record | |||
| */ | |||
| void addBuildingAndFloors(WxMallBuildingFloorDto record); | |||
| } | |||
| @@ -4,6 +4,7 @@ import com.github.pagehelper.PageHelper; | |||
| import com.github.pagehelper.PageInfo; | |||
| import com.iformall.common.IdWorker; | |||
| import com.iformall.common.ResultData; | |||
| import com.iformall.domain.dto.WxMallBuildingFloorDto; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| import com.iformall.domain.po.WxMallFloor; | |||
| import com.iformall.mapper.WxMallBuildingMapper; | |||
| @@ -90,5 +91,31 @@ public class WxMallBuildingServiceImpl implements WxMallBuildingService { | |||
| return new ResultData(wxMallBuildings); | |||
| } | |||
| @Override | |||
| public void addBuildingAndFloors(WxMallBuildingFloorDto record) { | |||
| final IdWorker idWorker = IdWorker.get(); | |||
| String [] floors = record.getFloors().split(","); | |||
| // 楼座 | |||
| WxMallBuilding mallBuilding = new WxMallBuilding(); | |||
| mallBuilding.setId(idWorker.nextId()); | |||
| mallBuilding.setTenantId(record.getTenantId()); | |||
| mallBuilding.setName(record.getBuilding()); | |||
| mallBuilding.setFloorNumber(floors.length); | |||
| wxMallBuildingMapper.insertSelective(mallBuilding); | |||
| // 楼层 | |||
| for(String floor: floors) { | |||
| WxMallFloor mallFloor = new WxMallFloor(); | |||
| mallFloor.setId(idWorker.nextId()); | |||
| mallFloor.setTenantId(record.getTenantId()); | |||
| mallFloor.setBuildingId(mallBuilding.getId()); | |||
| mallFloor.setFloorName(floor); | |||
| mallFloor.setBackgroundImg("https://s3.cn-northwest-1.amazonaws.com.cn/iformall-net/789/9eea8e0e-15ea-4be0-a43d-31e2e9d8db8c.jpg"); | |||
| wxMallFloorMapper.insertSelective(mallFloor); | |||
| } | |||
| } | |||
| } | |||
| @@ -2,14 +2,17 @@ package com.iformall.controller.basic; | |||
| import com.github.pagehelper.PageInfo; | |||
| 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.dto.WxMallBuildingFloorDto; | |||
| import com.iformall.domain.po.WxMallBuilding; | |||
| import com.iformall.service.WxMallBuildingService; | |||
| import io.swagger.annotations.ApiImplicitParam; | |||
| import io.swagger.annotations.ApiImplicitParams; | |||
| import io.swagger.annotations.ApiOperation; | |||
| import org.apache.commons.lang3.StringUtils; | |||
| import org.slf4j.Logger; | |||
| import org.slf4j.LoggerFactory; | |||
| import org.springframework.beans.factory.annotation.Autowired; | |||
| @@ -36,7 +39,7 @@ public class WxMallBuildingController extends BaseController { | |||
| return new ResultData(page); | |||
| } | |||
| @ApiOperation("新增接口(3)") | |||
| @ApiOperation("新增接口") | |||
| @PostMapping("add") | |||
| @SystemControllerLog(description = "商城-楼座-新增") | |||
| public ResultData add(@RequestBody WxMallBuilding wxMallBuilding) { | |||
| @@ -92,5 +95,26 @@ public class WxMallBuildingController extends BaseController { | |||
| return wxMallBuildingService.getbuildingfloorlist(getTenantId()); | |||
| } | |||
| @ApiOperation("新增接口(3)") | |||
| @PostMapping("addBuildingAndFloor") | |||
| @SystemControllerLog(description = "商城-楼座/楼层-新增") | |||
| public ResultData addBuildingAndFloor(@RequestBody WxMallBuildingFloorDto mallBuildingFloorDto) { | |||
| logger.debug("[" + getIpAddr() + "] WxMallBuildingController::addBuildingAndFloor"); | |||
| if(mallBuildingFloorDto.getMallId() == null || mallBuildingFloorDto.getMallId() == 0) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(StringUtils.isBlank(mallBuildingFloorDto.getTenantId())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(StringUtils.isBlank(mallBuildingFloorDto.getBuilding())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| if(StringUtils.isBlank(mallBuildingFloorDto.getFloors())) { | |||
| return new ResultData(ErrorCode.SYS_PARAMETER_NOT_NULL); | |||
| } | |||
| wxMallBuildingService.addBuildingAndFloors(mallBuildingFloorDto); | |||
| return new ResultData(); | |||
| } | |||
| } | |||