| | |
| | | super.put(key, value); |
| | | return this; |
| | | } |
| | | |
| | | public Result data(Object data) { |
| | | super.put("data", data); |
| | | return this; |
| | | } |
| | | |
| | | public Result total(Long total) { |
| | | super.put("total", total); |
| | | return this; |
| | | } |
| | | } |
| | |
| | | package com.ycl.jxkg.config.spring.exception; |
| | | |
| | | import com.fasterxml.jackson.core.JsonProcessingException; |
| | | import com.fasterxml.jackson.databind.ObjectMapper; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.base.SystemCode; |
| | | import com.ycl.jxkg.utils.ErrorUtil; |
| | | import org.slf4j.Logger; |
| | | import org.slf4j.LoggerFactory; |
| | | import org.springframework.http.HttpStatus; |
| | | import org.springframework.validation.BindException; |
| | | import org.springframework.validation.FieldError; |
| | | import org.springframework.web.HttpRequestMethodNotSupportedException; |
| | | import org.springframework.web.bind.MethodArgumentNotValidException; |
| | | import org.springframework.web.bind.annotation.ControllerAdvice; |
| | | import org.springframework.web.bind.annotation.ExceptionHandler; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ControllerAdvice |
| | | public class ExceptionHandle { |
| | | |
| | | private final static Logger logger = LoggerFactory.getLogger(ExceptionHandle.class); |
| | | /** 公司项目的包结构,用于缩短错误日志的长度 */ |
| | | private final static String COMPANY_PACKAGE = "com.ycl.jxkg."; |
| | | |
| | | /** |
| | | * Handler rest response. |
| | |
| | | */ |
| | | @ExceptionHandler(Exception.class) |
| | | @ResponseBody |
| | | public Result handler(Exception e) { |
| | | logger.error(e.getMessage(), e); |
| | | public Result handler(Exception e, HttpServletRequest request) { |
| | | String errMsg = String.format("系统异常-%s", e.getMessage()); |
| | | this.printExceptionLocation(e, request, errMsg); |
| | | return new Result<>(SystemCode.InnerError.getCode(), SystemCode.InnerError.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * Handler rest response. |
| | | * JSON传参数据校验异常 |
| | | * |
| | | * @param e the e |
| | | * @return the rest response |
| | | * @param e |
| | | * @param request |
| | | * @return |
| | | * @throws JsonProcessingException |
| | | */ |
| | | @ExceptionHandler(MethodArgumentNotValidException.class) |
| | | @ResponseBody |
| | | public Result handler(MethodArgumentNotValidException e) { |
| | | String errorMsg = e.getBindingResult().getAllErrors().stream().map(file -> { |
| | | FieldError fieldError = (FieldError) file; |
| | | return ErrorUtil.parameterErrorFormat(fieldError.getField(), fieldError.getDefaultMessage()); |
| | | }).collect(Collectors.joining()); |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | public Result handleMethodArgumentNotValidException(MethodArgumentNotValidException e, |
| | | HttpServletRequest request) throws JsonProcessingException { |
| | | List<String> err = e.getBindingResult().getAllErrors().stream().map(error -> error.getDefaultMessage()).collect(Collectors.toList()); |
| | | String s = new ObjectMapper().writeValueAsString(err); |
| | | String errMsg = String.format("参数校验失败-%s", s); |
| | | this.printExceptionLocation(e, request, errMsg); |
| | | return Result.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), s); |
| | | } |
| | | |
| | | /** |
| | |
| | | return new Result<>(SystemCode.ParameterValidError.getCode(), errorMsg); |
| | | } |
| | | |
| | | /** |
| | | * 请求方式不支持异常 |
| | | * |
| | | * @param e |
| | | * @param request |
| | | * @return |
| | | */ |
| | | @ExceptionHandler(HttpRequestMethodNotSupportedException.class) |
| | | public Result handleHttpRequestMethodNotSupported(HttpRequestMethodNotSupportedException e, |
| | | HttpServletRequest request) { |
| | | String errMSg = String.format("不支持%s请求", e.getMethod()); |
| | | this.printExceptionLocation(e, request, errMSg); |
| | | return Result.fail(HttpStatus.INTERNAL_SERVER_ERROR.value(), e.getMessage()); |
| | | } |
| | | |
| | | /** |
| | | * 打印异常出现位置 |
| | | * @param e |
| | | */ |
| | | private void printExceptionLocation(Throwable e, HttpServletRequest request, String errMsg) { |
| | | StackTraceElement stackTraceElement = e.getStackTrace()[0]; |
| | | String className = stackTraceElement.getClassName().contains(COMPANY_PACKAGE) ? |
| | | stackTraceElement.getClassName().split(COMPANY_PACKAGE)[1] : stackTraceElement.getClassName(); |
| | | logger.error("接口:【{}】, 异常类:【{}】,方法:【{}】,所在行:【{}】, 错误信息:【{}】", |
| | | request.getRequestURI(), |
| | | className, |
| | | stackTraceElement.getMethodName(), |
| | | stackTraceElement.getLineNumber(), |
| | | errMsg); |
| | | } |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.controller.admin; |
| | | |
| | | import com.ycl.jxkg.group.Update; |
| | | import com.ycl.jxkg.group.Add; |
| | | import org.springframework.validation.annotation.Validated; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import lombok.RequiredArgsConstructor; |
| | | import java.util.List; |
| | | import javax.validation.constraints.NotEmpty; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import com.ycl.jxkg.service.ClassesService; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.form.ClassesForm; |
| | | import com.ycl.jxkg.domain.query.ClassesQuery; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | /** |
| | | * 班级 前端控制器 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Validated |
| | | @RequiredArgsConstructor |
| | | @Api(value = "班级", tags = "班级管理") |
| | | @RestController |
| | | @RequestMapping("/classes") |
| | | public class ClassesController { |
| | | |
| | | private final ClassesService classesService; |
| | | |
| | | @PostMapping |
| | | @ApiOperation(value = "添加", notes = "添加") |
| | | @PreAuthorize("hasAuthority('classes:add')") |
| | | public Result add(@RequestBody @Validated(Add.class) ClassesForm form) { |
| | | return classesService.add(form); |
| | | } |
| | | |
| | | @PutMapping |
| | | @ApiOperation(value = "修改", notes = "修改") |
| | | @PreAuthorize("hasAuthority('classes:edit')") |
| | | public Result update(@RequestBody @Validated(Update.class) ClassesForm form) { |
| | | return classesService.update(form); |
| | | } |
| | | |
| | | @DeleteMapping("/{id}") |
| | | @ApiOperation(value = "ID删除", notes = "ID删除") |
| | | @PreAuthorize("hasAuthority('classes:del')") |
| | | public Result removeById(@PathVariable("id") String id) { |
| | | return classesService.removeById(id); |
| | | } |
| | | |
| | | @DeleteMapping("/batch") |
| | | @ApiOperation(value = "批量删除", notes = "批量删除") |
| | | @PreAuthorize("hasAuthority('classes:del:batch')") |
| | | public Result remove(@RequestBody @NotEmpty(message = "请选择数据") List<String> ids) { |
| | | return classesService.remove(ids); |
| | | } |
| | | |
| | | @GetMapping("/page") |
| | | @ApiOperation(value = "分页", notes = "分页") |
| | | @PreAuthorize("hasAuthority('classes:page')") |
| | | public Result page(ClassesQuery query) { |
| | | return classesService.page(query); |
| | | } |
| | | |
| | | @GetMapping("/{id}") |
| | | @ApiOperation(value = "详情", notes = "详情") |
| | | @PreAuthorize("hasAuthority('classes:detail')") |
| | | public Result detail(@PathVariable("id") Integer id) { |
| | | return classesService.detail(id); |
| | | } |
| | | |
| | | @GetMapping("/list") |
| | | @PreAuthorize("hasAuthority('classes:list')") |
| | | @ApiOperation(value = "列表", notes = "列表") |
| | | public Result list() { |
| | | return classesService.all(); |
| | | } |
| | | } |
File was renamed from src/main/java/com/ycl/jxkg/controller/admin/EducationController.java |
| | |
| | | import java.util.List; |
| | | |
| | | @RequiredArgsConstructor |
| | | @RestController("AdminEducationController") |
| | | @RequestMapping(value = "/api/admin/education") |
| | | public class EducationController extends BaseApiController { |
| | | @RestController("AdminSubjectController") |
| | | @RequestMapping(value = "/api/admin/subject") |
| | | public class SubjectController extends BaseApiController { |
| | | |
| | | private final SubjectService subjectService; |
| | | |
| | | @RequestMapping(value = "/subject/list", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/list", method = RequestMethod.POST) |
| | | public Result<List<Subject>> list() { |
| | | List<Subject> subjects = subjectService.allSubject(); |
| | | return Result.ok(subjects); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/page", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/page", method = RequestMethod.POST) |
| | | public Result<PageInfo<SubjectResponseVO>> pageList(@RequestBody SubjectPageRequestVO model) { |
| | | PageInfo<Subject> pageInfo = subjectService.page(model); |
| | | PageInfo<SubjectResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> { |
| | |
| | | return Result.ok(page); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/edit", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/edit", method = RequestMethod.POST) |
| | | public Result edit(@RequestBody @Valid SubjectEditRequestVO model) { |
| | | Subject subject = new Subject(); |
| | | BeanUtils.copyProperties(model, subject); |
| | |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/select/{id}", method = RequestMethod.POST) |
| | | public Result<SubjectEditRequestVO> select(@PathVariable Integer id) { |
| | | Subject subject = subjectService.getById(id); |
| | | SubjectEditRequestVO vo = new SubjectEditRequestVO(); |
| | |
| | | return Result.ok(vo); |
| | | } |
| | | |
| | | @RequestMapping(value = "/subject/delete/{id}", method = RequestMethod.POST) |
| | | @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST) |
| | | public Result delete(@PathVariable Integer id) { |
| | | Subject subject = subjectService.getById(id); |
| | | subjectService.updateById(subject); |
New file |
| | |
| | | package com.ycl.jxkg.domain.entity; |
| | | |
| | | import com.baomidou.mybatisplus.annotation.TableField; |
| | | import com.baomidou.mybatisplus.annotation.TableName; |
| | | |
| | | import com.ycl.jxkg.domain.base.AbsEntity; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 班级 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Data |
| | | @TableName("t_classes") |
| | | public class Classes extends AbsEntity { |
| | | |
| | | private static final long serialVersionUID = 1L; |
| | | |
| | | @TableField("class_name") |
| | | /** 班级名称 */ |
| | | private String className; |
| | | |
| | | @TableField("create_user") |
| | | /** 创建人 */ |
| | | private Integer createUser; |
| | | |
| | | @TableField("classes_number") |
| | | /** 班级人数 */ |
| | | private Integer classesNumber; |
| | | |
| | | @TableField("status") |
| | | /** 班级状态 */ |
| | | private String status; |
| | | |
| | | @TableField("verify_status") |
| | | /** 验证状态 */ |
| | | private String verifyStatus; |
| | | |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.domain.form; |
| | | |
| | | import com.ycl.jxkg.domain.base.AbsForm; |
| | | import com.ycl.jxkg.group.Update; |
| | | import com.ycl.jxkg.group.Add; |
| | | import com.ycl.jxkg.domain.entity.Classes; |
| | | import org.springframework.beans.BeanUtils; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import org.springframework.lang.NonNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | import java.util.Date; |
| | | |
| | | /** |
| | | * 班级表单 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "Classes表单", description = "班级表单") |
| | | public class ClassesForm extends AbsForm { |
| | | |
| | | @NotBlank(message = "班级名称不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("班级名称") |
| | | private String className; |
| | | |
| | | @NotNull(message = "创建人不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("创建人") |
| | | private Integer createUser; |
| | | |
| | | @NotNull(message = "创建时间不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("创建时间") |
| | | private Date createTime; |
| | | |
| | | @NotNull(message = "班级人数不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("班级人数") |
| | | private Integer classesNumber; |
| | | |
| | | @NotBlank(message = "班级状态不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("班级状态") |
| | | private String status; |
| | | |
| | | @NotBlank(message = "验证状态不能为空", groups = {Add.class, Update.class}) |
| | | @ApiModelProperty("验证状态") |
| | | private String verifyStatus; |
| | | |
| | | public static Classes getEntityByForm(@NonNull ClassesForm form, Classes entity) { |
| | | if(entity == null) { |
| | | entity = new Classes(); |
| | | } |
| | | BeanUtils.copyProperties(form, entity); |
| | | return entity; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.domain.query; |
| | | |
| | | import java.util.List; |
| | | |
| | | import com.ycl.jxkg.domain.base.AbsQuery; |
| | | import org.springframework.lang.NonNull; |
| | | import javax.validation.constraints.NotBlank; |
| | | import javax.validation.constraints.NotNull; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 班级查询 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Data |
| | | @ApiModel(value = "Classes查询", description = "班级查询") |
| | | public class ClassesQuery extends AbsQuery { |
| | | } |
| | | |
New file |
| | |
| | | package com.ycl.jxkg.domain.vo; |
| | | |
| | | import com.ycl.jxkg.domain.base.AbsVo; |
| | | import com.ycl.jxkg.domain.entity.Classes; |
| | | |
| | | import java.time.LocalDateTime; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import org.springframework.lang.NonNull; |
| | | import org.springframework.beans.BeanUtils; |
| | | import io.swagger.annotations.ApiModel; |
| | | import io.swagger.annotations.ApiModelProperty; |
| | | import lombok.Data; |
| | | |
| | | /** |
| | | * 班级展示 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Data |
| | | public class ClassesVO extends AbsVo { |
| | | |
| | | /** 班级名称 */ |
| | | private String className; |
| | | |
| | | /** 创建人 */ |
| | | private Integer createUser; |
| | | |
| | | /** 创建时间 */ |
| | | private Date createTime; |
| | | |
| | | /** 班级人数 */ |
| | | private Integer classesNumber; |
| | | |
| | | /** 班级状态 */ |
| | | private String status; |
| | | |
| | | /** 验证状态 */ |
| | | private String verifyStatus; |
| | | |
| | | public static ClassesVO getVoByEntity(@NonNull Classes entity, ClassesVO vo) { |
| | | if(vo == null) { |
| | | vo = new ClassesVO(); |
| | | } |
| | | BeanUtils.copyProperties(entity, vo); |
| | | return vo; |
| | | } |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.mapper; |
| | | |
| | | import com.ycl.jxkg.domain.entity.Classes; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ycl.jxkg.domain.query.ClassesQuery; |
| | | import com.ycl.jxkg.domain.vo.ClassesVO; |
| | | import java.util.List; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | /** |
| | | * 班级 Mapper 接口 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Mapper |
| | | public interface ClassesMapper extends BaseMapper<Classes> { |
| | | |
| | | /** |
| | | * id查找班级 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | ClassesVO getById(Integer id); |
| | | |
| | | /** |
| | | * 分页 |
| | | */ |
| | | IPage getPage(IPage page, @Param("query") ClassesQuery query); |
| | | |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.service; |
| | | |
| | | import com.ycl.jxkg.domain.entity.Classes; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.ycl.jxkg.domain.form.ClassesForm; |
| | | import com.ycl.jxkg.domain.query.ClassesQuery; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 班级 服务类 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | public interface ClassesService extends IService<Classes> { |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result add(ClassesForm form); |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | Result update(ClassesForm form); |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | Result remove(List<String> ids); |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result removeById(String id); |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | Result page(ClassesQuery query); |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | Result detail(Integer id); |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | Result all(); |
| | | } |
New file |
| | |
| | | package com.ycl.jxkg.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.ycl.jxkg.domain.entity.Classes; |
| | | import com.ycl.jxkg.mapper.ClassesMapper; |
| | | import com.ycl.jxkg.service.ClassesService; |
| | | import com.ycl.jxkg.base.Result; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ycl.jxkg.domain.form.ClassesForm; |
| | | import com.ycl.jxkg.domain.vo.ClassesVO; |
| | | import com.ycl.jxkg.domain.query.ClassesQuery; |
| | | import com.ycl.jxkg.utils.PageUtil; |
| | | import org.springframework.beans.BeanUtils; |
| | | import org.springframework.stereotype.Service; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | | * 班级 服务实现类 |
| | | * |
| | | * @author xp |
| | | * @since 2024-06-03 |
| | | */ |
| | | @Service |
| | | @RequiredArgsConstructor |
| | | public class ClassesServiceImpl extends ServiceImpl<ClassesMapper, Classes> implements ClassesService { |
| | | |
| | | private final ClassesMapper classesMapper; |
| | | |
| | | /** |
| | | * 添加 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result add(ClassesForm form) { |
| | | Classes entity = ClassesForm.getEntityByForm(form, null); |
| | | baseMapper.insert(entity); |
| | | return Result.ok("添加成功"); |
| | | } |
| | | |
| | | /** |
| | | * 修改 |
| | | * @param form |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result update(ClassesForm form) { |
| | | Classes entity = baseMapper.selectById(form.getId()); |
| | | |
| | | // 为空抛IllegalArgumentException,做全局异常处理 |
| | | Assert.notNull(entity, "记录不存在"); |
| | | BeanUtils.copyProperties(form, entity); |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | | /** |
| | | * 批量删除 |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result remove(List<String> ids) { |
| | | baseMapper.deleteBatchIds(ids); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * id删除 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result removeById(String id) { |
| | | baseMapper.deleteById(id); |
| | | return Result.ok("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 分页查询 |
| | | * @param query |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result page(ClassesQuery query) { |
| | | IPage<ClassesVO> page = PageUtil.getPage(query, ClassesVO.class); |
| | | baseMapper.getPage(page, query); |
| | | return Result.ok().data(page.getRecords()).total(page.getTotal()); |
| | | } |
| | | |
| | | /** |
| | | * 根据id查找 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result detail(Integer id) { |
| | | ClassesVO vo = baseMapper.getById(id); |
| | | Assert.notNull(vo, "记录不存在"); |
| | | return Result.ok().data(vo); |
| | | } |
| | | |
| | | /** |
| | | * 列表 |
| | | * @return |
| | | */ |
| | | @Override |
| | | public Result all() { |
| | | List<Classes> entities = baseMapper.selectList(null); |
| | | List<ClassesVO> vos = entities.stream() |
| | | .map(entity -> ClassesVO.getVoByEntity(entity, null)) |
| | | .collect(Collectors.toList()); |
| | | return Result.ok().data(vos); |
| | | } |
| | | } |
New file |
| | |
| | | <?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="com.ycl.jxkg.mapper.ClassesMapper"> |
| | | |
| | | <!-- 通用查询映射结果 --> |
| | | <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.vo.ClassesVO"> |
| | | <result column="class_name" property="className" /> |
| | | <result column="create_user" property="createUser" /> |
| | | <result column="create_time" property="createTime" /> |
| | | <result column="classes_number" property="classesNumber" /> |
| | | <result column="status" property="status" /> |
| | | <result column="verify_status" property="verifyStatus" /> |
| | | </resultMap> |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | <select id="getById" resultMap="BaseResultMap"> |
| | | SELECT |
| | | TC.class_name, |
| | | TC.create_user, |
| | | TC.create_time, |
| | | TC.classes_number, |
| | | TC.status, |
| | | TC.verify_status, |
| | | TC.id |
| | | FROM |
| | | t_classes TC |
| | | WHERE |
| | | TC.id = #{id} AND TC.deleted = 0 |
| | | </select> |
| | | |
| | | |
| | | <select id="getPage" resultMap="BaseResultMap"> |
| | | SELECT |
| | | TC.class_name, |
| | | TC.create_user, |
| | | TC.create_time, |
| | | TC.classes_number, |
| | | TC.status, |
| | | TC.verify_status, |
| | | TC.id |
| | | FROM |
| | | t_classes TC |
| | | WHERE |
| | | TC.deleted = 0 |
| | | </select> |
| | | |
| | | </mapper> |