人员资质功能模块完成
This commit is contained in:
parent
716e764689
commit
da92479da0
|
@ -34,4 +34,8 @@ public class Message implements Serializable {
|
||||||
public static final String ROLE_ID_NOT_EXIST_OR_ILLEGAL = "角色id不存在或者不合法";
|
public static final String ROLE_ID_NOT_EXIST_OR_ILLEGAL = "角色id不存在或者不合法";
|
||||||
public static final String MENU_ID_NOT_EXIST = "菜单id不存在";
|
public static final String MENU_ID_NOT_EXIST = "菜单id不存在";
|
||||||
public static final String MENU_ID_NOT_EXIST_OR_ILLEGAL = "菜单id不存在或者不合法";
|
public static final String MENU_ID_NOT_EXIST_OR_ILLEGAL = "菜单id不存在或者不合法";
|
||||||
|
public static final String USER_CERTIFICATION_EXIST = "用户{}已存在{}证书";
|
||||||
|
public static final String CERTIFICATION_TYPE_ILLEGAL = "证书类型不合法";
|
||||||
|
public static final String CERTIFICATION_CODE_EXIST = "证书编码已存在";
|
||||||
|
public static final String CERTIFICATION_ID_NOT_EXIST = "证书id不存在";
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,5 +65,11 @@ public interface Converts {
|
||||||
|
|
||||||
MenuResp toMenuResp(MenuEntity entity);
|
MenuResp toMenuResp(MenuEntity entity);
|
||||||
|
|
||||||
|
CertificationEntity toCertificationEntity(CertificationReq req);
|
||||||
|
|
||||||
|
CertificationResp toCertificationResp(CertificationEntity entity);
|
||||||
|
|
||||||
|
List<CertificationResp> toCertificationResp(List<CertificationEntity> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,62 @@
|
||||||
|
package com.dite.znpt.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.dite.znpt.domain.AuditableEntity;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:15
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@TableName("certification")
|
||||||
|
@ApiModel(value="CertificationEntity对象", description="人员资质")
|
||||||
|
public class CertificationEntity extends AuditableEntity implements Serializable {
|
||||||
|
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -5650015300122333342L;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书id")
|
||||||
|
@TableId(value = "certification_id", type = IdType.ASSIGN_UUID)
|
||||||
|
private String certificationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
@TableField("user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书编号")
|
||||||
|
@TableField("certification_code")
|
||||||
|
private String certificationCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书名称")
|
||||||
|
@TableField("certification_name")
|
||||||
|
private String certificationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书类型")
|
||||||
|
@TableField("certification_type")
|
||||||
|
private String certificationType;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书有效期-起")
|
||||||
|
@TableField("validity_date_begin")
|
||||||
|
private LocalDate validityDateBegin;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书有效期-讫")
|
||||||
|
@TableField("validity_date_end")
|
||||||
|
private LocalDate validityDateEnd;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书图片")
|
||||||
|
@TableField("certification_image")
|
||||||
|
private String certificationImage;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.dite.znpt.domain.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:25
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("人员资质列表请求实体")
|
||||||
|
public class CertificationListReq implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = -2663690591627122279L;
|
||||||
|
|
||||||
|
@ApiModelProperty("姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书名称")
|
||||||
|
private String certificationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书类型")
|
||||||
|
private String certificationType;
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
package com.dite.znpt.domain.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFilter;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import javax.validation.constraints.Size;
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:25
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("人员资质请求实体")
|
||||||
|
public class CertificationReq implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 1737569842748352413L;
|
||||||
|
|
||||||
|
@NotBlank(message = "用户id不能为空")
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@NotBlank(message = "证书名称不能为空")
|
||||||
|
@Size(max = 50, message = "证书名称长度不能超过50")
|
||||||
|
@ApiModelProperty("证书名称")
|
||||||
|
private String certificationName;
|
||||||
|
|
||||||
|
@NotBlank(message = "证书编号不能为空")
|
||||||
|
@Size(max = 50, message = "证书编号长度不能超过50")
|
||||||
|
@ApiModelProperty("证书编号")
|
||||||
|
private String certificationCode;
|
||||||
|
|
||||||
|
@NotBlank(message = "证书类型不能为空")
|
||||||
|
@ApiModelProperty("证书类型")
|
||||||
|
private String certificationType;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty("证书有效期-起")
|
||||||
|
private LocalDate validityDateBegin;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty("证书有效期-讫")
|
||||||
|
private LocalDate validityDateEnd;
|
||||||
|
|
||||||
|
@NotBlank(message = "证书图片不能为空")
|
||||||
|
@ApiModelProperty("证书图片")
|
||||||
|
private String certificationImage;
|
||||||
|
}
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.dite.znpt.domain.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serial;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:25
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel("人员资质响应实体")
|
||||||
|
public class CertificationResp implements Serializable {
|
||||||
|
@Serial
|
||||||
|
private static final long serialVersionUID = 4123163394817757998L;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书id")
|
||||||
|
private String certificationId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty("用户姓名")
|
||||||
|
private String userName;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书编号")
|
||||||
|
private String certificationCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书名称")
|
||||||
|
private String certificationName;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书类型")
|
||||||
|
private String certificationType;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书类型描述")
|
||||||
|
private String certificationTypeLabel;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty("证书有效期-起")
|
||||||
|
private LocalDate validityDateBegin;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@ApiModelProperty("证书有效期-讫")
|
||||||
|
private LocalDate validityDateEnd;
|
||||||
|
|
||||||
|
@ApiModelProperty("证书图片")
|
||||||
|
private String certificationImage;
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.dite.znpt.enums;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:33
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Getter
|
||||||
|
public enum CertificationEnum {
|
||||||
|
|
||||||
|
HEIGHT_OPERATION("height-operation", "高处作业"),
|
||||||
|
LOW_VOLTAGE_OPERATION("low-voltage-operation", "低压电工"),
|
||||||
|
HIGH_VOLTAGE_OPERATION("high-voltage-operation", "高压电工"),
|
||||||
|
MARITIME_TRAFFIC_SAFETY("maritime-traffic-safety", "海上交通安全"),
|
||||||
|
DRIVING_LICENSE("driving-license", "驾驶证"),
|
||||||
|
LIGHTNING_PROTECTION_DETECTION("lightning-protection-detection", "防雷检测"),
|
||||||
|
DRONE_DRIVING("drone-driving", "无人机驾驶");
|
||||||
|
|
||||||
|
private final String code;
|
||||||
|
private final String desc;
|
||||||
|
|
||||||
|
CertificationEnum(String code, String desc){
|
||||||
|
this.code = code;
|
||||||
|
this.desc = desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static CertificationEnum getByCode(String code){
|
||||||
|
for (CertificationEnum e : CertificationEnum.values() ) {
|
||||||
|
if(e.code.equals(code)){
|
||||||
|
return e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String getDescByCode(String code){
|
||||||
|
CertificationEnum e = getByCode(code);
|
||||||
|
return null == e ? null : e.desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static List<JSONObject> listAll(){
|
||||||
|
List<JSONObject> list = new ArrayList<>(CertificationEnum.values().length);
|
||||||
|
for (CertificationEnum e : CertificationEnum.values() ) {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.set(e.code, e.desc);
|
||||||
|
list.add(jsonObject);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
package com.dite.znpt.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.dite.znpt.domain.entity.CertificationEntity;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationListReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:21
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public interface CertificationMapper extends BaseMapper<CertificationEntity> {
|
||||||
|
List<CertificationResp> selectCertification(CertificationListReq req);
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.dite.znpt.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.dite.znpt.domain.entity.CertificationEntity;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationListReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:22
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
public interface CertificationService extends IService<CertificationEntity> {
|
||||||
|
|
||||||
|
List<CertificationResp> page(CertificationListReq req);
|
||||||
|
List<CertificationResp> list(CertificationListReq req);
|
||||||
|
CertificationResp detail(String certificationId);
|
||||||
|
void save(CertificationReq req);
|
||||||
|
void update(String certificationId, CertificationReq req);
|
||||||
|
void deleteById(String certificationId);
|
||||||
|
}
|
|
@ -0,0 +1,116 @@
|
||||||
|
package com.dite.znpt.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.dite.znpt.constant.Constants;
|
||||||
|
import com.dite.znpt.constant.Message;
|
||||||
|
import com.dite.znpt.converts.Converts;
|
||||||
|
import com.dite.znpt.domain.entity.CertificationEntity;
|
||||||
|
import com.dite.znpt.domain.entity.UserEntity;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationListReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationResp;
|
||||||
|
import com.dite.znpt.enums.CertificationEnum;
|
||||||
|
import com.dite.znpt.exception.ServiceException;
|
||||||
|
import com.dite.znpt.mapper.CertificationMapper;
|
||||||
|
import com.dite.znpt.service.CertificationService;
|
||||||
|
import com.dite.znpt.service.UserService;
|
||||||
|
import com.dite.znpt.util.PageUtil;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:23
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@AllArgsConstructor
|
||||||
|
@Service
|
||||||
|
public class CertificationServiceImpl extends ServiceImpl<CertificationMapper, CertificationEntity> implements CertificationService {
|
||||||
|
|
||||||
|
private final UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CertificationResp> page(CertificationListReq req) {
|
||||||
|
PageUtil.startPage();
|
||||||
|
return this.list(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CertificationResp> list(CertificationListReq req) {
|
||||||
|
List<CertificationResp> list = this.baseMapper.selectCertification(req);
|
||||||
|
list.stream().forEach(resp -> {
|
||||||
|
resp.setCertificationTypeLabel(CertificationEnum.getDescByCode(resp.getCertificationType()));
|
||||||
|
});
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CertificationResp detail(String certificationId) {
|
||||||
|
CertificationResp resp = Converts.INSTANCE.toCertificationResp(this.getById(certificationId));
|
||||||
|
resp.setCertificationTypeLabel(CertificationEnum.getDescByCode(resp.getCertificationType()));
|
||||||
|
resp.setUserName(userService.getById(resp.getUserId()).getName());
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void save(CertificationReq req) {
|
||||||
|
this.save(validation(null, req));
|
||||||
|
}
|
||||||
|
|
||||||
|
private CertificationEntity validation(String certificationId, CertificationReq req) {
|
||||||
|
UserEntity user = userService.getById(req.getUserId());
|
||||||
|
if(null == user || !Constants.DEL_FLAG_0.equals(user.getDelFlag()) || !Constants.STATUS_0.equals(user.getStatus())){
|
||||||
|
throw new ServiceException(Message.USER_ID_NOT_EXIST_OR_ILLEGAL);
|
||||||
|
}
|
||||||
|
if(null == CertificationEnum.getByCode(req.getCertificationType())){
|
||||||
|
throw new ServiceException(Message.CERTIFICATION_TYPE_ILLEGAL);
|
||||||
|
}
|
||||||
|
List<CertificationEntity> userIdTypeList = this.list(Wrappers.lambdaQuery(CertificationEntity.class).eq(CertificationEntity::getCertificationType, req.getCertificationType()).eq(CertificationEntity::getUserId, req.getUserId()));
|
||||||
|
List<CertificationEntity> codeList = this.list(Wrappers.lambdaQuery(CertificationEntity.class).eq(CertificationEntity::getCertificationCode, req.getCertificationCode()));
|
||||||
|
if(StrUtil.isBlank(certificationId)){
|
||||||
|
if(CollUtil.isNotEmpty(userIdTypeList)){
|
||||||
|
throw new ServiceException(StrUtil.format(Message.USER_CERTIFICATION_EXIST, user.getName(), CertificationEnum.getDescByCode(req.getCertificationType())));
|
||||||
|
}
|
||||||
|
if(CollUtil.isNotEmpty(codeList)){
|
||||||
|
throw new ServiceException(Message.CERTIFICATION_CODE_EXIST);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
CertificationEntity entity = this.getById(certificationId);
|
||||||
|
if(null == entity){
|
||||||
|
throw new ServiceException(Message.CERTIFICATION_ID_NOT_EXIST);
|
||||||
|
}
|
||||||
|
if((!entity.getUserId().equals(req.getUserId()) ||!entity.getCertificationType().equals(req.getCertificationType())) && CollUtil.isNotEmpty(userIdTypeList)){
|
||||||
|
throw new ServiceException(StrUtil.format(Message.USER_CERTIFICATION_EXIST, user.getName(), CertificationEnum.getDescByCode(req.getCertificationType())));
|
||||||
|
}
|
||||||
|
if(!entity.getCertificationCode().equals(req.getCertificationCode()) && CollUtil.isNotEmpty(codeList)){
|
||||||
|
throw new ServiceException(Message.CERTIFICATION_CODE_EXIST);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Converts.INSTANCE.toCertificationEntity(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void update(String certificationId, CertificationReq req) {
|
||||||
|
CertificationEntity entity = validation(certificationId, req);
|
||||||
|
entity.setCertificationId(certificationId);
|
||||||
|
this.updateById(entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
@Override
|
||||||
|
public void deleteById(String certificationId) {
|
||||||
|
if(null == this.getById(certificationId)){
|
||||||
|
throw new ServiceException(Message.CERTIFICATION_ID_NOT_EXIST);
|
||||||
|
}
|
||||||
|
this.removeById(certificationId);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
<?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.dite.znpt.mapper.CertificationMapper">
|
||||||
|
|
||||||
|
<select id="selectCertification" resultType="com.dite.znpt.domain.vo.CertificationResp">
|
||||||
|
SELECT c.certification_id, c.certification_code, c.certification_name, c.certification_type, c.user_id, u.name AS username, c.validity_date_begin, c.validity_date_end, c.certification_image
|
||||||
|
FROM certification c
|
||||||
|
LEFT JOIN user u ON c.user_id = u.user_id
|
||||||
|
<where>
|
||||||
|
<if test="certificationName != null and certificationName != ''">
|
||||||
|
AND c.certification_name LIKE CONCAT('%', #{certificationName}, '%')
|
||||||
|
</if>
|
||||||
|
<if test="certificationType!= null and certificationType!= ''">
|
||||||
|
AND c.certification_type = #{certificationType}
|
||||||
|
</if>
|
||||||
|
<if test="userName!= null and userName!= ''">
|
||||||
|
AND u.user_name LIKE CONCAT('%', #{userName}, '%')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
|
@ -0,0 +1,68 @@
|
||||||
|
package com.dite.znpt.web.controller;
|
||||||
|
|
||||||
|
import com.dite.znpt.domain.PageResult;
|
||||||
|
import com.dite.znpt.domain.Result;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationListReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationReq;
|
||||||
|
import com.dite.znpt.domain.vo.CertificationResp;
|
||||||
|
import com.dite.znpt.service.CertificationService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author Bear.G
|
||||||
|
* @date 2025/5/27/周二 15:24
|
||||||
|
* @description
|
||||||
|
*/
|
||||||
|
@Api(tags = "人员资质")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/certification")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CertificationController {
|
||||||
|
|
||||||
|
private final CertificationService certificationService;
|
||||||
|
|
||||||
|
@GetMapping("/page")
|
||||||
|
@ApiOperation(value = "分页查询人员资质信息", httpMethod = "GET")
|
||||||
|
public PageResult<CertificationResp> page(CertificationListReq req){
|
||||||
|
return PageResult.ok(certificationService.page(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
@ApiOperation(value = "查询人员资质信息列表", httpMethod = "GET")
|
||||||
|
public Result<List<CertificationResp>> list(CertificationListReq req){
|
||||||
|
return Result.ok(certificationService.list(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/detail/{certificationId}")
|
||||||
|
@ApiOperation(value = "查询人员资质详情", httpMethod = "GET")
|
||||||
|
public Result<CertificationResp> detail(@PathVariable String certificationId){
|
||||||
|
return Result.ok(certificationService.detail(certificationId));
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping
|
||||||
|
@ApiOperation(value = "新增人员资质", httpMethod = "POST")
|
||||||
|
public Result add(@Validated @RequestBody CertificationReq req){
|
||||||
|
certificationService.save(req);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@PutMapping("/{certificationId}")
|
||||||
|
@ApiOperation(value = "修改人员资质信息", httpMethod = "PUT")
|
||||||
|
public Result update(@PathVariable String certificationId, @Validated @RequestBody CertificationReq req){
|
||||||
|
certificationService.update(certificationId, req);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@DeleteMapping("/{certificationId}")
|
||||||
|
@ApiOperation(value = "删除人员资质信息", httpMethod = "DELETE")
|
||||||
|
public Result remove(@PathVariable String certificationId){
|
||||||
|
certificationService.deleteById(certificationId);
|
||||||
|
return Result.ok();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue