-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
294 additions
and
332 deletions.
There are no files selected for viewing
90 changes: 90 additions & 0 deletions
90
trip-web-server/trip-web-api/src/main/java/cn/zm/trip/restful/BaseScenicSpotController.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package cn.zm.trip.restful; | ||
|
||
import cn.zm.common.base.ResResult; | ||
import cn.zm.mybatis.base.BaseController; | ||
import cn.zm.trip.entity.dto.BaseScenicSpotDTO; | ||
import cn.zm.trip.entity.vo.BaseScenicSpotVO; | ||
import cn.zm.trip.service.IBaseScenicSpotService; | ||
import org.springframework.web.bind.annotation.RestController; | ||
import com.baomidou.mybatisplus.core.metadata.IPage; | ||
import io.swagger.annotations.ApiImplicitParam; | ||
import io.swagger.annotations.ApiImplicitParams; | ||
import io.swagger.annotations.ApiOperation; | ||
import io.swagger.annotations.Api; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.bind.annotation.*; | ||
import javax.annotation.Resource; | ||
import java.util.Objects; | ||
import java.util.List; | ||
|
||
/** | ||
* 基础景点 | ||
* @author 十渊 | ||
* @since 2022-07-12 | ||
*/ | ||
@RequestMapping("baseScenicSpot") | ||
@RestController | ||
@Api(tags = "基础景点") | ||
public class BaseScenicSpotController extends BaseController { | ||
|
||
@Resource | ||
private IBaseScenicSpotService baseScenicSpotService; | ||
|
||
@GetMapping | ||
@ApiOperation("基础景点page查询") | ||
@ApiImplicitParams({ | ||
@ApiImplicitParam(name = "page", value = "当前页数", defaultValue = "1"), | ||
@ApiImplicitParam(name = "size", value = "每页个数", defaultValue = "10"), | ||
@ApiImplicitParam(name = "orderByColumn", value = "排序字段"), | ||
@ApiImplicitParam(name = "isDesc", value = "是否降序") | ||
}) | ||
public ResResult<IPage<BaseScenicSpotVO>> getByPage(@Validated BaseScenicSpotDTO baseScenicSpot) { | ||
// TODO 分页查询 | ||
IPage<BaseScenicSpotVO> page = baseScenicSpotService.selectByPage(getPage(), baseScenicSpot); | ||
return ResResult.succ(page); | ||
} | ||
|
||
// @PostMapping("list") | ||
// @ApiOperation("基础景点list查询") | ||
// @ApiImplicitParams({ | ||
// @ApiImplicitParam(name = "orderByColumn", value = "排序字段"), | ||
// @ApiImplicitParam(name = "isDesc", value = "是否降序") | ||
// }) | ||
// public ResResult<List<BaseScenicSpotVO>> list(@Validated @RequestBody BaseScenicSpotDTO baseScenicSpot) { | ||
// // TODO 分页查询 | ||
// IPage<BaseScenicSpotVO> page = baseScenicSpotService.list(getPage(), baseScenicSpot); | ||
// return ResResult.succ(page); | ||
// } | ||
|
||
@GetMapping("{id}") | ||
@ApiOperation("基础景点查询(id)") | ||
public ResResult<BaseScenicSpotVO> get(@PathVariable String id) { | ||
// TODO 查询 | ||
boolean aNull = Objects.isNull(baseScenicSpotService.getById(id)); | ||
return ResResult.succ(aNull ? null : baseScenicSpotService.getById(id).convert()); | ||
} | ||
|
||
@PostMapping | ||
@ApiOperation("基础景点新增") | ||
public ResResult add(@RequestBody @Validated BaseScenicSpotDTO baseScenicSpot) { | ||
// TODO 新增 | ||
baseScenicSpotService.save(baseScenicSpot.convert()); | ||
return ResResult.succ("新增成功"); | ||
} | ||
|
||
@DeleteMapping("{id}") | ||
@ApiOperation("基础景点删除") | ||
public ResResult del(@PathVariable String id) { | ||
// TODO 删除 | ||
baseScenicSpotService.removeById(id); | ||
return ResResult.succ("删除成功"); | ||
} | ||
|
||
@PutMapping | ||
@ApiOperation("基础景点修改") | ||
public ResResult update(@RequestBody @Validated BaseScenicSpotDTO baseScenicSpot) { | ||
// TODO 修改 | ||
baseScenicSpotService.updateById(baseScenicSpot.convert()); | ||
return ResResult.succ("修改成功"); | ||
} | ||
} |
51 changes: 51 additions & 0 deletions
51
trip-web-server/trip-web-entity/src/main/java/cn/zm/trip/entity/BaseScenicSpot.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cn.zm.trip.entity; | ||
|
||
import cn.zm.trip.entity.vo.BaseScenicSpotVO; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
import com.baomidou.mybatisplus.annotation.IdType; | ||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import java.time.LocalDateTime; | ||
import cn.zm.mybatis.utils.ObjectConvert; | ||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
@TableName("base_scenic_spot") | ||
@ApiModel(value="BaseScenicSpot对象", description="基础景点") | ||
public class BaseScenicSpot extends ObjectConvert<BaseScenicSpotVO>{ | ||
@ApiModelProperty(value = "ID") | ||
@TableId(value = "id", type = IdType.AUTO) | ||
private Long id; | ||
@ApiModelProperty(value = "景点信息标题") | ||
private String title; | ||
@ApiModelProperty(value = "景点发布作者ID") | ||
private Long author; | ||
@ApiModelProperty(value = "景点发布作者姓名") | ||
private String authorName; | ||
@ApiModelProperty(value = "景点类型") | ||
private String type; | ||
@ApiModelProperty(value = "景点缩略图") | ||
private String avatar; | ||
@ApiModelProperty(value = "景点联系电话") | ||
private String phone; | ||
@ApiModelProperty(value = "景点级别") | ||
private String level; | ||
@ApiModelProperty(value = "景点门票") | ||
private Double price; | ||
@ApiModelProperty(value = "景点位置") | ||
private String location; | ||
@ApiModelProperty(value = "景点邮政编码") | ||
private String zip; | ||
@ApiModelProperty(value = "景点开放时间") | ||
private String opentime; | ||
@ApiModelProperty(value = "景点信息发布时间") | ||
@TableField("creatTime") | ||
private LocalDateTime creatTime; | ||
@ApiModelProperty(value = "景点描述内容") | ||
private String content; | ||
} | ||
|
51 changes: 51 additions & 0 deletions
51
trip-web-server/trip-web-entity/src/main/java/cn/zm/trip/entity/dto/BaseScenicSpotDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package cn.zm.trip.entity.dto; | ||
|
||
import cn.zm.trip.entity.BaseScenicSpot; | ||
import com.baomidou.mybatisplus.annotation.TableName; | ||
import com.baomidou.mybatisplus.annotation.IdType; | ||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import java.time.LocalDateTime; | ||
import cn.zm.mybatis.utils.ObjectConvert; | ||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
@TableName("base_scenic_spot") | ||
@ApiModel(value="BaseScenicSpotDTO对象", description="基础景点") | ||
public class BaseScenicSpotDTO extends ObjectConvert<BaseScenicSpot>{ | ||
@ApiModelProperty(value = "ID") | ||
@TableId(value = "id", type = IdType.AUTO) | ||
private Long id; | ||
@ApiModelProperty(value = "景点信息标题") | ||
private String title; | ||
@ApiModelProperty(value = "景点发布作者ID") | ||
private Long author; | ||
@ApiModelProperty(value = "景点发布作者姓名") | ||
private String authorName; | ||
@ApiModelProperty(value = "景点类型") | ||
private String type; | ||
@ApiModelProperty(value = "景点缩略图") | ||
private String avatar; | ||
@ApiModelProperty(value = "景点联系电话") | ||
private String phone; | ||
@ApiModelProperty(value = "景点级别") | ||
private String level; | ||
@ApiModelProperty(value = "景点门票") | ||
private Double price; | ||
@ApiModelProperty(value = "景点位置") | ||
private String location; | ||
@ApiModelProperty(value = "景点邮政编码") | ||
private String zip; | ||
@ApiModelProperty(value = "景点开放时间") | ||
private String opentime; | ||
@ApiModelProperty(value = "景点信息发布时间") | ||
@TableField("creatTime") | ||
private LocalDateTime creatTime; | ||
@ApiModelProperty(value = "景点描述内容") | ||
private String content; | ||
} | ||
|
50 changes: 50 additions & 0 deletions
50
trip-web-server/trip-web-entity/src/main/java/cn/zm/trip/entity/vo/BaseScenicSpotVO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package cn.zm.trip.entity.vo; | ||
|
||
import com.baomidou.mybatisplus.annotation.TableName; | ||
import com.baomidou.mybatisplus.annotation.IdType; | ||
import com.baomidou.mybatisplus.annotation.TableId; | ||
import java.time.LocalDateTime; | ||
import cn.zm.mybatis.utils.ObjectConvert; | ||
import com.baomidou.mybatisplus.annotation.TableField; | ||
import io.swagger.annotations.ApiModel; | ||
import io.swagger.annotations.ApiModelProperty; | ||
import lombok.Data; | ||
import lombok.experimental.Accessors; | ||
|
||
@Data | ||
@Accessors(chain = true) | ||
@TableName("base_scenic_spot") | ||
@ApiModel(value="BaseScenicSpotVO对象", description="基础景点") | ||
public class BaseScenicSpotVO { | ||
@ApiModelProperty(value = "ID") | ||
@TableId(value = "id", type = IdType.AUTO) | ||
private Long id; | ||
@ApiModelProperty(value = "景点信息标题") | ||
private String title; | ||
@ApiModelProperty(value = "景点发布作者ID") | ||
private Long author; | ||
@ApiModelProperty(value = "景点发布作者姓名") | ||
private String authorName; | ||
@ApiModelProperty(value = "景点类型") | ||
private String type; | ||
@ApiModelProperty(value = "景点缩略图") | ||
private String avatar; | ||
@ApiModelProperty(value = "景点联系电话") | ||
private String phone; | ||
@ApiModelProperty(value = "景点级别") | ||
private String level; | ||
@ApiModelProperty(value = "景点门票") | ||
private Double price; | ||
@ApiModelProperty(value = "景点位置") | ||
private String location; | ||
@ApiModelProperty(value = "景点邮政编码") | ||
private String zip; | ||
@ApiModelProperty(value = "景点开放时间") | ||
private String opentime; | ||
@ApiModelProperty(value = "景点信息发布时间") | ||
@TableField("creatTime") | ||
private LocalDateTime creatTime; | ||
@ApiModelProperty(value = "景点描述内容") | ||
private String content; | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
trip-web-server/trip-web-mapper/src/main/java/cn/zm/trip/mapper/BaseScenicSpotMapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cn.zm.trip.mapper; | ||
|
||
import cn.zm.trip.entity.BaseScenicSpot; | ||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; | ||
import org.apache.ibatis.annotations.Mapper; | ||
|
||
@Mapper | ||
public interface BaseScenicSpotMapper extends BaseMapper<BaseScenicSpot> { | ||
|
||
} |
71 changes: 0 additions & 71 deletions
71
trip-web-server/trip-web-mapper/src/main/resources/mapper/BaseAccountMapper.xml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.