diff --git a/src/main/java/com/ydool/common/constant/UrlConstant.java b/src/main/java/com/ydool/common/constant/UrlConstant.java index f9b2f66..eab50b0 100644 --- a/src/main/java/com/ydool/common/constant/UrlConstant.java +++ b/src/main/java/com/ydool/common/constant/UrlConstant.java @@ -26,6 +26,9 @@ public interface UrlConstant { String MENU = API + "/menu"; + + String JOB = API + "/job"; + String PERSON = API + "/person"; String EXCHANGE = API + "/exchange"; diff --git a/src/main/java/com/ydool/common/gen/Generator.java b/src/main/java/com/ydool/common/gen/Generator.java index daa5261..02d63da 100644 --- a/src/main/java/com/ydool/common/gen/Generator.java +++ b/src/main/java/com/ydool/common/gen/Generator.java @@ -27,7 +27,7 @@ public class Generator { public static void main(String[] args) { //表名 - String tableName = "t_sys_menu"; + String tableName = "t_sys_job"; //表前缀 String tablePrefix = "t_sys_"; //作者— diff --git a/src/main/java/com/ydool/system/controller/JobController.java b/src/main/java/com/ydool/system/controller/JobController.java new file mode 100644 index 0000000..55f951c --- /dev/null +++ b/src/main/java/com/ydool/system/controller/JobController.java @@ -0,0 +1,159 @@ +package com.ydool.system.controller; + +import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; +import com.github.xiaoymin.knife4j.annotations.ApiSupport; +import com.github.xiaoymin.knife4j.annotations.DynamicParameter; +import com.github.xiaoymin.knife4j.annotations.DynamicResponseParameters; +import com.ydool.common.base.BaseController; +import com.ydool.common.constant.UrlConstant; +import com.ydool.common.data.dto.AjaxResult; +import com.ydool.system.entity.Job; +import com.ydool.system.entity.Role; +import com.ydool.system.request.IdsRequest; +import com.ydool.system.request.JobRequest; +import com.ydool.system.request.RoleMenuRequest; +import com.ydool.system.request.RoleRequest; +import com.ydool.system.service.IJobService; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; + +import java.util.List; +import java.util.prefs.BackingStoreException; + +@RestController +@RequestMapping(UrlConstant.JOB) +@Api(tags = "岗位", value = "岗位") +@ApiSupport(order = 10) +public class JobController extends BaseController { + @Autowired + private IJobService jobService; + + /** + * 岗位列表 + * + * @param value + * @param column + * @param orderBy + * @param status + * @return + */ + @GetMapping(value = "list") + @ApiOperation(value = "岗位列表") + @ApiImplicitParams({ + @ApiImplicitParam(name = "current", value = "当前页", dataType = "Integer"), + @ApiImplicitParam(name = "size", value = "每页条数", dataType = "Integer"), + @ApiImplicitParam(name = "value", value = "搜索框中的内容(只支持字符串类型)"), + @ApiImplicitParam(name = "column", value = "排序字段 字段名"), + @ApiImplicitParam(name = "orderBy", value = "排序顺序 降序:desc,升序:asc"), + @ApiImplicitParam(name = "status", value = "启用状态", dataType = "Boolean"), + }) + @ApiOperationSupport( + responses = @DynamicResponseParameters(properties = { + @DynamicParameter(name = "data", dataTypeClass = Job.class) + }), + order = 1 + ) + public AjaxResult jobList(String value, + String column, + String orderBy, + Boolean status + ) { + return jobService.jobList(getPage(), value, column, orderBy, status); + } + + /** + * 岗位详情 + * + * @param id + * @return + */ + @GetMapping(value = "detail") + @ApiOperation(value = "岗位详情") + @ApiOperationSupport( + responses = @DynamicResponseParameters(properties = { + @DynamicParameter(name = "data", dataTypeClass = Job.class) + }), order = 2 + ) + @ApiImplicitParam(name = "id", value = "岗位Id") + public AjaxResult jobDetail(String id) { + return jobService.jobDetail(id); + } + + /** + * 保存岗位 + * + * @param jobRequest + * @return + */ + @PostMapping(value = "save") + @ApiOperation(value = "保存岗位") + @ApiOperationSupport(order = 3) + public AjaxResult saveJob(@RequestBody @Validated JobRequest jobRequest) { + return jobService.saveJob(jobRequest); + } + + /** + * 编辑岗位 + * + * @param id + * @param jobRequest + * @return + */ + @PutMapping(value = "edit") + @ApiOperation(value = "编辑岗位") + @ApiImplicitParam(name = "id", value = "岗位Id") + @ApiOperationSupport(order = 4) + public AjaxResult editJob(String id, @RequestBody @Validated JobRequest jobRequest) { + return jobService.editJob(id, jobRequest); + } + + /** + * 单个删除岗位 + * + * @param id + * @return + */ + @DeleteMapping(value = "remove") + @ApiOperation(value = "删除岗位") + @ApiImplicitParam(name = "id", value = "岗位Id") + @ApiOperationSupport(order = 5) + public AjaxResult removeJob(String id) { + return jobService.removeJob(id); + } + + /** + * 批量删除岗位 + * + * @param ids + * @return + */ + @PostMapping(value = "removeBatch") + @ApiOperation(value = "批量删除岗位") + @ApiOperationSupport(order = 6) + public AjaxResult removeJobs(@RequestBody @Validated IdsRequest ids) { + return jobService.removeJobs(ids); + } + + + + /** + * 岗位列表下拉框 + * + * @return + */ + @GetMapping(value = "jobs") + @ApiOperation(value = "岗位列表下拉框") + @ApiOperationSupport( + responses = @DynamicResponseParameters(properties = { + @DynamicParameter(name = "data", dataTypeClass = Job.class) + }), order = 7 + ) + public AjaxResult jobs() { + return jobService.jobs(); + } +} diff --git a/src/main/java/com/ydool/system/dto/UserDto.java b/src/main/java/com/ydool/system/dto/UserDto.java index 14dbf7b..6a18cb7 100644 --- a/src/main/java/com/ydool/system/dto/UserDto.java +++ b/src/main/java/com/ydool/system/dto/UserDto.java @@ -12,4 +12,7 @@ public class UserDto extends User { @ApiModelProperty(value = "角色名称") private String rolesName; + + @ApiModelProperty(value = "岗位名称") + private String jobName; } diff --git a/src/main/java/com/ydool/system/entity/Job.java b/src/main/java/com/ydool/system/entity/Job.java new file mode 100644 index 0000000..7c3ab3d --- /dev/null +++ b/src/main/java/com/ydool/system/entity/Job.java @@ -0,0 +1,41 @@ +package com.ydool.system.entity; +import com.baomidou.mybatisplus.annotation.TableName; +import com.ydool.common.base.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +/** + *
+ * 系统岗位 + *
+ * + * @author ljq + * @since 2023-02-08 + */ +@Data +@EqualsAndHashCode(callSuper = true) +@Accessors(chain = true) +@TableName("t_sys_job") +@ApiModel(value="Job对象", description="系统岗位") +public class Job extends BaseEntity{ + + private static final long serialVersionUID = 1L; + + @ApiModelProperty(value = "岗位编码") + private String code; + + @ApiModelProperty(value = "岗位名称") + private String name; + + @ApiModelProperty(value = "排序") + private Integer sortNo; + + @ApiModelProperty(value = "启用状态") + private Boolean status; + + @ApiModelProperty(value = "备注") + private String remarks; + +} diff --git a/src/main/java/com/ydool/system/entity/User.java b/src/main/java/com/ydool/system/entity/User.java index 378d3f3..cc3f5b6 100644 --- a/src/main/java/com/ydool/system/entity/User.java +++ b/src/main/java/com/ydool/system/entity/User.java @@ -70,4 +70,7 @@ public class User extends BaseEntity{ @ApiModelProperty(value = "备注") private String remarks; + @ApiModelProperty(value = "岗位") + private String job; + } diff --git a/src/main/java/com/ydool/system/mapper/JobMapper.java b/src/main/java/com/ydool/system/mapper/JobMapper.java new file mode 100644 index 0000000..8f96485 --- /dev/null +++ b/src/main/java/com/ydool/system/mapper/JobMapper.java @@ -0,0 +1,18 @@ +package com.ydool.system.mapper; + +import com.ydool.system.entity.Job; +import com.github.yulichang.base.MPJBaseMapper; +import org.apache.ibatis.annotations.Mapper; + +/** + *+ * 系统岗位 Mapper 接口 + *
+ * + * @author ljq + * @since 2023-02-08 + */ +@Mapper +public interface JobMapper extends MPJBaseMapper+ * 系统岗位 服务类 + *
+ * + * @author ljq + * @since 2023-02-08 + */ +public interface IJobService { + + /** + * 保存岗位 + * @param jobRequest + * @return + */ + AjaxResult saveJob(JobRequest jobRequest); + + + /** + * 编辑岗位 + * @param id + * @param jobRequest + * @return + */ + AjaxResult editJob(String id,JobRequest jobRequest); + + /** + * 删除岗位 + * + * @param id + * @return + */ + AjaxResult removeJob(String id); + + /** + * 批量删除岗位 + * @param ids + * @return + */ + AjaxResult removeJobs(IdsRequest ids); + + /** + * 岗位详情 + * @param id + * @return + */ + AjaxResult jobDetail(String id); + + /** + * 岗位列表 + * @param page + * @param value + * @param column + * @param orderBy + * @param status + * @return + */ + AjaxResult jobList(Page page, String value, String column, String orderBy, Boolean status); + + + /** + * 岗位列表 + * @return + */ + AjaxResult jobs(); + +} + diff --git a/src/main/java/com/ydool/system/service/impl/JobServiceImpl.java b/src/main/java/com/ydool/system/service/impl/JobServiceImpl.java new file mode 100644 index 0000000..6a65f1c --- /dev/null +++ b/src/main/java/com/ydool/system/service/impl/JobServiceImpl.java @@ -0,0 +1,184 @@ +package com.ydool.system.service.impl; + +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.util.ArrayUtil; +import cn.hutool.core.util.ObjUtil; +import cn.hutool.core.util.ObjectUtil; +import cn.hutool.core.util.StrUtil; +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.ydool.common.base.BaseService; +import com.ydool.common.data.dto.AjaxResult; +import com.ydool.system.entity.Job; +import com.ydool.system.entity.Role; +import com.ydool.system.mapper.JobMapper; +import com.ydool.system.request.IdsRequest; +import com.ydool.system.request.JobRequest; +import com.ydool.system.service.IJobService; +import org.springframework.stereotype.Service; + +import java.util.Arrays; +import java.util.List; + +/** + *+ * 系统岗位 服务类 + *
+ * + * @author ljq + * @since 2023-02-08 + */ +@Service +public class JobServiceImpl extends BaseService