添加技能字典表
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
package com.ruoyi.cms.controller.cms;
|
||||
|
||||
|
||||
import com.ruoyi.cms.service.BussinessDictJobCategoryService;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.ruoyi.common.core.domain.entity.BussinessDictJobCategory;
|
||||
|
||||
|
||||
/**
|
||||
* 技能字典表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-30 19:25:48
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cms/dict")
|
||||
@Anonymous
|
||||
public class BussinessDictJobCategoryController {
|
||||
@Autowired
|
||||
private BussinessDictJobCategoryService bussinessDictJobCategoryService;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
@GetMapping("/jobCategory")
|
||||
public AjaxResult jobCategory(BussinessDictJobCategory bussinessDictJobCategory){
|
||||
if (!hasAnyQueryCondition(bussinessDictJobCategory)) {
|
||||
return AjaxResult.error("请传递至少一个查询条件(大类、中类、小类、名称),避免数据量过大!");
|
||||
}
|
||||
return AjaxResult.success(bussinessDictJobCategoryService.getList(bussinessDictJobCategory));
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否包含至少一个有效的查询条件
|
||||
*/
|
||||
private boolean hasAnyQueryCondition(BussinessDictJobCategory queryParam) {
|
||||
// 避免空指针(若 queryParam 可能为 null,需先判断)
|
||||
if (queryParam == null) {
|
||||
return false;
|
||||
}
|
||||
// 检查四个字段中是否有非空值
|
||||
return StringUtils.isNotEmpty(queryParam.getLabd())
|
||||
|| StringUtils.isNotEmpty(queryParam.getLabz())
|
||||
|| StringUtils.isNotEmpty(queryParam.getLabx())
|
||||
|| StringUtils.isNotEmpty(queryParam.getName());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.cms.mapper;
|
||||
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.BussinessDictJobCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 技能字典表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-30 19:25:48
|
||||
*/
|
||||
public interface BussinessDictJobCategoryMapper {
|
||||
|
||||
List<BussinessDictJobCategory> getList(BussinessDictJobCategory bussinessDictJobCategory);
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.ruoyi.cms.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.BussinessDictJobCategory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 技能字典表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-30 19:25:48
|
||||
*/
|
||||
public interface BussinessDictJobCategoryService {
|
||||
|
||||
List<BussinessDictJobCategory> getList(BussinessDictJobCategory bussinessDictJobCategory);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.cms.service.impl;
|
||||
|
||||
import com.ruoyi.cms.mapper.BussinessDictJobCategoryMapper;
|
||||
import com.ruoyi.cms.service.BussinessDictJobCategoryService;
|
||||
import com.ruoyi.common.core.domain.entity.BussinessDictJobCategory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class BussinessDictJobCategoryServiceImpl implements BussinessDictJobCategoryService {
|
||||
|
||||
@Autowired
|
||||
BussinessDictJobCategoryMapper bussinessDictJobCategoryMapper;
|
||||
|
||||
public List<BussinessDictJobCategory> getList(BussinessDictJobCategory bussinessDictJobCategory){
|
||||
return bussinessDictJobCategoryMapper.getList(bussinessDictJobCategory);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.ruoyi.cms.mapper.BussinessDictJobCategoryMapper">
|
||||
|
||||
<!-- 可根据自己的需求,是否要使用 -->
|
||||
<resultMap type="bussinessDictJobCategory" id="bussinessDictJobCategoryResult">
|
||||
<result property="id" column="id"/>
|
||||
<result property="labd" column="labd"/>
|
||||
<result property="labz" column="labz"/>
|
||||
<result property="labx" column="labx"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<sql id="selectBussinessDictJobCategoryVo">
|
||||
select id, labd, labz, labx, name, create_by, del_flag from bussiness_dict_job_category
|
||||
</sql>
|
||||
|
||||
<sql id="findPage_where">
|
||||
<where> del_flag='0'
|
||||
<if test="id!=null and id!='' ">
|
||||
and id=#{id}
|
||||
</if>
|
||||
<if test="labd!=null and labd!='' ">
|
||||
and labd=#{labd}
|
||||
</if>
|
||||
<if test="labz!=null and labz!='' ">
|
||||
and labz=#{labz}
|
||||
</if>
|
||||
<if test="labx!=null and labx!='' ">
|
||||
and labx=#{labx}
|
||||
</if>
|
||||
<if test="name!=null and name!='' ">
|
||||
and name like concat('%', CAST(#{name} AS VARCHAR), '%')
|
||||
</if>
|
||||
</where>
|
||||
</sql>
|
||||
|
||||
<select id="getList" resultMap="bussinessDictJobCategoryResult" parameterType="bussinessDictJobCategory">
|
||||
<include refid="selectBussinessDictJobCategoryVo"/>
|
||||
<include refid="findPage_where" />
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
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.ruoyi.common.core.domain.BaseEntity;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 技能字典表
|
||||
*
|
||||
* @author
|
||||
* @email
|
||||
* @date 2025-10-30 19:25:48
|
||||
*/
|
||||
@Data
|
||||
@TableName("bussiness_dict_job_category")
|
||||
public class BussinessDictJobCategory extends BaseEntity {
|
||||
@TableField(exist = false)
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键id
|
||||
*/
|
||||
@TableId(value = "主键id",type = IdType.AUTO)
|
||||
private Long id;
|
||||
/**
|
||||
* 大类
|
||||
*/
|
||||
@ApiModelProperty("大类")
|
||||
private String labd;
|
||||
/**
|
||||
* 中类
|
||||
*/
|
||||
@ApiModelProperty("中类")
|
||||
private String labz;
|
||||
/**
|
||||
* 小类
|
||||
*/
|
||||
@ApiModelProperty("小类")
|
||||
private String labx;
|
||||
/**
|
||||
* 名称
|
||||
*/
|
||||
@ApiModelProperty("名称")
|
||||
private String name;
|
||||
}
|
||||
Reference in New Issue
Block a user