1.首先自己在entity类里面写一个实体类.
? ? ? ? 这个实体类是和数据库的表有联系的,如果你想操作数据库的这个表(? hq_demand_confirm? )
那么你的实体类名字必须是(? HqDemandConfire? )
? ? ? ? 其中类里面的属性名要和数据库表里面的字段名相互对应,例如字段名是(? confirm_id? )
那么你的属性名必须是(? confirmId )
?
package com.sinosoft.springbootplus.demandConfirm.domain.entity;
import com.sinosoft.springbootplus.common.entity.BaseEntity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <pre>
* 后勤需求确认单
* </pre>
*
* @author 李佳锴
* @since 2021-11-18
*/
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "HqDemandConfirm对象", description = "后勤需求确认单")
public class HqDemandConfirm extends BaseEntity {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "id")
private Long id;
@ApiModelProperty(value = "班级ID")
private Long classId;
@ApiModelProperty(value = "确认单名称")
private String confirmName;
@ApiModelProperty(value = "来院时间")
private Date schoolDate;
@ApiModelProperty(value = "退房开始时间")
private Date checkOutStartDate;
@ApiModelProperty(value = "退房结束时间")
private Date checkOutEndDate;
@ApiModelProperty(value = "联系人ID")
private Long userId;
@ApiModelProperty(value = "联系人姓名")
private String userName;
@ApiModelProperty(value = "联系人电话")
private String phone;
@ApiModelProperty(value = "联系人邮箱")
private String email;
@ApiModelProperty(value = "创建人")
@TableField("CREATED_BY")
private String createdBy;
@ApiModelProperty(value = "创建时间")
@TableField("CREATED_TIME")
private Date createdTime;
@ApiModelProperty(value = "更新人")
@TableField("UPDATED_BY")
private String updatedBy;
@ApiModelProperty(value = "更新时间")
@TableField("UPDATED_TIME")
private Date updatedTime;
@ApiModelProperty(value = "确认单状态")
private String confirmStatic;
@ApiModelProperty(value = "住宿情况其他要求")
private String accommodationRequirements;
@ApiModelProperty(value = "场地使用其他要求")
private String uenueRequirements;
@ApiModelProperty(value = "用餐情况其他要求")
private String mealRequirements;
@ApiModelProperty(value = "结算状态")
private String settlementStatus;
}
2.创建mapper层
package com.sinosoft.springbootplus.demandConfirm.domain.mapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.sinosoft.springbootplus.demandConfirm.domain.entity.HqDemandConfirm;
import com.sinosoft.springbootplus.demandConfirm.vo.HqDemandConfirmQueryVo;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.apache.ibatis.annotations.Select;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
/**
* <pre>
* 后勤需求确认单 Mapper 接口
* </pre>
*
* @author 李佳锴
* @since 2021-11-18
*/
@Repository //切勿忘记
public interface HqDemandConfirmMapper extends BaseMapper<HqDemandConfirm> { //BaseMapper里面就是刚开始1说的这个类对应的就是想要操纵的表,里面的属性名对应的就是数据库字段名
}
3.创建service层? ? ? ??
? ? ? ? ①接口
package com.sinosoft.springbootplus.demandConfirm.application.service;
import com.sinosoft.springbootplus.demandConfirm.domain.entity.HqDemandConfirm;
import com.sinosoft.springbootplus.demandConfirm.param.HqDemandConfirmQueryParam;
import com.sinosoft.springbootplus.demandConfirm.vo.HqDemandConfirmQueryVo;
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;
/**
* <pre>
* 后勤需求确认单 服务类
* </pre>
*
* @author 李佳锴
* @since 2021-11-18
*/
public interface HqDemandConfirmService extends BaseService<HqDemandConfirm> {
/**
* 保存
*
* @param hqDemandConfirm
* @return
* @throws Exception
*/
boolean saveHqDemandConfirm(HqDemandConfirm hqDemandConfirm) throws Exception;
/**
* 修改
*
* @param hqDemandConfirm
* @return
* @throws Exception
*/
boolean updateHqDemandConfirm(HqDemandConfirm hqDemandConfirm) throws Exception;
/**
* 删除
*
* @param id
* @return
* @throws Exception
*/
boolean deleteHqDemandConfirm(Long id) throws Exception;
}
? ? ? ? ②实现类
package com.sinosoft.springbootplus.demandConfirm.application.service.impl;
import com.sinosoft.springbootplus.demandConfirm.application.service.HqDemandConfirmService;
import com.sinosoft.springbootplus.demandConfirm.domain.entity.HqDemandConfirm;
import com.sinosoft.springbootplus.demandConfirm.domain.mapper.HqDemandConfirmMapper;
import com.sinosoft.springbootplus.demandConfirm.param.HqDemandConfirmQueryParam;
import com.sinosoft.springbootplus.demandConfirm.vo.HqDemandConfirmQueryVo;
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;
/**
* <pre>
* 后勤需求确认单 服务实现类
* </pre>
*
* @author 李佳锴
* @since 2021-11-18
*/
@Slf4j
@Service //切勿忘记
public class HqDemandConfirmServiceImpl extends BaseServiceImpl<HqDemandConfirmMapper, HqDemandConfirm> implements HqDemandConfirmService{
private HqDemandConfirmMapper hqDemandConfirmMapper; //依赖注入
private JwPtkScheduleCourseDetailByClassIdApiService jwPtkScheduleCourseDetailByClassIdApiService;
HqDemandConfirmServiceImpl (HqDemandConfirmMapper hqDemandConfirmMapper,JwPtkScheduleCourseDetailByClassIdApiService jwPtkScheduleCourseDetailByClassIdApiService){
this.hqDemandConfirmMapper =hqDemandConfirmMapper;
this.jwPtkScheduleCourseDetailByClassIdApiService=jwPtkScheduleCourseDetailByClassIdApiService;
}
}
3.controller层
package com.sinosoft.springbootplus.demandConfirm.controller;
import com.sinosoft.springbootplus.common.api.ApiResult;
import com.sinosoft.springbootplus.common.controller.BaseController;
import com.sinosoft.springbootplus.demandConfirm.application.service.HqDemandConfirmService;
import com.sinosoft.springbootplus.demandConfirm.domain.entity.HqDemandConfirm;
import com.sinosoft.springbootplus.demandConfirm.param.HqDemandConfirmQueryParam;
import com.sinosoft.springbootplus.demandConfirm.param.HqJwPtkScheduleCourseDetailQueryParams;
import com.sinosoft.springbootplus.demandConfirm.vo.HqDemandConfirmQueryVo;
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;
/**
* <pre>
* 后勤需求确认单 API接口
* </pre>
*
* @author 李佳锴
* @since 2021-11-18
*/
@Slf4j
@RestController
@RequestMapping("/hqDemandConfirm")
@Api(tags="后勤需求确认单 API",description = "提供后勤需求确认单相关的 Rest API")
public class HqDemandConfirmController extends BaseController {
private HqDemandConfirmService hqDemandConfirmService;
HqDemandConfirmController(HqDemandConfirmService hqDemandConfirmService){
this.hqDemandConfirmService =hqDemandConfirmService ;
}
}
|