init jc
This commit is contained in:
parent
f96163582b
commit
1dabf1cf4b
@ -3,8 +3,8 @@ package xyz.playedu.api.controller.backend.jc;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.textbook.domain.BookPaper;
|
import xyz.playedu.jc.domain.BookPaper;
|
||||||
import xyz.playedu.textbook.service.IBookPaperService;
|
import xyz.playedu.jc.service.IBookPaperService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@ -3,43 +3,43 @@ package xyz.playedu.api.controller.backend.jc;
|
|||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import xyz.playedu.common.types.JsonResponse;
|
import xyz.playedu.common.types.JsonResponse;
|
||||||
import xyz.playedu.textbook.domain.Resource;
|
import xyz.playedu.jc.domain.JCResource;
|
||||||
import xyz.playedu.textbook.service.IResourceService;
|
import xyz.playedu.jc.service.JCIResourceService;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/textbook/resource")
|
@RequestMapping("/textbook/resource")
|
||||||
public class ResourceController {
|
public class JCResourceController {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IResourceService resourceService;
|
private JCIResourceService resourceService;
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
public JsonResponse list(@RequestParam(value = "bookId", required = false) Integer bookId,
|
public JsonResponse list(@RequestParam(value = "bookId", required = false) Integer bookId,
|
||||||
@RequestParam(value = "chapterId", required = false) Integer chapterId) {
|
@RequestParam(value = "chapterId", required = false) Integer chapterId) {
|
||||||
// 简单示例:直接用 lambda query 写,实际可抽到 service 中
|
// 简单示例:直接用 lambda query 写,实际可抽到 service 中
|
||||||
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<Resource> wrapper =
|
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<JCResource> wrapper =
|
||||||
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
|
new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<>();
|
||||||
if (bookId != null) {
|
if (bookId != null) {
|
||||||
wrapper.eq(Resource::getBookId, bookId);
|
wrapper.eq(JCResource::getBookId, bookId);
|
||||||
}
|
}
|
||||||
if (chapterId != null) {
|
if (chapterId != null) {
|
||||||
wrapper.eq(Resource::getChapterId, chapterId);
|
wrapper.eq(JCResource::getChapterId, chapterId);
|
||||||
}
|
}
|
||||||
List<Resource> list = resourceService.list(wrapper);
|
List<JCResource> list = resourceService.list(wrapper);
|
||||||
return JsonResponse.data(list);
|
return JsonResponse.data(list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public JsonResponse create(@RequestBody Resource resource) {
|
public JsonResponse create(@RequestBody JCResource JCResource) {
|
||||||
resourceService.save(resource);
|
resourceService.save(JCResource);
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
public JsonResponse update(@RequestBody Resource resource) {
|
public JsonResponse update(@RequestBody JCResource JCResource) {
|
||||||
resourceService.updateById(resource);
|
resourceService.updateById(JCResource);
|
||||||
return JsonResponse.success();
|
return JsonResponse.success();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -14,7 +14,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@TableName("jc_resource")
|
@TableName("jc_resource")
|
||||||
public class Resource {
|
public class JCResource {
|
||||||
|
|
||||||
@TableId(type = IdType.AUTO)
|
@TableId(type = IdType.AUTO)
|
||||||
private Integer id;
|
private Integer id;
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package xyz.playedu.jc.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import xyz.playedu.jc.domain.JCResource;
|
||||||
|
|
||||||
|
public interface JCResourceMapper extends BaseMapper<JCResource> {
|
||||||
|
}
|
||||||
@ -1,7 +0,0 @@
|
|||||||
package xyz.playedu.jc.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import xyz.playedu.jc.domain.Resource;
|
|
||||||
|
|
||||||
public interface ResourceMapper extends BaseMapper<Resource> {
|
|
||||||
}
|
|
||||||
@ -0,0 +1,7 @@
|
|||||||
|
package xyz.playedu.jc.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import xyz.playedu.jc.domain.JCResource;
|
||||||
|
|
||||||
|
public interface JCIResourceService extends IService<JCResource> {
|
||||||
|
}
|
||||||
@ -0,0 +1,13 @@
|
|||||||
|
package xyz.playedu.jc.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import xyz.playedu.jc.domain.JCResource;
|
||||||
|
import xyz.playedu.jc.mapper.JCResourceMapper;
|
||||||
|
import xyz.playedu.jc.service.JCIResourceService;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class JCResourceServiceImpl
|
||||||
|
extends ServiceImpl<JCResourceMapper, JCResource>
|
||||||
|
implements JCIResourceService {
|
||||||
|
}
|
||||||
@ -1,6 +0,0 @@
|
|||||||
package xyz.playedu.task.service;
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import xyz.playedu.textbook.domain.Resource;
|
|
||||||
|
|
||||||
public interface IResourceService extends IService<Resource> {
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package xyz.playedu.task.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import xyz.playedu.jc.domain.Resource;
|
|
||||||
import xyz.playedu.jc.mapper.ResourceMapper;
|
|
||||||
import xyz.playedu.jc.service.IResourceService;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ResourceServiceImpl
|
|
||||||
extends ServiceImpl<ResourceMapper, Resource>
|
|
||||||
implements IResourceService {
|
|
||||||
}
|
|
||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="xyz.playedu.jc.mapper.BookDepartmentUserMapper">
|
<mapper namespace="xyz.playedu.jc.mapper.BookDepartmentUserMapper">
|
||||||
|
|
||||||
<resultMap id="BookDepartmentUserResultMap" type="xyz.playedu.textbook.domain.BookDepartmentUser">
|
<resultMap id="BookDepartmentUserResultMap" type="xyz.playedu.jc.domain.BookDepartmentUser">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
<result column="book_id" property="bookId"/>
|
<result column="book_id" property="bookId"/>
|
||||||
<result column="department_id" property="departmentId"/>
|
<result column="department_id" property="departmentId"/>
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="xyz.playedu.jc.mapper.BookPaperMapper">
|
<mapper namespace="xyz.playedu.jc.mapper.BookPaperMapper">
|
||||||
|
|
||||||
<resultMap id="BookPaperResultMap" type="xyz.playedu.textbook.domain.BookPaper">
|
<resultMap id="BookPaperResultMap" type="xyz.playedu.jc.domain.BookPaper">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
<result column="book_id" property="bookId"/>
|
<result column="book_id" property="bookId"/>
|
||||||
<result column="paper_id" property="paperId"/>
|
<result column="paper_id" property="paperId"/>
|
||||||
|
|||||||
@ -2,9 +2,9 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="xyz.playedu.jc.mapper.ResourceMapper">
|
<mapper namespace="xyz.playedu.jc.mapper.JCResourceMapper">
|
||||||
|
|
||||||
<resultMap id="ResourceResultMap" type="xyz.playedu.textbook.domain.Resource">
|
<resultMap id="ResourceResultMap" type="xyz.playedu.jc.domain.JCResource">
|
||||||
<id column="id" property="id"/>
|
<id column="id" property="id"/>
|
||||||
<result column="book_id" property="bookId"/>
|
<result column="book_id" property="bookId"/>
|
||||||
<result column="chapter_id" property="chapterId"/>
|
<result column="chapter_id" property="chapterId"/>
|
||||||
Loading…
Reference in New Issue
Block a user