虹软激活

This commit is contained in:
张博 2024-11-08 10:35:38 +08:00
parent c536fb5d69
commit 9e7941ddca
26 changed files with 454 additions and 408 deletions

View File

@ -288,7 +288,7 @@ public class AppInfoApiController {
AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId()); AppUserScopeEntity scope = appUserScopeService.getById(user.getCurrentScopeId());
TenCellEntity cellEntity = tenCellService.getById(scope.getCellId()); TenCellEntity cellEntity = tenCellService.getById(scope.getCellId());
if(cellEntity!=null){ if(cellEntity!=null){
params.put("tenantId",cellEntity.getTenantId()); params.put("cellId",cellEntity.getCellId());
int during = Integer.parseInt((String)params.get("during")); int during = Integer.parseInt((String)params.get("during"));
String recordTimeStart = null; String recordTimeStart = null;
String recordTimeEnd = null; String recordTimeEnd = null;

View File

@ -262,7 +262,7 @@ public class HttpApiController {
log.debug("全量获取:"+sn); log.debug("全量获取:"+sn);
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
//----------------------------------------以下业务----------------------------------------------------- //----------------------------------------以下业务-----------------------------------------------------
List<TenPersonIdUpdateAllVo> all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); List<TenPersonIdUpdateAllVo> all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getCellId());
List<TenPersonAllVo> resAll = new ArrayList<>(); List<TenPersonAllVo> resAll = new ArrayList<>();
for(TenPersonIdUpdateAllVo vo: all){ for(TenPersonIdUpdateAllVo vo: all){
TenPersonAllVo oVo = new TenPersonAllVo(); TenPersonAllVo oVo = new TenPersonAllVo();
@ -271,7 +271,7 @@ public class HttpApiController {
resAll.add(oVo); resAll.add(oVo);
} }
//删除状态为删除的人员 //删除状态为删除的人员
tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getCellId());
Map<String,Object> allPersons = new HashMap<>(); Map<String,Object> allPersons = new HashMap<>();
allPersons.put("allPerson",resAll); allPersons.put("allPerson",resAll);
return R.ok().put("data",allPersons); return R.ok().put("data",allPersons);
@ -429,7 +429,7 @@ public class HttpApiController {
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(),
p.getPersonId(),deviceEntity.getTenantId()); p.getPersonId(),deviceEntity.getCellId());
syncEntity.setState(Constant.PERSON_SYNC_OK); syncEntity.setState(Constant.PERSON_SYNC_OK);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);

View File

