Merge branch 'master' into docker_package

This commit is contained in:
wangliwen 2022-08-11 14:21:53 +08:00
commit a27757f18c
18 changed files with 1123 additions and 59 deletions

View File

@ -0,0 +1,49 @@
package io.renren.common.utils;
import java.util.ArrayList;
import java.util.List;
/**
* list分页工具
*/
public class PageUtil {
/**
* 手动分页类
* @param datas
* @param pageSize
* @param pageNo
* @param <T>
* @return
*/
public static <T> List<T> getPageSizeDataForRelations(List<T> datas,int pageSize,int pageNo){
int startNum = (pageNo-1)* pageSize+1 ; //起始截取数据位置
if(startNum > datas.size()){
return null;
}
List<T> res = new ArrayList<>();
int rum = datas.size() - startNum;
if(rum < 0){
return null;
}
if(rum == 0){ //说明正好是最后一个了
int index = datas.size() -1;
res.add(datas.get(index));
return res;
}
if(rum / pageSize >= 1){ //剩下的数据还够1页返回整页的数据
for(int i=startNum;i<startNum + pageSize;i++){ //截取从startNum开始的数据
res.add(datas.get(i-1));
}
return res;
}else if((rum / pageSize == 0) && rum > 0){ //不够一页直接返回剩下数据
for(int j = startNum ;j<=datas.size();j++){
res.add(datas.get(j-1));
}
return res;
}else{
return null;
}
}
}

View File

@ -0,0 +1,120 @@
package io.renren.modules.meeting.controller;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.service.TMeetingroomBookService;
import io.renren.modules.meeting.service.TMeetingroomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.annotation.Resource;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
@Api(tags="预约会议室")
@RestController
@RequestMapping("bookMeeting")
public class BookMeetingRoomController {
@Resource
private TMeetingroomBookService tMeetingroomBookService;
@Resource
private TMeetingroomService tMeetingroomService;
@GetMapping("list")
@ApiOperation("搜索可以预约的会议室")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "name", value = "会议室名称", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "bookDate", value = "预约开始时间", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "startTime", value = "预约开始时间", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "endTime", value = "预约结束时间", paramType = "query", dataType="String") ,
})
public Result<PageData<TMeetingroomDTO>> list(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TMeetingroomDTO> list = tMeetingroomService.selectFreeRoom(params);
return new Result<PageData<TMeetingroomDTO>>().ok(list);
}
@GetMapping("page")
@ApiOperation("分页查询预约记录")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "roomName", value = "会议室名称", paramType = "query", dataType="String") ,
})
public Result<PageData<TMeetingroomBookDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TMeetingroomBookDTO> page = tMeetingroomBookService.queryList(params);
return new Result<PageData<TMeetingroomBookDTO>>().ok(page);
}
@GetMapping("availableDate")
@ApiOperation("根据日期获取会议室当天的可用时段")
@ApiImplicitParams({
@ApiImplicitParam(name = "roomId", value = "会议室主键", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = "date", value = "查询的天数", paramType = "query", required = true, dataType="String") ,
})
public Result<List<String>> availableDate(@ApiIgnore @RequestParam Map<String, Object> params) throws ParseException {
List<String> stringList = tMeetingroomBookService.queryFreeForDate(params);
return new Result<List<String>>().ok(stringList);
}
@PostMapping
@ApiOperation("新增预约")
@LogOperation("新增")
public Result save(@RequestBody TMeetingroomBookDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
if (tMeetingroomBookService.checkBookRepeat(dto)){
return new Result().error("该会议室在预申请时段已经存在申请会议,请申请其他会议室或者选择其他时段");
}
dto.setState(1);
tMeetingroomBookService.save(dto);
return new Result();
}
@GetMapping("{id}")
@ApiOperation("查看预约信息")
public Result<TMeetingroomBookDTO> get(@PathVariable("id") Long id){
TMeetingroomBookDTO data = tMeetingroomBookService.get(id);
return new Result<TMeetingroomBookDTO>().ok(data);
}
@GetMapping("auditPage")
@ApiOperation("分页查询预约记录(管理端)")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "roomName", value = "会议室名称", paramType = "query", dataType="String") ,
@ApiImplicitParam(name = "state", value = "预约状态", paramType = "query", dataType="int") ,
})
public Result<PageData<TMeetingroomBookDTO>> auditPage(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TMeetingroomBookDTO> page = tMeetingroomBookService.queryAuditList(params);
return new Result<PageData<TMeetingroomBookDTO>>().ok(page);
}
@PutMapping
@ApiOperation("审核预约")
@LogOperation("修改")
public Result update(@RequestBody TMeetingroomBookDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
tMeetingroomBookService.update(dto);
return new Result();
}
}

View File

