mirror of
https://github.com/WeiYe-Jing/datax-web.git
synced 2026-07-03 21:08:58 +08:00
任务管理表增加jobGroup字段,service层,controller修改;
This commit is contained in:
parent
c355fcac04
commit
cc79d8a3de
@ -1,51 +1,99 @@
|
||||
package com.wugui.dataxweb.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.api.ApiController;
|
||||
import com.baomidou.mybatisplus.extension.api.R;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
import com.wugui.dataxweb.service.JobConfigService;
|
||||
import com.wugui.dataxweb.service.IJobConfigService;
|
||||
import com.wugui.dataxweb.util.PageUtils;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 作业配置表控制层
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* 作业配置表控制器层
|
||||
* @author zhouhongfa@gz-yibo.com
|
||||
* @since 2019-06-17
|
||||
* @version v1.0
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("api/jobConfig")
|
||||
@Api(tags = "作业配置表控制层")
|
||||
@RequestMapping("/api/jobConfig")
|
||||
@Api(tags = "作业配置表接口")
|
||||
public class JobConfigController extends ApiController {
|
||||
/**
|
||||
* 服务对象
|
||||
*/
|
||||
@Autowired
|
||||
private JobConfigService jobConfigServiceImpl;
|
||||
private IJobConfigService jobConfigService;
|
||||
|
||||
/**
|
||||
* 分页查询所有数据
|
||||
*
|
||||
* @param page 分页对象
|
||||
* @param jobConfig 查询实体
|
||||
* @return 所有数据
|
||||
*/
|
||||
@GetMapping
|
||||
@ApiOperation("分页查询所有数据")
|
||||
public R selectAll(Page<JobConfig> page, JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.page(page, new QueryWrapper<>(jobConfig)));
|
||||
@ApiImplicitParams(
|
||||
{@ApiImplicitParam(paramType = "query", dataType = "String", name = "current", value = "当前页", defaultValue = "1", required = true),
|
||||
@ApiImplicitParam(paramType = "query", dataType = "String", name = "size", value = "一页大小", defaultValue = "10", required = true),
|
||||
@ApiImplicitParam(paramType = "query", dataType = "Boolean", name = "ifCount", value = "是否查询总数", defaultValue = "true"),
|
||||
@ApiImplicitParam(paramType = "query", dataType = "String", name = "ascs", value = "升序字段,多个用逗号分隔"),
|
||||
@ApiImplicitParam(paramType = "query", dataType = "String", name = "descs", value = "降序字段,多个用逗号分隔")
|
||||
})
|
||||
public R<IPage<JobConfig>> selectAll() {
|
||||
BaseForm<JobConfig> baseForm = new BaseForm();
|
||||
return success(this.jobConfigService.page(baseForm.getPlusPagingQueryEntity(), pageQueryWrapperCustom(baseForm.getParameters())));
|
||||
}
|
||||
|
||||
/**
|
||||
* 自定义查询组装
|
||||
*
|
||||
* @param map
|
||||
* @return
|
||||
*/
|
||||
protected QueryWrapper<JobConfig> pageQueryWrapperCustom(Map<String, Object> map) {
|
||||
// mybatis plus 分页相关的参数
|
||||
Map<String, Object> pageHelperParams = PageUtils.filterPageParams(map);
|
||||
logger.info("分页相关的参数: {}", pageHelperParams);
|
||||
//过滤空值,分页查询相关的参数
|
||||
Map<String, Object> columnQueryMap = PageUtils.filterColumnQueryParams(map);
|
||||
logger.info("字段查询条件参数为: {}", columnQueryMap);
|
||||
|
||||
QueryWrapper<JobConfig> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
//排序 操作
|
||||
pageHelperParams.forEach((k, v) -> {
|
||||
switch (k) {
|
||||
case "ascs":
|
||||
queryWrapper.orderByAsc(StrUtil.toUnderlineCase(StrUtil.toString(v)));
|
||||
break;
|
||||
case "descs":
|
||||
queryWrapper.orderByDesc(StrUtil.toUnderlineCase(StrUtil.toString(v)));
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
//遍历进行字段查询条件组装
|
||||
columnQueryMap.forEach((k, v) -> {
|
||||
switch (k) {
|
||||
default:
|
||||
queryWrapper.eq(StrUtil.toUnderlineCase(k), v);
|
||||
}
|
||||
});
|
||||
|
||||
return queryWrapper;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 通过主键查询单条数据
|
||||
*
|
||||
@ -55,31 +103,31 @@ public class JobConfigController extends ApiController {
|
||||
@ApiOperation("通过主键查询单条数据")
|
||||
@GetMapping("{id}")
|
||||
public R<JobConfig> selectOne(@PathVariable Serializable id) {
|
||||
return success(this.jobConfigServiceImpl.getById(id));
|
||||
return success(this.jobConfigService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增数据
|
||||
*
|
||||
* @param jobConfig 实体对象
|
||||
* @param entity 实体对象
|
||||
* @return 新增结果
|
||||
*/
|
||||
@ApiOperation("新增数据")
|
||||
@PostMapping
|
||||
public R<Boolean> insert(@RequestBody JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.save(jobConfig));
|
||||
public R<Boolean> insert(@RequestBody JobConfig entity) {
|
||||
return success(this.jobConfigService.save(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改数据
|
||||
*
|
||||
* @param jobConfig 实体对象
|
||||
* @param entity 实体对象
|
||||
* @return 修改结果
|
||||
*/
|
||||
@ApiOperation("修改数据")
|
||||
@PutMapping
|
||||
public R<Boolean> update(@RequestBody JobConfig jobConfig) {
|
||||
return success(this.jobConfigServiceImpl.updateById(jobConfig));
|
||||
@ApiOperation("修改数据")
|
||||
public R<Boolean> update(@RequestBody JobConfig entity) {
|
||||
return success(this.jobConfigService.updateById(entity));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -88,9 +136,9 @@ public class JobConfigController extends ApiController {
|
||||
* @param idList 主键结合
|
||||
* @return 删除结果
|
||||
*/
|
||||
@ApiOperation("删除数据")
|
||||
@DeleteMapping
|
||||
@ApiOperation("删除数据")
|
||||
public R<Boolean> delete(@RequestParam("idList") List<Long> idList) {
|
||||
return success(this.jobConfigServiceImpl.removeByIds(idList));
|
||||
return success(this.jobConfigService.removeByIds(idList));
|
||||
}
|
||||
}
|
||||
@ -2,46 +2,113 @@ package com.wugui.dataxweb.entity;
|
||||
|
||||
import com.alibaba.fastjson.annotation.JSONField;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.extension.activerecord.Model;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 作业配置表实体类(job_config)
|
||||
*
|
||||
* @author zhouhongfa@gz-yibo.com
|
||||
* @version v1.0
|
||||
* @since 2019-06-17
|
||||
*/
|
||||
|
||||
@Data
|
||||
@TableName(value = "job_config")
|
||||
public class JobConfig {
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
@ApiModel
|
||||
@TableName("job_config")
|
||||
public class JobConfig extends Model<JobConfig> {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableId
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer id;
|
||||
|
||||
@TableField(value = "config_json")
|
||||
private String configJson;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "")
|
||||
private Integer userId;
|
||||
|
||||
@TableField(value = "description")
|
||||
private String description;
|
||||
|
||||
@TableField(value = "name")
|
||||
/**
|
||||
* 作业名
|
||||
*/
|
||||
@ApiModelProperty(value = "作业名")
|
||||
private String name;
|
||||
|
||||
@TableField(value = "label")
|
||||
/**
|
||||
* 分组
|
||||
*/
|
||||
@ApiModelProperty(value = "分组")
|
||||
private String jobGroup;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "")
|
||||
private String configJson;
|
||||
|
||||
/**
|
||||
* 作业描述信息
|
||||
*/
|
||||
@ApiModelProperty(value = "作业描述信息")
|
||||
private String description;
|
||||
|
||||
/**
|
||||
* 标签(读插件、写插件)
|
||||
*/
|
||||
@ApiModelProperty(value = "标签(读插件、写插件)")
|
||||
private String label;
|
||||
|
||||
|
||||
@TableField(fill = FieldFill.INSERT) //mp自动填充
|
||||
@JSONField(format = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date createDate;
|
||||
|
||||
@TableField(value = "create_by")
|
||||
private Integer createBy;
|
||||
|
||||
@TableField(value = "update_by")
|
||||
private Integer updateBy;
|
||||
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE) //mp自动填充
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT_UPDATE)
|
||||
@JSONField(format = "yyyy/MM/dd")
|
||||
@ApiModelProperty(value = "", hidden = true)
|
||||
private Date updateDate;
|
||||
|
||||
@TableField(value = "status")
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableLogic
|
||||
@ApiModelProperty(value = "", hidden = true)
|
||||
private Integer status;
|
||||
|
||||
@TableField(value = "user_id")
|
||||
private Integer userID;
|
||||
}
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "", hidden = true)
|
||||
private Integer createBy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@TableField(fill = FieldFill.INSERT)
|
||||
@JSONField(format = "yyyy/MM/dd")
|
||||
@ApiModelProperty(value = "", hidden = true)
|
||||
private Date createDate;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
@ApiModelProperty(value = "", hidden = true)
|
||||
private Integer updateBy;
|
||||
|
||||
|
||||
/**
|
||||
* 获取主键值
|
||||
*
|
||||
* @return 主键值
|
||||
*/
|
||||
@Override
|
||||
protected Serializable pkVal() {
|
||||
return this.id;
|
||||
}
|
||||
}
|
||||
@ -4,11 +4,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
|
||||
/**
|
||||
* datax插件信息表服务接口
|
||||
* @author huzekang@gz-yibo.com
|
||||
* @since 2019-05-20
|
||||
* 作业配置表表服务接口
|
||||
* @author zhouhongfa@gz-yibo.com
|
||||
* @since 2019-06-17
|
||||
* @version v1.0
|
||||
*/
|
||||
public interface JobConfigService extends IService<JobConfig> {
|
||||
public interface IJobConfigService extends IService<JobConfig> {
|
||||
|
||||
}
|
||||
@ -3,9 +3,10 @@ package com.wugui.dataxweb.service.impl;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.wugui.dataxweb.dao.JobConfigMapper;
|
||||
import com.wugui.dataxweb.entity.JobConfig;
|
||||
import com.wugui.dataxweb.service.JobConfigService;
|
||||
import com.wugui.dataxweb.service.IJobConfigService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class JobConfigServiceImpl extends ServiceImpl<JobConfigMapper, JobConfig> implements JobConfigService {
|
||||
public class JobConfigServiceImpl extends ServiceImpl<JobConfigMapper, JobConfig> implements IJobConfigService {
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user