DX
3 days ago
17 changed files with 234 additions and 129 deletions
@ -0,0 +1,42 @@
|
||||
package com.ruoyi.framework.mybatis.handler; |
||||
|
||||
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler; |
||||
import com.ruoyi.common.utils.SecurityUtils; |
||||
import org.apache.ibatis.reflection.MetaObject; |
||||
import org.springframework.stereotype.Component; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 自定义元对象处理器,用于自动填充创建和修改时间、用户 |
||||
*/ |
||||
@Component |
||||
public class CustomMetaObjectHandler implements MetaObjectHandler { |
||||
|
||||
@Override |
||||
public void insertFill(MetaObject metaObject) { |
||||
// 创建时自动填充
|
||||
this.strictInsertFill(metaObject, "createTime", Date.class, new Date()); |
||||
this.strictInsertFill(metaObject, "createBy", String.class, getCurrentUsername()); |
||||
this.strictInsertFill(metaObject, "updateTime", Date.class, new Date()); |
||||
this.strictInsertFill(metaObject, "updateBy", String.class, getCurrentUsername()); |
||||
} |
||||
|
||||
@Override |
||||
public void updateFill(MetaObject metaObject) { |
||||
// 修改时自动填充
|
||||
this.strictUpdateFill(metaObject, "updateTime", Date.class, new Date()); |
||||
this.strictUpdateFill(metaObject, "updateBy", String.class, getCurrentUsername()); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前登录用户名 |
||||
*/ |
||||
private String getCurrentUsername() { |
||||
try { |
||||
return SecurityUtils.getUsername(); |
||||
} catch (Exception e) { |
||||
return "unknown"; |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.ruoyi.system.domain; |
||||
|
||||
import com.ruoyi.common.core.domain.BaseEntity; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* 企业资质映 |
||||
* @TableName enterprise_qualification |
||||
*/ |
||||
@Data |
||||
public class EnterpriseQualification extends BaseEntity implements Serializable { |
||||
/** |
||||
* 主键 |
||||
*/ |
||||
private Long id; |
||||
|
||||
/** |
||||
* 企业ID |
||||
*/ |
||||
private Long enterpriseId; |
||||
|
||||
/** |
||||
* 资质名称,例如:排污许可证、环保合格证 |
||||
*/ |
||||
private String qualificationName; |
||||
|
||||
/** |
||||
* 资质到期日期 |
||||
*/ |
||||
private Date expiryDate; |
||||
|
||||
/** |
||||
* 资质描述,详细说明资质信息 |
||||
*/ |
||||
private String qualificationDescription; |
||||
/** |
||||
* 是否删除 |
||||
*/ |
||||
private Boolean delFlag; |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
} |
@ -0,0 +1,20 @@
|
||||
package com.ruoyi.system.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.ruoyi.system.domain.EnterpriseQualification; |
||||
import com.ruoyi.system.domain.Enterprises; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 企业Mapper接口 |
||||
* |
||||
* @author ruoyi |
||||
* @date 2025-01-08 |
||||
*/ |
||||
@Mapper |
||||
public interface EnterprisesQualificationMapper extends BaseMapper<EnterpriseQualification> |
||||
{ |
||||
|
||||
} |
@ -0,0 +1,8 @@
|
||||
package com.ruoyi.system.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.ruoyi.system.domain.EnterpriseQualification; |
||||
import com.ruoyi.system.domain.FileInfo; |
||||
|
||||
public interface IEnterpriseQualificationService extends IService<EnterpriseQualification> { |
||||
} |
@ -0,0 +1,11 @@
|
||||
package com.ruoyi.system.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import com.ruoyi.system.domain.EnterpriseQualification; |
||||
import com.ruoyi.system.mapper.EnterprisesQualificationMapper; |
||||
import com.ruoyi.system.service.IEnterpriseQualificationService; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
@Service |
||||
public class EnterpriseQualificationServiceImpl extends ServiceImpl<EnterprisesQualificationMapper, EnterpriseQualification> implements IEnterpriseQualificationService { |
||||
} |
Loading…
Reference in new issue