@ -0,0 +1,78 @@
package io.renren.modules.meeting.controller;
import java.util.Map;
import javax.annotation.Resource;
import io.renren.common.annotation.LogOperation;
import io.renren.common.constant.Constant;
import io.renren.common.page.PageData;
import io.renren.common.utils.Result;
import io.renren.common.validator.ValidatorUtils;
import io.renren.common.validator.group.AddGroup;
import io.renren.common.validator.group.DefaultGroup;
import io.renren.common.validator.group.UpdateGroup;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.service.TMeetingroomService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
@Api(tags="会议室")
@RestController
@RequestMapping("meeting")
public class MeetingroomController {
@Resource
private TMeetingroomService meetingroomService;
@GetMapping("page")
@ApiOperation("分页")
@ApiImplicitParams({
@ApiImplicitParam(name = Constant.PAGE, value = "当前页码从1开始", paramType = "query", required = true, dataType="int") ,
@ApiImplicitParam(name = Constant.LIMIT, value = "每页显示记录数", paramType = "query",required = true, dataType="int") ,
@ApiImplicitParam(name = "name", value = "会议室名称", paramType = "query",dataType="String") ,
})
public Result<PageData<TMeetingroomDTO>> page(@ApiIgnore @RequestParam Map<String, Object> params){
PageData<TMeetingroomDTO> page = meetingroomService.queryList(params);
return new Result<PageData<TMeetingroomDTO>>().ok(page);
}
@GetMapping("{id}")
@ApiOperation("信息")
public Result<TMeetingroomDTO> get(@PathVariable("id") Long id){
TMeetingroomDTO data = meetingroomService.get(id);
return new Result<TMeetingroomDTO>().ok(data);
}
@PostMapping
@ApiOperation("新增")
@LogOperation("新增")
public Result save(@RequestBody TMeetingroomDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
if (meetingroomService.checkMeetingRepeat(dto.getName())){
return new Result().error("已经存在相同名称的会议室,请勿重复新增");
}
meetingroomService.save(dto);
return new Result();
}
@PutMapping
@ApiOperation("修改、删除")
@LogOperation("修改")
public Result update(@RequestBody TMeetingroomDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
meetingroomService.update(dto);
return new Result();
}
}

View File

@ -0,0 +1,37 @@
package io.renren.modules.meeting.dao;
import java.util.Date;
import java.util.List;
import io.renren.common.dao.BaseDao;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.entity.TMeetingroomBook;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TMeetingroomBookMapper extends BaseDao<TMeetingroomBook> {
List<TMeetingroomBookDTO> selectByRoomAndTime(@Param("roomId") Long roomId,
@Param("bookDate") String bookDate,
@Param("startTime") String startTime,
@Param("endTime") String endTime);
int queryCountByRoomName(@Param("userId") Long userId,
@Param("roomName") String roomName);
List<TMeetingroomBookDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSizeint,
@Param("userId") Long userId,
@Param("roomName") String roomName);
int queryCountByState(@Param("roomName") String roomName,
@Param("state") Integer state);
List<TMeetingroomBookDTO> queryListForAudit(@Param("currentNum") int currentNum,
@Param("pageSize") int pageSize,
@Param("roomName")String roomName,
@Param("state")Integer state);
List<TMeetingroomBook> selectInvalid(Date date);
}

View File

@ -0,0 +1,23 @@
package io.renren.modules.meeting.dao;
import java.util.List;
import io.renren.common.dao.BaseDao;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.entity.TMeetingroom;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TMeetingroomMapper extends BaseDao<TMeetingroom> {
int queryCount(String name);
List<TMeetingroomDTO> queryList(@Param("currentNum") int currentNum,
@Param("pageSize")int pageSize,
@Param("name")String name);
List<TMeetingroomDTO> selectByName(String name);
}

View File

@ -0,0 +1,56 @@
package io.renren.modules.meeting.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel(value = "会议室预约")
public class TMeetingroomBookDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键,新增时不传")
private Long id;
@ApiModelProperty(value = "会议室id")
private Long roomId;
@ApiModelProperty(value = "预约时间请传时间格式为2000-01-01")
@JsonFormat(pattern = "yyyy-MM-dd")
private Date bookDate;
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty(value = "预约开始时间请传时间格式为12:00:00")
private Date startTime;
@JsonFormat(pattern = "HH:mm:ss")
@ApiModelProperty(value = "预约结束时间请传时间格式为12:00:00")
private Date endTime;
@ApiModelProperty(value = "预约人")
private String name;
@ApiModelProperty(value = "联系电话")
private String phone;
@ApiModelProperty(value = "预约部门")
private String dept;
@ApiModelProperty(value = "使用事项")
private String matter;
@ApiModelProperty(value = "附件")
private String file;
@ApiModelProperty(value = "创建时间")
private Date createDate;
@ApiModelProperty(value = "创建者")
private Long creator;
@ApiModelProperty(value = "审核状态审核时传2-通过3-不通过")
private Integer state;
@ApiModelProperty(value = "审核意见")
private String auditViem;
@ApiModelProperty(value = "审核者,审核时传")
private Long auditor;
@ApiModelProperty(value = "审核时间")
private Date auditTime;
private String roomName;
}

View File

