Browse Source

任务管理,配置默认参数属性, 任务看板关联IP

2022年11月24日  sxm
master
[li_she] 3 years ago
parent
commit
dd7b72d80b
  1. 38
      src/main/java/com/heai/config/MyMetaObjectHandler.java
  2. 6
      src/main/resources/mapper/taskmanage/TaskDatailDao.xml

38
src/main/java/com/heai/config/MyMetaObjectHandler.java

@ -0,0 +1,38 @@
package com.heai.config;
import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
import com.heai.modules.sys.entity.SysUserEntity;
import org.apache.ibatis.reflection.MetaObject;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.apache.shiro.SecurityUtils;
import org.springframework.stereotype.Component;
import java.util.Date;
/**
* @Author sxm
* @Description 自定义自动填充策略 @TableField(fill = FieldFill.INSERT)
* @Date 2022-11-23
**/
@Component
public class MyMetaObjectHandler implements MetaObjectHandler {
private Logger logger = LogManager.getLogger(getClass());
@Override
public void insertFill(MetaObject metaObject) {
SysUserEntity user = (SysUserEntity) SecurityUtils.getSubject().getPrincipal();
logger.info("start insert fill ....");
this.strictInsertFill(metaObject,"createdDate", Date.class, new Date());
this.strictInsertFill(metaObject,"site",String.class, user.getSite());
this.strictInsertFill(metaObject,"createdBy",String.class, user.getUserDisplay());
}
@Override
public void updateFill(MetaObject metaObject) {
logger.info("start update fill ....");
this.strictUpdateFill(metaObject, "updatedDate", Date.class, new Date());
}
}

6
src/main/resources/mapper/taskmanage/TaskDatailDao.xml

@ -31,13 +31,13 @@
, tl.updated_by
, tl.task_header
, u.username responsible_person
,( td.department + ' | ' + u.username) as dep_user_name
,( u.department + ' | ' + u.username) as dep_user_name
, td.task_id
from task_detail td
left join task_list tl on td.task_id = tl.id AND td.site = tl.site
left join users u on td.site = u.site and u.userId = td.responsible_person
left join users u2 on td.site = u2.site and u2.userId = tl.task_initiator
LEFT JOIN report_mapping_ipaddress rmi on rmi.department = td.department
LEFT JOIN report_mapping_ipaddress rmi on rmi.department = u.department
<where>
td.site = #{site}
<if test="ipAddress != null and ipAddress != ''">
@ -47,7 +47,7 @@
and tl.created_by like #{taskInitiator}
</if>
<if test="department != null and department != ''">
and td.department like #{department}
and u.department like #{department}
</if>
<if test="customer != null and customer != ''">
and tl.customer like #{customer}

Loading…
Cancel
Save