跨模块(跨项目)是调用不到里面的方法的,如果想用其他模块里面的方法就需要自己去写api调用.
具体方法流程如下:
1.首先在api下写自己需要的接口
①vo类
package com.sinosoft.springbootplus.schedule.vo;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.sinosoft.springbootplus.common.entity.baseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import javax.validation.constraints.NotNull;
import java.util.Date;
import java.util.List;
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "JwPtkScheduleCourseDetail对象", description = "课程表排课详情信息表 ")
public class JwPtkScheduleCourseDetailByClassId extends baseEntity {
private static final long serialVersionUID = 1L;
public static final Integer MORNING = 1; //早上
public static final Integer AFTERNOON = 2; //下午
public static final Integer EVENING = 3; //晚上
public static final Integer COURSE = 0;
public static final Integer ACTIVITY = 1;
@ApiModelProperty(value = "主键", required = true)
@TableId(value = "id", type = IdType.ID_WORKER)
private Long id;
@ApiModelProperty(value = "课程表id", required = true)
@NotNull(message = "课程表id不能为空")
private Long scheduleId;
@ApiModelProperty(value = "班级课程id", required = true)
@NotNull(message = "班级课程id不能为空")
private Long classCourseId;
@ApiModelProperty(value = "课程库id")
private Long courseId;
@ApiModelProperty(value = "课程类型 课程类型 0课程 1活动")
private Integer courseType;
@ApiModelProperty(value = "课程名称")
private String courseName;
@ApiModelProperty(value = "上课日期", required = true)
@NotNull(message = "上课日期不能为空")
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
private Date courseDate;
@ApiModelProperty(value = "上课时间 1:上午 2:下午 3:晚上", required = true)
@NotNull(message = "上课时间 1:上午 2:下午 3:晚上不能为空")
private Integer courseTime;
@ApiModelProperty(value = "备注")
private String remark;
@ApiModelProperty(value = "时间段内排序 课程在一个时间段(上午/下午/晚上)内的排序", required = true)
@NotNull(message = "时间段内排序 课程在一个时间段(上午/下午/晚上)内的排序不能为空")
private Integer timeframeOrder;
@ApiModelProperty(value = "课程开始时间")
private String courseBeginTime;
@ApiModelProperty(value = "课程结束时间")
private String courseEndTime;
@ApiModelProperty(value = "职务职称 所选的最后一位讲师的职务职称")
@TableField(exist = false)
private String duty;
@ApiModelProperty(value = "工作单位")
@TableField(exist = false)
private String workUnit;
@ApiModelProperty(value = "审核人")
private String approvalUser;
@ApiModelProperty(value = "审核人ID")
private String approvalUserId;
@ApiModelProperty(value = "审核状态")
private int approvalStatus;
@ApiModelProperty(value = "教室名称")
private String classroom;
@ApiModelProperty(value = "教室备注")
private String classRoomRemark;
@ApiModelProperty(value = "教室人数")
private String trueNum;
}
②写mapper
package com.sinosoft.springbootplus.schedule.domain.mapper; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.mapper.baseMapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.sinosoft.springbootplus.course.vo.JxSkRecordVo; import com.sinosoft.springbootplus.project.vo.JwPtkbaseInfoVo; import com.sinosoft.springbootplus.schedule.domain.entity.JwPtkCourseAssessInfo; import com.sinosoft.springbootplus.schedule.domain.entity.JwPtkScheduleCourseDetail; import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId; import org.apache.ibatis.annotations.Delete; import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Select; import org.apache.ibatis.annotations.Update; import org.springframework.stereotype.Repository; import java.util.List; @Repository public interface JwPtkScheduleCourseDetailMapper extends baseMapper{ @Select("select id, schedule_id, class_course_id, course_id, course_type, course_name, course_date, course_time, remark, time_frame_order ,classroom ,class_room_remark FROM jw_ptk_schedule_course_detail ${ew.customSqlSegment}") IPage getJwPtkScheduleCourseDetailPageList(Page page, @Param(Constants.WRAPPER) Wrapper wrapper); @Delete("delete FROM jw_ptk_course_teacher_mid where schedule_course_id in (select id from jw_ptk_schedule_course_detail ${ew.customSqlSegment})") int deletedWithJwPtkCourseTeacherMid(@Param(Constants.WRAPPER) Wrapper wrapper); @Update("update jw_ptk_schedule_course_detail set time_frame_order = time_frame_order-1 ${ew.customSqlSegment}") int updateTimeframeOrderByDeleteCourse(@Param(Constants.WRAPPER) Wrapper wrapper); @Select("select info.class_id from jw_ptk_schedule_course_detail detail LEFT JOIN jw_ptk_schedule_baseinfo info on detail.schedule_id = info.id where detail.id = #{scheduleCourseId}") Long getClassIdByScheduleCourseId(Long scheduleCourseId); @Select("select d.course_id,d.course_name,d.course_date,t.id teacher_id,t.name teacher_name from jw_ptk_schedule_course_detail d LEFT JOIN jw_ptk_course_teacher_mid m on d.id = m.schedule_course_id LEFT JOIN jw_ptk_teacher_info t on m.teacher_id = t.id where d.schedule_id = #{scheduleId} and m.teacher_type = 1") List getCourseOfPg(Long scheduleId); @Select("select d.course_id,d.course_name,d.course_date,c.way from jw_ptk_schedule_course_detail d LEFT JOIN jw_ptk_schedule_baseinfo s on d.schedule_id = s.id LEFT JOIN jw_ptk_course_baseinfo c on d.class_course_id = c.id LEFT JOIN jw_ptk_course_teacher_mid m on m.schedule_course_id = d.id where s.class_id = #{classId} and d.course_id = #{courseId} and m.teacher_id = #{teacherId} limit 1") JwPtkCourseAssessInfo getCourseDetailInfoByAssessInfo(@Param("classId")Long classId,@Param("courseId")Long courseId,@Param("teacherId")Long teacherId); @Select("SELECT jpctm.teacher_id AS teacherId, jpscd.schedule_id AS scheduleId, jpti.name AS teacherName, jpscd.course_id AS courseId, jpscd.course_name AS courseName, jpscd.course_date AS courseDate, jpscd.course_time AS courseTime FROM jw_ptk_schedule_course_detail jpscd LEFT JOIN jw_ptk_course_teacher_mid jpctm ON jpscd.id = jpctm.schedule_course_id LEFT JOIN jw_ptk_teacher_info jpti ON jpctm.teacher_id = jpti.id ${ew.customSqlSegment}") IPage getLectureRecordsPaging(Page page, @Param(Constants.WRAPPER) QueryWrapper wrapper); @Update("update jw_ptk_schedule_course_detail set course_begin_time = null ${ew.customSqlSegment}") int updateCourseBeginTimeById(@Param(Constants.WRAPPER) QueryWrapper wrapper); @Update("update jw_ptk_schedule_course_detail set course_end_time = null ${ew.customSqlSegment}") int updateCourseEndTimeById(@Param(Constants.WRAPPER) QueryWrapper wrapper); @Select("select detail.course_name,detail.course_begin_time,detail.course_end_time,detail.course_time,detail.course_date from jw_ptk_schedule_course_detail detail left join jw_ptk_course_teacher_mid mid on detail.id = mid.schedule_course_id left join jw_ptk_schedule_baseinfo base on base.id = detail.schedule_id ${ew.customSqlSegment}") List getTeacherAllCourseHourByClass(@Param(Constants.WRAPPER) QueryWrapper wrapper); @Select("select count(0) from jw_ptk_schedule_course_detail detail left join jw_ptk_schedule_baseinfo base on base.id = detail.schedule_id ${ew.customSqlSegment}") int getCourseCountByClassId(@Param(Constants.WRAPPER) QueryWrapper wrapper); @Select("select id , schedule_id, class_course_id from jw_ptk_schedule_course_detail where schedule_id = #{scheduleId} ") List selectByscheduleId(@Param("scheduleId") Long scheduleId); @Select("select a.id,a.course_begin_time,a.course_end_time,a.classroom,a.remark,b.class_id,c.true_num from jw_ptk_schedule_course_detail a join jw_ptk_schedule_baseinfo b on a.schedule_id=b.id join jw_bj_baseinfo c on c.id=b.class_id where b.class_id=#{classId}") List getJwPtkScheduleCourseDetailByClassId(@Param("classId") Long classId); @Update("update jw_ptk_schedule_course_detail set remark = #{remark} where id = #{id}") int updateJwPtkScheduleCourseDetailByClassId(@Param("id") Long id,@Param("remark") String remark); @Select(" select ptk.id as ptk_id, ptk.course_name,ptkb.class_name, ptkt.name as teacher_name from jw_ptk_schedule_course_detail ptk " + " LEFT JOIN jw_ptk_schedule_baseinfo ptkb ON ptkb.id = ptk.schedule_id" + " LEFT JOIN jw_ptk_course_teacher_mid ptkm ON ptkm.schedule_course_id = ptk.id " + " LEFT JOIN jw_ptk_teacher_info ptkt ON ptkt.id = ptkm.teacher_id " + "where ptk.id= #{ptkId}") JwPtkbaseInfoVo selectByPtkId(Long ptkId); }
③创建接口
package com.sinosoft.springbootplus.schedule.service;
import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId;
import java.util.List;
public interface JwPtkScheduleCourseDetailByClassIdApiService {
List getJwPtkScheduleCourseDetailByClassId(Long classId);
boolean updateJwPtkScheduleCourseDetail(Long id,String remark);
}
2.在项目模块里的impl里面创建实现类并实现上方接口.
package com.sinosoft.springbootplus.schedule.application.service.impl; import com.sinosoft.springbootplus.mybatis.service.impl.baseServiceImpl; import com.sinosoft.springbootplus.schedule.domain.entity.JwPtkScheduleCourseDetail; import com.sinosoft.springbootplus.schedule.domain.mapper.JwPtkScheduleCourseDetailMapper; import com.sinosoft.springbootplus.schedule.service.JwPtkScheduleCourseDetailByClassIdApiService; import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.List; @Slf4j @Service public class JwPtkScheduleCourseDetailByClassIdServiceImpl extends baseServiceImplimplements JwPtkScheduleCourseDetailByClassIdApiService { private JwPtkScheduleCourseDetailMapper jwPtkScheduleCourseDetailMapper; JwPtkScheduleCourseDetailByClassIdServiceImpl (JwPtkScheduleCourseDetailMapper jwPtkScheduleCourseDetailMapper){ this.jwPtkScheduleCourseDetailMapper =jwPtkScheduleCourseDetailMapper; } @Override public List getJwPtkScheduleCourseDetailByClassId(Long classId) { List jwPtkScheduleCourseDetailByClassId = jwPtkScheduleCourseDetailMapper.getJwPtkScheduleCourseDetailByClassId(classId); return jwPtkScheduleCourseDetailByClassId; } @Override public boolean updateJwPtkScheduleCourseDetail(Long id, String remark) { int i = jwPtkScheduleCourseDetailMapper.updateJwPtkScheduleCourseDetailByClassId(id, remark); if (i > 0){ return true; }else { return false; } } }
3.在自己的模块中完成方法的调用.
在service层完成方法的调用.
①接口(里面最后俩方法才是)
package com.sinosoft.springbootplus.demand/confirm/i.application.service; import com.sinosoft.springbootplus.demand/confirm/i.domain.entity.HqDemand/confirm/i; import com.sinosoft.springbootplus.demand/confirm/i.param.HqDemand/confirm/iQueryParam; import com.sinosoft.springbootplus.demand/confirm/i.vo.HqDemand/confirm/iQueryVo; import com.sinosoft.springbootplus.mybatis.service.baseService; import com.sinosoft.springbootplus.mybatis.vo.Paging; import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId; import java.util.List; public interface HqDemandConfirmService extends baseService{ boolean saveHqDemandConfirm(HqDemandConfirm hqDemand/confirm/i) throws Exception; boolean updateHqDemandConfirm(HqDemandConfirm hqDemand/confirm/i) throws Exception; boolean deleteHqDemandConfirm(Long id) throws Exception; Paging getHqDemandConfirmPageList(HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam) throws Exception; List getVenueInfoPageList(HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam); boolean updateVenueInfoPageList(Long id,String remark); }
②实现类(里面最后俩方法才是)
package com.sinosoft.springbootplus.demand/confirm/i.application.service.impl; import com.sinosoft.springbootplus.demand/confirm/i.application.service.HqDemand/confirm/iService; import com.sinosoft.springbootplus.demand/confirm/i.domain.entity.HqDemand/confirm/i; import com.sinosoft.springbootplus.demand/confirm/i.domain.mapper.HqDemand/confirm/iMapper; import com.sinosoft.springbootplus.demand/confirm/i.param.HqDemand/confirm/iQueryParam; import com.sinosoft.springbootplus.demand/confirm/i.vo.HqDemand/confirm/iQueryVo; import com.sinosoft.springbootplus.mybatis.service.impl.baseServiceImpl; import com.sinosoft.springbootplus.mybatis.vo.Paging; import com.sinosoft.springbootplus.schedule.service.JwPtkScheduleCourseDetailByClassIdApiService; import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.toolkit.Wrappers; import java.util.ArrayList; import java.util.List; @Slf4j @Service public class HqDemandConfirmServiceImpl extends baseServiceImplimplements HqDemand/confirm/iService{ private HqDemandConfirmMapper hqDemand/confirm/iMapper; private JwPtkScheduleCourseDetailByClassIdApiService jwPtkScheduleCourseDetailByClassIdApiService; HqDemandConfirmServiceImpl (HqDemandConfirmMapper hqDemand/confirm/iMapper,JwPtkScheduleCourseDetailByClassIdApiService jwPtkScheduleCourseDetailByClassIdApiService){ this.hqDemandConfirmMapper =hqDemand/confirm/iMapper; this.jwPtkScheduleCourseDetailByClassIdApiService=jwPtkScheduleCourseDetailByClassIdApiService; } @Transactional(rollbackFor = Exception.class) @Override public boolean saveHqDemandConfirm(HqDemandConfirm hqDemand/confirm/i) { return super.save(hqDemand/confirm/i); } @Transactional(rollbackFor = Exception.class) @Override public boolean updateHqDemandConfirm(HqDemandConfirm hqDemand/confirm/i) { return super.updateById(hqDemand/confirm/i); } @Transactional(rollbackFor = Exception.class) @Override public boolean deleteHqDemandConfirm(Long id) { return super.removeById(id); } @Override public Paging getHqDemandConfirmPageList(HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam) { QueryWrapper queryWrapper = Wrappers. query() .eq("/confirm/i_static",hqDemand/confirm/iQueryParam.getConfirmStatic()) .like(hqDemand/confirm/iQueryParam.getConfirmName()!= null,"/confirm/i_name",hqDemand/confirm/iQueryParam.getConfirmName()) // .eq(hqDemand/confirm/iQueryParam.getCheckOutStartDate() != null,"check_out_start_date",hqDemand/confirm/iQueryParam.getCheckOutStartDate()) .ge(hqDemand/confirm/iQueryParam.getCheckOutStartDate() != null,"check_out_start_date",hqDemand/confirm/iQueryParam.getCheckOutStartDate()) .le(hqDemand/confirm/iQueryParam.getCheckOutEndDate() != null,"check_out_start_date",hqDemand/confirm/iQueryParam.getCheckOutEndDate()) .between(hqDemand/confirm/iQueryParam.getSchoolBeginDate() != null && hqDemand/confirm/iQueryParam.getSchoolEndDate() != null,"school_date",hqDemand/confirm/iQueryParam.getSchoolBeginDate(),hqDemand/confirm/iQueryParam.getSchoolEndDate()); IPage iPage = hqDemand/confirm/iMapper.getHqDemandConfirmPageList(hqDemand/confirm/iQueryParam.page(),queryWrapper); return new Paging<>(iPage); } @Override public List getVenueInfoPageList(HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam) { //获取培训单所有信息 List hqDemandConfirms = hqDemand/confirm/iMapper.selectList(null); //获取培训单所有班级Id List list = new ArrayList<>(); for (HqDemandConfirm demandConfirm : hqDemand/confirm/is) { list.add(demand/confirm/i.getClassId()); } //根据班级Id获取场地所有信息 List list2=new ArrayList<>(); for (Long aLong : list) { List jwPtkScheduleCourseDetailByClassId = jwPtkScheduleCourseDetailByClassIdApiService.getJwPtkScheduleCourseDetailByClassId(aLong); for (JwPtkScheduleCourseDetailByClassId ptkScheduleCourseDetailByClassId : jwPtkScheduleCourseDetailByClassId) { list2.add(ptkScheduleCourseDetailByClassId); } } return list2; } @Override public boolean updateVenueInfoPageList(Long id, String remark) { boolean b = jwPtkScheduleCourseDetailByClassIdApiService.updateJwPtkScheduleCourseDetail(id, remark); return b; } }
③写controller层
package com.sinosoft.springbootplus.demand/confirm/i.controller;
import com.sinosoft.springbootplus.common.api.ApiResult;
import com.sinosoft.springbootplus.common.controller.baseController;
import com.sinosoft.springbootplus.demand/confirm/i.application.service.HqDemand/confirm/iService;
import com.sinosoft.springbootplus.demand/confirm/i.domain.entity.HqDemand/confirm/i;
import com.sinosoft.springbootplus.demand/confirm/i.param.HqDemand/confirm/iQueryParam;
import com.sinosoft.springbootplus.demand/confirm/i.param.HqJwPtkScheduleCourseDetailQueryParams;
import com.sinosoft.springbootplus.demand/confirm/i.vo.HqDemand/confirm/iQueryVo;
import com.sinosoft.springbootplus.schedule.vo.JwPtkScheduleCourseDetailByClassId;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import com.sinosoft.springbootplus.mybatis.vo.Paging;
import java.util.List;
@Slf4j
@RestController
@RequestMapping("/hqDemand/confirm/i")
@Api(tags="后勤需求确认单 API",description = "提供后勤需求确认单相关的 Rest API")
public class HqDemandConfirmController extends baseController {
private HqDemandConfirmService hqDemand/confirm/iService;
HqDemandConfirmController(HqDemandConfirmService hqDemand/confirm/iService){
this.hqDemandConfirmService =hqDemandConfirmService ;
}
@PostMapping("/add")
@RequiresPermissions("hq:demand:/confirm/i:add")
@ApiOperation(value = "添加HqDemand/confirm/i对象", notes = "添加后勤需求确认单")
public ApiResult addHqDemandConfirm(@Valid @RequestBody HqDemandConfirm hqDemand/confirm/i) throws Exception {
boolean flag = hqDemand/confirm/iService.saveHqDemandConfirm(hqDemand/confirm/i);
//noinspection unchecked
return ApiResult.result(flag);
}
@PostMapping("/update")
// @RequiresPermissions("hq:demand:/confirm/i:update")
@ApiOperation(value = "修改HqDemand/confirm/i对象", notes = "修改后勤需求确认单") //不可加培训确认单状态
public ApiResult updateHqDemandConfirm(@Valid @RequestBody HqDemandConfirm hqDemand/confirm/i) throws Exception {
boolean flag = hqDemand/confirm/iService.updateHqDemandConfirm(hqDemand/confirm/i);
//noinspection unchecked
return ApiResult.result(flag);
}
@PostMapping("/delete/{id}")
@RequiresPermissions("hq:demand:/confirm/i:delete")
@ApiOperation(value = "删除HqDemand/confirm/i对象", notes = "删除后勤需求确认单")
public ApiResult deleteHqDemandConfirm(@PathVariable("id") Long id) throws Exception {
boolean flag = hqDemand/confirm/iService.deleteHqDemandConfirm(id);
//noinspection unchecked
return ApiResult.result(flag);
}
@PostMapping("/pageList")
//@RequiresPermissions("hq:demand:/confirm/i:page")
@ApiOperation(value = "获取HqDemand/confirm/i分页列表", notes = "后勤需求确认单分页列表")
public ApiResult> getHqDemandConfirmPageList(@Valid @RequestBody HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam) throws Exception {
Paging paging = hqDemand/confirm/iService.getHqDemandConfirmPageList(hqDemand/confirm/iQueryParam);
//noinspection unchecked
return ApiResult.ok(paging);
}
@PostMapping("/vuepageList")
//@RequiresPermissions("hq:demand:/confirm/i:page")
@ApiOperation(value = "获取JwPtkScheduleCourseDetail列表", notes = "场地使用列表")
public ApiResult> getHqDemandConfirmVuepageList(@Valid @RequestBody HqDemandConfirmQueryParam hqDemand/confirm/iQueryParam) throws Exception {
List venueInfoPageList = hqDemand/confirm/iService.getVenueInfoPageList(hqDemand/confirm/iQueryParam);
//noinspection unchecked
Paging jwPtkScheduleCourseDetailByClassIdPaging = new Paging<>(venueInfoPageList);
return ApiResult.ok(jwPtkScheduleCourseDetailByClassIdPaging);
}
@PostMapping("/updatepdk")
@ApiOperation(value = "修改HqDemand/confirm/i对象", notes = "修改排调课备注")
public ApiResult updatejwPtkScheduleCourseDetail(@Valid @RequestBody HqJwPtkScheduleCourseDetailQueryParams hqJwPtkScheduleCourseDetailQueryParams) throws Exception {
boolean b = hqDemand/confirm/iService.updateVenueInfoPageList(hqJwPtkScheduleCourseDetailQueryParams.getId(),hqJwPtkScheduleCourseDetailQueryParams.getRemark());
return ApiResult.result(b);
}
}