@ -0,0 +1,44 @@
package io.renren.modules.meeting.dto;
import io.renren.common.entity.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* 会议室
*/
@Data
@ApiModel(value = "会议室表")
public class TMeetingroomDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键,新增时不传")
private Long id;
@ApiModelProperty(value = "房间号")
private String num;
@ApiModelProperty(value = "名称")
private String name;
@ApiModelProperty(value = "面积")
private String area;
@ApiModelProperty(value = "可容纳人数")
private Integer capacity;
@ApiModelProperty(value = "会议室图片")
private String pic;
@ApiModelProperty(value = "描述")
private String description;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "修改时间,修改和删除时传")
private Date modifyTime;
@ApiModelProperty(value = "创建人")
private Long creator;
@ApiModelProperty(value = "修改人,修改和删除时传")
private Long modifier;
@ApiModelProperty(value = "是否删除0-未删除1-删除")
private Integer delFlag;
}

View File

@ -0,0 +1,40 @@
package io.renren.modules.meeting.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 会议室
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_meetingroom")
public class TMeetingroom extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 房间号 */
private String num;
/** 名称 */
private String name;
/** 面积 */
private String area;
/** 可容纳人数 */
private Integer capacity;
/** 会议室图片 */
private String pic;
/** 描述 */
private String description;
/** 修改时间 */
@TableField(fill = FieldFill.UPDATE)
private Date modifyTime;
private Integer delFlag;
@TableField(fill = FieldFill.UPDATE)
private Long modifier;
}

View File

@ -0,0 +1,47 @@
package io.renren.modules.meeting.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.renren.common.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 会议室预约
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("t_meetingroom_book")
public class TMeetingroomBook extends BaseEntity {
private static final long serialVersionUID = 1L;
/** 会议室id */
private Long roomId;
private Date bookDate;
/** 预约开始时间 */
private Date startTime;
/** 预约结束时间 */
private Date endTime;
/** 预约人 */
private String name;
/** 联系电话 */
private String phone;
/** 预约部门 */
private String dept;
/** 使用事项 */
private String matter;
/** 附件 */
private String file;
/** 审核状态 */
private Integer state;
/** 审核意见 */
private String auditViem;
/** 审核者 */
private Long auditor;
/** 审核时间 */
@TableField(fill = FieldFill.UPDATE)
private Date auditTime;
}

View File

@ -0,0 +1,161 @@
package io.renren.modules.meeting.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.modules.meeting.dao.TMeetingroomBookMapper;
import io.renren.modules.meeting.dao.TMeetingroomMapper;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.entity.TMeetingroom;
import io.renren.modules.meeting.entity.TMeetingroomBook;
import io.renren.modules.meeting.service.TMeetingroomBookService;
import io.renren.modules.meeting.service.TMeetingroomService;
import io.renren.modules.security.user.SecurityUser;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.stream.Collector;
import java.util.stream.Collectors;
@Service
public class TMeetingroomBookServiceImpl extends CrudServiceImpl<TMeetingroomBookMapper, TMeetingroomBook, TMeetingroomBookDTO> implements TMeetingroomBookService {
@Resource
private TMeetingroomBookMapper tMeetingroomBookMapper;
@Override
public PageData<TMeetingroomBookDTO> queryList(Map<String, Object> params) {
Long userId = SecurityUser.getUserId();
//分页参数
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.parseInt(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.parseInt(params.get("page").toString());
}
int currentNum = (page-1)*pageSize;
String roomName = null;
if(params.containsKey("roomName") && StringUtils.isNotBlank(params.get("roomName").toString())){
roomName = params.get("roomName").toString();
}
int count = tMeetingroomBookMapper.queryCountByRoomName(userId,roomName);
List<TMeetingroomBookDTO> list = tMeetingroomBookMapper.queryList(currentNum,pageSize,userId,roomName);
return new PageData<>(list,count);
}
@Override
public List<String> queryFreeForDate(Map<String, Object> params) throws ParseException {
List<String> free = new ArrayList<>();
Long roomId = Long.valueOf(params.get("roomId").toString());
if(!params.containsKey("date")){
return free;
}
String date = params.get("date").toString();
List<TMeetingroomBookDTO> tMeetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(roomId,date+" 00:00:00",
"1970-01-01 00:00:00","1970-01-01 23:59:59");
if (CollectionUtils.isEmpty(tMeetingroomBookDTOS)){
free.add("00:00:00 - 23:59:59");
} else {
// 将所有预约的开始时间和结束时间都整理成列表
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
List<Date> startList = tMeetingroomBookDTOS.stream().map(TMeetingroomBookDTO::getStartTime).collect(Collectors.toList());
List<Date> endList = tMeetingroomBookDTOS.stream().map(TMeetingroomBookDTO::getEndTime).collect(Collectors.toList());
Date zero = sdf.parse("00:00:00");
for (int i = 0; i < startList.size(); i++){
Date start = startList.get(i);
if (zero.before(start)){
free.add(sdf.format(zero) + " - " + sdf.format(start));
}
zero = endList.get(i);
if (i == startList.size()-1){
// 最后一次
free.add(sdf.format(endList.get(i)) + " - 23:59:59");
}
}
}
return free;
}
@Override
public PageData<TMeetingroomBookDTO> queryAuditList(Map<String, Object> params) {
//分页参数
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.parseInt(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.parseInt(params.get("page").toString());
}
int currentNum = (page-1)*pageSize;
String roomName = null;
if(params.containsKey("roomName") && StringUtils.isNotBlank(params.get("roomName").toString())){
roomName = params.get("roomName").toString();
}
Integer state = null;
if (params.containsKey("state") && StringUtils.isNotBlank(params.get("state").toString())){
state = Integer.valueOf(params.get("state").toString());
}
int count = tMeetingroomBookMapper.queryCountByState(roomName,state);
List<TMeetingroomBookDTO> list = tMeetingroomBookMapper.queryListForAudit(currentNum,pageSize,roomName,state);
return new PageData<>(list,count);
}
@Override
public boolean checkBookRepeat(TMeetingroomBookDTO tMeetingroomBookDTO) {
boolean flag = false;
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat timeFormat = new SimpleDateFormat("HH:mm:ss");
List<TMeetingroomBookDTO> tMeetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(tMeetingroomBookDTO.getRoomId(),
dateFormat.format(tMeetingroomBookDTO.getBookDate())+" 00:00:00",
"1970-01-01 "+timeFormat.format(tMeetingroomBookDTO.getStartTime()),
"1970-01-01 "+timeFormat.format(tMeetingroomBookDTO.getEndTime()));
if (CollectionUtils.isNotEmpty(tMeetingroomBookDTOS)){
flag = true;
}
return flag;
}
@Override
public QueryWrapper<TMeetingroomBook> getWrapper(Map<String, Object> params) {
return null;
}
public void updateInvalidBook(){
// 获得当日的日期将本日之前的预约状态为申请中的预约更新为状态4已失效
Date date = new Date();
List<TMeetingroomBook> tMeetingroomBooks = tMeetingroomBookMapper.selectInvalid(date);
for (TMeetingroomBook tMeetingroomBook : tMeetingroomBooks){
tMeetingroomBook.setState(4);
tMeetingroomBookMapper.updateById(tMeetingroomBook);
}
}
}

