stjdydayou пре 4 година
родитељ
комит
136320a722

+ 41 - 0
src/main/java/com/zhiqiyun/open/core/enmus/SceneryGrade.java

@@ -0,0 +1,41 @@
+package com.zhiqiyun.open.core.enmus;
+
+
+public enum SceneryGrade implements IBaseEnum {
+    /**
+     *
+     */
+    A(1, "A"), AA(2, "AA"), AAA(3, "AAA"), AAAA(4, "AAAA"), AAAAA(5, "AAAAA");
+
+    private final int value;
+    private final String text;
+
+    SceneryGrade(int value, String text) {
+        this.value = value;
+        this.text = text;
+    }
+
+    public static SceneryGrade valueOf(int value) {
+        SceneryGrade[] values = SceneryGrade.values();
+        for (SceneryGrade type : values) {
+            if (type.value == value) {
+                return type;
+            }
+        }
+        return null;
+    }
+
+
+    public String getText() {
+        return text;
+    }
+
+    public Integer getValue() {
+        return value;
+    }
+
+    @Override
+    public String getName() {
+        return this.name();
+    }
+}

+ 10 - 0
src/main/java/com/zhiqiyun/open/core/mapper/SceneryInfoMapper.java

@@ -0,0 +1,10 @@
+package com.zhiqiyun.open.core.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.bz.SceneryInfo;
+import com.zhiqiyun.open.core.models.bz.VenueInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface SceneryInfoMapper extends BaseMapper<SceneryInfo> {
+}

+ 30 - 0
src/main/java/com/zhiqiyun/open/core/models/bz/SceneryInfo.java

@@ -0,0 +1,30 @@
+package com.zhiqiyun.open.core.models.bz;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.zhiqiyun.open.core.enmus.SceneryGrade;
+import com.zhiqiyun.open.core.typeHandler.FastjsonTypeHandler;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+@TableName(value = "bz_scenery_info", autoResultMap = true)
+public class SceneryInfo {
+    @TableId(type = IdType.INPUT)
+    private Long id;
+    private String name;
+    private SceneryGrade grade;
+    @TableField(typeHandler = FastjsonTypeHandler.class)
+    private List<String> litpics;
+    private String brief;
+    private String address;
+    private String contacts;
+    private String contactNumber;
+    private String businessHours;
+    private BigDecimal lng;
+    private BigDecimal lat;
+}

+ 8 - 0
src/main/java/com/zhiqiyun/open/core/service/SceneryInfoService.java

@@ -0,0 +1,8 @@
+package com.zhiqiyun.open.core.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.bz.SceneryInfo;
+import com.zhiqiyun.open.core.models.bz.VenueInfo;
+
+public interface SceneryInfoService extends IService<SceneryInfo> {
+}

+ 14 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/SceneryInfoServiceImpl.java

@@ -0,0 +1,14 @@
+package com.zhiqiyun.open.core.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhiqiyun.open.core.mapper.SceneryInfoMapper;
+import com.zhiqiyun.open.core.mapper.VenueInfoMapper;
+import com.zhiqiyun.open.core.models.bz.SceneryInfo;
+import com.zhiqiyun.open.core.models.bz.VenueInfo;
+import com.zhiqiyun.open.core.service.SceneryInfoService;
+import com.zhiqiyun.open.core.service.VenueInfoService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class SceneryInfoServiceImpl extends ServiceImpl<SceneryInfoMapper, SceneryInfo> implements SceneryInfoService {
+}

+ 98 - 0
src/main/java/com/zhiqiyun/open/mvc/manager/controller/SceneryInfoController.java