@ -264,10 +264,10 @@ public class DeviceApiServiceImpl implements DeviceApiService {
// List<TenPersonIdUpdateAllVo> all = tenPersonService.findAllPersonIdUpdateAll(cellEntity.getCellId(),null,null); // List<TenPersonIdUpdateAllVo> all = tenPersonService.findAllPersonIdUpdateAll(cellEntity.getCellId(),null,null);
List<TenPersonIdUpdateAllVo> all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); List<TenPersonIdUpdateAllVo> all = tenPersonSyncService.getDeviceAllPersonIdUpdateTime(deviceEntity.getDeviceId(),deviceEntity.getCellId());
//删除状态为删除的人员 //删除状态为删除的人员
tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(),deviceEntity.getCellId());
Result res = new Result(); Result res = new Result();
res.put("data",all); res.put("data",all);
@ -391,7 +391,7 @@ public class DeviceApiServiceImpl implements DeviceApiService {
// .eq("person_id",p.getPersonId())); // .eq("person_id",p.getPersonId()));
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(),
p.getPersonId(),deviceEntity.getTenantId()); p.getPersonId(),deviceEntity.getCellId());
syncEntity.setState(Constant.PERSON_SYNC_OK); syncEntity.setState(Constant.PERSON_SYNC_OK);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);
@ -708,7 +708,7 @@ public class DeviceApiServiceImpl implements DeviceApiService {
channel.writeAndFlush(message); channel.writeAndFlush(message);
//配置同步数据 //配置同步数据
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(p.getPersonId(), p.getTenantId()); List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(p.getPersonId(), p.getCellId());
for (TenPersonSyncEntity syncEn : syncEntitys) { for (TenPersonSyncEntity syncEn : syncEntitys) {
syncEn.setLastUpdateTime(p.getLastUpdateTime()); syncEn.setLastUpdateTime(p.getLastUpdateTime());
syncEn.setState(2); syncEn.setState(2);

View File

@ -170,7 +170,7 @@ public class ServerApiServiceImpl implements ServerApiService {
//1.删除同步表中数据 //1.删除同步表中数据
// tenPersonSyncService.remove(new QueryWrapper<TenPersonSyncEntity>() // tenPersonSyncService.remove(new QueryWrapper<TenPersonSyncEntity>()
// .eq("device_id",deviceEntity.getDeviceId())); // .eq("device_id",deviceEntity.getDeviceId()));
tenPersonSyncService.removeByDeviceId(deviceEntity.getDeviceId(),deviceEntity.getTenantId()); tenPersonSyncService.removeByDeviceId(deviceEntity.getDeviceId(),deviceEntity.getCellId());
//2.在同步表中插入所有信息 //2.在同步表中插入所有信息
List<TenPersonIdUpdateAllVo> list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(), List<TenPersonIdUpdateAllVo> list = tenPersonService.findAllPersonIdUpdateAll(deviceEntity.getCellId(),
deviceEntity.getBuildId(), deviceEntity.getBuildId(),
@ -182,6 +182,7 @@ public class ServerApiServiceImpl implements ServerApiService {
entity.setDeviceSn(deviceEntity.getSn()); entity.setDeviceSn(deviceEntity.getSn());
entity.setLastUpdateTime(vo.getLast_update_stamp()); entity.setLastUpdateTime(vo.getLast_update_stamp());
entity.setPersonId(vo.getUid()); entity.setPersonId(vo.getUid());
entity.setCellId(deviceEntity.getCellId());
entity.setState(0); entity.setState(0);
entity.setTenantId(deviceEntity.getTenantId()); entity.setTenantId(deviceEntity.getTenantId());
tenPersonSyncService.insert(entity); tenPersonSyncService.insert(entity);

View File

@ -215,7 +215,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
userScopeEntity.setUserId(user.getUserId()); userScopeEntity.setUserId(user.getUserId());
/* //小区管理员 //小区管理员
if (user.getRoleIdList().get(0).longValue() == Constant.ROLE_TEN_CELL) { if (user.getRoleIdList().get(0).longValue() == Constant.ROLE_TEN_CELL) {
TenCellEntity cell = tenCellService.getById(user.getCellId()); TenCellEntity cell = tenCellService.getById(user.getCellId());
userScopeEntity.setAreaId(cell.getAreaId()); userScopeEntity.setAreaId(cell.getAreaId());
@ -251,7 +251,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserDao, SysUserEntity> i
appUser.setCurrentScopeId(appScope.getUserScopeId()); appUser.setCurrentScopeId(appScope.getUserScopeId());
appUserService.updateById(appUser); appUserService.updateById(appUser);
}*/ }
} }
@Override @Override

View File

@ -87,7 +87,7 @@ public class TenCheckController extends AbstractController {
@RequiresPermissions("ten:check:list") @RequiresPermissions("ten:check:list")
@ApiOperation(value = "考勤详细信息,所有考勤识别记录",response = TenRecordEntity.class) @ApiOperation(value = "考勤详细信息,所有考勤识别记录",response = TenRecordEntity.class)
public R checkDetail(@PathVariable("checkId") Long checkId){ public R checkDetail(@PathVariable("checkId") Long checkId){
Long tenantId = getUser().getTenantId(); Long cellId = getUser().getCellId();
TenCheckEntity tenCheck = tenCheckService.getById(checkId); TenCheckEntity tenCheck = tenCheckService.getById(checkId);
// List<Long> recordIds = new ArrayList<>(); // List<Long> recordIds = new ArrayList<>();
List<TenCheckScheduleEntity> csList = tenCheckScheduleService.list( List<TenCheckScheduleEntity> csList = tenCheckScheduleService.list(
@ -99,13 +99,13 @@ public class TenCheckController extends AbstractController {
// recordIds.add(ss.getDutyOnRecordId()); // recordIds.add(ss.getDutyOnRecordId());
// recordIds.add(ss.getDutyOffRecordId()); // recordIds.add(ss.getDutyOffRecordId());
if (ss.getDutyOnRecordId()!=null) { if (ss.getDutyOnRecordId()!=null) {
TenRecordEntity recordEntityOn = tenRecordService.getById(ss.getDutyOnRecordId(),tenantId); TenRecordEntity recordEntityOn = tenRecordService.getById(ss.getDutyOnRecordId(),cellId);
if (recordEntityOn!=null) { if (recordEntityOn!=null) {
records.add(recordEntityOn); records.add(recordEntityOn);
} }
} }
if(ss.getDutyOffRecordId()!=null){ if(ss.getDutyOffRecordId()!=null){
TenRecordEntity recordEntityOff = tenRecordService.getById(ss.getDutyOffRecordId(),tenantId); TenRecordEntity recordEntityOff = tenRecordService.getById(ss.getDutyOffRecordId(),cellId);
if(recordEntityOff!=null){ if(recordEntityOff!=null){
records.add(recordEntityOff); records.add(recordEntityOff);
} }

View File

@ -145,8 +145,8 @@ public class TenPersonController extends AbstractController {
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId()); List<Long> roleIdList = sysUserRoleService.queryRoleIdList(user.getUserId());
//小区管理员 //小区管理员
if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) { if (roleIdList.get(0).longValue() == Constant.ROLE_TEN_CELL) {
TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId())); //TenUserScopeEntity scope = tenUserScopeService.getOne(new QueryWrapper<TenUserScopeEntity>().eq("user_id", user.getUserId()));
params.put("cellId", scope.getCellId().toString()); params.put("cellId", getUser().getCellId());
} }
List<Integer> personTypeList = new ArrayList<>(); List<Integer> personTypeList = new ArrayList<>();
List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>() List<TenLabelEntity> tenLabel = tenLabelService.list(new QueryWrapper<TenLabelEntity>()
@ -307,7 +307,7 @@ public class TenPersonController extends AbstractController {
} }
person.setDoorCardEntity(doorCard); person.setDoorCardEntity(doorCard);
String lastRecordTime = tenRecordService.findLastRecordTime(personId,person.getTenantId()); String lastRecordTime = tenRecordService.findLastRecordTime(personId,person.getCellId());
person.setLastRecordTime(lastRecordTime); person.setLastRecordTime(lastRecordTime);
String lastLoginTime = appUserService.findLastLoginTime(personId, cellId); String lastLoginTime = appUserService.findLastLoginTime(personId, cellId);
@ -578,7 +578,7 @@ public class TenPersonController extends AbstractController {
//状态是0正常发送推送 //状态是0正常发送推送
for (TenDeviceVo dev : devList) { for (TenDeviceVo dev : devList) {
//添加到同步表下发设备通知 //添加到同步表下发设备通知
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getTenantId()); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getCellId());
if(syncEntity==null){ if(syncEntity==null){
syncEntity = new TenPersonSyncEntity(); syncEntity = new TenPersonSyncEntity();
syncEntity.setPersonId(tenPerson.getPersonId()); syncEntity.setPersonId(tenPerson.getPersonId());
@ -587,6 +587,7 @@ public class TenPersonController extends AbstractController {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(Constant.PERSON_SYNC_ADD); syncEntity.setState(Constant.PERSON_SYNC_ADD);
syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime());
syncEntity.setCellId(tenPerson.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
//下发通知 //下发通知
@ -617,7 +618,7 @@ public class TenPersonController extends AbstractController {
else{ else{
for (TenDeviceVo dev : devList) { for (TenDeviceVo dev : devList) {
//添加到同步表下发设备通知 //添加到同步表下发设备通知
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getTenantId()); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(dev.getDeviceId(),tenPerson.getPersonId(),tenPerson.getCellId());
if(syncEntity!=null){ if(syncEntity!=null){
syncEntity.setState(Constant.PERSON_SYNC_DELETE); syncEntity.setState(Constant.PERSON_SYNC_DELETE);
syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime());
@ -631,7 +632,7 @@ public class TenPersonController extends AbstractController {
list.add(vo); list.add(vo);
int flag = serverApiService.personOperation(dev.getSn(),list); int flag = serverApiService.personOperation(dev.getSn(),list);
if(flag!= -1){ if(flag!= -1){
tenPersonSyncService.removeByPersonSyncId(syncEntity.getPersonSyncId(),syncEntity.getTenantId()); tenPersonSyncService.removeByPersonSyncId(syncEntity.getPersonSyncId(),syncEntity.getCellId());
} }
} }
} }

View File

@ -172,7 +172,7 @@ public class TenRecordController extends AbstractController {
String start = yearMonth+"-01 00:00:0l"; String start = yearMonth+"-01 00:00:0l";
String end = yearMonthLastDay+" 23:59:59"; String end = yearMonthLastDay+" 23:59:59";
List<TenRecordEntity> monthRecords = tenRecordService.getMonthRecords(start,end,tenantId); List<TenRecordEntity> monthRecords = tenRecordService.getMonthRecords(start,end,getUser().getCellId().toString());
for(TenRecordEntity recordEntity: monthRecords){ for(TenRecordEntity recordEntity: monthRecords){
if (recordEntity.getRecordFace()!=null && recordEntity.getRecordFace().length()>0) { if (recordEntity.getRecordFace()!=null && recordEntity.getRecordFace().length()>0) {
@ -203,7 +203,7 @@ public class TenRecordController extends AbstractController {
@PostMapping("/copy3dZip") @PostMapping("/copy3dZip")
public R copy3dZip(@RequestParam("yearMonth") String yearMonth){ public R copy3dZip(@RequestParam("yearMonth") String yearMonth){
String tenantId = getUser().getTenantId()+""; String cellId = getUser().getCellId()+"";
int count = 0; int count = 0;
String[] yearMonthArray = yearMonth.split("-"); String[] yearMonthArray = yearMonth.split("-");
int year = Integer.parseInt(yearMonthArray[0]); int year = Integer.parseInt(yearMonthArray[0]);
@ -213,7 +213,7 @@ public class TenRecordController extends AbstractController {
String start = yearMonth+"-01 00:00:0l"; String start = yearMonth+"-01 00:00:0l";
String end = yearMonthLastDay+" 23:59:59"; String end = yearMonthLastDay+" 23:59:59";
List<TenRecordEntity> monthRecords = tenRecordService.getMonthRecords(start,end,tenantId); List<TenRecordEntity> monthRecords = tenRecordService.getMonthRecords(start,end,cellId);
for(TenRecordEntity recordEntity: monthRecords){ for(TenRecordEntity recordEntity: monthRecords){

View File

@ -248,7 +248,7 @@ public class TenRoomController extends AbstractController {
//配置同步数据 //配置同步数据
for(TenPersonEntity entity: roomPersonList){ for(TenPersonEntity entity: roomPersonList){
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId());
for (TenPersonSyncEntity syncEn : syncEntitys) { for (TenPersonSyncEntity syncEn : syncEntitys) {
syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setLastUpdateTime(entity.getLastUpdateTime());
syncEn.setState(Constant.PERSON_SYNC_MODIFY); syncEn.setState(Constant.PERSON_SYNC_MODIFY);

View File

@ -25,6 +25,9 @@ public interface TenCellDao extends BaseMapper<TenCellEntity> {
void createTenPackRecord(@Param("tenantId")String tenantId); void createTenPackRecord(@Param("tenantId")String tenantId);
void createTenPersonExtract(@Param("tenantId")String tenantId); void createTenPersonExtract(@Param("tenantId")String tenantId);
void createTenPersonSync(@Param("tenantId")String tenantId); void createTenPersonSync(@Param("tenantId")String tenantId);
void createTenCellDept(@Param("cellId")String cellId);
void createTenParent(@Param("cellId")String celId);
void createTenRelation(@Param("cellId")String celId);

View File

@ -1,7 +1,6 @@
package net.shapelight.modules.ten.dao; package net.shapelight.modules.ten.dao;
import net.shapelight.modules.ten.entity.TenPersonSyncEntity; import net.shapelight.modules.ten.entity.TenPersonSyncEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.shapelight.modules.vo.TenPersonIdUpdateAllVo; import net.shapelight.modules.vo.TenPersonIdUpdateAllVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@ -16,31 +15,31 @@ import java.util.Map;
@Mapper @Mapper
public interface TenPersonSyncDao { public interface TenPersonSyncDao {
List<TenPersonIdUpdateAllVo> getDeviceAllPersonIdUpdateTime(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); List<TenPersonIdUpdateAllVo> getDeviceAllPersonIdUpdateTime(@Param("deviceId")Long deviceId,@Param("cellId")Long tenantId);
int insert(TenPersonSyncEntity tenLicenseEntity); int insert(TenPersonSyncEntity tenLicenseEntity);
int insertBatch(@Param("list")List<TenPersonSyncEntity> list,@Param("tenantId")Long tenantId); int insertBatch(@Param("list")List<TenPersonSyncEntity> list,@Param("cellId")Long cellId);
int updateById(TenPersonSyncEntity entity); int updateById(TenPersonSyncEntity entity);
void removeByDeviceId(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); void removeByDeviceId(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId);
void removeAllDeletePersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); void removeAllDeletePersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId);
TenPersonSyncEntity findByDeviceIdAndPersonId(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("tenantId")Long tenantId); TenPersonSyncEntity findByDeviceIdAndPersonId(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("cellId")Long cellId);
List<TenPersonSyncEntity> findByPersonId(@Param("personId")Long personId, @Param("tenantId")Long tenantId); List<TenPersonSyncEntity> findByPersonId(@Param("personId")Long personId, @Param("cellId")Long cellId);
List<Map<String,String>> findGroupDevicePersons(@Param("personIds")List<Long> personIds, @Param("tenantId")Long tenantId); List<Map<String,String>> findGroupDevicePersons(@Param("personIds")List<Long> personIds, @Param("cellId")Long cellId);
List<TenPersonSyncEntity> findDeviceAllDeletePersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); List<TenPersonSyncEntity> findDeviceAllDeletePersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId);
List<TenPersonSyncEntity> findDeviceAllAddPersons(@Param("deviceId")Long deviceId,@Param("tenantId")Long tenantId); List<TenPersonSyncEntity> findDeviceAllAddPersons(@Param("deviceId")Long deviceId,@Param("cellId")Long cellId);
void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("tenantId")Long tenantId); void removePersonSyncId(@Param("personSyncId")Long personSyncId,@Param("cellId")Long cellId);
List<TenPersonSyncEntity> findTwo(@Param("tenantId")Long tenantId); List<TenPersonSyncEntity> findTwo(@Param("tenantId")Long tenantId);
List<TenPersonSyncEntity> findByDeviceIdAndPersonIdTwo(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("tenantId")Long tenantId); List<TenPersonSyncEntity> findByDeviceIdAndPersonIdTwo(@Param("deviceId")Long deviceId, @Param("personId")Long personId, @Param("cellId")Long tenantId);

View File

@ -17,11 +17,11 @@ import java.util.Map;
public interface TenRecordDao { public interface TenRecordDao {
int insert(TenRecordEntity tenRecordEntity); int insert(TenRecordEntity tenRecordEntity);
int deleteById(@Param("recordId") Long id, @Param("tenantId") Long tenantId); int deleteById(@Param("recordId") Long id, @Param("cellId") Long cellId);
boolean updateById(TenRecordEntity entity); boolean updateById(TenRecordEntity entity);
TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("tenantId") Long tenantId); TenRecordEntity selectById(@Param("recordId") Long recordId, @Param("cellId") Long cellId);
IPage<TenRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params); IPage<TenRecordEntity> findPageAll(Page page, @Param("cellIds") List<Long> cellIds, @Param("params") Map params);
@ -37,13 +37,13 @@ public interface TenRecordDao {
IPage<TenRecordEntity> findPageRoomRecord(Page page, @Param("params") Map params); IPage<TenRecordEntity> findPageRoomRecord(Page page, @Param("params") Map params);
String findLastRecordTime(@Param("personId") Long personId, @Param("tenantId") Long tenantId); String findLastRecordTime(@Param("personId") Long personId, @Param("cellId") Long cellId);
List<TenRecordEntity> getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); List<TenRecordEntity> getNotSync(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
List<TenRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2); List<TenRecordEntity> getNotSyncImage(@Param("cellId") Long paramLong1, @Param("tenantId") Long paramLong2);
List<TenRecordEntity> getMonthRecords(@Param("start") String start, @Param("end") String end, @Param("tenantId") String tenantId); List<TenRecordEntity> getMonthRecords(@Param("start") String start, @Param("end") String end, @Param("cellId") String cellId);
IPage<TenRecordEntity> findPageDeptRecord(Page page, @Param("params") Map params); IPage<TenRecordEntity> findPageDeptRecord(Page page, @Param("params") Map params);

View File

@ -55,4 +55,8 @@ public class TenPersonSyncEntity implements Serializable {
@JsonSerialize(using = ToStringSerializer.class) @JsonSerialize(using = ToStringSerializer.class)
private Long tenantId; private Long tenantId;
@ApiModelProperty("学校ID")
@JsonSerialize(using = ToStringSerializer.class)
private Long cellId;
} }

View File

@ -16,10 +16,10 @@ import java.util.Map;
public interface TenPersonSyncService { public interface TenPersonSyncService {
List<TenPersonIdUpdateAllVo> getDeviceAllPersonIdUpdateTime(Long deviceId,Long tenantId); List<TenPersonIdUpdateAllVo> getDeviceAllPersonIdUpdateTime(Long deviceId,Long cellId);
int insert(TenPersonSyncEntity tenLicenseEntity); int insert(TenPersonSyncEntity tenLicenseEntity);
int insertBatch(List<TenPersonSyncEntity> list,Long tenantId); int insertBatch(List<TenPersonSyncEntity> list,Long cellId);
int updateById(TenPersonSyncEntity entity); int updateById(TenPersonSyncEntity entity);
void removeByDeviceId(Long deviceId, Long tenantId); void removeByDeviceId(Long deviceId, Long tenantId);
@ -34,7 +34,7 @@ public interface TenPersonSyncService {
List<Map<String,String>> findGroupDevicePersons(List<Long> personIds, Long tenantId); List<Map<String,String>> findGroupDevicePersons(List<Long> personIds, Long tenantId);
List<TenPersonSyncEntity> findDeviceAllDeletePersons(Long deviceId, Long tenantId); List<TenPersonSyncEntity> findDeviceAllDeletePersons(Long deviceId, Long cellId);
List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId); List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId);

View File

@ -87,6 +87,9 @@ public class TenCellServiceImpl extends ServiceImpl<TenCellDao, TenCellEntity> i
// tenCellDao.createTenPackRecord(cellId); // tenCellDao.createTenPackRecord(cellId);
tenCellDao.createTenPersonExtract(cellId); tenCellDao.createTenPersonExtract(cellId);
tenCellDao.createTenPersonSync(cellId); tenCellDao.createTenPersonSync(cellId);
tenCellDao.createTenParent(cellId);
tenCellDao.createTenRelation(cellId);
//tenCellDao.createTenCellDept(cellId);
return super.save(entity); return super.save(entity);
} }

View File

@ -342,7 +342,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
if(idList.size()>0){ if(idList.size()>0){
for (Long devId : (List<Long>) idList) { for (Long devId : (List<Long>) idList) {
TenDeviceEntity deviceEntity = this.getById(devId); TenDeviceEntity deviceEntity = this.getById(devId);
tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getTenantId()); tenPersonSyncService.removeByDeviceId(devId, deviceEntity.getCellId());
//清除通知 //清除通知
serverApiService.cleanData(deviceEntity.getSn()); serverApiService.cleanData(deviceEntity.getSn());
} }
@ -430,7 +430,7 @@ public class TenDeviceServiceImpl extends ServiceImpl<TenDeviceDao, TenDeviceEnt
// tenPersonSyncService.insert(entity); // tenPersonSyncService.insert(entity);
} }
if (saveList.size() > 0) { if (saveList.size() > 0) {
tenPersonSyncService.insertBatch(saveList, deviceEntity.getTenantId()); tenPersonSyncService.insertBatch(saveList, deviceEntity.getCellId());
} }
// tenPersonSyncService.saveBatch(sList); // tenPersonSyncService.saveBatch(sList);

View File

@ -31,6 +31,7 @@ import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
import net.shapelight.modules.face.service.FaceEngineService; import net.shapelight.modules.face.service.FaceEngineService;
import net.shapelight.modules.job.entity.KeysEntity; import net.shapelight.modules.job.entity.KeysEntity;
import net.shapelight.modules.nettyapi.service.ServerApiService; import net.shapelight.modules.nettyapi.service.ServerApiService;
import net.shapelight.modules.sys.controller.AbstractController;
import net.shapelight.modules.sys.entity.SysDictEntity; import net.shapelight.modules.sys.entity.SysDictEntity;
import net.shapelight.modules.sys.service.impl.SysDictServiceImpl; import net.shapelight.modules.sys.service.impl.SysDictServiceImpl;
import net.shapelight.modules.ten.dao.TenRelationMapper; import net.shapelight.modules.ten.dao.TenRelationMapper;
@ -491,6 +492,7 @@ public class TenPersonServiceImpl implements TenPersonService {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(1); syncEntity.setState(1);
syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); syncEntity.setLastUpdateTime(entity.getLastUpdateTime());
syncEntity.setCellId(entity.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
/* //下发通知 /* //下发通知
@ -582,6 +584,7 @@ public class TenPersonServiceImpl implements TenPersonService {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(1); syncEntity.setState(1);
syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); syncEntity.setLastUpdateTime(entity.getLastUpdateTime());
syncEntity.setCellId(entity.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
//下发通知 //下发通知
@ -612,7 +615,7 @@ public class TenPersonServiceImpl implements TenPersonService {
if (flag == 1) { if (flag == 1) {
//发送设备通知 //发送设备通知
//配置同步数据 //配置同步数据
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId());
for (TenPersonSyncEntity syncEn : syncEntitys) { for (TenPersonSyncEntity syncEn : syncEntitys) {
syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setLastUpdateTime(entity.getLastUpdateTime());
syncEn.setState(2); syncEn.setState(2);
@ -824,6 +827,7 @@ public class TenPersonServiceImpl implements TenPersonService {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(1); syncEntity.setState(1);
syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); syncEntity.setLastUpdateTime(entity.getLastUpdateTime());
syncEntity.setCellId(entity.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
/* //下发通知 /* //下发通知
@ -919,7 +923,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//配置同步信息并推送 //配置同步信息并推送
List<Map<String, String>> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, tenantId); List<Map<String, String>> snPersonsList = tenPersonSyncService.findGroupDevicePersons(personIds, cellId);
for (Map<String, String> snPersons : snPersonsList) { for (Map<String, String> snPersons : snPersonsList) {
String sn = snPersons.get("deviceSn"); String sn = snPersons.get("deviceSn");
TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn); TenDeviceEntity deviceEntity = tenDeviceService.findBySn(sn);
@ -933,7 +937,7 @@ public class TenPersonServiceImpl implements TenPersonService {
Long personId = Long.parseLong(personInfoStr[0]); Long personId = Long.parseLong(personInfoStr[0]);
Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN); Date lastUpdateTime = DateUtils.stringToDate(personInfoStr[1], DateUtils.DATE_TIME_PATTERN);
TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personId, tenantId); TenPersonSyncEntity syncEntity = tenPersonSyncService.findByDeviceIdAndPersonId(deviceEntity.getDeviceId(), personId, cellId);
syncEntity.setLastUpdateTime(lastUpdateTime); syncEntity.setLastUpdateTime(lastUpdateTime);
syncEntity.setState(Constant.PERSON_SYNC_DELETE); syncEntity.setState(Constant.PERSON_SYNC_DELETE);
tenPersonSyncService.updateById(syncEntity); tenPersonSyncService.updateById(syncEntity);
@ -951,7 +955,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//int flag = serverApiService.personOperation(sn, list); //int flag = serverApiService.personOperation(sn, list);
//下发成功删除状态为删除的同步人员 //下发成功删除状态为删除的同步人员
tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), tenantId); tenPersonSyncService.removeAllDeletePersons(deviceEntity.getDeviceId(), cellId);
} }
return true; return true;
} }
@ -979,13 +983,14 @@ public class TenPersonServiceImpl implements TenPersonService {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(Constant.PERSON_SYNC_ADD); syncEntity.setState(Constant.PERSON_SYNC_ADD);
syncEntity.setLastUpdateTime(entity.getLastUpdateTime()); syncEntity.setLastUpdateTime(entity.getLastUpdateTime());
syncEntity.setCellId(entity.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
} }
} }
//下发设备通知 //下发设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId); List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
for (TenDeviceVo deviceVo : devList) { for (TenDeviceVo deviceVo : devList) {
List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getCellId());
List<TenPersonOperationVo> voList = new ArrayList<>(); List<TenPersonOperationVo> voList = new ArrayList<>();
for (TenPersonSyncEntity syncEntity : operationList) { for (TenPersonSyncEntity syncEntity : operationList) {
TenPersonOperationVo vo = new TenPersonOperationVo(); TenPersonOperationVo vo = new TenPersonOperationVo();
@ -1444,7 +1449,7 @@ public class TenPersonServiceImpl implements TenPersonService {
tenPersonDao.updateById(entity); tenPersonDao.updateById(entity);
//配置同步数据 //配置同步数据
List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getTenantId()); List<TenPersonSyncEntity> syncEntitys = tenPersonSyncService.findByPersonId(entity.getPersonId(), entity.getCellId());
for (TenPersonSyncEntity syncEn : syncEntitys) { for (TenPersonSyncEntity syncEn : syncEntitys) {
syncEn.setLastUpdateTime(entity.getLastUpdateTime()); syncEn.setLastUpdateTime(entity.getLastUpdateTime());
syncEn.setState(2); syncEn.setState(2);
@ -2234,6 +2239,7 @@ public class TenPersonServiceImpl implements TenPersonService {
syncEntity.setDeviceId(dev.getDeviceId()); syncEntity.setDeviceId(dev.getDeviceId());
syncEntity.setState(1); syncEntity.setState(1);
syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime()); syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime());
syncEntity.setCellId(tenPerson.getCellId());
tenPersonSyncService.insert(syncEntity); tenPersonSyncService.insert(syncEntity);
} }
} }
@ -2242,7 +2248,7 @@ public class TenPersonServiceImpl implements TenPersonService {
//下发设备通知 //下发设备通知
List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId); List<TenDeviceVo> devList = tenDeviceService.findByCellId(cellId);
for (TenDeviceVo deviceVo : devList) { for (TenDeviceVo deviceVo : devList) {
List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getTenantId()); List<TenPersonSyncEntity> operationList = tenPersonSyncService.findDeviceAllAddPersons(deviceVo.getDeviceId(), deviceVo.getCellId());
List<TenPersonOperationVo> voList = new ArrayList<>(); List<TenPersonOperationVo> voList = new ArrayList<>();
for (TenPersonSyncEntity syncEntity : operationList) { for (TenPersonSyncEntity syncEntity : operationList) {
TenPersonOperationVo vo = new TenPersonOperationVo(); TenPersonOperationVo vo = new TenPersonOperationVo();

View File

@ -34,7 +34,7 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService {
public int insert(TenPersonSyncEntity tenPersonSyncEntity) { public int insert(TenPersonSyncEntity tenPersonSyncEntity) {
TenPersonSyncEntity entity = this.findByDeviceIdAndPersonId(tenPersonSyncEntity.getDeviceId(), TenPersonSyncEntity entity = this.findByDeviceIdAndPersonId(tenPersonSyncEntity.getDeviceId(),
tenPersonSyncEntity.getPersonId(), tenPersonSyncEntity.getPersonId(),
tenPersonSyncEntity.getTenantId()); tenPersonSyncEntity.getCellId());
if(entity==null){ if(entity==null){
return tenPersonSyncDao.insert(tenPersonSyncEntity); return tenPersonSyncDao.insert(tenPersonSyncEntity);
}else{ }else{
@ -45,8 +45,8 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService {
} }
@Override @Override
public int insertBatch(List<TenPersonSyncEntity> list,Long tenantId) { public int insertBatch(List<TenPersonSyncEntity> list,Long cellId) {
return tenPersonSyncDao.insertBatch(list,tenantId); return tenPersonSyncDao.insertBatch(list,cellId);
} }
@Override @Override
@ -56,52 +56,52 @@ public class TenPersonSyncServiceImpl implements TenPersonSyncService {
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void removeByDeviceId(Long deviceId,Long tenantId) { public void removeByDeviceId(Long deviceId,Long cellId) {
tenPersonSyncDao.removeByDeviceId(deviceId,tenantId); tenPersonSyncDao.removeByDeviceId(deviceId,cellId);
} }
@Override @Override
public void removeByPersonSyncId(Long personSyncId, Long tenantId) { public void removeByPersonSyncId(Long personSyncId, Long cellId) {
tenPersonSyncDao.removePersonSyncId(personSyncId, tenantId); tenPersonSyncDao.removePersonSyncId(personSyncId, cellId);
} }
@Override @Override
public void removeAllDeletePersons(Long deviceId, Long tenantId) { public void removeAllDeletePersons(Long deviceId, Long cellId) {
tenPersonSyncDao.removeAllDeletePersons(deviceId, tenantId); tenPersonSyncDao.removeAllDeletePersons(deviceId, cellId);
} }
@Override @Override
public TenPersonSyncEntity findByDeviceIdAndPersonId(Long deviceId, Long personId, Long tenantId) { public TenPersonSyncEntity findByDeviceIdAndPersonId(Long deviceId, Long personId, Long cellId) {
return tenPersonSyncDao.findByDeviceIdAndPersonId(deviceId, personId, tenantId); return tenPersonSyncDao.findByDeviceIdAndPersonId(deviceId, personId, cellId);
} }
@Override @Override
public List<TenPersonSyncEntity> findByPersonId(Long personId, Long tenantId) { public List<TenPersonSyncEntity> findByPersonId(Long personId, Long cellId) {
return tenPersonSyncDao.findByPersonId(personId, tenantId); return tenPersonSyncDao.findByPersonId(personId, cellId);
} }
@Override @Override
public List<Map<String, String>> findGroupDevicePersons(List<Long> personIds, Long tenantId) { public List<Map<String, String>> findGroupDevicePersons(List<Long> personIds, Long cellId) {
return tenPersonSyncDao.findGroupDevicePersons(personIds, tenantId); return tenPersonSyncDao.findGroupDevicePersons(personIds, cellId);
} }
@Override @Override
public List<TenPersonSyncEntity> findDeviceAllDeletePersons(Long deviceId, Long tenantId) { public List<TenPersonSyncEntity> findDeviceAllDeletePersons(Long deviceId, Long cellId) {
return tenPersonSyncDao.findDeviceAllDeletePersons(deviceId,tenantId); return tenPersonSyncDao.findDeviceAllDeletePersons(deviceId,cellId);
} }
@Override @Override
public List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long tenantId) { public List<TenPersonSyncEntity> findDeviceAllAddPersons(Long deviceId, Long cellId) {
return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,tenantId); return tenPersonSyncDao.findDeviceAllAddPersons(deviceId,cellId);
} }
@Override @Override
public List<TenPersonSyncEntity> findTwo(Long tenantId) { public List<TenPersonSyncEntity> findTwo(Long cellId) {
return tenPersonSyncDao.findTwo(tenantId); return tenPersonSyncDao.findTwo(cellId);
} }
@Override @Override
public List<TenPersonSyncEntity> findByDeviceIdAndPersonIdList(Long deviceId, Long personId, Long tenantId) { public List<TenPersonSyncEntity> findByDeviceIdAndPersonIdList(Long deviceId, Long personId, Long cellId) {
return tenPersonSyncDao.findByDeviceIdAndPersonIdTwo(deviceId, personId, tenantId); return tenPersonSyncDao.findByDeviceIdAndPersonIdTwo(deviceId, personId, cellId);
} }
} }

View File

@ -279,13 +279,13 @@ public class TenRecordServiceImpl implements TenRecordService {
} }
@Override @Override
public TenRecordEntity getById(Long id, Long tenantId) { public TenRecordEntity getById(Long id, Long cellId) {
return tenRecordDao.selectById(id, tenantId); return tenRecordDao.selectById(id, cellId);
} }
@Override @Override
public String findLastRecordTime(Long personId, Long tenantId) { public String findLastRecordTime(Long personId, Long cellId) {
return tenRecordDao.findLastRecordTime(personId, tenantId); return tenRecordDao.findLastRecordTime(personId, cellId);
} }
@Override @Override
@ -433,8 +433,8 @@ public class TenRecordServiceImpl implements TenRecordService {
} }
@Override @Override
public List<TenRecordEntity> getMonthRecords(String start, String end, String tenantId) { public List<TenRecordEntity> getMonthRecords(String start, String end, String cellId) {
return this.tenRecordDao.getMonthRecords(start, end, tenantId); return this.tenRecordDao.getMonthRecords(start, end, cellId);
} }
@Override @Override
@ -481,8 +481,8 @@ public class TenRecordServiceImpl implements TenRecordService {
Page pageParam = new Page(); Page pageParam = new Page();
pageParam.setCurrent(Long.parseLong((String) params.get("page"))); pageParam.setCurrent(Long.parseLong((String) params.get("page")));
pageParam.setSize(Long.parseLong((String) params.get("limit"))); pageParam.setSize(Long.parseLong((String) params.get("limit")));
List<Long> list = (List<Long>) params.get("personIds"); //List<Long> list = (List<Long>) params.get("personIds");
Long cellId = Long.parseLong(params.get("tenantId").toString()); //Long cellId = Long.parseLong(params.get("tenantId").toString());
int during = Integer.parseInt((String)params.get("during")); int during = Integer.parseInt((String)params.get("during"));
String recordTimeStart = null; String recordTimeStart = null;
String recordTimeEnd = null; String recordTimeEnd = null;

View File

@ -54,7 +54,7 @@
</resultMap> </resultMap>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity"> <insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity">
insert into ten_build insert into ten_build_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="buildId != null"> <if test="buildId != null">
build_id, build_id,
@ -166,7 +166,7 @@
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenBuildEntity">
update ten_build update ten_build_${cellId}
<set> <set>
<if test="buildId != null"> <if test="buildId != null">
build_id = #{buildId,jdbcType=BIGINT}, build_id = #{buildId,jdbcType=BIGINT},
@ -225,37 +225,37 @@
<delete id="logicDeleteById"> <delete id="logicDeleteById">
update ten_build set delete_flag = 1 update ten_build_${cellId} set delete_flag = 1
where build_id = #{buildId,jdbcType=BIGINT} where build_id = #{buildId,jdbcType=BIGINT}
</delete> </delete>
<delete id="logicDeleteByCellId"> <delete id="logicDeleteByCellId">
update ten_build set delete_flag = 1 update ten_build_${cellId} set delete_flag = 1
where cell_id = #{cellId,jdbcType=BIGINT} where cell_id = #{cellId,jdbcType=BIGINT}
</delete> </delete>
<delete id="deleteById"> <delete id="deleteById">
delete from ten_build delete from ten_build_${cellId}
where build_id = #{buildId,jdbcType=BIGINT} where build_id = #{buildId,jdbcType=BIGINT}
</delete> </delete>
<select id="selectById" resultMap="tenBuildMap"> <select id="selectById" resultMap="tenBuildMap">
select * from ten_build select * from ten_build_${cellId}
where build_id = #{buildId} where build_id = #{buildId}
</select> </select>
<select id="selectByCellId" resultMap="tenBuildMap"> <select id="selectByCellId" resultMap="tenBuildMap">
select * from ten_build select * from ten_build_${cellId}
where cell_id = #{cellId} and delete_flag = 0 where cell_id = #{cellId} and delete_flag = 0
</select> </select>
<select id="getBuildName" resultType="string"> <select id="getBuildName" resultType="string">
select name from ten_build select name from ten_build_${cellId}
where build_id = #{buildId} where build_id = #{buildId}
</select> </select>
<select id="getBuildUnit" resultType="string"> <select id="getBuildUnit" resultType="string">
select unit from ten_build select unit from ten_build_${cellId}
where build_id = #{buildId} where build_id = #{buildId}
</select> </select>
@ -265,33 +265,33 @@
<!--</select>--> <!--</select>-->
<select id="queryByNumberAndUnit" resultMap="tenBuildMap"> <select id="queryByNumberAndUnit" resultMap="tenBuildMap">
select * from ten_build where delete_flag = 0 select * from ten_build_${cellId} where delete_flag = 0
and number = #{number} and unit = #{unit} and cell_id = #{cellId} and number = #{number} and unit = #{unit} and cell_id = #{cellId}
</select> </select>
<select id="queryByNameAndUnit" resultMap="tenBuildMap"> <select id="queryByNameAndUnit" resultMap="tenBuildMap">
select * from ten_build where delete_flag = 0 select * from ten_build_${cellId} where delete_flag = 0
and name = #{name} and unit = #{unit} and cell_id = #{cellId} and name = #{name} and unit = #{unit} and cell_id = #{cellId}
</select> </select>
<select id="findPageAll" resultMap="tenBuildMap" > <select id="findPageAll" resultMap="tenBuildMap" >
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select * from ten_build_${item}--> select * from ten_build_${item}
<!--</foreach>--> </foreach>
<!--) alias where delete_flag = 0--> ) alias where delete_flag = 0
<!--<if test="params.areaId != null and params.areaId!=''">--> <if test="params.areaId != null and params.areaId!=''">
<!--and alias.area_id = #{params.areaId}--> and alias.area_id = #{params.areaId}
<!--</if>--> </if>
<!--<if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!--and alias.cell_id = #{params.cellId}--> and alias.cell_id = #{params.cellId}
<!--</if>--> </if>
<!--<if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!--and `name` like CONCAT('%', '${params.name}', '%')--> and `name` like CONCAT('%', '${params.name}', '%')
<!--</if>--> </if>
select * from ten_build <!--select * from ten_build_${cellId}
where delete_flag = 0 where delete_flag = 0
<if test="params.areaId != null and params.areaId!=''"> <if test="params.areaId != null and params.areaId!=''">
and area_id = #{params.areaId} and area_id = #{params.areaId}
@ -308,7 +308,7 @@
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>-->
</select> </select>
@ -320,7 +320,7 @@
<!--</foreach>--> <!--</foreach>-->
<!--) alias where delete_flag = 0--> <!--) alias where delete_flag = 0-->
select * from ten_build select * from ten_build_${cellId}
where delete_flag = 0 where delete_flag = 0
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
@ -331,7 +331,7 @@
</select> </select>
<select id="getBuildNumber" resultType="string"> <select id="getBuildNumber" resultType="string">
select number from ten_build select number from ten_build_${cellId}
where build_id = #{buildId} where build_id = #{buildId}
</select> </select>

View File

@ -68,6 +68,17 @@
create table if not exists `ten_person_sync_${tenantId}` like `ten_person_sync_0`; create table if not exists `ten_person_sync_${tenantId}` like `ten_person_sync_0`;
</update> </update>
<update id="createTenCellDept" parameterType="String">
create table if not exists `ten_cell_dept_${cellId}` like `ten_cell_dept_0`;
</update>
<update id="createTenParent" parameterType="String">
create table if not exists `ten_parent_${cellId}` like `ten_parent_0`;
</update>
<update id="createTenRelation" parameterType="String">
create table if not exists `ten_relation_${cellId}` like `ten_relation_0`;
</update>
<select id="queryList" resultMap="tenCellMap"> <select id="queryList" resultMap="tenCellMap">
select * from ten_cell where delete_flag = 0 and tenant_id = #{params.tenantId} select * from ten_cell where delete_flag = 0 and tenant_id = #{params.tenantId}
<if test="params.sql_filter != null"> <if test="params.sql_filter != null">

View File

@ -113,7 +113,7 @@
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity"> <insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
insert into ten_person insert into ten_person_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personId != null"> <if test="personId != null">
person_id, person_id,
@ -438,7 +438,7 @@
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
update ten_person update ten_person_${cellId}
<set> <set>
<if test="personId != null"> <if test="personId != null">
person_id = #{personId,jdbcType=BIGINT}, person_id = #{personId,jdbcType=BIGINT},
@ -464,9 +464,7 @@
<if test="mobile != null"> <if test="mobile != null">
mobile = #{mobile,jdbcType=VARCHAR}, mobile = #{mobile,jdbcType=VARCHAR},
</if> </if>
<if test="cellId != null">
cell_id = #{cellId,jdbcType=BIGINT},
</if>
<if test="buildId != null"> <if test="buildId != null">
build_id = #{buildId,jdbcType=BIGINT}, build_id = #{buildId,jdbcType=BIGINT},
</if> </if>
@ -605,26 +603,26 @@
<delete id="deleteById"> <delete id="deleteById">
delete from ten_person delete from ten_person_${cellId}
where person_id = #{personId,jdbcType=BIGINT} where person_id = #{personId,jdbcType=BIGINT}
</delete> </delete>
<delete id="logicDeleteById"> <delete id="logicDeleteById">
update ten_person set delete_flag = 1 update ten_person_${cellId} set delete_flag = 1
where person_id = #{personId} where person_id = #{personId}
</delete> </delete>
<select id="selectById" resultMap="BaseResultMap"> <select id="selectById" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where person_id = #{personId} on p.room_id = r.room_id where person_id = #{personId}
</select> </select>
<select id="selectByMemberId" resultMap="BaseResultMap"> <select id="selectByMemberId" resultMap="BaseResultMap">
select * from ten_person where member_id = #{memberId} select * from ten_person_${cellId} where member_id = #{memberId}
</select> </select>
<select id="selectByRoomId" resultMap="BaseResultMap"> <select id="selectByRoomId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0 on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
<if test="key != null and key!=''"> <if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%') and (p.name like CONCAT('%', '${key}', '%')
@ -635,7 +633,7 @@
</select> </select>
<select id="selectByRoomIdForGuest" resultMap="BaseResultMap"> <select id="selectByRoomIdForGuest" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0 on p.room_id = r.room_id where p.room_id = #{roomId} and p.delete_flag = 0
and p.person_type = 5005 and p.person_type = 5005
<if test="key != null and key!=''"> <if test="key != null and key!=''">
@ -647,13 +645,13 @@
<select id="findByName" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="findByName" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where room_id = #{roomId} and delete_flag = 0 where room_id = #{roomId} and delete_flag = 0
and name = #{name} and (person_type = 5000 or person_type = 5001 or person_type = 5002) and name = #{name} and (person_type = 5000 or person_type = 5001 or person_type = 5002)
</select> </select>
<select id="findByIdCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="findByIdCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where room_id = #{roomId} and delete_flag = 0 where room_id = #{roomId} and delete_flag = 0
and id_card = #{idCard} and (person_type = 5000 or person_type = 5001 or person_type = 5002) and id_card = #{idCard} and (person_type = 5000 or person_type = 5001 or person_type = 5002)
</select> </select>
@ -661,7 +659,7 @@
<select id="selectByCellId" resultMap="BaseResultMap"> <select id="selectByCellId" resultMap="BaseResultMap">
select p.*,r.layer,r.room_name from ten_person p left join ten_room r select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0 on p.room_id = r.room_id where p.delete_flag = 0
and p.cell_id = #{cellId} and p.cell_id = #{cellId}
<if test="key != null and key!=''"> <if test="key != null and key!=''">
@ -673,54 +671,54 @@
</select> </select>
<select id="findPageAll" resultMap="BaseResultMap"> <select id="findPageAll" resultMap="BaseResultMap">
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r--> select p.*,r.layer,r.room_name from ten_person_${item} p left join ten_room_${item} r
<!--on p.room_id = r.room_id where p.delete_flag = 0--> on p.room_id = r.room_id where p.delete_flag = 0
<!--<if test="params.buildId != null and params.buildId!=''">--> <if test="params.buildId != null and params.buildId!=''">
<!--and r.build_id = #{params.buildId}--> and r.build_id = #{params.buildId}
<!--</if>--> </if>
<!--<if test="params.layer != null and params.layer!=''">--> <if test="params.layer != null and params.layer!=''">
<!--and r.layer = #{params.layer}--> and r.layer = #{params.layer}
<!--</if>--> </if>
<!--<if test="params.roomName != null and params.roomName!=''">--> <if test="params.roomName != null and params.roomName!=''">
<!--and r.room_name like CONCAT('%', '${params.roomName}', '%')--> and r.room_name like CONCAT('%', '${params.roomName}', '%')
<!--</if>--> </if>
<!--<if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!--and p.name like CONCAT('%', '${params.name}', '%')--> and p.name like CONCAT('%', '${params.name}', '%')
<!--</if>--> </if>
<!--<if test="params.gender != null and params.gender!=''">--> <if test="params.gender != null and params.gender!=''">
<!--and p.gender = #{params.gender}--> and p.gender = #{params.gender}
<!--</if>--> </if>
<!--<if test="params.status != null and params.status!=''">--> <if test="params.status != null and params.status!=''">
<!--and p.status = #{params.status}--> and p.status = #{params.status}
<!--</if>--> </if>
<!--<if test="params.idCard != null and params.idCard!=''">--> <if test="params.idCard != null and params.idCard!=''">
<!--and p.id_card like CONCAT('%', '${params.idCard}', '%')--> and p.id_card like CONCAT('%', '${params.idCard}', '%')
<!--</if>--> </if>
<!--<if test="params.mobile != null and params.mobile!=''">--> <if test="params.mobile != null and params.mobile!=''">
<!--and p.mobile like CONCAT('%', '${params.mobile}', '%')--> and p.mobile like CONCAT('%', '${params.mobile}', '%')
<!--</if>--> </if>
<!--<if test="params.personType != null and params.personType!=''">--> <if test="params.personType != null and params.personType!=''">
<!--and p.person_type = #{params.personType}--> and p.person_type = #{params.personType}
<!--</if>--> </if>
<!--<if test="params.faceFailure != null and params.faceFailure!=''">--> <if test="params.faceFailure != null and params.faceFailure!=''">
<!--and p.face_failure = #{params.faceFailure}--> and p.face_failure = #{params.faceFailure}
<!--</if>--> </if>
<!--<if test="params.personTypeList != null">--> <if test="params.personTypeList != null">
<!--and p.person_type in--> and p.person_type in
<!--<foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">--> <foreach item="personType" collection="params.personTypeList" open="(" separator="," close=")">
<!--#{personType}--> #{personType}
<!--</foreach>--> </foreach>
<!--</if>--> </if>
<!--</foreach>--> </foreach>
<!--) alias where 1 = 1 order by alias.person_id desc--> ) alias where 1 = 1 order by alias.person_id desc
select p.*,r.layer,r.room_name from ten_person p left join ten_room r <!-- select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0 on p.room_id = r.room_id where p.delete_flag = 0
<if test="params.buildId != null and params.buildId!=''"> <if test="params.buildId != null and params.buildId!=''">
and r.build_id = #{params.buildId} and r.build_id = #{params.buildId}
@ -773,7 +771,7 @@
<if test="params.labelId != null and params.labelId!=''"> <if test="params.labelId != null and params.labelId!=''">
and p.label_id = #{params.labelId} and p.label_id = #{params.labelId}
</if> </if>
order by p.create_time desc order by p.create_time desc-->
</select> </select>
@ -798,7 +796,7 @@
<!--</foreach>--> <!--</foreach>-->
<!--) alias where 1 = 1 order by alias.person_id desc--> <!--) alias where 1 = 1 order by alias.person_id desc-->
select count(*) from ten_person where delete_flag = 0 select count(*) from ten_person_${cellId} where delete_flag = 0
<if test="params.status != null and params.status!=''"> <if test="params.status != null and params.status!=''">
and status = #{params.status} and status = #{params.status}
</if> </if>
@ -847,7 +845,7 @@
<!--) alias where 1 = 1 order by alias.person_id desc--> <!--) alias where 1 = 1 order by alias.person_id desc-->
select p.*,r.layer,r.room_name from ten_person p left join ten_room r select p.*,r.layer,r.room_name from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0 on p.room_id = r.room_id where p.delete_flag = 0 and p.status != 0
<if test="params.name != null and params.name!=''"> <if test="params.name != null and params.name!=''">
and p.name like CONCAT('%', '${params.name}', '%') and p.name like CONCAT('%', '${params.name}', '%')
@ -886,7 +884,7 @@
<!--) alias where 1 = 1--> <!--) alias where 1 = 1-->
select * from ten_person select * from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
<if test="params.key != null and params.key!=''"> <if test="params.key != null and params.key!=''">
and (name like CONCAT('%', '${params.key}', '%') and (name like CONCAT('%', '${params.key}', '%')
@ -903,7 +901,7 @@
<select id="findUpdatePerson" resultMap="updateMap"> <select id="findUpdatePerson" resultMap="updateMap">
select * from ten_person select * from ten_person_${cellId}
where 1=1 where 1=1
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -924,7 +922,7 @@
<select id="findAllPersonIdUpdate" resultType="net.shapelight.modules.vo.TenPersonIdUpdateVo"> <select id="findAllPersonIdUpdate" resultType="net.shapelight.modules.vo.TenPersonIdUpdateVo">
select member_id,last_update_time from ten_person select member_id,last_update_time from ten_person_${cellId}
where 1=1 where 1=1
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -939,7 +937,7 @@
<select id="findAllPersonIdUpdateAll" resultMap="idupdateMap"> <select id="findAllPersonIdUpdateAll" resultMap="idupdateMap">
select person_id,last_update_time from ten_person select person_id,last_update_time from ten_person_${cellId}
where delete_flag = 0 and status = 0 where delete_flag = 0 and status = 0
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -954,7 +952,7 @@
<select id="findByLastUpdatePerson" resultMap="updateMap"> <select id="findByLastUpdatePerson" resultMap="updateMap">
select * from ten_person select * from ten_person_${cellId}
where 1=1 where 1=1
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -971,12 +969,12 @@
</select> </select>
<select id="findAllByCellId" resultMap="updateMap"> <select id="findAllByCellId" resultMap="updateMap">
select * from ten_person select * from ten_person_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
</select> </select>
<select id="findRoomCount" resultType="int"> <select id="findRoomCount" resultType="int">
select count(*) from ten_person select count(*) from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -987,7 +985,7 @@
</select> </select>
<select id="findBuildCount" resultType="int"> <select id="findBuildCount" resultType="int">
select count(*) from ten_person select count(*) from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
@ -998,13 +996,13 @@
</select> </select>
<select id="findCellCount" resultType="int"> <select id="findCellCount" resultType="int">
select count(*) from ten_person select count(*) from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
and cell_id = #{cellId} and cell_id = #{cellId}
</select> </select>
<select id="findCellOwnerCount" resultType="int"> <select id="findCellOwnerCount" resultType="int">
select count(*) from ten_person select count(*) from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
and person_type in(5000,5001,5002) and person_type in(5000,5001,5002)
and cell_id = #{cellId} and cell_id = #{cellId}
@ -1014,7 +1012,7 @@
</select> </select>
<select id="findLabelCount" resultType="int"> <select id="findLabelCount" resultType="int">
select count(*) from ten_person select count(*) from ten_person_${cellId}
where delete_flag = 0 where delete_flag = 0
and label_id = #{labelId} and label_id = #{labelId}
where cell_id = #{cellId} where cell_id = #{cellId}
@ -1022,7 +1020,7 @@
<select id="getAllExpireGuest" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getAllExpireGuest" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
SELECT * FROM ten_person SELECT * FROM ten_person_${cellId}
where person_type = 5005 where person_type = 5005
and live_end &lt; NOW() and live_end &lt; NOW()
and delete_flag = 0 and delete_flag = 0
@ -1030,14 +1028,14 @@
<select id="getOwner" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getOwner" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where room_id = #{roomId} where room_id = #{roomId}
and delete_flag = 0 and person_type = 5000 and delete_flag = 0 and person_type = 5000
limit 1 limit 1
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person p left join ten_room r select * from ten_person_${cellId} p left join ten_room r
on p.room_id = r.room_id on p.room_id = r.room_id
where p.cell_id = #{cellId} where p.cell_id = #{cellId}
and p.delete_flag = 0 and (p.person_type = 5000 || p.person_type = 5001) and p.delete_flag = 0 and (p.person_type = 5000 || p.person_type = 5001)
@ -1046,14 +1044,14 @@
</select> </select>
<select id="getNotSyncCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getNotSyncCard" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001) and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_card = 0 and xa_sync_card = 0
</select> </select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
and delete_flag = 0 and (person_type = 5000 || person_type = 5001) and delete_flag = 0 and (person_type = 5000 || person_type = 5001)
and xa_sync_image = 0 and xa_sync_image = 0
@ -1062,7 +1060,7 @@
<select id="getByHaveMobilePersonByRoomId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="getByHaveMobilePersonByRoomId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where room_id = #{roomId} and trim(mobile) != '' where room_id = #{roomId} and trim(mobile) != ''
</select> </select>
@ -1072,7 +1070,7 @@
select count(*) from select count(*) from
(select (select
if (CHAR_LENGTH(id_card) &lt; 18,(substring(now(),1,4)-(1900+substring(id_card,7,2)))-(substring(id_card,9,4)-date_format(now(),'%m%d')>0),(substring(now(),1,4)-substring(id_card,7,4))-(substring(id_card,11,4)-date_format(now(),'%m%d')>0)) as age if (CHAR_LENGTH(id_card) &lt; 18,(substring(now(),1,4)-(1900+substring(id_card,7,2)))-(substring(id_card,9,4)-date_format(now(),'%m%d')>0),(substring(now(),1,4)-substring(id_card,7,4))-(substring(id_card,11,4)-date_format(now(),'%m%d')>0)) as age
from ten_person where delete_flag = 0 from ten_person_${cellId} where delete_flag = 0
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1091,7 +1089,7 @@
</select> </select>
<select id="getMonthCreate" resultType="net.shapelight.modules.vo.TenPersonMonthCountVo"> <select id="getMonthCreate" resultType="net.shapelight.modules.vo.TenPersonMonthCountVo">
select MONTH(NOW()) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(NOW()) select MONTH(NOW()) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(NOW())
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1099,7 +1097,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1107,7 +1105,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1115,7 +1113,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1123,7 +1121,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1131,7 +1129,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1139,7 +1137,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 0 and MONTH(create_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1150,7 +1148,7 @@
<select id="getMonthDelete" resultType="net.shapelight.modules.vo.TenPersonMonthCountVo"> <select id="getMonthDelete" resultType="net.shapelight.modules.vo.TenPersonMonthCountVo">
select MONTH(NOW()) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(NOW()) select MONTH(NOW()) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(NOW())
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1158,7 +1156,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 1 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1166,7 +1164,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 2 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1174,7 +1172,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 3 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1182,7 +1180,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 4 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1190,7 +1188,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 5 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1198,7 +1196,7 @@
</foreach> </foreach>
</if> </if>
UNION UNION
select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) select MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH)) as m,count(*) as c from ten_person_${cellId} where delete_flag = 1 and MONTH(last_update_time) = MONTH(DATE_SUB(NOW(), INTERVAL 6 MONTH))
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
@ -1209,27 +1207,27 @@
<select id="checkByIdCardDept" resultType="int"> <select id="checkByIdCardDept" resultType="int">
select count(person_id) from ten_person where delete_flag = 0 select count(person_id) from ten_person_${cellId} where delete_flag = 0
and id_card = #{idCard} and dept_id = #{deptId} and id_card = #{idCard} and dept_id = #{deptId}
</select> </select>
<select id="getDeptPersonCount" resultType="int"> <select id="getDeptPersonCount" resultType="int">
select count(person_id) from ten_person where delete_flag = 0 and dept_id = #{deptId} select count(person_id) from ten_person_${cellId} where delete_flag = 0 and dept_id = #{deptId}
</select> </select>
<select id="checkByIdCardCell" resultType="int"> <select id="checkByIdCardCell" resultType="int">
select count(person_id) from ten_person where delete_flag = 0 select count(person_id) from ten_person_${cellId} where delete_flag = 0
and id_card = #{idCard} and cell_id = #{cellId} and id_card = #{idCard} and cell_id = #{cellId}
and (person_type = 5006 or person_type = 5005) and (person_type = 5006 or person_type = 5005)
</select> </select>
<select id="getByLabel" resultType="int"> <select id="getByLabel" resultType="int">
select count(person_id) from ten_person where delete_flag = 0 select count(person_id) from ten_person_${cellId} where delete_flag = 0
and label_id = #{labelId} and label_id = #{labelId}
</select> </select>
<select id="selectByDeptId" resultMap="BaseResultMap"> <select id="selectByDeptId" resultMap="BaseResultMap">
select p.* from ten_person p where p.dept_id = #{deptId} and p.delete_flag = 0 select p.* from ten_person_${cellId} p where p.dept_id = #{deptId} and p.delete_flag = 0
and p.person_type in(5000,5001,5002) and p.person_type in(5000,5001,5002)
<if test="key != null and key!=''"> <if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%') and (p.name like CONCAT('%', '${key}', '%')
@ -1240,7 +1238,7 @@
</select> </select>
<select id="selectByDeptIdForGuest" resultMap="BaseResultMap"> <select id="selectByDeptIdForGuest" resultMap="BaseResultMap">
select p.* from ten_person p where p.dept_id = #{deptId} and p.delete_flag = 0 select p.* from ten_person_${cellId} p where p.dept_id = #{deptId} and p.delete_flag = 0
and p.person_type = 5005 and p.person_type = 5005
<if test="key != null and key!=''"> <if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%') and (p.name like CONCAT('%', '${key}', '%')
@ -1250,19 +1248,19 @@
</select> </select>
<select id="getByIdWithDelete" resultMap="BaseResultMap"> <select id="getByIdWithDelete" resultMap="BaseResultMap">
select * from ten_person where person_id = #{personId} select * from ten_person_${cellId} where person_id = #{personId}
</select> </select>
<select id="findExtractPageAll" resultMap="BaseResultMap"> <select id="findExtractPageAll" resultMap="BaseResultMap">
select p.* from (select DISTINCT person_id from ten_person_extract where 1 = 1 select p.* from (select DISTINCT person_id from ten_person_extract_${cellId} where 1 = 1
<if test="cellIds != null"> <if test="cellIds != null">
and cell_id in and cell_id in
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>
) as e left join ten_person p ) as e left join ten_person_${cellId} p
on e.person_id = p.person_id on e.person_id = p.person_id
where p.delete_flag = 0 where p.delete_flag = 0
<if test="params.name != null and params.name!=''"> <if test="params.name != null and params.name!=''">
@ -1301,12 +1299,12 @@
<select id="findByIdCardAndDept" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="findByIdCardAndDept" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person where delete_flag = 0 select * from ten_person_${cellId} where delete_flag = 0
and id_card = #{idCard} and id_card = #{idCard}
</select> </select>
<select id="selectByCreateBy" resultMap="BaseResultMap"> <select id="selectByCreateBy" resultMap="BaseResultMap">
select p.* from ten_person p where p.delete_flag = 0 and create_by = #{createBy} select p.* from ten_person_${cellId} p where p.delete_flag = 0 and create_by = #{createBy}
<if test="key != null and key!=''"> <if test="key != null and key!=''">
and (p.name like CONCAT('%', '${key}', '%') and (p.name like CONCAT('%', '${key}', '%')
or p.mobile like CONCAT('%', '${key}', '%')) or p.mobile like CONCAT('%', '${key}', '%'))
@ -1320,18 +1318,18 @@
</select> </select>
<select id="findByRyId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="findByRyId" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select * from ten_person select * from ten_person_${cellId}
where ryid = #{ryId} and id_card = #{idCard} and delete_flag = 0 where ryid = #{ryId} and id_card = #{idCard} and delete_flag = 0
</select> </select>
<select id="getCountByRyId" resultType="int"> <select id="getCountByRyId" resultType="int">
select count(1) from ten_person select count(1) from ten_person_${cellId}
where ryid = #{ryId} and delete_flag = 0 where ryid = #{ryId} and delete_flag = 0
</select> </select>
<select id="getByPersonIds" resultMap="BaseResultMap"> <select id="getByPersonIds" resultMap="BaseResultMap">
select * from ten_person select * from ten_person_${cellId}
where delete_flag = 0 and person_id in where delete_flag = 0 and person_id in
<foreach item="personId" collection="personIds" open="(" separator="," close=")"> <foreach item="personId" collection="personIds" open="(" separator="," close=")">
#{personId} #{personId}
@ -1339,7 +1337,7 @@
</select> </select>
<select id="listPage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity"> <select id="listPage" resultType="net.shapelight.modules.ten.entity.TenPersonEntity">
select a.* from ten_person a INNER JOIN (SELECT member_id FROM ten_person WHERE delete_flag = 0 and `status` = 0 select a.* from ten_person_${cellId} a INNER JOIN (SELECT member_id FROM ten_person_${cellId} WHERE delete_flag = 0 and `status` = 0
<if test="cellId != null and cellId!=''"> <if test="cellId != null and cellId!=''">
and cell_id = #{cellId} and cell_id = #{cellId}
</if> ORDER BY member_id LIMIT #{start},#{count}) b on a.member_id = b.member_id </if> ORDER BY member_id LIMIT #{start},#{count}) b on a.member_id = b.member_id

View File

@ -21,7 +21,7 @@
<insert id="insertBatch" parameterType="java.util.List"> <insert id="insertBatch" parameterType="java.util.List">
INSERT INTO ten_person_sync_${tenantId} INSERT INTO ten_person_sync_${cellId}
(device_id, (device_id,
device_sn, device_sn,
person_id, person_id,
@ -40,7 +40,7 @@
</insert> </insert>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
insert into ten_person_sync_${tenantId} insert into ten_person_sync_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="personSyncId != null"> <if test="personSyncId != null">
person_sync_id, person_sync_id,
@ -91,7 +91,7 @@
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
update ten_person_sync_${tenantId} update ten_person_sync_${cellId}
<set> <set>
<if test="personSyncId != null"> <if test="personSyncId != null">
person_sync_id = #{personSyncId,jdbcType=BIGINT}, person_sync_id = #{personSyncId,jdbcType=BIGINT},
@ -120,7 +120,7 @@
<select id="getDeviceAllPersonIdUpdateTime" resultMap="idupdatetime"> <select id="getDeviceAllPersonIdUpdateTime" resultMap="idupdatetime">
select person_id,last_update_time from ten_person_sync_${tenantId} select person_id,last_update_time from ten_person_sync_${cellId}
where 1=1 where 1=1
<if test="deviceId != null and deviceId!=''"> <if test="deviceId != null and deviceId!=''">
and device_id = #{deviceId} and device_id = #{deviceId}
@ -129,25 +129,25 @@
</select> </select>
<delete id="removeAllDeletePersons"> <delete id="removeAllDeletePersons">
delete from ten_person_sync_${tenantId} delete from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
and state = 3 and state = 3
</delete> </delete>
<delete id="removeByDeviceId"> <delete id="removeByDeviceId">
delete from ten_person_sync_${tenantId} delete from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
</delete> </delete>
<delete id="removePersonSyncId"> <delete id="removePersonSyncId">
delete from ten_person_sync_${tenantId} delete from ten_person_sync_${cellId}
where person_sync_id = #{personSyncId} where person_sync_id = #{personSyncId}
</delete> </delete>
<select id="findByDeviceIdAndPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findByDeviceIdAndPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
and person_id = #{personId} and person_id = #{personId}
order by last_update_time desc order by last_update_time desc
@ -155,14 +155,14 @@
</select> </select>
<select id="findByPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findByPersonId" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${cellId}
where person_id = #{personId} where person_id = #{personId}
</select> </select>
<select id="findGroupDevicePersons" resultType="map"> <select id="findGroupDevicePersons" resultType="map">
select device_sn as deviceSn,group_concat(person_id,"_",last_update_time separator ",") as plist select device_sn as deviceSn,group_concat(person_id,"_",last_update_time separator ",") as plist
from ten_person_sync_${tenantId} where 1= 1 from ten_person_sync_${cellId} where 1= 1
<if test="personIds != null"> <if test="personIds != null">
and person_id in and person_id in
<foreach item="personId" collection="personIds" open="(" separator="," close=")"> <foreach item="personId" collection="personIds" open="(" separator="," close=")">
@ -173,23 +173,23 @@
</select> </select>
<select id="findDeviceAllDeletePersons" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findDeviceAllDeletePersons" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
and state = 3 and state = 3
</select> </select>
<select id="findDeviceAllAddPersons" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findDeviceAllAddPersons" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
and state = 1 and state = 1
</select> </select>
<select id="findTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select device_id, person_id, count(*) from ten_person_sync_${tenantId} group by device_id, person_id having count(*) > 1 select device_id, person_id, count(*) from ten_person_sync_${cellId} group by device_id, person_id having count(*) > 1
</select> </select>
<select id="findByDeviceIdAndPersonIdTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity"> <select id="findByDeviceIdAndPersonIdTwo" resultType="net.shapelight.modules.ten.entity.TenPersonSyncEntity">
select * from ten_person_sync_${tenantId} select * from ten_person_sync_${cellId}
where device_id = #{deviceId} where device_id = #{deviceId}
and person_id = #{personId} and person_id = #{personId}
</select> </select>

View File

@ -38,7 +38,7 @@
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenRecordEntity"> <insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenRecordEntity">
insert into ten_record_${tenantId} insert into ten_record_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="recordId != null"> <if test="recordId != null">
record_id, record_id,
@ -183,7 +183,7 @@
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenRecordEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenRecordEntity">
update ten_record_${tenantId} update ten_record_${cellId}
<set> <set>
<if test="recordId != null"> <if test="recordId != null">
record_id = #{recordId,jdbcType=BIGINT}, record_id = #{recordId,jdbcType=BIGINT},
@ -233,64 +233,64 @@
<delete id="deleteById" parameterType="java.lang.Long"> <delete id="deleteById" parameterType="java.lang.Long">
delete from ten_record_${tenantId} delete from ten_record_${cellId}
where record_id = #{recordId,jdbcType=BIGINT} where record_id = #{recordId,jdbcType=BIGINT}
</delete> </delete>
<select id="selectById" parameterType="java.lang.Long" resultMap="tenRecordMap"> <select id="selectById" parameterType="java.lang.Long" resultMap="tenRecordMap">
select * from ten_record_${tenantId} select * from ten_record_${cellId}
where record_id = #{recordId,jdbcType=BIGINT} where record_id = #{recordId,jdbcType=BIGINT}
</select> </select>
<select id="findPageAll" resultMap="tenRecordMap"> <select id="findPageAll" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id--> select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id
<!--</foreach>--> </foreach>
<!--) alias where 1=1--> ) alias where 1=1
<!--<if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!--and alias.cell_id = #{params.cellId}--> and alias.cell_id = #{params.cellId}
<!--</if>--> </if>
<!--<if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!--and `name` like CONCAT('%', '${params.name}', '%')--> and `name` like CONCAT('%', '${params.name}', '%')
<!--</if>--> </if>
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <if test="params.recordTimeStart != null and params.recordTimeStart!=''">
<!--and `record_time` &gt;= #{params.recordTimeStart}--> and `record_time` &gt;= #{params.recordTimeStart}
<!--</if>--> </if>
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
<!--and `record_time` &lt; #{params.recordTimeEnd}--> and `record_time` &lt; #{params.recordTimeEnd}
<!--</if>--> </if>
<!--order by record_time desc--> order by record_time desc
<!-- select r.*,t.name from ten_record_${params.tenantId} r left join ten_person t on r.person_id = t.person_id--> <!--select r.*,t.name from ten_record_${cellId} r left join ten_person t on r.person_id = t.person_id
<!-- where 1 = 1--> where 1 = 1
<!-- <if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!-- and r.cell_id = #{params.cellId}--> and r.cell_id = #{params.cellId}
<!-- </if>--> </if>
<!-- <if test="params.sn != null and params.sn!=''">--> <if test="params.sn != null and params.sn!=''">
<!-- and r.device_sn = #{params.sn}--> and r.device_sn = #{params.sn}
<!-- </if>--> </if>
<!-- <if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!-- and `name` like CONCAT('%', '${params.name}', '%')--> and `name` like CONCAT('%', '${params.name}', '%')
<!-- </if>--> </if>
<!-- <if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <if test="params.recordTimeStart != null and params.recordTimeStart!=''">
<!-- and `record_time` &gt;= #{params.recordTimeStart}--> and `record_time` &gt;= #{params.recordTimeStart}
<!-- </if>--> </if>
<!-- <if test="params.recordTimeEnd != null and params.recordTimeEnd!=''">--> <if test="params.recordTimeEnd != null and params.recordTimeEnd!=''">
<!-- and `record_time` &lt; #{params.recordTimeEnd}--> and `record_time` &lt; #{params.recordTimeEnd}
<!-- </if>--> </if>
<!-- <if test="cellIds != null">--> <if test="cellIds != null">
<!-- and r.cell_id in--> and r.cell_id in
<!-- <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">--> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
<!-- #{cellId}--> #{cellId}
<!-- </foreach>--> </foreach>
<!-- </if>--> </if>
<!-- order by record_time desc--> order by record_time desc-->
select r.* from ten_record_${params.tenantId} r <!--select r.* from ten_record_${params.cellId} r
<if test="params.name != null and params.name!=''"> <if test="params.name != null and params.name!=''">
left join ten_person t on r.person_id = t.person_id left join ten_person t on r.person_id = t.person_id
</if> </if>
@ -316,33 +316,33 @@
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>
order by record_time desc order by record_time desc-->
</select> </select>
<select id="findAll" resultMap="tenRecordMap"> <select id="findAll" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id--> select r.*,t.name from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id
<!--</foreach>--> </foreach>
<!--) alias where 1=1--> ) alias where 1=1
<!--<if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!--and alias.cell_id = #{params.cellId}--> and alias.cell_id = #{params.cellId}
<!--</if>--> </if>
<!--<if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!--and `name` like CONCAT('%', '${params.name}', '%')--> and `name` like CONCAT('%', '${params.name}', '%')
<!--</if>--> </if>
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <if test="params.recordTimeStart != null and params.recordTimeStart!=''">
<!--and `record_time` &gt;= #{params.recordTimeStart}--> and `record_time` &gt;= #{params.recordTimeStart}
<!--</if>--> </if>
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
<!--and `record_time` &lt; #{params.recordTimeEnd}--> and `record_time` &lt; #{params.recordTimeEnd}
<!--</if>--> </if>
<!--order by record_time desc--> order by record_time desc
select r.*,t.name from ten_record_${params.tenantId} r left join ten_person t on r.person_id = t.person_id <!-- select r.*,t.name from ten_record_${params.cellId} r left join ten_person t on r.person_id = t.person_id
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
and r.cell_id = #{params.cellId} and r.cell_id = #{params.cellId}
</if> </if>
@ -361,12 +361,12 @@
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>
order by record_time desc order by record_time desc-->
</select> </select>
<select id="findAllSize" resultType="int"> <select id="findAllSize" resultType="int">
select count(1) from ten_record_${params.tenantId} r <!--select count(1) from ten_record_${params.cellId} r
where 1 = 1 where 1 = 1
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
and r.cell_id = #{params.cellId} and r.cell_id = #{params.cellId}
@ -376,28 +376,33 @@
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>-->
SELECT alias.num from (
<foreach collection="cellIds" item="item" index="index" separator="union all">
select count(1) as num from ten_record_${item} r left join ten_person_${item} t on r.person_id = t.person_id
</foreach>
) alias
</select> </select>
<select id="findHourAll" resultType="int"> <select id="findHourAll" resultType="int">
<!--SELECT count(*) from (--> SELECT count(*) from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select record_id,cell_id,record_time from ten_record_${item}--> select record_id,cell_id,record_time from ten_record_${item}
<!--</foreach>--> </foreach>
<!--) alias where 1=1--> ) alias where 1=1
<!--<if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!--and alias.cell_id = #{params.cellId}--> and alias.cell_id = #{params.cellId}
<!--</if>--> </if>
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <if test="params.recordTimeStart != null and params.recordTimeStart!=''">
<!--and `record_time` &gt;= #{params.recordTimeStart}--> and `record_time` &gt;= #{params.recordTimeStart}
<!--</if>--> </if>
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
<!--and `record_time` &lt; #{params.recordTimeEnd}--> and `record_time` &lt; #{params.recordTimeEnd}
<!--</if>--> </if>
<!--order by record_time desc--> order by record_time desc
select count(*) from ten_record_${params.tenantId} where 1 = 1 <!-- select count(*) from ten_record_${params.cellId} where 1 = 1
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
and cell_id = #{params.cellId} and cell_id = #{params.cellId}
</if> </if>
@ -412,14 +417,29 @@
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>-->
</select> </select>
<select id="findCellHourAll" resultType="int"> <select id="findCellHourAll" resultType="int">
select count(*) from ten_record_${params.tenantId} where 1 = 1 SELECT count(*) from (
<foreach collection="cellIds" item="item" index="index" separator="union all">
select record_id,cell_id,record_time from ten_record_${item}
</foreach>
) alias where 1=1
<if test="params.cellId != null and params.cellId!=''">
and alias.cell_id = #{params.cellId}
</if>
<if test="params.recordTimeStart != null and params.recordTimeStart!=''">
and `record_time` &gt;= #{params.recordTimeStart}
</if>
<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
and `record_time` &lt; #{params.recordTimeEnd}
</if>
order by record_time desc
<!--select count(*) from ten_record_${params.cellId} where 1 = 1
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
and cell_id = #{params.cellId} and cell_id = #{params.cellId}
</if> </if>
@ -428,35 +448,35 @@
</if> </if>
<if test="params.recordTimeEnd != null and params.recordTimeStart!=''"> <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
and `record_time` &lt; #{params.recordTimeEnd} and `record_time` &lt; #{params.recordTimeEnd}
</if> </if>-->
</select> </select>
<select id="findPageBlackRecord" resultMap="tenRecordMap"> <select id="findPageBlackRecord" resultMap="tenRecordMap">
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select r.*,t.name from ten_record_${item} r--> select r.*,t.name from ten_record_${item} r
<!--left join ten_person_${item} t on r.person_id = t.person_id--> left join ten_person_${item} t on r.person_id = t.person_id
<!--where t.delete_flag = 0--> where t.delete_flag = 0
<!--and t.person_type = 5008--> and t.person_type = 5008
<!--</foreach>--> </foreach>
<!--) alias where 1=1--> ) alias where 1=1
<!--<if test="params.cellId != null and params.cellId!=''">--> <if test="params.cellId != null and params.cellId!=''">
<!--and alias.cell_id = #{params.cellId}--> and alias.cell_id = #{params.cellId}
<!--</if>--> </if>
<!--<if test="params.name != null and params.name!=''">--> <if test="params.name != null and params.name!=''">
<!--and `name` like CONCAT('%', '${params.name}', '%')--> and `name` like CONCAT('%', '${params.name}', '%')
<!--</if>--> </if>
<!--<if test="params.recordTimeStart != null and params.recordTimeStart!=''">--> <if test="params.recordTimeStart != null and params.recordTimeStart!=''">
<!--and `record_time` &gt;= #{params.recordTimeStart}--> and `record_time` &gt;= #{params.recordTimeStart}
<!--</if>--> </if>
<!--<if test="params.recordTimeEnd != null and params.recordTimeStart!=''">--> <if test="params.recordTimeEnd != null and params.recordTimeStart!=''">
<!--and `record_time` &lt; #{params.recordTimeEnd}--> and `record_time` &lt; #{params.recordTimeEnd}
<!--</if>--> </if>
<!--order by record_time desc--> order by record_time desc
select r.*,t.name from ten_record_${params.tenantId} r <!--select r.*,t.name from ten_record_${params.cellId} r
left join ten_person t on r.person_id = t.person_id left join ten_person t on r.person_id = t.person_id
where t.delete_flag = 0 where t.delete_flag = 0
and t.person_type = 5008 and t.person_type = 5008
@ -478,7 +498,7 @@
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>
order by r.record_time desc order by r.record_time desc-->
</select> </select>
@ -504,7 +524,7 @@
<!--</if>--> <!--</if>-->
<!--order by record_time desc--> <!--order by record_time desc-->
<!-- select r.*,t.name from ten_record_${params.tenantId} r--> <!-- select r.*,t.name from ten_record_${params.cellId} r-->
<!-- left join ten_person t on r.person_id = t.person_id--> <!-- left join ten_person t on r.person_id = t.person_id-->
<!-- left join ten_device d on r.device_sn = d.sn--> <!-- left join ten_device d on r.device_sn = d.sn-->
<!-- where d.tenant_id = #{params.tenantId}--> <!-- where d.tenant_id = #{params.tenantId}-->
@ -526,8 +546,8 @@
<!-- </if>--> <!-- </if>-->
<!-- order by record_time desc--> <!-- order by record_time desc-->
select rec.* from (select r.*,t.name from ten_record_${params.tenantId} r select rec.* from (select r.*,t.name from ten_record_${params.cellId} r
left join ten_person t on r.person_id = t.person_id left join ten_person_${cellId} t on r.person_id = t.person_id
where 1 = 1 where 1 = 1
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
and r.cell_id = #{params.cellId} and r.cell_id = #{params.cellId}
@ -553,14 +573,14 @@
<select id="findLastRecordTime" resultType="string"> <select id="findLastRecordTime" resultType="string">
select record_time from ten_record_${tenantId} select record_time from ten_record_${cellId}
where person_id = #{personId} where person_id = #{personId}
order by record_time desc limit 1 order by record_time desc limit 1
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity"> <select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
<!-- <!--
select tr.* from ten_record_${tenantId} tr left join ten_person tp select tr.* from ten_record_${cellId} tr left join ten_person tp
on tr.person_id = tp.person_id on tr.person_id = tp.person_id
where tr.cell_id = #{cellId} where tr.cell_id = #{cellId}
and tr.xa_sync = 0 and tr.xa_sync = 0
@ -569,7 +589,7 @@
and tp.xa_sync_card = 1 and tp.xa_sync_card = 1
select tr.* from (select * from ten_record_${tenantId} select tr.* from (select * from ten_record_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
and xa_sync = 0 and xa_sync = 0
and TO_DAYS(record_time) = TO_DAYS(NOW()) and TO_DAYS(record_time) = TO_DAYS(NOW())
@ -578,12 +598,12 @@
and tp.xa_sync_card = 1--> and tp.xa_sync_card = 1-->
select rr.* from (select record_id from ten_record_${tenantId} select rr.* from (select record_id from ten_record_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
and xa_sync = 0 and xa_sync = 0
and TO_DAYS(record_time) = TO_DAYS(NOW()) and TO_DAYS(record_time) = TO_DAYS(NOW())
and record_face is not null) as tr and record_face is not null) as tr
left join ten_record_${tenantId} rr left join ten_record_${cellId} rr
on tr.record_id = rr.record_id on tr.record_id = rr.record_id
left join ten_person tp left join ten_person tp
on rr.person_id = tp.person_id on rr.person_id = tp.person_id
@ -591,7 +611,7 @@
</select> </select>
<select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity"> <select id="getNotSyncImage" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
select * from ten_record_${tenantId} select * from ten_record_${cellId}
where cell_id = #{cellId} where cell_id = #{cellId}
and xa_sync_image = 0 and xa_sync_image = 0
and xa_sync = 1 and xa_sync = 1
@ -600,7 +620,7 @@
</select> </select>
<select id="getMonthRecords" resultType="net.shapelight.modules.ten.entity.TenRecordEntity"> <select id="getMonthRecords" resultType="net.shapelight.modules.ten.entity.TenRecordEntity">
select * from ten_record_${tenantId} select * from ten_record_${cellId}
where where
record_time &gt;= #{start} record_time &gt;= #{start}
and record_time &lt;= #{end} and record_time &lt;= #{end}
@ -609,7 +629,7 @@
<select id="findPageDeptRecord" resultMap="tenRecordMap"> <select id="findPageDeptRecord" resultMap="tenRecordMap">
select rec.* from (select r.*,t.name from ten_record_${params.tenantId} r select rec.* from (select r.*,t.name from ten_record_${params.cellId} r
left join ten_person t on r.person_id = t.person_id left join ten_person t on r.person_id = t.person_id
where 1 = 1 where 1 = 1
<if test="params.cellId != null and params.cellId!=''"> <if test="params.cellId != null and params.cellId!=''">
@ -639,7 +659,7 @@
</select> </select>
<select id="getByPersonIds" resultMap="tenRecordMap"> <select id="getByPersonIds" resultMap="tenRecordMap">
select * from ten_record_${params.tenantId} r select * from ten_record_${params.cellId} r
<if test="params.name != null and params.name!=''"> <if test="params.name != null and params.name!=''">
left join ten_person t on r.person_id = t.person_id left join ten_person t on r.person_id = t.person_id
</if> </if>

View File

@ -49,7 +49,7 @@
</resultMap> </resultMap>
<insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenRoomEntity"> <insert id="insert" parameterType="net.shapelight.modules.ten.entity.TenRoomEntity">
insert into ten_room insert into ten_room_${cellId}
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="roomId != null"> <if test="roomId != null">
room_id, room_id,
@ -215,7 +215,7 @@
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenRoomEntity"> <update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenRoomEntity">
update ten_room update ten_room_${cellId}
<set> <set>
<if test="roomId != null"> <if test="roomId != null">
room_id = #{roomId,jdbcType=BIGINT}, room_id = #{roomId,jdbcType=BIGINT},
@ -300,27 +300,27 @@
</update> </update>
<select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap"> <select id="selectById" parameterType="java.lang.Long" resultMap="BaseResultMap">
select * from ten_room select * from ten_room_${cellId}
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</select> </select>
<delete id="deleteById"> <delete id="deleteById">
delete from ten_room delete from ten_room_${cellId}
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</delete> </delete>
<delete id="logicDeleteById"> <delete id="logicDeleteById">
update ten_room set delete_flag = 1 update ten_room_${cellId} set delete_flag = 1
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</delete> </delete>
<delete id="logicDeleteByBuildId"> <delete id="logicDeleteByBuildId">
update ten_room set delete_flag = 1 update ten_room_${cellId} set delete_flag = 1
where build_id = #{buildId,jdbcType=BIGINT} where build_id = #{buildId,jdbcType=BIGINT}
</delete> </delete>
<delete id="logicDeleteByCellId"> <delete id="logicDeleteByCellId">
update ten_room set delete_flag = 1 update ten_room_${cellId} set delete_flag = 1
where cell_id = #{cellId,jdbcType=BIGINT} where cell_id = #{cellId,jdbcType=BIGINT}
</delete> </delete>
@ -329,25 +329,25 @@
<!--</select>--> <!--</select>-->
<select id="findPageAll" resultMap="BaseResultMap" > <select id="findPageAll" resultMap="BaseResultMap" >
<!--SELECT alias.* from (--> SELECT alias.* from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select * from ten_room_${item}--> select * from ten_room_${item}
<!--</foreach>--> </foreach>
<!--) alias where delete_flag = 0--> ) alias where delete_flag = 0
<!--<if test="params.buildId != null and params.buildId!=''">--> <if test="params.buildId != null and params.buildId!=''">
<!--and alias.build_id = #{params.buildId}--> and alias.build_id = #{params.buildId}
<!--</if>--> </if>
<!--<if test="params.layer != null and params.layer!=''">--> <if test="params.layer != null and params.layer!=''">
<!--and alias.layer = #{params.layer}--> and alias.layer = #{params.layer}
<!--</if>--> </if>
<!--<if test="params.roomName != null and params.roomName!=''">--> <if test="params.roomName != null and params.roomName!=''">
<!--and room_name like CONCAT('%', '${params.roomName}', '%')--> and room_name like CONCAT('%', '${params.roomName}', '%')
<!--</if>--> </if>
<!--<if test="params.roomNumber != null and params.roomNumber!=''">--> <if test="params.roomNumber != null and params.roomNumber!=''">
<!--and room_number = #{params.roomNumber}--> and room_number = #{params.roomNumber}
<!--</if>--> </if>
select * from ten_room where delete_flag = 0 <!--select * from ten_room_${cellId} where delete_flag = 0
<if test="params.buildId != null and params.buildId!=''"> <if test="params.buildId != null and params.buildId!=''">
and build_id = #{params.buildId} and build_id = #{params.buildId}
</if> </if>
@ -365,23 +365,23 @@
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>-->
</select> </select>
<select id="getAllCount" resultType="int" > <select id="getAllCount" resultType="int" >
<!--SELECT count(*) from (--> SELECT count(*) from (
<!--<foreach collection="cellIds" item="item" index="index" separator="union all">--> <foreach collection="cellIds" item="item" index="index" separator="union all">
<!--select room_id from ten_room_${item} where delete_flag = 0--> select room_id from ten_room_${item} where delete_flag = 0
<!--<if test="params.type != null and params.type!=''">--> <if test="params.type != null and params.type!=''">
<!--and type = #{params.type}--> and type = #{params.type}
<!--</if>--> </if>
<!--</foreach>--> </foreach>
<!--) alias--> ) alias
select count(*) from ten_room where 1 = 1 <!--select count(*) from ten_room_${cellId} where 1 = 1
<if test="params.type != null and params.type!=''"> <if test="params.type != null and params.type!=''">
and type = #{params.type} and type = #{params.type}
</if> </if>
@ -390,30 +390,30 @@
<foreach item="cellId" collection="cellIds" open="(" separator="," close=")"> <foreach item="cellId" collection="cellIds" open="(" separator="," close=")">
#{cellId} #{cellId}
</foreach> </foreach>
</if> </if>-->
</select> </select>
<select id="queryByNumberAndLayer" resultMap="BaseResultMap"> <select id="queryByNumberAndLayer" resultMap="BaseResultMap">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and room_number = #{roomNumber} and layer = #{layer} and room_number = #{roomNumber} and layer = #{layer}
and build_id = #{buildId} and build_id = #{buildId}
</select> </select>
<select id="findByRoomName" resultMap="BaseResultMap"> <select id="findByRoomName" resultMap="BaseResultMap">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and room_name = #{roomName} and room_name = #{roomName}
and build_id = #{buildId} and build_id = #{buildId}
</select> </select>
<select id="getLayerRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity"> <select id="getLayerRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and build_id = #{buildId} and build_id = #{buildId}
</select> </select>
<select id="getBuildRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity"> <select id="getBuildRooms" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and build_id = #{buildId} and build_id = #{buildId}
</select> </select>
@ -421,51 +421,51 @@
<select id="getRoomName" resultType="string"> <select id="getRoomName" resultType="string">
select room_name from ten_room select room_name from ten_room_${cellId}
where room_id = #{roomId,jdbcType=BIGINT} where room_id = #{roomId,jdbcType=BIGINT}
</select> </select>
<select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRoomEntity"> <select id="getNotSync" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and xa_sync = 0 and xa_sync = 0
and cell_id = #{cellId} and cell_id = #{cellId}
and p_id is not null and p_id is not null
</select> </select>
<select id="getNotBindByCellId" resultType="net.shapelight.modules.ten.entity.TenRoomEntity"> <select id="getNotBindByCellId" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and cell_id = #{cellId} and p_id is null and cell_id = #{cellId} and p_id is null
</select> </select>
<select id="getPicByCellId" resultType="net.shapelight.modules.ten.entity.TenRoomEntity"> <select id="getPicByCellId" resultType="net.shapelight.modules.ten.entity.TenRoomEntity">
select * from ten_room where delete_flag = 0 select * from ten_room_${cellId} where delete_flag = 0
and p_id = #{pId} and p_id = #{pId}
and cell_id = #{cellId} and cell_id = #{cellId}
</select> </select>
<select id="getDistinctBuild" resultType="net.shapelight.modules.vo.TenRoomDeptVo"> <select id="getDistinctBuild" resultType="net.shapelight.modules.vo.TenRoomDeptVo">
select DISTINCT b.name from ten_room r select DISTINCT b.name from ten_room_${cellId} r
left join ten_build b left join ten_build b
on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId}
</select> </select>
<select id="getDistinctUnit" resultType="net.shapelight.modules.vo.TenRoomDeptVo"> <select id="getDistinctUnit" resultType="net.shapelight.modules.vo.TenRoomDeptVo">
select DISTINCT b.name,b.unit from ten_room r select DISTINCT b.name,b.unit from ten_room_${cellId} r
left join ten_build b left join ten_build b
on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName} on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName}
</select> </select>
<select id="getDistinctLayer" resultType="net.shapelight.modules.vo.TenRoomDeptVo"> <select id="getDistinctLayer" resultType="net.shapelight.modules.vo.TenRoomDeptVo">
select DISTINCT b.name,b.unit,r.layer from ten_room r select DISTINCT b.name,b.unit,r.layer from ten_room_${cellId} r
left join ten_build b left join ten_build b
on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName} and unit = #{unit} on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName} and unit = #{unit}
</select> </select>
<select id="getDistinctRoom" resultType="net.shapelight.modules.vo.TenRoomDeptVo"> <select id="getDistinctRoom" resultType="net.shapelight.modules.vo.TenRoomDeptVo">
select DISTINCT b.name,b.unit,r.layer,r.room_name,r.room_id from ten_room r select DISTINCT b.name,b.unit,r.layer,r.room_name,r.room_id from ten_room_${cellId} r
left join ten_build b left join ten_build b
on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName} and unit = #{unit} and layer = #{layer} on r.build_id = b.build_id where r.delete_flag = 0 and r.cell_id = #{cellId} and b.name = #{buildName} and unit = #{unit} and layer = #{layer}
</select> </select>

View File

@ -57,12 +57,12 @@ select * from ten_person where person_id = 1144346910165827586
List<SysUserEntity> allSysTenUser = sysUserService.findAllSysTenUser(); List<SysUserEntity> allSysTenUser = sysUserService.findAllSysTenUser();
for (SysUserEntity sysTenUser : allSysTenUser) { for (SysUserEntity sysTenUser : allSysTenUser) {
System.out.println("处理运营商:"+sysTenUser.getUsername()+" tenantId:"+sysTenUser.getTenantId()); System.out.println("处理运营商:"+sysTenUser.getUsername()+" tenantId:"+sysTenUser.getTenantId());
List<TenPersonSyncEntity> towList = tenPersonSyncService.findTwo(sysTenUser.getTenantId()); List<TenPersonSyncEntity> towList = tenPersonSyncService.findTwo(sysTenUser.getCellId());
for(TenPersonSyncEntity personEntity: towList){ for(TenPersonSyncEntity personEntity: towList){
List<TenPersonSyncEntity> haveTwo = tenPersonSyncService.findByDeviceIdAndPersonIdList(personEntity.getDeviceId(),personEntity.getPersonId(),sysTenUser.getTenantId()); List<TenPersonSyncEntity> haveTwo = tenPersonSyncService.findByDeviceIdAndPersonIdList(personEntity.getDeviceId(),personEntity.getPersonId(),sysTenUser.getCellId());
if(haveTwo.size()>1){ if(haveTwo.size()>1){
TenPersonSyncEntity entity = haveTwo.get(0); TenPersonSyncEntity entity = haveTwo.get(0);
tenPersonSyncService.removeByPersonSyncId(entity.getPersonSyncId(),entity.getTenantId()); tenPersonSyncService.removeByPersonSyncId(entity.getPersonSyncId(),entity.getCellId());
System.out.println("删除同步信息:"+entity.getPersonSyncId()); System.out.println("删除同步信息:"+entity.getPersonSyncId());
} }
} }