View File

@ -0,0 +1,121 @@
package io.renren.modules.meeting.service.Impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.common.page.PageData;
import io.renren.common.service.impl.CrudServiceImpl;
import io.renren.common.utils.PageUtil;
import io.renren.modules.meeting.dao.TMeetingroomBookMapper;
import io.renren.modules.meeting.dao.TMeetingroomMapper;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.entity.TMeetingroom;
import io.renren.modules.meeting.service.TMeetingroomService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
@Service
public class TMeetingroomServiceImpl extends CrudServiceImpl<TMeetingroomMapper, TMeetingroom, TMeetingroomDTO> implements TMeetingroomService {
@Resource
private TMeetingroomMapper tMeetingroomMapper;
@Resource
private TMeetingroomBookMapper tMeetingroomBookMapper;
@Override
public PageData<TMeetingroomDTO> queryList(Map<String, Object> params) {
//分页参数
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.parseInt(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.parseInt(params.get("page").toString());
}
int currentNum = (page-1)*pageSize;
String name = null;
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())){
name = params.get("name").toString();
}
int count = tMeetingroomMapper.queryCount(name);
List<TMeetingroomDTO> list = tMeetingroomMapper.queryList(currentNum,pageSize,name);
return new PageData<>(list,count);
}
@Override
public PageData<TMeetingroomDTO> selectFreeRoom(Map<String, Object> params) {
int page = 1;
int pageSize = 10;
if(params.containsKey("limit") && StringUtils.isNotBlank(params.get("limit").toString())){
pageSize = Integer.parseInt(params.get("limit").toString());
}
if(params.containsKey("page") && StringUtils.isNotBlank(params.get("page").toString())){
page = Integer.parseInt(params.get("page").toString());
}
String name = null;
if (params.containsKey("name") && StringUtils.isNotBlank(params.get("name").toString())){
name = params.get("name").toString();
}
String bookDate = null;
if (params.containsKey("bookDate") && StringUtils.isNotBlank(params.get("bookDate").toString())){
bookDate = params.get("bookDate").toString();
}
String startTime = "";
if (params.containsKey("startTime") && StringUtils.isNotBlank(params.get("startTime").toString())){
startTime = params.get("startTime").toString();
}
String endTime = "";
if (params.containsKey("endTime") && StringUtils.isNotBlank(params.get("endTime").toString())){
endTime = params.get("endTime").toString();
}
List<TMeetingroomDTO> tMeetingroomDTOS = tMeetingroomMapper.selectByName(name);
String finalBookDate = bookDate + " 00:00:00";
String finalStartTime = "1970-01-01 "+startTime;
String finalEndTime = "1970-01-01 "+endTime;
tMeetingroomDTOS = tMeetingroomDTOS.stream().filter(room -> {
// 根据时间段去预约表搜如果搜不到那就芜湖起飞
boolean flag = false;
List<TMeetingroomBookDTO> meetingroomBookDTOS = tMeetingroomBookMapper.selectByRoomAndTime(room.getId(), finalBookDate,
finalStartTime, finalEndTime);
if (CollectionUtils.isEmpty(meetingroomBookDTOS)){
flag = true;
}
return flag;
}).collect(Collectors.toList());
List<TMeetingroomDTO> pageSizeDataForRelations = PageUtil.getPageSizeDataForRelations(tMeetingroomDTOS, pageSize, page);
return new PageData<>(pageSizeDataForRelations,tMeetingroomDTOS.size());
}
@Override
public boolean checkMeetingRepeat(String name) {
boolean flag = false;
int count = tMeetingroomMapper.queryCount(name);
if (count > 0){
flag = true;
}
return flag;
}
@Override
public QueryWrapper<TMeetingroom> getWrapper(Map<String, Object> params) {
return null;
}
}

