1.controller层
代码如下(示例):controller层会议详情#
/**
* 获取会议详情
* @return
*/
@GetMapping("/swMeetingDetail")
public ResponseResult<SwMeetingDetailVo> swMeetingDetail(@RequestParam String meetingId){
SwMeetingDetailVo res=new SwMeetingDetailVo();
try {
res= swMeetingService.swMeetingDetail(meetingId);
return this.getOkResponseResult(res, "查询成功");
}catch (SwException e){
return this.getErrResponseResult(res, ErrCode.SYS_PARAMETER_ERROR.getErrCode(), e.getMessage());
} catch (Exception e){
log.error("【获取未开的会议】接口出现异常,参数meetingId${}$,异常${}$", meetingId, ExceptionUtils.getStackTrace(e));
return this.getErrResponseResult(res, ErrCode.UNKNOW_ERROR.getErrCode(), "操作失败");
}
}
2.mapper层
package com.authine.cloudpivot.ext.mapper;
import com.authine.cloudpivot.ext.entity.SwMeetingDetail;
import com.authine.cloudpivot.ext.entity.SwMeetingDetailCriteria;
import java.util.List;
import org.apache.ibatis.annotations.Param;
public interface SwMeetingDetailMapper {
//根据条件统计
long countByExample(SwMeetingDetailCriteria example);
//根据条件删除
int deleteByExample(SwMeetingDetailCriteria example);
//根据主键删除
int deleteByPrimaryKey(String id);
//插入
int insert(SwMeetingDetail record);
//插入非空
int insertSelective(SwMeetingDetail record);
//根据条件查询
List<SwMeetingDetail> selectByExample(SwMeetingDetailCriteria example);
//根据主键查询
SwMeetingDetail selectByPrimaryKey(String id);
//根据条件查询非空
int updateByExampleSelective(@Param("record") SwMeetingDetail record, @Param("example") SwMeetingDetailCriteria example);
//根据条件更新
int updateByExample(@Param("record") SwMeetingDetail record, @Param("example") SwMeetingDetailCriteria example);
//根据主键更新非空
int updateByPrimaryKeySelective(SwMeetingDetail record);
//根据主键更新
int updateByPrimaryKey(SwMeetingDetail record);
}
`
2.impl层
代码如下(示例):impl层会议详情#
@Override
public SwMeetingDetailVo swMeetingDetail(String meetingId) {
//检查会议是否存在,swMeeting 是根据主键查询的结果
SwMeeting swMeeting = swMeetingMapper.selectByPrimaryKey(meetingId);
if(swMeeting==null || DeleteFlagEnum.DELETE.getCode().equals(swMeeting.getDeleted())){
throw new SwException("没有查到该会议");
}
SwMeetingDetailVo swMeetingDetailVo = BeanCopyUtils.coypToClass(swMeeting, SwMeetingDetailVo.class, null);
swMeetingDetailVo.setMeetingStartTime(swMeeting.getMeetingStarttime());
swMeetingDetailVo.setMeetingEndTime(swMeeting.getMeetingEndtime());
//查出参会人员
// SwMeetingUserRelCriteria example=new SwMeetingUserRelCriteria();
// example.createCriteria()
// .andSwMeetingIdEqualTo(swMeeting.getId())
// .andDeletedEqualTo(DeleteFlagEnum.NOT_DELETE.getCode());
List<SwMeetingUserDto> users = swMeetingUserRelMapper.selectUsersByMeetingId(swMeeting.getId());
String joinUsers="";
for (SwMeetingUserDto user : users) {
joinUsers=joinUsers+user.getName()+",";
}
if(StringUtils.isNotBlank(joinUsers)){
joinUsers=joinUsers.substring(0,joinUsers.length()-1);
}
swMeetingDetailVo.setJoinUser(joinUsers);
return swMeetingDetailVo;
}