master
Chengliang 1 month ago
parent b0db84f231
commit 9cf8a7cdf0

@ -0,0 +1,55 @@
package com.engine.organization.entity.po;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/26
* @Version V1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Demo {
//主建,非自增 0表示集团 正数是现有分部信息ID
private Integer fid;
//1-集团或者虚拟组织名称 2-分部级虚拟组织分部
private Integer flevel;
//维度: 0-行政维度 负数-虚拟组织架构id
private Integer fwd;
//编号
private String fnumber;
//名称
private String fname;
//负责人id
private Integer fleader;
//编制人数
private Integer fplan;
//在岗人数
private Integer fonjob;
//是否虚拟组织0-实体组织1-虚拟组织
private Integer fisvitual;
//生效时间
private Date ftimebegin;
//失效时间
private Date ftimeend;
}

@ -0,0 +1,27 @@
package com.engine.organization.mapper;
import com.engine.organization.entity.po.Demo;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/3/9
* @Version V1.0
**/
public interface DemoMapper {
/**
*
* @return
*/
List<Demo> listAll();
}

@ -0,0 +1,43 @@
<?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.engine.organization.mapper.DemoMapper">
<resultMap id="BaseResultMap" type="com.engine.organization.entity.po.Demo">
<result column="fid" property="fid"/>
<result column="flevel" property="flevel"/>
<result column="fwd" property="fwd"/>
<result column="fnumber" property="fnumber"/>
<result column="fname" property="fname"/>
<result column="fleader" property="fleader"/>
<result column="fplan" property="fplan"/>
<result column="fonjob" property="fonjob"/>
<result column="fisvitual" property="fisvitual"/>
<result column="ftimebegin" property="ftimebegin"/>
<result column="ftimeend" property="ftimeend"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.fid
, t.flevel
, t.fwd
, t.fnumber
, t.fname
, t.fleader
, t.fplan
, t.fonjob
, t.fisvitual
, t.ftimebegin
, t.ftimeend
</sql>
<select id="listAll" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
FROM hr_company t
</select>
</mapper>

@ -0,0 +1,22 @@
package com.engine.organization.service;
import com.engine.organization.entity.po.Demo;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/27
* @Version V1.0
**/
public interface DemoService {
/**
*
* @param name
* @return
*/
List<Demo> list(String name);
}

@ -0,0 +1,15 @@
package com.engine.organization.service;
import com.engine.organization.entity.po.Demo;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/28
* @Version V1.0
**/
public interface TestService {
Demo list(String name);
}

@ -0,0 +1,45 @@
package com.engine.organization.service.impl;
import com.engine.core.impl.Service;
import com.engine.organization.annotation.Log;
import com.engine.organization.entity.LoggerContext;
import com.engine.organization.entity.po.Demo;
import com.engine.organization.enums.OperateTypeEnum;
import com.engine.organization.mapper.DemoMapper;
import com.engine.organization.service.DemoService;
import com.engine.organization.util.HrmI18nUtil;
import com.engine.organization.util.LogAspect;
import com.engine.organization.util.OrganizationAssert;
import com.engine.organization.util.db.MapperProxyFactory;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocService;
import java.lang.reflect.Method;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/27
* @Version V1.0
**/
@WeaIocService
public class DemoServiceImpl extends Service implements DemoService {
@Override
@Log(operateType = OperateTypeEnum.ADD,operateDesc = "测试自定义日志")
public List<Demo> list(String name) {
OrganizationAssert.notNull(name,HrmI18nUtil.getI18nLabel(34721,"参数不能为空") );
List<Demo> demos = MapperProxyFactory.getProxy(DemoMapper.class).listAll();
//操作日志记录
Method method = new Object(){}.getClass().getEnclosingMethod();
LoggerContext loggerContext = LoggerContext.builder().operatorId(user.getUID()).operatorName(user.getLastname()).build();
LogAspect logAspect = new LogAspect(DemoServiceImpl.class,method,loggerContext);
logAspect.start();
return demos;
}
}

@ -0,0 +1,20 @@
package com.engine.organization.service.impl;
import com.engine.organization.entity.po.Demo;
import com.engine.organization.service.TestService;
import com.weaverboot.frame.ioc.anno.classAnno.WeaIocService;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/28
* @Version V1.0
**/
@WeaIocService
public class TestServiceImpl implements TestService {
@Override
public Demo list(String name) {
return Demo.builder().fid(1).build();
}
}

@ -0,0 +1,29 @@
package com.engine.organization.wrapper;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.organization.entity.po.Demo;
import com.engine.organization.service.DemoService;
import com.engine.organization.service.impl.DemoServiceImpl;
import com.engine.organization.util.response.ReturnResult;
import weaver.hrm.User;
import java.util.List;
/**
* @Author weaver_cl
* @Description: TODO
* @Date 2022/4/26
* @Version V1.0
**/
public class DemoWrapper extends Service {
private DemoService getDemoService(User user) {
return ServiceUtil.getService(DemoServiceImpl.class,user);
}
public ReturnResult testDemo(String name) {
List<Demo> list = getDemoService(user).list(name);
return ReturnResult.successed(list);
}
}
Loading…
Cancel
Save