View File

@ -0,0 +1,22 @@
package io.renren.modules.meeting.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.meeting.dto.TMeetingroomBookDTO;
import io.renren.modules.meeting.entity.TMeetingroomBook;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
public interface TMeetingroomBookService extends CrudService<TMeetingroomBook, TMeetingroomBookDTO> {
PageData<TMeetingroomBookDTO> queryList(Map<String, Object> params);
List<String> queryFreeForDate(Map<String, Object> params) throws ParseException;
PageData<TMeetingroomBookDTO> queryAuditList(Map<String, Object> params);
boolean checkBookRepeat(TMeetingroomBookDTO tMeetingroomBookDTO);
}

View File

@ -0,0 +1,19 @@
package io.renren.modules.meeting.service;
import io.renren.common.page.PageData;
import io.renren.common.service.CrudService;
import io.renren.modules.meeting.dto.TMeetingroomDTO;
import io.renren.modules.meeting.entity.TMeetingroom;
import java.util.List;
import java.util.Map;
public interface TMeetingroomService extends CrudService<TMeetingroom, TMeetingroomDTO> {
PageData<TMeetingroomDTO> queryList(Map<String, Object> params);
PageData<TMeetingroomDTO> selectFreeRoom(Map<String, Object> params);
boolean checkMeetingRepeat(String name);
}

View File

