人员中台 - 对接企业、组相关代码以及接口变动

pet-图片单独上传接口-2024.8.28-徐绎丰
water_xu 2024-08-22 18:51:58 +08:00
parent eb19ec1372
commit 94ff24d671
17 changed files with 923 additions and 10 deletions

View File

@ -9,6 +9,8 @@ import java.util.Map;
import com.zcloud.service.bus.CorpInfoRelatedService; import com.zcloud.service.bus.CorpInfoRelatedService;
import com.zcloud.service.system.DictionariesService; import com.zcloud.service.system.DictionariesService;
import com.zcloud.syncData.SyncPlatformAdvice;
import com.zcloud.syncData.SyncTypeEnum;
import com.zcloud.util.*; import com.zcloud.util.*;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
@ -79,6 +81,7 @@ public class CorpInfoController extends BaseController {
@RequiresPermissions("corpinfo:add") @RequiresPermissions("corpinfo:add")
@ResponseBody @ResponseBody
@Transactional @Transactional
@SyncPlatformAdvice(type = SyncTypeEnum.CORP, isInsert = true)
public Object add() throws Exception{ public Object add() throws Exception{
Map<String,Object> map = new HashMap<String,Object>(); Map<String,Object> map = new HashMap<String,Object>();
String errInfo = "success"; String errInfo = "success";
@ -123,6 +126,8 @@ public class CorpInfoController extends BaseController {
map.put("pd",pd); map.put("pd",pd);
map.put("result", errInfo); map.put("result", errInfo);
map.put("syncInfo", corpinfoService.findById(pd));
map.put("code", "0");
return map; return map;
} }
@ -133,13 +138,17 @@ public class CorpInfoController extends BaseController {
@RequestMapping(value="/delete") @RequestMapping(value="/delete")
@RequiresPermissions("corpinfo:del") @RequiresPermissions("corpinfo:del")
@ResponseBody @ResponseBody
@SyncPlatformAdvice(type = SyncTypeEnum.CORP, isUpdate = true)
public Object delete() throws Exception{ public Object delete() throws Exception{
Map<String,String> map = new HashMap<String,String>(); Map map = new HashMap();
String errInfo = "success"; String errInfo = "success";
PageData pd = new PageData(); PageData pd = new PageData();
pd = this.getPageData(); pd = this.getPageData();
corpinfoService.delete(pd); corpinfoService.delete(pd);
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
pd.put("ISDELETE", "1");
map.put("syncInfo", pd);
map.put("code", "0");
return map; return map;
} }
@ -150,6 +159,7 @@ public class CorpInfoController extends BaseController {
@RequestMapping(value="/edit", headers = "content-type=multipart/form-data") @RequestMapping(value="/edit", headers = "content-type=multipart/form-data")
@ResponseBody @ResponseBody
@Transactional @Transactional
@SyncPlatformAdvice(type = SyncTypeEnum.CORP, isUpdate = true)
public Object edit( public Object edit(
@RequestParam(value="imgFiles",required=false) MultipartFile[] imgFiles, @RequestParam(value="imgFiles",required=false) MultipartFile[] imgFiles,
@RequestParam(value="fourFiles",required=false) MultipartFile[] fourFiles) throws Exception{ @RequestParam(value="fourFiles",required=false) MultipartFile[] fourFiles) throws Exception{
@ -188,7 +198,8 @@ public class CorpInfoController extends BaseController {
corpinfoService.editCorpUserNew(pdNew); corpinfoService.editCorpUserNew(pdNew);
corpinfoService.editCorpdeptNew(pdNew); corpinfoService.editCorpdeptNew(pdNew);
map.put("syncInfo", corpinfoService.findById(pd));
map.put("code", "0");
return map; return map;
} }
@RequestMapping(value="/editIsReceive") @RequestMapping(value="/editIsReceive")

View File

@ -6,6 +6,8 @@ import com.alibaba.fastjson.JSONObject;
import com.zcloud.entity.system.User; import com.zcloud.entity.system.User;
import com.zcloud.service.system.PostService; import com.zcloud.service.system.PostService;
import com.zcloud.service.system.SupervisionDepartmentService; import com.zcloud.service.system.SupervisionDepartmentService;
import com.zcloud.syncData.SyncPlatformAdvice;
import com.zcloud.syncData.SyncTypeEnum;
import com.zcloud.util.DateUtil; import com.zcloud.util.DateUtil;
import com.zcloud.util.ObjectExcelView; import com.zcloud.util.ObjectExcelView;
import net.sf.json.JSONArray; import net.sf.json.JSONArray;
@ -58,6 +60,7 @@ public class DepartmentController extends BaseController {
@RequestMapping(value = "/add") @RequestMapping(value = "/add")
@RequiresPermissions("department:add") @RequiresPermissions("department:add")
@ResponseBody @ResponseBody
@SyncPlatformAdvice(type = SyncTypeEnum.DEPARTMENT, isInsert = true)
public Object add(Page page) throws Exception { public Object add(Page page) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
@ -100,6 +103,8 @@ public class DepartmentController extends BaseController {
} }
} }
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
map.put("syncInfo", departmentService.findById(pd));
map.put("code", "0");
return map; return map;
} }
@ -157,6 +162,7 @@ public class DepartmentController extends BaseController {
@RequestMapping(value = "/delete") @RequestMapping(value = "/delete")
@RequiresPermissions("department:del") @RequiresPermissions("department:del")
@ResponseBody @ResponseBody
@SyncPlatformAdvice(type = SyncTypeEnum.DEPARTMENT, isUpdate = true)
public Object delete(@RequestParam String DEPARTMENT_ID) throws Exception { public Object delete(@RequestParam String DEPARTMENT_ID) throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
@ -181,6 +187,9 @@ public class DepartmentController extends BaseController {
} }
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
pd.put("ISDELETE", "1");
map.put("syncInfo", pd);
map.put("code", "0");
return map; return map;
} }
@ -193,6 +202,7 @@ public class DepartmentController extends BaseController {
@RequestMapping(value = "/edit") @RequestMapping(value = "/edit")
@RequiresPermissions("department:edit") @RequiresPermissions("department:edit")
@ResponseBody @ResponseBody
@SyncPlatformAdvice(type = SyncTypeEnum.DEPARTMENT, isUpdate = true)
public Object edit() throws Exception { public Object edit() throws Exception {
Map<String, Object> map = new HashMap<String, Object>(); Map<String, Object> map = new HashMap<String, Object>();
String errInfo = "success"; String errInfo = "success";
@ -244,6 +254,8 @@ public class DepartmentController extends BaseController {
} }
} }
map.put("result", errInfo); //返回结果 map.put("result", errInfo); //返回结果
map.put("syncInfo", departmentService.findById(pd));
map.put("code", "0");
return map; return map;
} }