@@ -0,0 +1,98 @@
+package com.zhiqiyun.open.mvc.manager.controller;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.OrderItem;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.zhiqiyun.open.annotation.Permission;
+import com.zhiqiyun.open.core.models.bz.SceneryInfo;
+import com.zhiqiyun.open.core.service.SceneryInfoService;
+import com.zhiqiyun.open.core.service.SequenceService;
+import com.zhiqiyun.open.mvc.Result;
+import com.zhiqiyun.open.mvc.manager.params.QuerySceneryInfoParams;
+import com.zhiqiyun.open.mvc.manager.params.SaveSceneryInfoParams;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+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;
+
+import javax.validation.Valid;
+import java.util.List;
+
+@RestController
+@RequestMapping("/bz/base/scenery")
+public class SceneryInfoController {
+
+    @Autowired
+    private SceneryInfoService sceneryInfoService;
+
+    @Autowired
+    private SequenceService sequenceService;
+
+    @Permission(value = "bz.base.scenery.find", tags = "查询场馆")
+    @PostMapping("/findPage")
+    public Result findPage(@RequestBody QuerySceneryInfoParams params) {
+
+        QueryWrapper<SceneryInfo> queryWrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(params.getContactNumber())) {
+            queryWrapper.like("contact_number", params.getContactNumber());
+        }
+        if (params.getGrade() != null) {
+            queryWrapper.like("grade", params.getGrade());
+        }
+        if (StringUtils.isNotBlank(params.getKeyword())) {
+            queryWrapper.and(true, sceneryInfoQueryWrapper -> {
+                sceneryInfoQueryWrapper.like("name", params.getKeyword());
+                sceneryInfoQueryWrapper.or();
+                sceneryInfoQueryWrapper.like("brief", params.getKeyword());
+                sceneryInfoQueryWrapper.or();
+                sceneryInfoQueryWrapper.like("address", params.getKeyword());
+                sceneryInfoQueryWrapper.or();
+                sceneryInfoQueryWrapper.like("contacts", params.getKeyword());
+            });
+        }
+
+        Page<SceneryInfo> page = params.getPage();
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<SceneryInfo> resultData = this.sceneryInfoService.page(page, queryWrapper);
+
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+
+    @Permission(value = "bz.base.scenery.add", tags = "保存场馆")
+    @PostMapping("/save")
+    public Result save(@Valid @RequestBody SaveSceneryInfoParams params) {
+
+        SceneryInfo sceneryInfo = new SceneryInfo();
+        BeanUtils.copyProperties(params, sceneryInfo);
+        sceneryInfo.setId(this.sequenceService.nextId());
+        this.sceneryInfoService.save(sceneryInfo);
+
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+
+    @Permission(value = "bz.base.scenery.edit", tags = "编辑场馆")
+    @PostMapping("/updateById")
+    public Result updateById(Long id, @Valid @RequestBody SaveSceneryInfoParams params) {
+
+        SceneryInfo sceneryInfo = new SceneryInfo();
+        BeanUtils.copyProperties(params, sceneryInfo);
+        sceneryInfo.setId(id);
+
+        this.sceneryInfoService.updateById(sceneryInfo);
+
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+
+
+    @Permission(value = "bz.base.scenery.delete", tags = "删除场馆")
+    @PostMapping("/deleteByIds")
+    public Result deleteByIds(@RequestBody List<Long> ids) {
+        this.sceneryInfoService.removeByIds(ids);
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+}

+ 13 - 0
src/main/java/com/zhiqiyun/open/mvc/manager/params/QuerySceneryInfoParams.java

@@ -0,0 +1,13 @@
+package com.zhiqiyun.open.mvc.manager.params;
+
+import com.zhiqiyun.open.core.enmus.SceneryGrade;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class QuerySceneryInfoParams extends QueryPageParams {
+	private String keyword;
+	private String contactNumber;
+	private SceneryGrade grade;
+}

+ 22 - 0
src/main/java/com/zhiqiyun/open/mvc/manager/params/SaveSceneryInfoParams.java

@@ -0,0 +1,22 @@
+package com.zhiqiyun.open.mvc.manager.params;
+
+import com.zhiqiyun.open.core.enmus.SceneryGrade;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.List;
+
+@Data
+public class SaveSceneryInfoParams {
+    private String name;
+    private SceneryGrade grade;
+    private List<String> litpics;
+    private String describe;
+    private String brief;
+    private String address;
+    private String contacts;
+    private String contactNumber;
+    private String businessHours;
+    private BigDecimal lng;
+    private BigDecimal lat;
+}

+ 0 - 0
src/main/resources/db/migration/V1.0.4__bz_tourist_agency_info.sql → src/main/resources/db/migration/V1.0.4__bz_scenery_info.sql