@ -1,8 +1,5 @@
package io.renren.modules.monitor.controller;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import io.renren.modules.monitor.dto.*;
import io.renren.modules.monitor.entity.*;
import io.renren.modules.monitor.mapper.*;
@ -19,7 +16,6 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -604,6 +600,20 @@ public class Controller {
queryMap.replace("pageNum", (pageNum - 1) * pageSize);
queryMap.replace("pageSize", pageSize);
}
if (StringUtils.isNotBlank(queryMap.get("gpsY").toString())) {
String gpsY = queryMap.get("gpsY").toString();
String gpsX = queryMap.get("gpsX").toString();
if (gpsY.length() > 15) {
gpsY = gpsY.substring(0, gpsY.length() - 1);
}
if (gpsX.length() > 15) {
gpsX = gpsX.substring(0, gpsX.length() - 1);
}
double[] gps84 = CGS2000ToWGS84(Double.parseDouble(gpsY), Double.parseDouble(gpsX));
queryMap.replace("gpsY", String.valueOf(gps84[0]));
queryMap.replace("gpsX", String.valueOf(gps84[1]));
}
List<String> list1 = null;
if (null != labelCodes && labelCodes.length > 0) {
list1 = Arrays.asList(labelCodes);
@ -622,6 +632,46 @@ public class Controller {
}
//2000转84
public static double[] CGS2000ToWGS84(double X, double Y) {
double L0 = 120.19;//中央子午线需根据实际情况设置
double lat ,lon;
Y-=500000;
double [] result = new double[2];
double iPI = 0.0174532925199433;//pi/180
double a = 6378137.0; //长半轴 m
double b = 6356752.31414; //短半轴 m
double f = 1/298.257222101;//扁率 a-b/a
double e = 0.0818191910428; //第一偏心率 Math.sqrt(5)
double ee = Math.sqrt(a*a-b*b)/b; //第二偏心率
double bf = 0; //底点纬度
double a0 = 1+(3*e*e/4) + (45*e*e*e*e/64) + (175*e*e*e*e*e*e/256) + (11025*e*e*e*e*e*e*e*e/16384) + (43659*e*e*e*e*e*e*e*e*e*e/65536);
double b0 = X/(a*(1-e*e)*a0);
double c1 = 3*e*e/8 +3*e*e*e*e/16 + 213*e*e*e*e*e*e/2048 + 255*e*e*e*e*e*e*e*e/4096;
double c2 = 21*e*e*e*e/256 + 21*e*e*e*e*e*e/256 + 533*e*e*e*e*e*e*e*e/8192;
double c3 = 151*e*e*e*e*e*e*e*e/6144 + 151*e*e*e*e*e*e*e*e/4096;
double c4 = 1097*e*e*e*e*e*e*e*e/131072;
bf = b0 + c1*Math.sin(2*b0) + c2*Math.sin(4*b0) +c3*Math.sin(6*b0) + c4*Math.sin(8*b0); // bf =b0+c1*sin2b0 + c2*sin4b0 + c3*sin6b0 +c4*sin8b0 +...
double tf = Math.tan(bf);
double n2 = ee*ee*Math.cos(bf)*Math.cos(bf); //第二偏心率平方成bf余弦平方
double c = a*a/b;
double v=Math.sqrt(1+ ee*ee*Math.cos(bf)*Math.cos(bf));
double mf = c/(v*v*v); //子午圈半径
double nf = c/v;//卯酉圈半径
//纬度计算
lat=bf-(tf/(2*mf)*Y)*(Y/nf) * (1-1/12*(5+3*tf*tf+n2-9*n2*tf*tf)*(Y*Y/(nf*nf))+1/360*(61+90*tf*tf+45*tf*tf*tf*tf)*(Y*Y*Y*Y/(nf*nf*nf*nf)));
//经度偏差
lon=1/(nf*Math.cos(bf))*Y -(1/(6*nf*nf*nf*Math.cos(bf)))*(1+2*tf*tf +n2)*Y*Y*Y + (1/(120*nf*nf*nf*nf*nf*Math.cos(bf)))*(5+28*tf*tf+24*tf*tf*tf*tf)*Y*Y*Y*Y*Y;
result[0] =formatby6(lat/iPI);
result[1] =formatby6(L0+lon/iPI);
return result;
}
private static double formatby6(double num) {
return Double.parseDouble(String.format("%.6f", num));
}
/**
* 摄像头按照市区进行聚合查询
*/
@ -636,7 +686,7 @@ public class Controller {
* 事件版的保存区域组织信息
*/
@GetMapping("/saveOrgenizationEvent")
public Result saveOrgenizationEvent() throws Exception{
public Result saveOrgenizationEvent() {
monitorService.getAndSaveOrgenization();
return Result.success();
}

View File

@ -728,14 +728,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
});
} while (page.getRecords().size() < 9);
//for (int i = 0; page.getRecords().size() < 9; i++) {
// for (int j = 0; j < page.getRecords().size(); j++) {
// if (!page.getRecords().get(j).getId().equals(resultPage.getRecords().get(i).getId())) {
// page.getRecords().add(resultPage.getRecords().get(i));
// break;
// }
// }
//}
}
return page;
} else {
@ -959,16 +951,14 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map> typeList = new ArrayList<>();
final Long[] maxTypeCount = {0L};
final String[] maxTypeString = new String[1];
typeListOld.forEach(map -> {
typeList.add(new HashMap() {{
put("type", map.get("type"));
put("total", map.get("count"));
if (Long.parseLong(map.get("count").toString()) > maxTypeCount[0]) {
maxTypeCount[0] = Long.parseLong(map.get("count").toString());
maxTypeString[0] = map.get("type").toString();
}
}});
});
typeListOld.forEach(map -> typeList.add(new HashMap() {{
put("type", map.get("type"));
put("total", map.get("count"));
if (Long.parseLong(map.get("count").toString()) > maxTypeCount[0]) {
maxTypeCount[0] = Long.parseLong(map.get("count").toString());
maxTypeString[0] = map.get("type").toString();
}
}}));
resultMap.put("typeList", typeList);
HashMap<String, Object> maxdeptMap = new HashMap<>();
if (maxTypeCount[0] > 0) {
@ -976,12 +966,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if ("基础设施".equals(maxTypeString[0])) {
List<Map> resourceList = new ArrayList<>();
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
infrastructureList.forEach((k, v) -> {
resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}});
});
infrastructureList.forEach((k, v) -> resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}}));
maxdeptMap.put("resourceList", resourceList);
} else if ("数据资源".equals(maxTypeString[0])) {
GetDataResourceListDto dto = new GetDataResourceListDto();
@ -1058,7 +1046,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<TAbilityApplicationEntity> applicationEntities = tAbilityApplicationDao.selectList(queryWrapper);
ArrayList cameraList = new ArrayList();
applicationEntities.forEach(index -> {
//List<CameraChannelDto1> channelDto1s = cameraChannelMapper.selectByChannelCode(index.getCameraList().replaceAll("\"", ""));
CameraChannelDto1 channelDto1s = JSON.toJavaObject(JSON.parseObject(index.getCameraList()), CameraChannelDto1.class);
if (ObjectUtils.allNotNull(channelDto1s)) {
cameraList.add(channelDto1s);
@ -1072,12 +1059,10 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if ("基础设施".equals(type)) {
List<Map> resourceList = new ArrayList<>();
Map<String, Object> infrastructureList = (Map<String, Object>) this.selectInfrastructureList();
infrastructureList.forEach((k, v) -> {
resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}});
});
infrastructureList.forEach((k, v) -> resourceList.add(new HashMap() {{
put("id", k + v + "");
put("name", k + v + "");
}}));
return resourceList;
} else if ("数据资源".equals(type)) {
GetDataResourceListDto dto = new GetDataResourceListDto();
@ -1173,7 +1158,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
Request gatewayRequest = new Request.Builder().url(gateway).post(signFormBody.build()).build();
Response gatewayResponse = client.newCall(gatewayRequest).execute();
String gatewayResult = gatewayResponse.body().string();
logger.info("{}分页数据:" + gatewayResult, page);
logger.info("{}分页数据:{}", page, gatewayResult);
JSONObject gatewayJsonObject = JSON.parseObject(gatewayResult);
JSONObject gatewayData = JSON.parseObject(gatewayJsonObject.get("data").toString());
JSONArray infos = gatewayData.getJSONObject("data").getJSONArray("infos");
@ -1195,7 +1180,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
}
}, executor).thenAcceptAsync(list -> {
logger.info("知识库数据量:{}", list.size());
if (list.size() < 1) {
if (list.isEmpty()) {
end.set(false);
}
list.parallelStream().filter(resource -> {
@ -1278,16 +1263,12 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
public PageData<Map<String, Object>> resourceBusinessDetails(Map<String, Object> params) {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
List<Map> deptList = new ArrayList<>();//保存部门 发布总数 访问量
// params.put("pageNum", (Integer.parseInt(params.get("page").toString()) - 1) * Integer.parseInt(params.get("limit").toString()));
// params.put("pageSize", params.get("limit"));
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")};
List<Map<String, Object>> result2 = new ArrayList<>();
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName,\n" +
"SUM(a.visits) AS resourceVisits \n" +
@ -1305,7 +1286,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
"ORDER BY a.dept_id,b.name\n", pas);
}
if (result2.size() > 0) {
if (!result2.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
result.addAll(partition.get(page));
} else {
@ -1368,18 +1349,17 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02, voidCompletableFuture03, voidCompletableFuture04, voidCompletableFuture05);
all.join();
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size());
return pageData;
return new PageData<>(result, result2.size());
}
@Override
public PageData<Map<String, Object>> resourceApplicationDetails(Map<String, Object> params) {
List<Map<String, Object>> result = new CopyOnWriteArrayList<>();
List<Map<String, Object>> result;
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")};
List<Map<String, Object>> result2 = new ArrayList<>();
List<Map<String, Object>> result2;
if (Long.parseLong(params.get("id").toString()) == 0) {
result2 = jdbcTemplate.queryForList("SELECT COUNT(a.id) AS resourceNum,a.dept_id AS deptId,b.name AS deptName\n" +
"FROM tb_data_resource a INNER JOIN sys_dept b ON a.dept_id = b.id\n" +
@ -1395,16 +1375,15 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
"ORDER BY a.dept_id,b.name\n", pas);
}
if (result2.size() > 0) {
if (!result2.isEmpty()) {
List<List<Map<String, Object>>> partition = Lists.partition(result2, pageSize);
result.addAll(partition.get(page));
result = new CopyOnWriteArrayList<>(partition.get(page));
} else {
return new PageData<>(result2, result2.size());
return new PageData<>(result2, 0);
}
CompletableFuture<Void> voidCompletableFuture01 = CompletableFuture.runAsync(() -> { //应用浏览数量
result.forEach(r -> {
Object[] qu = {r.get("deptId")};
Integer integer = baseDao.selectResourceBrowseNum(params);
r.put("resourceBrowseNum", integer);
});
@ -1412,7 +1391,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> voidCompletableFuture02 = CompletableFuture.runAsync(() -> { //应用收藏量
result.forEach(r -> {
Object[] qu = {r.get("deptId")};
Integer integer = baseDao.selectResourceCollectionNum(params);
r.put("resourceCollectionNum", integer);
});
@ -1421,8 +1399,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
CompletableFuture<Void> all = CompletableFuture.allOf(voidCompletableFuture01, voidCompletableFuture02);
all.join();
PageData<Map<String, Object>> pageData = new PageData<>(result, result2.size());
return pageData;
return new PageData<>(result, result2.size());
}
@ -1430,8 +1407,6 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
List<Map<String, Object>> result;
Integer page = Integer.parseInt(params.get("page").toString()) - 1;
Integer pageSize = Integer.parseInt(params.get("limit").toString());
Object[] pas = {params.get("id"), params.get("id")};
List<Map<String, Object>> result2;
result2 = resourceDao.resourceInstallationOrDataResourceDetails(params);
@ -1985,7 +1960,7 @@ public class ResourceServiceImpl extends CrudServiceImpl<ResourceDao, ResourceEn
if (map.get(attr.getAttrValue()) != null) {
map.get(attr.getAttrValue()).add(it);
} else {
map.put(attr.getAttrValue(), (List) Collections.synchronizedList(new ArrayList() {{
map.put(attr.getAttrValue(), Collections.synchronizedList(new ArrayList() {{
add(it);
}}));
}

View File

@ -25,7 +25,6 @@ public class ShiroSessionManager extends DefaultWebSessionManager {
@Override
protected Serializable getSessionId(ServletRequest request, ServletResponse response) {
String sessionId = WebUtils.toHttp(request).getHeader(HEADER_TOKEN_NAME);
log.error("获取的sessionId为------>{}", sessionId);
if (StringUtils.isEmpty(sessionId)) {
return super.getSessionId(request, response);
} else {

View File

@ -0,0 +1,144 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.renren.modules.meeting.dao.TMeetingroomBookMapper">
<resultMap id="BaseResultMap" type="io.renren.modules.meeting.entity.TMeetingroomBook">
<result column="id" property="id" />
<result column="room_id" property="roomId" />
<result column="book_date" property="bookDate"/>
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="name" property="name" />
<result column="phone" property="phone" />
<result column="dept" property="dept" />
<result column="matter" property="matter" />
<result column="file" property="file" />
<result column="create_date" property="createDate" />
<result column="creator" property="creator" />
<result column="state" property="state" />
<result column="audit_viem" property="auditViem" />
<result column="auditor" property="auditor" />
<result column="audit_time" property="auditTime" />
</resultMap>
<resultMap id="dtoMap" type="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
<result column="id" property="id" />
<result column="room_id" property="roomId" />
<result column="book_date" property="bookDate"/>
<result column="start_time" property="startTime" />
<result column="end_time" property="endTime" />
<result column="name" property="name" />
<result column="phone" property="phone" />
<result column="dept" property="dept" />
<result column="matter" property="matter" />
<result column="file" property="file" />
<result column="create_date" property="createDate" />
<result column="creator" property="creator" />
<result column="state" property="state" />
<result column="audit_viem" property="auditViem" />
<result column="auditor" property="auditor" />
<result column="audit_time" property="auditTime" />
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.room_id
, t.book_date
, t.start_time
, t.end_time
, t.name
, t.phone
, t.dept
, t.matter
, t.file
, t.create_date
, t.creator
, t.state
, t.audit_viem
, t.auditor
, t.audit_time
</sql>
<select id="selectByRoomAndTime" resultMap="dtoMap">
select <include refid="baseColumns"/>
from t_meetingroom_book t
where t.room_id = #{roomId}
and t.state != 3
<if test="bookDate != 'null 00:00:00'.toString()">
and t.book_date = #{bookDate}
</if>
<if test="startTime.length() == 19 and startTime.substring(11,19) != null
and endTime.length() == 19 and endTime.substring(11,19) != null ">
and t.end_time >= #{startTime} and #{endTime} >= t.start_time
</if>
order by t.start_time asc
</select>
<select id="queryCountByRoomName" resultType="java.lang.Integer">
select count(t.id) from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
where t.creator = #{userId}
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
</select>
<select id="queryList" resultMap="dtoMap">
select <include refid="baseColumns"/>,tm.name as roomName
from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
where t.creator = #{userId}
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
order by t.create_date desc
limit #{currentNum},#{pageSize}
</select>
<select id="queryCountByState" resultType="java.lang.Integer">
select count(t.id) from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
<where>
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
<if test="state != null">
<choose>
<when test="state == 1">
and t.state = #{state}
</when>
<otherwise>
and t.state in (2,3)
</otherwise>
</choose>
</if>
</where>
</select>
<select id="queryListForAudit" resultType="io.renren.modules.meeting.dto.TMeetingroomBookDTO">
select <include refid="baseColumns"/>,tm.name as roomName
from t_meetingroom_book t
left join t_meetingroom tm on t.room_id = tm.id and tm.del_flag = 0
<where>
<if test="roomName != null and roomName != ''">
and tm.name like CONCAT('%',#{roomName},'%')
</if>
<if test="state != null">
<choose>
<when test="state == 1">
and t.state = #{state}
</when>
<otherwise>
and t.state in (2,3)
</otherwise>
</choose>
</if>
</where>
order by t.state asc,t.create_date desc
limit #{currentNum},#{pageSize}
</select>
<select id="selectInvalid" resultMap="BaseResultMap">
select <include refid="baseColumns"/>
from t_meetingroom_book t
where t.state = 1
and #{date} > t.book_date
</select>
</mapper>

View File

@ -0,0 +1,79 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper namespace="io.renren.modules.meeting.dao.TMeetingroomMapper">
<resultMap id="BaseResultMap" type="io.renren.modules.meeting.entity.TMeetingroom">
<result column="id" property="id" />
<result column="num" property="num" />
<result column="name" property="name" />
<result column="area" property="area" />
<result column="capacity" property="capacity" />
<result column="pic" property="pic" />
<result column="description" property="description" />
<result property="creator" column="creator"/>
<result property="createDate" column="create_date"/>
<result column="modify_time" property="modifyTime" />
<result column="del_flag" property="delFlag"/>
<result column="modifier" property="modifier"/>
</resultMap>
<resultMap id="meetingroomDto" type="io.renren.modules.meeting.dto.TMeetingroomDTO">
<result column="id" property="id" />
<result column="num" property="num" />
<result column="name" property="name" />
<result column="area" property="area" />
<result column="capacity" property="capacity" />
<result column="pic" property="pic" />
<result column="description" property="description" />
<result property="creator" column="creator"/>
<result property="createTime" column="create_date"/>
<result column="modify_time" property="modifyTime" />
<result column="del_flag" property="delFlag"/>
<result column="modifier" property="modifier"/>
</resultMap>
<!-- 表字段 -->
<sql id="baseColumns">
t.id
, t.num
, t.name
, t.area
, t.capacity
, t.pic
, t.description
, t.create_date
, t.modify_time
, t.del_flag
, t.creator
, t.modifier
</sql>
<select id="queryCount" resultType="java.lang.Integer">
select count(t.id) FROM t_meetingroom t
where t.del_flag = 0
<if test="name != null and name != ''">
and t.name like CONCAT('%',#{name},'%')
</if>
</select>
<select id="queryList" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns" />
FROM t_meetingroom t
where t.del_flag = 0
<if test="name != null and name != ''">
and t.name like CONCAT('%',#{name},'%')
</if>
ORDER BY t.create_date desc
limit #{currentNum},#{pageSize}
</select>
<select id="selectByName" resultMap="meetingroomDto">
SELECT
<include refid="baseColumns" />
FROM t_meetingroom t
where t.del_flag = 0
<if test="name != null and name != ''">
and t.name like CONCAT('%',#{name},'%')
</if>
ORDER BY t.create_date desc
</select>
</mapper>