View File

@ -0,0 +1,42 @@
package com.zcloud.mapper.datasource.core;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* Mapper
*/
public interface CoreSyncCorpMapper {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,42 @@
package com.zcloud.mapper.datasource.core;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* Mapper
*/
public interface CoreSyncDeptMapper {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,42 @@
package com.zcloud.mapper.datasource.core;
import com.zcloud.entity.PageData;
import java.util.List;
/**
* Mapper
*/
public interface CoreSyncUserMapper {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,39 @@
package com.zcloud.service.core;
import com.zcloud.entity.PageData;
import java.util.List;
public interface CoreSyncCorpService {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,39 @@
package com.zcloud.service.core;
import com.zcloud.entity.PageData;
import java.util.List;
public interface CoreSyncDeptService {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,39 @@
package com.zcloud.service.core;
import com.zcloud.entity.PageData;
import java.util.List;
public interface CoreSyncUserService {
/**()
* @param pd
* @throws Exception
*/
List<PageData> listAll(PageData pd);
/**
* @param pd
* @throws Exception
*/
void delete(PageData pd);
/**
* @param pd
* @throws Exception
*/
void save(PageData pd);
/**
* @param pd
* @throws Exception
*/
void edit(PageData pd);
/**id
* @param pd
* @throws Exception
*/
PageData findById(PageData pd);
}

View File

@ -0,0 +1,38 @@
package com.zcloud.service.core.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.core.CoreSyncCorpMapper;
import com.zcloud.service.core.CoreSyncCorpService;
import javax.annotation.Resource;
import java.util.List;
public class CoreSyncCorpServiceImpl implements CoreSyncCorpService {
@Resource
private CoreSyncCorpMapper coreSyncCorpMapper;
@Override
public List<PageData> listAll(PageData pd) {
return coreSyncCorpMapper.listAll(pd);
}
@Override
public void delete(PageData pd) {
coreSyncCorpMapper.delete(pd);
}
@Override
public void save(PageData pd) {
coreSyncCorpMapper.save(pd);
}
@Override
public void edit(PageData pd) {
coreSyncCorpMapper.edit(pd);
}
@Override
public PageData findById(PageData pd) {
return coreSyncCorpMapper.findById(pd);
}
}

View File

@ -0,0 +1,38 @@
package com.zcloud.service.core.impl;
import com.zcloud.entity.PageData;
import com.zcloud.service.core.CoreSyncDeptService;
import javax.annotation.Resource;
import java.util.List;
public class CoreSyncDeptServiceImpl implements CoreSyncDeptService {
@Resource
private CoreSyncDeptService coreSyncDeptService;
@Override
public List<PageData> listAll(PageData pd) {
return coreSyncDeptService.listAll(pd);
}
@Override
public void delete(PageData pd) {
coreSyncDeptService.delete(pd);
}
@Override
public void save(PageData pd) {
coreSyncDeptService.save(pd);
}
@Override
public void edit(PageData pd) {
coreSyncDeptService.edit(pd);
}
@Override
public PageData findById(PageData pd) {
return coreSyncDeptService.findById(pd);
}
}

View File

@ -0,0 +1,39 @@
package com.zcloud.service.core.impl;
import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.core.CoreSyncUserMapper;
import com.zcloud.service.core.CoreSyncUserService;
import javax.annotation.Resource;
import java.util.List;
public class CoreSyncUserServiceImpl implements CoreSyncUserService {
@Resource
private CoreSyncUserMapper coreSyncUserMapper;
@Override
public List<PageData> listAll(PageData pd) {
return coreSyncUserMapper.listAll(pd);
}
@Override
public void delete(PageData pd) {
coreSyncUserMapper.delete(pd);
}
@Override
public void save(PageData pd) {
coreSyncUserMapper.save(pd);
}
@Override
public void edit(PageData pd) {
coreSyncUserMapper.edit(pd);
}
@Override
public PageData findById(PageData pd) {
return coreSyncUserMapper.findById(pd);
}
}

View File

@ -75,18 +75,38 @@ public class SyncDataAdviceAspect {
message.setTopic(sliceDataChangeTopic); message.setTopic(sliceDataChangeTopic);
// 判断同步类型 // 判断同步类型
/**
*
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.HIDDEN)){ if (syncPlatformAdvice.type().equals(SyncTypeEnum.HIDDEN)){
// 同步隐患
} }
/**
*
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.PERSONNEL)){ if (syncPlatformAdvice.type().equals(SyncTypeEnum.PERSONNEL)){
// 同步人员
dockSendMessageService.sendMessage(message); dockSendMessageService.sendMessage(message);
} }
if (syncPlatformAdvice.type().equals(SyncTypeEnum.SAFETY_ENVIRONMENTAL_CHECK)){ /**
// 同步安全环保检查 *
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.SAFETY_ENVIRONMENTAL_CHECK)){ }
/**
*
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.KEY_PROJECT)){ }
/**
*
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.CORP)){
// 1. 发信
dockSendMessageService.sendMessage(message);
} }
if (syncPlatformAdvice.type().equals(SyncTypeEnum.KEY_PROJECT)){ /**
// 同步重点工程 *
*/
if (syncPlatformAdvice.type().equals(SyncTypeEnum.DEPARTMENT)){
// 1. 发信
dockSendMessageService.sendMessage(message);
} }

View File

@ -9,7 +9,9 @@ public enum SyncTypeEnum {
PERSONNEL("人员"), PERSONNEL("人员"),
HIDDEN("隐患"), HIDDEN("隐患"),
SAFETY_ENVIRONMENTAL_CHECK("安全环保检查"), SAFETY_ENVIRONMENTAL_CHECK("安全环保检查"),
KEY_PROJECT("重点工程"); KEY_PROJECT("重点工程"),
DEPARTMENT("部门"),
CORP("企业");
private final String description; private final String description;

View File

@ -4,8 +4,13 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.zcloud.dto.TenCorpDto; import com.zcloud.dto.TenCorpDto;
import com.zcloud.entity.PageData; import com.zcloud.entity.PageData;
import com.zcloud.mapper.datasource.bus.CorpInfoMapper;
import com.zcloud.mapper.datasource.core.CoreSyncCorpMapper;
import com.zcloud.mapper.datasource.core.CoreSyncDeptMapper;
import com.zcloud.mapper.datasource.core.CoreSyncUserMapper;
import com.zcloud.mapper.datasource.mq.MqConsumptionErrorLogMapper; import com.zcloud.mapper.datasource.mq.MqConsumptionErrorLogMapper;
import com.zcloud.mapper.datasource.mq.MqConsumptionLogMapper; import com.zcloud.mapper.datasource.mq.MqConsumptionLogMapper;
import com.zcloud.mapper.datasource.system.DepartmentMapper;
import com.zcloud.service.system.UsersService; import com.zcloud.service.system.UsersService;
import com.zcloud.service.xgf.XgfUserService; import com.zcloud.service.xgf.XgfUserService;
import com.zcloud.syncData.SyncTypeEnum; import com.zcloud.syncData.SyncTypeEnum;
@ -39,6 +44,22 @@ public class SyncDataListener implements RocketMQListener<String> {
@Autowired @Autowired
private XgfUserService xgfUserService; private XgfUserService xgfUserService;
@Autowired
private CorpInfoMapper corpinfoMapper;
@Autowired
private DepartmentMapper departmentMapper;
/* 本地中台同步 */
@Autowired
private CoreSyncUserMapper coreSyncUserMapper;
@Autowired
private CoreSyncCorpMapper coreSyncCorpMapper;
@Autowired
private CoreSyncDeptMapper coreSyncDeptMapper;
@Autowired @Autowired
private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper; private static MqConsumptionErrorLogMapper mqConsumptionErrorLogMapper;
@ -84,8 +105,14 @@ public class SyncDataListener implements RocketMQListener<String> {
PageData localData = usersService.findById(syncInfo); PageData localData = usersService.findById(syncInfo);
if (localData != null && !localData.isEmpty()){ if (localData != null && !localData.isEmpty()){
usersService.editUser(syncInfo); usersService.editUser(syncInfo);
}
// 2024.8.9 按郭跃鹏提出后期各公司从企业端分离后需要其他公司的用户进行SQL联查要求新增一张core_user的同步表用于记录中台的所有用户数据
PageData coreLocalData = coreSyncUserMapper.findById(syncInfo);
if (coreLocalData != null && !coreLocalData.isEmpty()){
coreSyncUserMapper.edit(syncInfo);
} else { } else {
// 2024.8.9 按郭跃鹏提出后期各公司从企业端分离后需要其他公司的用户进行SQL联查要求新增一张core_user的同步表用于记录中台的所有用户数据 coreSyncUserMapper.save(syncInfo);
} }
} }
@ -101,6 +128,60 @@ public class SyncDataListener implements RocketMQListener<String> {
if (SyncTypeEnum.KEY_PROJECT.getDescription().equals(tenCorpDto.getMark())){ if (SyncTypeEnum.KEY_PROJECT.getDescription().equals(tenCorpDto.getMark())){
} }
// 部门
if (SyncTypeEnum.DEPARTMENT.getDescription().equals(tenCorpDto.getMark())){
System.out.println("department");
String str = tenCorpDto.getData().getString("syncInfo");
PageData syncInfo = JSONUtil.toBean(str, PageData.class);
PageData localData = departmentMapper.findById(syncInfo);
if (localData != null && !localData.isEmpty()){
departmentMapper.edit(syncInfo);
}
PageData coreLocalData = coreSyncDeptMapper.findById(syncInfo);
try {
if (!"1".equals(syncInfo.getString("ISDELETE"))) {
// 如果不是待删除的数据, 则进行排序字段的转换, 删除的数据只会传递ID和ISDELETE参数
syncInfo.put("DEP_ORDER", Integer.parseInt(syncInfo.getString("DEP_ORDER")));
}
}catch (Exception e){
System.out.println("========================排序字段为空 : " + syncInfo.getString("DEP_ORDER") + " ========================");
}
if (coreLocalData != null && !coreLocalData.isEmpty()){
syncInfo.put("ISDELETE", syncInfo.getString("ISDELETE") == null ? "0" : syncInfo.getString("ISDELETE"));
coreSyncDeptMapper.edit(syncInfo);
} else {
syncInfo.put("ISDELETE", "0");
coreSyncDeptMapper.save(syncInfo);
}
}
// 企业
if (SyncTypeEnum.CORP.getDescription().equals(tenCorpDto.getMark())){
System.out.println("corp");
String str = tenCorpDto.getData().getString("syncInfo");
PageData syncInfo = JSONUtil.toBean(str, PageData.class);
PageData localData = corpinfoMapper.findById(syncInfo);
if (localData != null && !localData.isEmpty()){
corpinfoMapper.edit(syncInfo);
}
PageData coreLocalData = coreSyncCorpMapper.findById(syncInfo);
try {
if (!"1".equals(syncInfo.getString("ISDELETE"))) {
// 如果不是待删除的数据, 则进行排序字段的转换, 删除的数据只会传递ID和ISDELETE参数
syncInfo.put("COR_ORDER", Integer.parseInt(syncInfo.getString("COR_ORDER")));
}
}catch (Exception e){
System.out.println("========================排序字段为空 : " + syncInfo.getString("COR_ORDER") + " ========================");
}
if (coreLocalData != null && !coreLocalData.isEmpty()){
syncInfo.put("ISDELETE", syncInfo.getString("ISDELETE") == null ? "0" : syncInfo.getString("ISDELETE"));
coreSyncCorpMapper.edit(syncInfo);
} else {
syncInfo.put("ISDELETE", "0");
coreSyncCorpMapper.save(syncInfo);
}
}
mqConsumptionLogMapper.save(productionPD); mqConsumptionLogMapper.save(productionPD);
mqConsumptionLogMapper.save(pd); mqConsumptionLogMapper.save(pd);

View File

@ -0,0 +1,106 @@
<?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.zcloud.mapper.datasource.core.CoreSyncCorpMapper">
<!--表名 -->
<sql id="tableName">
CORE_SYNC_CORPINFO
</sql>
<!-- 字段 -->
<sql id="Field">
f.CORPINFO_ID ,
f.CORP_NAME ,
f.COR_ORDER ,
f.ISDELETE,
f.CORP_FLAG
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
CORPINFO_ID ,
CORP_NAME ,
COR_ORDER ,
ISDELETE,
CORP_FLAG
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{CORPINFO_ID} ,
#{CORP_NAME} ,
#{COR_ORDER} ,
#{ISDELETE},
#{CORP_FLAG}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 查询 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.CORPINFO_ID = #{CORPINFO_ID}
</select>
<delete id="edit" parameterType="pd">
update
<include refid="tableName"></include>
<set>
<if test="CORP_NAME != null and CORP_NAME.trim() != ''">
CORP_NAME = #{CORP_NAME},
</if>
<if test="COR_ORDER != null">
COR_ORDER = #{COR_ORDER},
</if>
<if test="ISDELETE != null">
ISDELETE = #{ISDELETE},
</if>
<if test="CORP_FLAG != null">
CORP_FLAG = #{CORP_FLAG}
</if>
</set>
where
CORPINFO_ID = #{CORPINFO_ID}
</delete>
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set ISDELETE = '1'
where
CORPINFO_ID = #{CORPINFO_ID}
</delete>
<select id="listAll" resultType="com.zcloud.entity.PageData">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where 1=1
<if test="CORPINFO_ID != null and CORPINFO_ID.trim() != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="CORP_NAME != null and CORP_NAME.trim() != ''">
and f.CORP_NAME like CONCAT('%', #{CORP_NAME},'%')
</if>
<if test="ISDELETE != null">
and f.ISDELETE = #{ISDELETE}
</if>
<if test="CORP_FLAG != null">
and f.CORP_FLAG = #{CORP_FLAG}
</if>
</select>
</mapper>

View File

@ -0,0 +1,136 @@
<?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.zcloud.mapper.datasource.core.CoreSyncDeptMapper">
<!--表名 -->
<sql id="tableName">
CORE_SYNC_DEPARTMENT
</sql>
<!-- 字段 -->
<sql id="Field">
f.DEPARTMENT_ID ,
f.NAME ,
f.PARENT_ID ,
f.CORPINFO_ID ,
f.CORP_NAME ,
f.DEP_ORDER ,
f.DEPT_FLAG ,
f.ISDELETE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
DEPARTMENT_ID ,
NAME ,
PARENT_ID ,
CORPINFO_ID ,
CORP_NAME ,
DEP_ORDER ,
DEPT_FLAG ,
ISDELETE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{DEPARTMENT_ID} ,
#{NAME} ,
#{PARENT_ID} ,
#{CORPINFO_ID} ,
#{CORP_NAME} ,
#{DEP_ORDER} ,
#{DEPT_FLAG} ,
#{ISDELETE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 查询 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.DEPARTMENT_ID = #{DEPARTMENT_ID}
</select>
<delete id="edit" parameterType="pd">
update
<include refid="tableName"></include>
<set>
<if test="NAME != null and NAME.trim() != ''">
NAME = #{NAME},
</if>
<if test="PARENT_ID != null and PARENT_ID.trim() != ''">
PARENT_ID = #{PARENT_ID},
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID.trim() != ''">
CORPINFO_ID = #{CORPINFO_ID},
</if>
<if test="CORP_NAME != null and CORP_NAME.trim() != ''">
CORP_NAME = #{CORP_NAME},
</if>
<if test="DEP_ORDER != null">
DEP_ORDER = #{DEP_ORDER},
</if>
<if test="DEPT_FLAG != null and DEPT_FLAG.trim() != ''">
DEPT_FLAG = #{DEPT_FLAG},
</if>
<if test="ISDELETE != null">
ISDELETE = #{ISDELETE}
</if>
</set>
where
DEPARTMENT_ID = #{DEPARTMENT_ID}
</delete>
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set ISDELETE = '1'
where
DEPARTMENT_ID = #{DEPARTMENT_ID}
</delete>
<select id="listAll" resultType="com.zcloud.entity.PageData">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where 1=1
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID.trim() != ''">
and f.DEPARTMENT_ID = #{DEPARTMENT_ID}
</if>
<if test="NAME != null and NAME.trim() != ''">
and f.NAME like CONCAT('%', #{NAME},'%')
</if>
<if test="PARENT_ID != null and PARENT_ID.trim() != ''">
and f.PARENT_ID = #{PARENT_ID}
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID.trim() != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="CORP_NAME != null and CORP_NAME.trim() != ''">
and f.CORP_NAME like CONCAT('%', #{CORP_NAME},'%')
</if>
<if test="DEP_ORDER != null">
and f.DEP_ORDER = #{DEP_ORDER}
</if>
<if test="DEPT_FLAG != null and DEPT_FLAG.trim() != ''">
and f.DEPT_FLAG = #{DEPT_FLAG}
</if>
<if test="ISDELETE != null">
and f.ISDELETE = #{ISDELETE}
</if>
</select>
</mapper>

View File

@ -0,0 +1,187 @@
<?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.zcloud.mapper.datasource.core.CoreSyncUserMapper">
<!--表名 -->
<sql id="tableName">
CORE_SYNC_USER
</sql>
<!-- 字段 -->
<sql id="Field">
f.USER_ID ,
f.USERNAME ,
f.NAME ,
f.PHONE ,
f.CORPINFO_ID ,
f.CORPINFO_NAME ,
f.DEPARTMENT_ID ,
f.DEPARTMENT_NAME ,
f.POST_ID ,
f.POST_NAME ,
f.ROLE_ID ,
f.ROLE_NAME ,
f.USER_TYPE ,
f.ISDELETE
</sql>
<!-- 字段用于新增 -->
<sql id="Field2">
USER_ID ,
USERNAME ,
NAME ,
PHONE ,
CORPINFO_ID ,
CORPINFO_NAME ,
DEPARTMENT_ID ,
DEPARTMENT_NAME ,
POST_ID ,
POST_NAME ,
ROLE_ID ,
ROLE_NAME ,
USER_TYPE ,
ISDELETE
</sql>
<!-- 字段值 -->
<sql id="FieldValue">
#{USER_ID} ,
#{USERNAME} ,
#{NAME} ,
#{PHONE} ,
#{CORPINFO_ID} ,
#{CORPINFO_NAME} ,
#{DEPARTMENT_ID} ,
#{DEPARTMENT_NAME} ,
#{POST_ID} ,
#{POST_NAME} ,
#{ROLE_ID} ,
#{ROLE_NAME} ,
#{USER_TYPE} ,
#{ISDELETE}
</sql>
<!-- 新增-->
<insert id="save" parameterType="pd">
insert into
<include refid="tableName"></include>
(
<include refid="Field2"></include>
) values (
<include refid="FieldValue"></include>
)
</insert>
<!-- 查询 -->
<select id="findById" parameterType="pd" resultType="pd">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where
f.USER_ID = #{USER_ID}
</select>
<delete id="edit" parameterType="pd">
update
<include refid="tableName"></include>
<set>
<if test="USER_ID != null and USER_ID.trim() != ''">
USER_ID = #{USER_ID},
</if>
<if test="USERNAME != null and USERNAME.trim() != ''">
USERNAME = #{USERNAME},
</if>
<if test="NAME != null and NAME.trim() != ''">
NAME = #{NAME},
</if>
<if test="PHONE != null and PHONE.trim() != ''">
PHONE = #{PHONE},
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID.trim() != ''">
CORPINFO_ID = #{CORPINFO_ID},
</if>
<if test="CORPINFO_NAME != null and CORPINFO_NAME.trim() != ''">
CORPINFO_NAME = #{CORPINFO_NAME},
</if>
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID.trim() != ''">
DEPARTMENT_ID = #{DEPARTMENT_ID},
</if>
<if test="DEPARTMENT_NAME != null and DEPARTMENT_NAME.trim() != ''">
DEPARTMENT_NAME = #{DEPARTMENT_NAME},
</if>
<if test="POST_ID != null and POST_ID.trim() != ''">
POST_ID = #{POST_ID},
</if>
<if test="POST_NAME != null and POST_NAME.trim() != ''">
POST_NAME = #{POST_NAME},
</if>
<if test="ROLE_ID != null and ROLE_ID.trim() != ''">
ROLE_ID = #{ROLE_ID},
</if>
<if test="ROLE_NAME != null and ROLE_NAME.trim() != ''">
ROLE_NAME = #{ROLE_NAME},
</if>
<if test="USER_TYPE != null and USER_TYPE.trim() != ''">
USER_TYPE = #{USER_TYPE},
</if>
<if test="ISDELETE != null and ISDELETE.trim() != ''">
ISDELETE = #{ISDELETE}
</if>
</set>
where
USER_ID = #{USER_ID}
</delete>
<delete id="delete" parameterType="pd">
update
<include refid="tableName"></include>
set ISDELETE = '1'
where
USER_ID = #{USER_ID}
</delete>
<select id="listAll" resultType="com.zcloud.entity.PageData">
select
<include refid="Field"></include>
from
<include refid="tableName"></include> f
where 1=1
<if test="USER_ID != null and USER_ID.trim() != ''">
and f.USER_ID = #{USER_ID}
</if>
<if test="USERNAME != null and USERNAME.trim() != ''">
and f.USERNAME like CONCAT('%', #{USERNAME}, '%')
</if>
<if test="CORPINFO_ID != null and CORPINFO_ID.trim() != ''">
and f.CORPINFO_ID = #{CORPINFO_ID}
</if>
<if test="CORPINFO_NAME != null and CORPINFO_NAME.trim() != ''">
and f.CORPINFO_NAME like CONCAT('%', #{CORPINFO_NAME},'%')
</if>
<if test="DEPARTMENT_ID != null and DEPARTMENT_ID.trim() != ''">
and f.DEPARTMENT_ID = #{DEPARTMENT_ID}
</if>
<if test="DEPARTMENT_NAME != null and DEPARTMENT_NAME.trim() != ''">
and f.DEPARTMENT_NAME like CONCAT('%', #{DEPARTMENT_NAME},'%')
</if>
<if test="POST_ID != null and POST_ID.trim() != ''">
and f.POST_ID = #{POST_ID}
</if>
<if test="POST_NAME != null and POST_NAME.trim() != ''">
and f.POST_NAME like CONCAT('%', #{POST_NAME},'%')
</if>
<if test="ROLE_ID != null and ROLE_ID.trim() != ''">
and f.ROLE_ID = #{ROLE_ID}
</if>
<if test="ROLE_NAME != null and ROLE_NAME.trim() != ''">
and f.ROLE_NAME like CONCAT('%', #{ROLE_NAME},'%')
</if>
<if test="USER_TYPE != null and USER_TYPE.trim() != ''">
and f.USER_TYPE = #{USER_TYPE}
</if>
<if test="ISDELETE != null and ISDELETE.trim() != ''">
and f.ISDELETE = #{ISDELETE}
</if>
</select>
</mapper>