Commit 2738c5ad authored by 郭建文's avatar 郭建文

分年级教学目标查询

parent 4c3d0f57
package com.chineseall.teachgoal.dao;
import com.chineseall.teachgoal.model.MathHighNationOne;
import com.chineseall.teachgoal.model.*;
import org.apache.ibatis.annotations.Param;
import java.util.List;
......@@ -9,4 +9,12 @@ public interface ImportMathMapperE {
// 高中数学excel导入
void saveHighNationOne(@Param("list") List<MathHighNationOne> list, @Param("id") Long id);
MathPrimaryTeachTarget getTeachTargetByPid(@Param("pid") String pid);
List<MathPrimaryCourseTarget> getCourseTargetByCode(@Param("codes") String[] codes);
List<MathPrimaryStageTarget> getStageTargetByCode(@Param("codes") String[] codes);
List<MathPrimaryCourseContent> getCourseContentByCode(@Param("codes") String[] codes);
}
......@@ -11,6 +11,7 @@ import com.github.pagehelper.PageHelper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
@Service
......@@ -403,5 +404,32 @@ public class CourseStandardListServiceE {
// }
// return null;
// }
/**
* 将excel标题添加到在数据库课标列表里,并返回插入后的id
* @param studyStage 上传课标的学段 eg.(小学、初中、高中)
* @param subject 上传课标的科目 eg.(语文、数学...)
* @param curType 上传课标的类型 eg.(国家标准01、国标02..)
* @return 数据库中该课标的id
*/
public Long saveExcelList(String studyStage, String subject,String curType){
// 判断数据库中是否已存在该课标,存在则不允许添加
Long idOld = countByCondition(studyStage,curType,subject);
if (idOld != null){
throw new ServiceException("此课标已经入库,不允许添加");
}
CourseStandardList list = new CourseStandardList();
list.setCode(UuidGenerator.getUUID32());
list.setCurType(curType);
list.setSubject(subject);
list.setStudyStage(studyStage);
list.setIsDelete(false);
list.setGmtCreate(new Date());
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
return courseStandardListMapperE.saveAndBackId(list);
}
}
......@@ -99,6 +99,21 @@ public class ImportMathServiceE {
}
public MathPrimaryTeachTarget getTeachTargetByPid(String pid){
return mathMapperE.getTeachTargetByPid(pid);
}
public List<MathPrimaryCourseTarget> getCourseTargetByCode(String[] codes){
return mathMapperE.getCourseTargetByCode(codes);
}
public List<MathPrimaryStageTarget> getStageTargetByCode(String[] codes){
return mathMapperE.getStageTargetByCode(codes);
}
public List<MathPrimaryCourseContent> getCourseContentByCode(String[] codes){
return mathMapperE.getCourseContentByCode(codes);
}
// /**
......
......@@ -6,8 +6,6 @@ import com.chineseall.teachgoal.model.CourseStandardList;
import com.chineseall.teachgoal.model.Query.TeachGoalQuery;
import com.chineseall.teachgoal.model.VO.DictVO;
import com.chineseall.teachgoal.model.VO.ExcelTreeVO;
import com.chineseall.teachgoal.model.VO.TreeVO;
import com.chineseall.teachgoal.model.VO.TreeWithIdVO;
import com.chineseall.teachgoal.service.CourseStandardListService;
import com.chineseall.teachgoal.service.CourseStandardListServiceE;
import com.chineseall.teachgoal.service.ExcelNameServiceE;
......@@ -159,60 +157,60 @@ public class CourseStandardListController extends BaseNoLoginController {
}
@ApiOperation(value = "获取 最新插入课标的课标树结构 接口")
@RequestMapping(value = "/getTree", method = RequestMethod.GET)
@CrossOrigin
public Result getTree(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
CourseStandardList courseStandardList = courseStandardListServiceE.findLastOne();
Long id = courseStandardList.getId();
List<TreeVO> tree = null;
//courseStandardListServiceE.getTree(id);
TreeWithIdVO voId = new TreeWithIdVO();
voId.setId(id);
voId.setTree(tree);
return ResultGenerator.genSuccessResult(voId);
}
@ApiOperation(value = "通过id获取课标树结构接口")
@RequestMapping(value = "/getTreeById", method = RequestMethod.GET)
@CrossOrigin
public Result getTreeById(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam Long id){
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult))
{
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
List<TreeVO> treeVo = null;
//courseStandardListServiceE.getTree(id);
TreeWithIdVO voId = new TreeWithIdVO();
voId.setId(id);
voId.setTree(treeVo);
return ResultGenerator.genSuccessResult(voId);
}
// @ApiOperation(value = "获取 最新插入课标的课标树结构 接口")
// @RequestMapping(value = "/getTree", method = RequestMethod.GET)
// @CrossOrigin
// public Result getTree(@RequestParam(required =false) String t_clientId,
// @RequestParam(required =false) String timeStamp,
// @RequestParam(required =false) String sign,
// @RequestParam(required =false) String versionNo){
// String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
// if(!"SUCCESS".equals(validResult))
// {
// if("NOCLIENT".equals(validResult)) {
// return ResultGenerator.genNoClientIdResult("ClientId不正确");
// }
// if("SIGNFAIL".equals(validResult)) {
// return ResultGenerator.genSignFailResult("Sign不正确");
// }
// }
// CourseStandardList courseStandardList = courseStandardListServiceE.findLastOne();
// Long id = courseStandardList.getId();
//
// List<TreeVO> tree = null;
// //courseStandardListServiceE.getTree(id);
// TreeWithIdVO voId = new TreeWithIdVO();
// voId.setId(id);
// voId.setTree(tree);
//
// return ResultGenerator.genSuccessResult(voId);
// }
//
// @ApiOperation(value = "通过id获取课标树结构接口")
// @RequestMapping(value = "/getTreeById", method = RequestMethod.GET)
// @CrossOrigin
// public Result getTreeById(@RequestParam(required =false) String t_clientId,
// @RequestParam(required =false) String timeStamp,
// @RequestParam(required =false) String sign,
// @RequestParam(required =false) String versionNo,
// @RequestParam Long id){
// String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
// if(!"SUCCESS".equals(validResult))
// {
// if("NOCLIENT".equals(validResult)) {
// return ResultGenerator.genNoClientIdResult("ClientId不正确");
// }
// if("SIGNFAIL".equals(validResult)) {
// return ResultGenerator.genSignFailResult("Sign不正确");
// }
// }
// List<TreeVO> treeVo = null;
// //courseStandardListServiceE.getTree(id);
// TreeWithIdVO voId = new TreeWithIdVO();
// voId.setId(id);
// voId.setTree(treeVo);
//
// return ResultGenerator.genSuccessResult(voId);
// }
}
......@@ -3,6 +3,7 @@ package com.chineseall.teachgoal.web;
import com.chineseall.teachgoal.core.BaseNoLoginController;
import com.chineseall.teachgoal.core.Result;
import com.chineseall.teachgoal.core.ResultGenerator;
import com.chineseall.teachgoal.core.StringUtils;
import com.chineseall.teachgoal.model.DTO.UploadDTO;
import com.chineseall.teachgoal.model.MathPrimaryCourseContent;
import com.chineseall.teachgoal.model.MathPrimaryCourseTarget;
......@@ -15,6 +16,7 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**   
......@@ -66,7 +68,7 @@ public class ImportMathController extends BaseNoLoginController {
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
Long id = courseStandardListServiceE.saveExcelList(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryTeachTarget> list = mathServiceE.saveTeachTarget(dto.getList(), id);
......@@ -163,6 +165,30 @@ public class ImportMathController extends BaseNoLoginController {
}
@ApiOperation(value = "根据pid查询分年级教学目标")
@RequestMapping(value = "/getTeachTargetByPid", method = RequestMethod.GET)
@CrossOrigin
@Transactional
public Result getTeachTargetByPid(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam String pid) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
MathPrimaryTeachTarget teachTarget = mathServiceE.getTeachTargetByPid(pid);
return ResultGenerator.genSuccessResult(teachTarget);
}
@ApiOperation(value = "根据国标编码查询课程总目标")
@RequestMapping(value = "/getCourseTargetByCode", method = RequestMethod.POST)
@CrossOrigin
......@@ -171,7 +197,7 @@ public class ImportMathController extends BaseNoLoginController {
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestBody UploadDTO dto) {
@RequestParam String nationCode) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
......@@ -182,14 +208,66 @@ public class ImportMathController extends BaseNoLoginController {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
List<MathPrimaryCourseTarget> list = new ArrayList<>();
if(StringUtils.isNotEmpty(nationCode)){
String[] codes = nationCode.split(",");
list = mathServiceE.getCourseTargetByCode(codes);
}
return ResultGenerator.genSuccessResult(list);
}
// 将excel标题添加到在数据库课标列表里,并返回插入后的id
Long id = courseStandardListServiceE.saveAndBackId(dto.getStudyStage(),dto.getSubject(),dto.getCurType());
@ApiOperation(value = "根据国标编码查询课程目标(学段目标)")
@RequestMapping(value = "/getStageTargetByCode", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result getStageTargetByCode(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam String nationCode) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
List<MathPrimaryStageTarget> list = new ArrayList<>();
if(StringUtils.isNotEmpty(nationCode)){
String[] codes = nationCode.split(",");
list = mathServiceE.getStageTargetByCode(codes);
}
return ResultGenerator.genSuccessResult(list);
}
// 将excel数据导入数据库,并于课标列表的id相关联
List<MathPrimaryCourseContent> list = mathServiceE.saveCourseContent(dto.getList(), id);
mathPrimaryCourseContentService.save(list);
return ResultGenerator.genSuccessResult(id);
@ApiOperation(value = "根据国标编码查询课程内容")
@RequestMapping(value = "/getCourseContentByCode", method = RequestMethod.POST)
@CrossOrigin
@Transactional
public Result getCourseContentByCode(@RequestParam(required =false) String t_clientId,
@RequestParam(required =false) String timeStamp,
@RequestParam(required =false) String sign,
@RequestParam(required =false) String versionNo,
@RequestParam String nationCode) {
// 安全性验证
String validResult=validClientId(t_clientId,timeStamp,sign,versionNo);
if(!"SUCCESS".equals(validResult)) {
if("NOCLIENT".equals(validResult)) {
return ResultGenerator.genNoClientIdResult("ClientId不正确");
}
if("SIGNFAIL".equals(validResult)) {
return ResultGenerator.genSignFailResult("Sign不正确");
}
}
List<MathPrimaryCourseContent> list = new ArrayList<>();
if(StringUtils.isNotEmpty(nationCode)){
String[] codes = nationCode.split(",");
list = mathServiceE.getCourseContentByCode(codes);
}
return ResultGenerator.genSuccessResult(list);
}
}
......@@ -57,6 +57,63 @@
</select>
<resultMap id="TeachTargetMap" type="com.chineseall.teachgoal.model.MathPrimaryTeachTarget">
<id column="id" jdbcType="BIGINT" property="id" />
<result column="code" jdbcType="VARCHAR" property="code" />
<result column="nation_code" jdbcType="VARCHAR" property="nationCode" />
<result column="study_stage" jdbcType="VARCHAR" property="studyStage" />
<result column="course_target_code" jdbcType="VARCHAR" property="courseTargetCode" />
<result column="stage_target_code" jdbcType="VARCHAR" property="stageTargetCode" />
<result column="course_content_code" jdbcType="VARCHAR" property="courseContentCode" />
<result column="grade" jdbcType="VARCHAR" property="grade" />
<result column="element" jdbcType="VARCHAR" property="element" />
<result column="theme" jdbcType="VARCHAR" property="theme" />
<result column="level" jdbcType="VARCHAR" property="level" />
<result column="teach_target_number" jdbcType="VARCHAR" property="teachTargetNumber" />
<result column="teach_target" jdbcType="VARCHAR" property="teachTarget" />
<result column="pid" jdbcType="BIGINT" property="pid" />
<result column="is_delete" jdbcType="BIT" property="isDelete" />
<result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate" />
<result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified" />
</resultMap>
<select id="getTeachTargetByPid" resultMap="TeachTargetMap">
SELECT * FROM math_primary_teach_target
WHERE pid = #{pid}
</select>
<select id="getCourseTargetByCode" resultMap="com.chineseall.teachgoal.dao.MathPrimaryCourseTargetMapper.BaseResultMap">
select * from math_primary_course_target
wehre 1=1
<if test="codes != null">
AND nation_code in
<foreach collection="codes" open="(" item="item" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="getStageTargetByCode" resultMap="com.chineseall.teachgoal.dao.MathPrimaryStageTargetMapper.BaseResultMap">
select * from math_primary_stage_target
wehre 1=1
<if test="codes != null">
AND nation_code in
<foreach collection="codes" open="(" item="item" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
<select id="getCourseContentByCode" resultMap="com.chineseall.teachgoal.dao.MathPrimaryCourseContentMapper.BaseResultMap">
select * from math_primary_course_content
wehre 1=1
<if test="codes != null">
AND nation_code in
<foreach collection="codes" open="(" item="item" close=")" separator=",">
#{item}
</foreach>
</if>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment