Ver código fonte

岗位目录管理

stjdydayou 4 anos atrás
pai
commit
93b63477fb

+ 9 - 0
src/main/java/com/zhiqiyun/open/core/mapper/cultural/tourism/OccupationInfoMapper.java

@@ -0,0 +1,9 @@
+package com.zhiqiyun.open.core.mapper.cultural.tourism;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.zhiqiyun.open.core.models.cultural.tourism.OccupationInfo;
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface OccupationInfoMapper extends BaseMapper<OccupationInfo> {
+}

+ 23 - 0
src/main/java/com/zhiqiyun/open/core/models/cultural/tourism/OccupationInfo.java

@@ -0,0 +1,23 @@
+package com.zhiqiyun.open.core.models.cultural.tourism;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.Date;
+
+@Data
+@TableName("cultural_tourism_occupation_info")
+public class OccupationInfo implements Serializable {
+
+    private static final long serialVersionUID = -1387167827315361132L;
+
+    private Long id;
+    private String name;
+    private String remark;
+
+    private Date createdTime;
+    private Long createdBy;
+    private Date updatedTime;
+    private Long updatedBy;
+}

+ 7 - 0
src/main/java/com/zhiqiyun/open/core/service/OccupationInfoService.java

@@ -0,0 +1,7 @@
+package com.zhiqiyun.open.core.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.zhiqiyun.open.core.models.cultural.tourism.OccupationInfo;
+
+public interface OccupationInfoService extends IService<OccupationInfo> {
+}

+ 11 - 0
src/main/java/com/zhiqiyun/open/core/service/impl/OccupationInfoServiceImpl.java

@@ -0,0 +1,11 @@
+package com.zhiqiyun.open.core.service.impl;
+
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.zhiqiyun.open.core.mapper.cultural.tourism.OccupationInfoMapper;
+import com.zhiqiyun.open.core.models.cultural.tourism.OccupationInfo;
+import com.zhiqiyun.open.core.service.OccupationInfoService;
+import org.springframework.stereotype.Service;
+
+@Service
+public class OccupationInfoServiceImpl extends ServiceImpl<OccupationInfoMapper, OccupationInfo> implements OccupationInfoService {
+}

+ 101 - 0
src/main/java/com/zhiqiyun/open/mvc/controller/OccupationInfoController.java

@@ -0,0 +1,101 @@
+package com.zhiqiyun.open.mvc.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.cultural.tourism.OccupationInfo;
+import com.zhiqiyun.open.core.models.user.OauthInfo;
+import com.zhiqiyun.open.core.service.OauthService;
+import com.zhiqiyun.open.core.service.OccupationInfoService;
+import com.zhiqiyun.open.core.service.SequenceService;
+import com.zhiqiyun.open.mvc.Result;
+import com.zhiqiyun.open.mvc.params.cultural.tourism.QueryOccupationInfoParam;
+import com.zhiqiyun.open.mvc.params.cultural.tourism.SaveOccupationInfoParam;
+import com.zhiqiyun.open.utils.DateUtil;
+import com.zhiqiyun.open.utils.ServletContext;
+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("/cultural/tourism/occupation")
+public class OccupationInfoController {
+
+    @Autowired
+    private OccupationInfoService occupationInfoService;
+
+    @Autowired
+    private SequenceService sequenceService;
+
+    @Autowired
+    private OauthService oauthService;
+
+    @Permission(value = "cultural.tourism.occupation.find", tags = "查询文旅岗位目录")
+    @PostMapping("/findPage")
+    public Result findPage(@RequestBody QueryOccupationInfoParam param) {
+
+        QueryWrapper<OccupationInfo> wrapper = new QueryWrapper<>();
+
+        if (StringUtils.isNotBlank(param.getName())) {
+            wrapper.like("name", param.getName());
+        }
+        Page<OccupationInfo> page = param.getPage();
+        page.addOrder(OrderItem.desc("id"));
+
+        Page<OccupationInfo> resultData = this.occupationInfoService.page(page, wrapper);
+
+        return Result.instance(Result.Code.SUCCESS).setData(resultData);
+    }
+
+    @Permission(value = "cultural.tourism.occupation.add", tags = "新建文旅岗位目录")
+    @PostMapping("/save")
+    public Result save(@Valid @RequestBody SaveOccupationInfoParam param) throws Exception {
+
+        OccupationInfo entity = new OccupationInfo();
+        BeanUtils.copyProperties(param, entity);
+
+        OauthInfo oauthInfo = this.oauthService.getAuth(ServletContext.getAccessToken());
+
+        entity.setCreatedTime(DateUtil.current());
+        entity.setCreatedBy(oauthInfo.getId());
+
+        entity.setUpdatedTime(DateUtil.current());
+        entity.setUpdatedBy(oauthInfo.getId());
+        entity.setId(this.sequenceService.nextId());
+
+        this.occupationInfoService.save(entity);
+
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+
+    @Permission(value = "cultural.tourism.occupation.edit", tags = "更新文旅岗位目录")
+    @PostMapping("/updateById")
+    public Result updateById(Long id, @Valid @RequestBody SaveOccupationInfoParam param) {
+        OccupationInfo entity = new OccupationInfo();
+        BeanUtils.copyProperties(param, entity);
+
+        OauthInfo oauthInfo = this.oauthService.getAuth(ServletContext.getAccessToken());
+        entity.setUpdatedBy(oauthInfo.getId());
+        entity.setUpdatedTime(DateUtil.current());
+        entity.setId(id);
+
+        this.occupationInfoService.updateById(entity);
+
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+
+    @Permission(value = "cultural.tourism.occupation.delete", tags = "删除文旅岗位目录")
+    @PostMapping("/deleteByIds")
+    public Result deleteByIds(@RequestBody List<Long> ids) {
+        this.occupationInfoService.removeByIds(ids);
+        return Result.instance(Result.Code.MESSAGE_SUCCESS);
+    }
+}

+ 11 - 0
src/main/java/com/zhiqiyun/open/mvc/params/cultural/tourism/QueryOccupationInfoParam.java

@@ -0,0 +1,11 @@
+package com.zhiqiyun.open.mvc.params.cultural.tourism;
+
+import com.zhiqiyun.open.mvc.params.QueryPageParams;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+@EqualsAndHashCode(callSuper = true)
+@Data
+public class QueryOccupationInfoParam extends QueryPageParams {
+    private String name;
+}

+ 11 - 0
src/main/java/com/zhiqiyun/open/mvc/params/cultural/tourism/SaveOccupationInfoParam.java

@@ -0,0 +1,11 @@
+package com.zhiqiyun.open.mvc.params.cultural.tourism;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class SaveOccupationInfoParam {
+    private String name;
+    private String remark;
+}

+ 31 - 10
src/main/resources/db/migration/V1.0.6__cultural_tourism.sql

@@ -4,18 +4,18 @@ DROP TABLE IF EXISTS `cultural_tourism_organization_info`;
 CREATE TABLE `cultural_tourism_organization_info`
 (
     `id`                     BIGINT(20) NOT NULL COMMENT 'ID',
-    `name`                   VARCHAR(50)    NOT NULL COMMENT '公司名称' COLLATE 'utf8mb4_general_ci',
-    `social_code`            VARCHAR(50)    NOT NULL COMMENT '统一社会信用编码' COLLATE 'utf8mb4_general_ci',
-    `business_license`       VARCHAR(100)   NOT NULL COMMENT '公司的营业执照' COLLATE 'utf8mb4_general_ci',
-    `legal_person_name`      VARCHAR(32)    NOT NULL COMMENT '法人姓名' COLLATE 'utf8mb4_general_ci',
-    `legal_person_id_card_a` VARCHAR(100)   NOT NULL COMMENT '法人身份证正面' COLLATE 'utf8mb4_general_ci',
-    `legal_person_id_card_b` VARCHAR(100)   NOT NULL COMMENT '法人身份证反面' COLLATE 'utf8mb4_general_ci',
-    `contacts`               VARCHAR(32)    NOT NULL COMMENT '联系人' COLLATE 'utf8mb4_general_ci',
-    `contact_number`         VARCHAR(32)    NOT NULL COMMENT '联系电话' COLLATE 'utf8mb4_general_ci',
-    `contact_address`        VARCHAR(100)   NOT NULL COMMENT '联系地址' COLLATE 'utf8mb4_general_ci',
+    `name`                   VARCHAR(50)    NOT NULL COMMENT '公司名称',
+    `social_code`            VARCHAR(50)    NOT NULL COMMENT '统一社会信用编码',
+    `business_license`       VARCHAR(100)   NOT NULL COMMENT '公司的营业执照',
+    `legal_person_name`      VARCHAR(32)    NOT NULL COMMENT '法人姓名',
+    `legal_person_id_card_a` VARCHAR(100)   NOT NULL COMMENT '法人身份证正面',
+    `legal_person_id_card_b` VARCHAR(100)   NOT NULL COMMENT '法人身份证反面',
+    `contacts`               VARCHAR(32)    NOT NULL COMMENT '联系人',
+    `contact_number`         VARCHAR(32)    NOT NULL COMMENT '联系电话',
+    `contact_address`        VARCHAR(100)   NOT NULL COMMENT '联系地址',
     `lng`                    DECIMAL(20, 6) NOT NULL DEFAULT '0.000000' COMMENT '经度(坐标)',
     `lat`                    DECIMAL(20, 6) NOT NULL DEFAULT '0.000000' COMMENT '纬度(坐标)',
-    `remark`                 VARCHAR(200) NULL DEFAULT NULL COMMENT '公司备注说明' COLLATE 'utf8mb4_general_ci',
+    `remark`                 VARCHAR(200) NULL DEFAULT NULL COMMENT '公司备注说明',
     `created_time`           DATETIME NULL DEFAULT NULL COMMENT '创建时间',
     `created_by`             BIGINT(20) NULL DEFAULT NULL COMMENT '创建人',
     `updated_time`           DATETIME NULL DEFAULT NULL COMMENT '修改时间',
@@ -31,3 +31,24 @@ VALUES (2200, 0, 'cultural.tourism.organization', '文旅机构管理'),
        (2203, 2200, 'cultural.tourism.organization.edit', '修改'),
        (2204, 2200, 'cultural.tourism.organization.delete', '删除');
 
+
+DROP TABLE IF EXISTS `cultural_tourism_occupation_info`;
+CREATE TABLE `cultural_tourism_occupation_info`
+(
+    `id`           BIGINT(20) NOT NULL COMMENT 'ID',
+    `name`         VARCHAR(50) NOT NULL COMMENT '岗位目录名称',
+    `remark`       TEXT        NOT NULL COMMENT '备注说明',
+    `created_time` DATETIME NULL DEFAULT NULL COMMENT '创建时间',
+    `created_by`   BIGINT(20) NULL DEFAULT NULL COMMENT '创建人',
+    `updated_time` DATETIME NULL DEFAULT NULL COMMENT '修改时间',
+    `updated_by`   BIGINT(20) NULL DEFAULT NULL COMMENT '修改人',
+    PRIMARY KEY (`id`)
+) COMMENT ='文旅岗位目录管理' ENGINE = InnoDB;
+
+REPLACE
+INTO `authority_info` (`id`, `parent_id`, `name`, `remark`)
+VALUES (2300, 0, 'cultural.tourism.occupation', '文旅岗位目录管理'),
+       (2301, 2300, 'cultural.tourism.occupation.find', '查询'),
+       (2302, 2300, 'cultural.tourism.occupation.add', '添加'),
+       (2303, 2300, 'cultural.tourism.occupation.edit', '修改'),
+       (2304, 2300, 'cultural.tourism.occupation.delete', '删除');