Commit bebd3a9d by lanpingxiong

Merge branch 'dev/lanpingxiong' into 'master'

Dev/lanpingxiong

See merge request hewei/Jumeirah!35
parents 949d3fbe f835ddbc
package com.jumeirah.api.merchant.controller.order;
import com.jumeirah.common.entity.PlainType;
import com.jumeirah.common.service.PlainTypeService;
import com.jumeirah.common.vo.PlainTypeQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.log.annotation.Module;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* 飞机型号表 控制器
*
* @author wei
* @since 2020-10-09
*/
@Slf4j
@RestController
@RequestMapping("/merchant/plainType")
@Module("${cfg.module}")
@Api(value = "飞机型号表API", tags = {"飞机型号"})
public class McPlainTypeController extends BaseController {
@Autowired
private PlainTypeService plainTypeService;
/**
* 获取飞机型号列表
*/
@GetMapping("/getAllList")
@OperationLog(name = "获取飞机型号列表", type = OperationLogType.PAGE)
@ApiOperation(value = "获取飞机型号列表", response = PlainTypeQueryVo.class)
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<List<PlainType> > getAllList() throws Exception {
List<PlainType> plainTypeList = plainTypeService.getAllMap();
return ApiResult.ok(plainTypeList);
}
}
...@@ -17,6 +17,7 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType; ...@@ -17,6 +17,7 @@ import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
...@@ -25,6 +26,8 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -25,6 +26,8 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.sql.Timestamp;
/** /**
* 行程表 控制器 * 行程表 控制器
* *
...@@ -46,9 +49,11 @@ public class McStrokeController extends BaseController { ...@@ -46,9 +49,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/complete") @PostMapping("/complete")
@OperationLog(name = "完成行程接口", type = OperationLogType.UPDATE) @OperationLog(name = "完成行程接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "完成行程接口", response = ApiResult.class) @ApiOperation(value = "完成行程接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception { public ApiResult<Boolean> completeStroke(@Validated @RequestBody StrokeCompleteParam strokeCompleteParam) throws Exception {
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
stroke.setId(strokeCompleteParam.getId()) stroke.setId(strokeCompleteParam.getId())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setStatus(StrokeStatusEnum.COMPLETED.getCode()); .setStatus(StrokeStatusEnum.COMPLETED.getCode());
boolean flag = strokeService.updateStroke(stroke); boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
...@@ -60,6 +65,7 @@ public class McStrokeController extends BaseController { ...@@ -60,6 +65,7 @@ public class McStrokeController extends BaseController {
@PostMapping("/getPageList") @PostMapping("/getPageList")
@OperationLog(name = "行程分页列表", type = OperationLogType.PAGE) @OperationLog(name = "行程分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "行程分页列表") @ApiOperation(value = "行程分页列表")
@RequiresPermissions("merchant:order:view")
public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception { public ApiResult<Paging<McStrokeQueryVo>> getMyStrokePageList(@Validated @RequestBody McStrokePageParam mcStrokePageParam) throws Exception {
Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam); Paging<McStrokeQueryVo> paging = strokeService.getMcStrokePageList(mcStrokePageParam);
return ApiResult.ok(paging); return ApiResult.ok(paging);
...@@ -71,9 +77,11 @@ public class McStrokeController extends BaseController { ...@@ -71,9 +77,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/update/quotedPrice") @PostMapping("/update/quotedPrice")
@OperationLog(name = "行程报价接口", type = OperationLogType.UPDATE) @OperationLog(name = "行程报价接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "行程报价接口", response = ApiResult.class) @ApiOperation(value = "行程报价接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception { public ApiResult<Boolean> updateStroke(@Validated @RequestBody StrokeQuotedPriceParam strokeQuotedPriceParam) throws Exception {
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
BeanUtils.copyProperties(strokeQuotedPriceParam, stroke); BeanUtils.copyProperties(strokeQuotedPriceParam, stroke);
stroke.setUpdateTime(new Timestamp(System.currentTimeMillis()));
boolean flag = strokeService.updateStroke(stroke); boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
...@@ -84,9 +92,11 @@ public class McStrokeController extends BaseController { ...@@ -84,9 +92,11 @@ public class McStrokeController extends BaseController {
@PostMapping("/discount/check") @PostMapping("/discount/check")
@OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE) @OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "优惠调机审核接口", response = ApiResult.class) @ApiOperation(value = "优惠调机审核接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> checkStrokeDiscount(@Validated @RequestBody StrokeDiscountCheckParam strokeDiscountCheckParam) throws Exception { public ApiResult<Boolean> checkStrokeDiscount(@Validated @RequestBody StrokeDiscountCheckParam strokeDiscountCheckParam) throws Exception {
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
stroke.setId(strokeDiscountCheckParam.getId()) stroke.setId(strokeDiscountCheckParam.getId())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setAuditStatus(strokeDiscountCheckParam.getAuditStatus()); .setAuditStatus(strokeDiscountCheckParam.getAuditStatus());
boolean flag = strokeService.updateStroke(stroke); boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
...@@ -98,15 +108,18 @@ public class McStrokeController extends BaseController { ...@@ -98,15 +108,18 @@ public class McStrokeController extends BaseController {
@PostMapping("/confirmPayment") @PostMapping("/confirmPayment")
@OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE) @OperationLog(name = "优惠调机审核接口", type = OperationLogType.UPDATE)
@ApiOperation(value = "优惠调机审核接口", response = ApiResult.class) @ApiOperation(value = "优惠调机审核接口", response = ApiResult.class)
@RequiresPermissions("merchant:order:edit")
public ApiResult<Boolean> confirmPaymentStroke(@Validated @RequestBody StrokeConfirmPaymentParam strokeConfirmPaymentParam) throws Exception { public ApiResult<Boolean> confirmPaymentStroke(@Validated @RequestBody StrokeConfirmPaymentParam strokeConfirmPaymentParam) throws Exception {
Stroke stroke = new Stroke(); Stroke stroke = new Stroke();
stroke.setId(strokeConfirmPaymentParam.getId()) stroke.setId(strokeConfirmPaymentParam.getId())
.setStatus(StrokeStatusEnum.PROCESSING.getCode())
.setUpdateTime(new Timestamp(System.currentTimeMillis()))
.setPaymentStatus(strokeConfirmPaymentParam.getPaymentStatus()); .setPaymentStatus(strokeConfirmPaymentParam.getPaymentStatus());
boolean flag = strokeService.updateStroke(stroke); boolean flag = strokeService.updateStroke(stroke);
return ApiResult.result(flag); return ApiResult.result(flag);
} }
/* *//** /* *//**
* 修改行程表 * 修改行程表
*//* *//*
@PostMapping("/update") @PostMapping("/update")
......
package com.jumeirah.api.merchant.controller.plain;
import com.jumeirah.api.merchant.entity.param.McPlainAddParam;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.service.McPlainService;
import com.jumeirah.common.vo.McPlainQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 商家飞机表 控制器
*
* @author xxx
* @since 2020-10-19
*/
@Slf4j
@RestController
@RequestMapping("/merchant/mcPlain")
@Api(value = "商家飞机表API", tags = {"商家飞机表"})
public class McPlainController extends BaseController {
@Autowired
private McPlainService mcPlainService;
/**
* 添加商家飞机表
*/
@PostMapping("/add")
@OperationLog(name = "添加商家飞机表", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家飞机表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addMcPlain(@Validated(Add.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
mcPlain.setMcId(jwtToken.getMcId());
boolean flag = mcPlainService.saveMcPlain(mcPlain);
return ApiResult.result(flag);
}
/**
* 修改商家飞机表
*/
@PostMapping("/update")
@OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家飞机表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlainAddParam mcPlainAddParam) throws Exception {
McPlain mcPlain = new McPlain();
BeanUtils.copyProperties(mcPlainAddParam, mcPlain);
boolean flag = mcPlainService.updateMcPlain(mcPlain);
return ApiResult.result(flag);
}
/**
* 删除商家飞机表
*/
@PostMapping("/delete/{id}")
@RequiresPermissions("merchant:aircraft:management:edit")
@OperationLog(name = "删除商家飞机表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家飞机表")
public ApiResult<Boolean> deleteMcPlain(@PathVariable("id") Long id) throws Exception {
boolean flag = mcPlainService.deleteMcPlain(id);
return ApiResult.result(flag);
}
/**
* 获取商家飞机表详情
*/
/* @GetMapping("/info/{id}")
@OperationLog(name = "商家飞机表详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家飞机表详情")
public ApiResult<McPlainQueryVo> getMcPlain(@PathVariable("id") Long id) throws Exception {
McPlainQueryVo mcPlainQueryVo = mcPlainService.getMcPlainById(id);
return ApiResult.ok(mcPlainQueryVo);
}*/
/**
* 商家飞机表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "商家飞机表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家飞机表分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<Paging<McPlainQueryVo>> getMcPlainPageList(@Validated @RequestBody McPlainPageParam mcPlainPageParam) throws Exception {
Paging<McPlainQueryVo> paging = mcPlainService.getMcPlainPageList(mcPlainPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.merchant.controller.plain;
import com.jumeirah.api.merchant.entity.param.McStrokeDiscountAddParam;
import com.jumeirah.common.entity.StrokeDiscount;
import com.jumeirah.common.param.StrokeDiscountPageParam;
import com.jumeirah.common.service.StrokeDiscountService;
import com.jumeirah.common.vo.StrokeDiscountQueryVo;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.geekidea.springbootplus.framework.shiro.jwt.JwtToken;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 优惠行程表 控制器
*
* @author xxx
* @since 2020-10-14
*/
@Slf4j
@RestController
@RequestMapping("/merchant/strokeDiscount")
@Api(value = "优惠行程表API", tags = {"优惠行程表"})
public class McStrokeDiscountController extends BaseController {
@Autowired
private StrokeDiscountService strokeDiscountService;
/**
* 添加优惠行程表
*/
@PostMapping("/add")
@OperationLog(name = "添加优惠行程表", type = OperationLogType.ADD)
@ApiOperation(value = "添加优惠行程表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> addStrokeDiscount(@Validated(Add.class) @RequestBody McStrokeDiscountAddParam mcStrokeDiscountAddParam) throws Exception {
StrokeDiscount strokeDiscount = new StrokeDiscount();
BeanUtils.copyProperties(mcStrokeDiscountAddParam,strokeDiscount);
JwtToken jwtToken = (JwtToken) SecurityUtils.getSubject().getPrincipal();
strokeDiscount.setMcId(jwtToken.getMcId());
boolean flag = strokeDiscountService.saveStrokeDiscount(strokeDiscount);
return ApiResult.result(flag);
}
/**
* 修改优惠行程表
*/
/* @PostMapping("/update")
@OperationLog(name = "修改优惠行程表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改优惠行程表")
public ApiResult<Boolean> updateStrokeDiscount(@Validated(Update.class) @RequestBody StrokeDiscount strokeDiscount) throws Exception {
boolean flag = strokeDiscountService.updateStrokeDiscount(strokeDiscount);
return ApiResult.result(flag);
}*/
/**
* 删除优惠行程表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除优惠行程表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除优惠行程表")
@RequiresPermissions("merchant:aircraft:management:edit")
public ApiResult<Boolean> deleteStrokeDiscount(@PathVariable("id") Long id) throws Exception {
boolean flag = strokeDiscountService.deleteStrokeDiscount(id);
return ApiResult.result(flag);
}
/**
* 获取优惠行程表详情
*/
/*@GetMapping("/info/{id}")
@OperationLog(name = "优惠行程表详情", type = OperationLogType.INFO)
@ApiOperation(value = "优惠行程表详情")
public ApiResult<StrokeDiscountQueryVo> getStrokeDiscount(@PathVariable("id") Long id) throws Exception {
StrokeDiscountQueryVo strokeDiscountQueryVo = strokeDiscountService.getStrokeDiscountById(id);
return ApiResult.ok(strokeDiscountQueryVo);
}*/
/**
* 优惠行程表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "优惠行程表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "优惠行程表分页列表")
@RequiresPermissions("merchant:aircraft:management:view")
public ApiResult<Paging<StrokeDiscountQueryVo>> getStrokeDiscountPageList(@Validated @RequestBody StrokeDiscountPageParam strokeDiscountPageParam) throws Exception {
Paging<StrokeDiscountQueryVo> paging = strokeDiscountService.getStrokeDiscountPageList(strokeDiscountPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.api.merchant.entity.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
/**
* 商家飞机表
*
* @author xxx
* @since 2020-10-19
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "McPlain对象")
public class McPlainAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键ID")
private Long id;
@NotNull(message = "飞机类型ID不能为空")
@ApiModelProperty("飞机类型ID")
private Long ptId;
@NotNull(message = "数量不能为空")
@ApiModelProperty("数量")
private Integer amount;
@NotNull(message = "所在地城市ID不能为空")
@ApiModelProperty("所在地城市ID")
private Long cityId;
}
package com.jumeirah.api.merchant.entity.param;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
/**
* 优惠行程表
*
* @author xxx
* @since 2020-10-14
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "StrokeDiscount对象")
public class McStrokeDiscountAddParam extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "出发城市id不能为空")
@ApiModelProperty("出发城市id")
private Long cityOutsetId;
@NotNull(message = "到达城市id不能为空")
@ApiModelProperty("到达城市id")
private Long cityArriveId;
@NotNull(message = "座位数不能为空")
@ApiModelProperty("座位数")
private Integer seatNum;
@NotNull(message = "飞机型号ID不能为空")
@ApiModelProperty("飞机型号ID")
private Long plainTypeId;
@ApiModelProperty("飞机型号名称")
private String plainTypeName;
@ApiModelProperty("价格")
private BigDecimal money;
}
package com.jumeirah.common.controller;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.vo.McPlainQueryVo;
import com.jumeirah.common.service.McPlainService;
import io.geekidea.springbootplus.framework.common.api.ApiResult;
import io.geekidea.springbootplus.framework.common.controller.BaseController;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.validator.groups.Add;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.geekidea.springbootplus.framework.log.annotation.OperationLog;
import io.geekidea.springbootplus.framework.log.enums.OperationLogType;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
/**
* 商家飞机表 控制器
*
* @author xxx
* @since 2020-10-19
*/
/*@Slf4j
@RestController
@RequestMapping("/mcPlain")
@Api(value = "商家飞机表API", tags = {"商家飞机表"})*/
public class McPlainController extends BaseController {
@Autowired
private McPlainService mcPlainService;
/**
* 添加商家飞机表
*/
@PostMapping("/add")
@OperationLog(name = "添加商家飞机表", type = OperationLogType.ADD)
@ApiOperation(value = "添加商家飞机表")
public ApiResult<Boolean> addMcPlain(@Validated(Add.class) @RequestBody McPlain mcPlain) throws Exception {
boolean flag = mcPlainService.saveMcPlain(mcPlain);
return ApiResult.result(flag);
}
/**
* 修改商家飞机表
*/
@PostMapping("/update")
@OperationLog(name = "修改商家飞机表", type = OperationLogType.UPDATE)
@ApiOperation(value = "修改商家飞机表")
public ApiResult<Boolean> updateMcPlain(@Validated(Update.class) @RequestBody McPlain mcPlain) throws Exception {
boolean flag = mcPlainService.updateMcPlain(mcPlain);
return ApiResult.result(flag);
}
/**
* 删除商家飞机表
*/
@PostMapping("/delete/{id}")
@OperationLog(name = "删除商家飞机表", type = OperationLogType.DELETE)
@ApiOperation(value = "删除商家飞机表")
public ApiResult<Boolean> deleteMcPlain(@PathVariable("id") Long id) throws Exception {
boolean flag = mcPlainService.deleteMcPlain(id);
return ApiResult.result(flag);
}
/**
* 获取商家飞机表详情
*/
@GetMapping("/info/{id}")
@OperationLog(name = "商家飞机表详情", type = OperationLogType.INFO)
@ApiOperation(value = "商家飞机表详情")
public ApiResult<McPlainQueryVo> getMcPlain(@PathVariable("id") Long id) throws Exception {
McPlainQueryVo mcPlainQueryVo = mcPlainService.getMcPlainById(id);
return ApiResult.ok(mcPlainQueryVo);
}
/**
* 商家飞机表分页列表
*/
@PostMapping("/getPageList")
@OperationLog(name = "商家飞机表分页列表", type = OperationLogType.PAGE)
@ApiOperation(value = "商家飞机表分页列表")
public ApiResult<Paging<McPlainQueryVo>> getMcPlainPageList(@Validated @RequestBody McPlainPageParam mcPlainPageParam) throws Exception {
Paging<McPlainQueryVo> paging = mcPlainService.getMcPlainPageList(mcPlainPageParam);
return ApiResult.ok(paging);
}
}
package com.jumeirah.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.geekidea.springbootplus.framework.common.entity.BaseEntity;
import io.geekidea.springbootplus.framework.core.validator.groups.Update;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.sql.Timestamp;
/**
* 商家飞机表
*
* @author xxx
* @since 2020-10-19
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "McPlain对象")
public class McPlain extends BaseEntity {
private static final long serialVersionUID = 1L;
@NotNull(message = "id不能为空", groups = {Update.class})
@ApiModelProperty("主键ID")
@TableId(value = "id", type = IdType.AUTO)
private Long id;
@NotNull(message = "飞机类型ID不能为空")
@ApiModelProperty("飞机类型ID")
private Long ptId;
@NotNull(message = "状态,0-正常,1-禁用,99-删除不能为空")
@ApiModelProperty("状态,0-正常,1-禁用,99-删除")
private Integer status;
@NotNull(message = "创建时间(时间戳)不能为空")
@ApiModelProperty("创建时间(时间戳)")
private Timestamp createTime;
@ApiModelProperty("更新时间(时间戳)")
private Timestamp updateTime;
@NotNull(message = "商家ID不能为空")
@ApiModelProperty("商家ID")
private Long mcId;
@NotNull(message = "数量不能为空")
@ApiModelProperty("数量")
private Integer amount;
@NotNull(message = "所在地城市ID不能为空")
@ApiModelProperty("所在地城市ID")
private Long cityId;
}
package com.jumeirah.common.enums;
import io.geekidea.springbootplus.framework.common.enums.BaseEnum;
import lombok.AllArgsConstructor;
import lombok.Getter;
/**
* 状态,0-正常,1-完成,99-删除
*/
@Getter
@AllArgsConstructor
public enum StrokeDiscountStatusEnum implements BaseEnum {
OK(0, "正常"),
COMPLETE(1, "完成"),
CANCEL(99, "取消");
/**
* 编号
*/
private final Integer code;
/**
* 名称
*/
private final String desc;
}
package com.jumeirah.common.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.vo.McPlainQueryVo;
import org.springframework.stereotype.Repository;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import java.io.Serializable;
/**
* 商家飞机表 Mapper 接口
*
* @author xxx
* @since 2020-10-19
*/
@Repository
public interface McPlainMapper extends BaseMapper<McPlain> {
/**
* 根据ID获取查询对象
*
* @param id
* @return
*/
McPlainQueryVo getMcPlainById(Serializable id);
/**
* 获取分页对象
*
* @param page
* @param mcPlainPageParam
* @return
*/
IPage<McPlainQueryVo> getMcPlainPageList(@Param("page") Page page, @Param("param") McPlainPageParam mcPlainPageParam);
}
package com.jumeirah.common.param;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import io.geekidea.springbootplus.framework.core.pagination.BasePageOrderParam;
/**
* <pre>
* 商家飞机表 分页参数对象
* </pre>
*
* @author xxx
* @date 2020-10-19
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "商家飞机表分页参数")
public class McPlainPageParam extends BasePageOrderParam {
private static final long serialVersionUID = 1L;
}
...@@ -28,6 +28,9 @@ public class McStrokePageParam extends BasePageOrderParam { ...@@ -28,6 +28,9 @@ public class McStrokePageParam extends BasePageOrderParam {
@ApiModelProperty("主键id") @ApiModelProperty("主键id")
private Long id; private Long id;
@ApiModelProperty("状态,-1全部,0-审核中,1-进行中,2-已完成,99-取消")
private Integer status;
@ApiModelProperty("开始时间") @ApiModelProperty("开始时间")
private String startTime; private String startTime;
......
package com.jumeirah.common.service;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.param.McPlainPageParam;
import io.geekidea.springbootplus.framework.common.service.BaseService;
import com.jumeirah.common.vo.McPlainQueryVo;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
/**
* 商家飞机表 服务类
*
* @author xxx
* @since 2020-10-19
*/
public interface McPlainService extends BaseService<McPlain> {
/**
* 保存
*
* @param mcPlain
* @return
* @throws Exception
*/
boolean saveMcPlain(McPlain mcPlain) throws Exception;
/**
* 修改
*
* @param mcPlain
* @return
* @throws Exception
*/
boolean updateMcPlain(McPlain mcPlain) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteMcPlain(Long id) throws Exception;
/**
* 根据ID获取查询对象
*
* @param id
* @return
* @throws Exception
*/
McPlainQueryVo getMcPlainById(Long id) throws Exception;
/**
* 获取分页对象
*
* @param mcPlainPageParam
* @return
* @throws Exception
*/
Paging<McPlainQueryVo> getMcPlainPageList(McPlainPageParam mcPlainPageParam) throws Exception;
}
package com.jumeirah.common.service.impl;
import com.jumeirah.common.entity.McPlain;
import com.jumeirah.common.mapper.McPlainMapper;
import com.jumeirah.common.service.McPlainService;
import com.jumeirah.common.param.McPlainPageParam;
import com.jumeirah.common.vo.McPlainQueryVo;
import io.geekidea.springbootplus.framework.common.service.impl.BaseServiceImpl;
import io.geekidea.springbootplus.framework.core.pagination.Paging;
import io.geekidea.springbootplus.framework.core.pagination.PageInfo;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.metadata.OrderItem;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.transaction.annotation.Transactional;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
/**
* 商家飞机表 服务实现类
*
* @author xxx
* @since 2020-10-19
*/
@Slf4j
@Service
public class McPlainServiceImpl extends BaseServiceImpl<McPlainMapper, McPlain> implements McPlainService {
@Autowired
private McPlainMapper mcPlainMapper;
@Transactional(rollbackFor = Exception.class)
@Override
public boolean saveMcPlain(McPlain mcPlain) throws Exception {
return super.save(mcPlain);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean updateMcPlain(McPlain mcPlain) throws Exception {
return super.updateById(mcPlain);
}
@Transactional(rollbackFor = Exception.class)
@Override
public boolean deleteMcPlain(Long id) throws Exception {
return super.removeById(id);
}
@Override
public McPlainQueryVo getMcPlainById(Long id) throws Exception {
return mcPlainMapper.getMcPlainById(id);
}
@Override
public Paging<McPlainQueryVo> getMcPlainPageList(McPlainPageParam mcPlainPageParam) throws Exception {
Page<McPlainQueryVo> page = new PageInfo<>(mcPlainPageParam, OrderItem.desc(getLambdaColumn(McPlain::getCreateTime)));
IPage<McPlainQueryVo> iPage = mcPlainMapper.getMcPlainPageList(page, mcPlainPageParam);
return new Paging<McPlainQueryVo>(iPage);
}
}
package com.jumeirah.common.service.impl; package com.jumeirah.common.service.impl;
import com.jumeirah.common.entity.StrokeDiscount; import com.jumeirah.common.entity.StrokeDiscount;
import com.jumeirah.common.enums.StrokeDiscountStatusEnum;
import com.jumeirah.common.mapper.StrokeDiscountMapper; import com.jumeirah.common.mapper.StrokeDiscountMapper;
import com.jumeirah.common.service.StrokeDiscountService; import com.jumeirah.common.service.StrokeDiscountService;
import com.jumeirah.common.param.StrokeDiscountPageParam; import com.jumeirah.common.param.StrokeDiscountPageParam;
...@@ -44,7 +45,10 @@ public class StrokeDiscountServiceImpl extends BaseServiceImpl<StrokeDiscountMap ...@@ -44,7 +45,10 @@ public class StrokeDiscountServiceImpl extends BaseServiceImpl<StrokeDiscountMap
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
@Override @Override
public boolean deleteStrokeDiscount(Long id) throws Exception { public boolean deleteStrokeDiscount(Long id) throws Exception {
return super.removeById(id); StrokeDiscount strokeDiscount = new StrokeDiscount();
strokeDiscount.setId(id)
.setStatus(StrokeDiscountStatusEnum.CANCEL.getCode());
return super.updateById(strokeDiscount);
} }
@Override @Override
......
package com.jumeirah.common.vo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import java.io.Serializable;
/**
* <pre>
* 商家飞机表 查询结果对象
* </pre>
*
* @author xxx
* @date 2020-10-19
*/
@Data
@Accessors(chain = true)
@ApiModel(value = "McPlainQueryVo对象")
public class McPlainQueryVo implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty("主键ID")
private Long id;
@ApiModelProperty("飞机类型ID")
private Long ptId;
@ApiModelProperty("飞机类型名称")
private String ptName;
@ApiModelProperty("状态,0-正常,1-禁用,99-删除")
private Integer status;
@ApiModelProperty("创建时间(时间戳)")
private Long createTime;
@ApiModelProperty("更新时间(时间戳)")
private Long updateTime;
@ApiModelProperty("商家ID")
private Long mcId;
@ApiModelProperty("数量")
private Integer amount;
@ApiModelProperty("所在地城市ID")
private Long cityId;
@ApiModelProperty("所在地城市名称")
private String cityName;
@ApiModelProperty("飞机图片地址")
private String imgUrl;
}
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jumeirah.common.mapper.McPlainMapper">
<!-- 通用查询结果列 -->
<sql id="Base_Column_List">
id,
pt_id,
status,
create_time,
update_time,
mc_id,
amount,
city_id
</sql>
<select id="getMcPlainById" resultType="com.jumeirah.common.vo.McPlainQueryVo">
select
<include refid="Base_Column_List"/>
from mc_plain where id = #{id}
</select>
<select id="getMcPlainPageList" parameterType="com.jumeirah.common.param.McPlainPageParam"
resultType="com.jumeirah.common.vo.McPlainQueryVo">
select
pt.name as pt_name,
pt.img_url,
ctc.city_name_cn as city_name,
mp.*
from mc_plain mp
left join plain_type pt on pt.id = mp.pt_id
left join city_three_code ctc on ctc.id = mp.city_id
</select>
</mapper>
...@@ -128,6 +128,9 @@ ...@@ -128,6 +128,9 @@
LEFT JOIN app_user au ON au.id = s.user_id LEFT JOIN app_user au ON au.id = s.user_id
LEFT JOIN plain_type pt ON pt.id = s.plain_type_id LEFT JOIN plain_type pt ON pt.id = s.plain_type_id
<where> <where>
<if test="mcStrokePageParam.status != null and mcStrokePageParam.status != -1">
AND s.status = #{mcStrokePageParam.status}
</if>
<if test="mcStrokePageParam.type != null and mcStrokePageParam.type != -1"> <if test="mcStrokePageParam.type != null and mcStrokePageParam.type != -1">
AND s.type = #{mcStrokePageParam.type} AND s.type = #{mcStrokePageParam.type}
</if> </if>
......
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