diff --git a/ant-design-vue-jeecg/src/views/py/PyBasicCourseList.vue b/ant-design-vue-jeecg/src/views/py/PyBasicCourseList.vue index 6a7dc50..34a4ca6 100644 --- a/ant-design-vue-jeecg/src/views/py/PyBasicCourseList.vue +++ b/ant-design-vue-jeecg/src/views/py/PyBasicCourseList.vue @@ -35,7 +35,7 @@
- 新增 + 设置培养方案课程
@@ -102,7 +102,6 @@ export default { title: '培养方案名称', dataIndex: 'pyBasicInfo.chartHead', align: 'center', - width: '30px', ellipsis: true, }, /*{ @@ -158,6 +157,7 @@ export default { title: '课程名称', align: 'center', dataIndex: 'seCourse.name', + ellipsis: true, }, { title: '学期', @@ -168,7 +168,6 @@ export default { { title: '课程学分', align: 'center', - width: 10, dataIndex: 'seCourse.credit', }, { diff --git a/ant-design-vue-jeecg/src/views/py/PyBasicInfoList.vue b/ant-design-vue-jeecg/src/views/py/PyBasicInfoList.vue index 5add475..3c724e4 100644 --- a/ant-design-vue-jeecg/src/views/py/PyBasicInfoList.vue +++ b/ant-design-vue-jeecg/src/views/py/PyBasicInfoList.vue @@ -96,7 +96,8 @@ - + 置顶 + 编辑 @@ -274,6 +275,11 @@ export default { align: 'center', dataIndex: 'startorstop_dicText', }, + { + title: '是否置顶', + align: 'center', + dataIndex: 'isTop', + }, /*{ title: '修学年限', align: 'center', @@ -288,8 +294,6 @@ export default { title: '操作', dataIndex: 'action', align: 'center', - fixed: 'right', - width: 147, scopedSlots: { customRender: 'action' }, }, ], @@ -300,6 +304,7 @@ export default { exportXlsUrl: '/py/pyBasicInfo/exportXls', importExcelUrl: 'py/pyBasicInfo/importExcel', getId: '/py/basicinfo/', + zhiding:'/py/basicinfo/zhiding', }, dictOptions: { collegeId: [], @@ -331,6 +336,16 @@ export default { }, }, methods: { + zhiding(record){ + getAction(this.url.zhiding,{id:record.basicId}).then((res) => { + if (res.flag) { + this.$message.success("置顶成功"); + this.loadData(); + }else{ + this.$message.error("置顶失败"); + } + }) + }, handleAdd1(){ this.$router.push({ path: '/py/PyAddProject', diff --git a/ant-design-vue-jeecg/src/views/py/modules/PyBasicCourseForm.vue b/ant-design-vue-jeecg/src/views/py/modules/PyBasicCourseForm.vue index 3188293..be66f35 100644 --- a/ant-design-vue-jeecg/src/views/py/modules/PyBasicCourseForm.vue +++ b/ant-design-vue-jeecg/src/views/py/modules/PyBasicCourseForm.vue @@ -86,7 +86,9 @@ export default { data() { return { queryParam: { - coursecategory: '0' + coursecategory: '0', + deptId: '', + majorId: '', }, dicode: "se_major,name,id", basicInfoCode: "py_basic_info,chart_head,id", @@ -105,7 +107,8 @@ export default { url: { list: "py/pyBasicCourse/queryCourse4BasicInfo", add: "py/pyBasicCourse/add", - queryBasicInfoList: "py/pyBasicCourse/queryBasicInfoList" + queryBasicInfoList: "py/pyBasicCourse/queryBasicInfoList", + dqyh: '/course/seCourse/dqyh', }, selectedRowKeys: [], selectionRows: [], @@ -187,7 +190,19 @@ export default { // this.modelDefault = JSON.parse(JSON.stringify(this.model)); // console.log("modelDefault---->", modelDefault) }, + mounted () { + this.getData() + }, methods: { + getData () { + getAction(this.url.dqyh).then((res) => { + if (res.success) { + this.queryParam.deptId = res.result.depid + this.queryParam.majorId = res.result.majorid + this.basicInfoCode = "py_basic_info,chart_head,id, major_id='" + this.queryParam.majorId + "'"; + } + }) + }, onSelectChange(selectedRowKeys, selectionRows) { this.selectedRowKeys = selectedRowKeys this.selectionRows = selectionRows diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/controller/BasicInfoController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/controller/BasicInfoController.java index acbf1ba..a1cfe21 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/controller/BasicInfoController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/controller/BasicInfoController.java @@ -10,17 +10,20 @@ import org.apache.shiro.SecurityUtils; import org.jeecg.common.aspect.annotation.AutoLog; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.base.controller.JeecgController; +import org.jeecg.common.system.query.QueryGenerator; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.course.entity.SeCourse; import org.jeecg.modules.course.service.ISeCourseService; import org.jeecg.modules.major.entity.SeMajor; import org.jeecg.modules.major.service.ISeMajorService; +import org.jeecg.modules.py.entity.PyBasicCourse; import org.jeecg.modules.py.entity.PyBasicInfo; import org.jeecg.modules.py.entity.PyGraRequire; import org.jeecg.modules.py.entity.PyTrainingObjective; import org.jeecg.modules.py.mapper.PyGraRequireMapper; import org.jeecg.modules.py.mapper.PyTrainingObjectiveMapper; import org.jeecg.modules.py.service.BasicInfoService; +import org.jeecg.modules.py.service.IPyBasicCourseService; import org.jeecg.modules.py.utils.MessageConstant; import org.jeecg.modules.py.utils.R; import org.jeecg.modules.py.utils.Result; @@ -32,7 +35,10 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.servlet.ModelAndView; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.stream.Collectors; /** @@ -60,6 +66,8 @@ public class BasicInfoController extends JeecgController(true, CommonConstant.SC_OK_200, MessageConstant.QUERY_BSAICINFO_SUCCESS, pyBasicInfo); } + /** + * 置顶 + * + * @return + */ + @AutoLog(value = "置顶") + @ApiOperation(value = "置顶", notes = "置顶") + @GetMapping("/zhiding") + public Result zhiding(@RequestParam(name="id",required=true) String id,HttpServletRequest req) { + PyBasicInfo pyBasicInfo = basicInfoService.getById(id); + PyBasicInfo pyBasicInfolist = new PyBasicInfo(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(pyBasicInfolist, req.getParameterMap()); + queryWrapper.eq("is_top","是"); + queryWrapper.eq("major_id",pyBasicInfo.getMajorId()); + List list = basicInfoService.list(queryWrapper); + if(list.size()>0){ + pyBasicInfolist = list.get(0); + pyBasicInfolist.setIsTop("否"); + basicInfoService.updateById(pyBasicInfolist); + } + if(pyBasicInfo!=null){ + pyBasicInfo.setIsTop("是"); + basicInfoService.updateById(pyBasicInfo); + } + return new Result(true,CommonConstant.SC_OK_200,"置顶成功"); + } + + @ApiOperation(value = "获取置顶课程", notes = "获取置顶课程") + @GetMapping(value = "/getTopCourse") + public org.jeecg.common.api.vo.Result getTopCourse(HttpServletRequest req) { + PyBasicInfo pyBasicInfo = new PyBasicInfo(); + QueryWrapper queryWrapper = QueryGenerator.initQueryWrapper(pyBasicInfo, req.getParameterMap()); + queryWrapper.eq("is_top","是"); + //写死为软件工程(合作办学)专业 + queryWrapper.eq("major_id","1479007021540012033"); + List list = basicInfoService.list(queryWrapper); + PyBasicCourse pyBasicCourse = new PyBasicCourse(); + QueryWrapper queryWrapper1 = QueryGenerator.initQueryWrapper(pyBasicCourse, req.getParameterMap()); + queryWrapper1.eq("basic_id",list.get(0).getBasicId()); + queryWrapper1.eq("status","0"); + List list1 = pyBasicCourseService.list(queryWrapper1); + List> listmap = new ArrayList<>(); + for (int i = 0 ; i < list1.size() ; i++){ + Map maptemp = new HashMap(); + SeCourse seCourse = seCourseService.getById(list1.get(i).getCourseId()); + maptemp.put("title",seCourse.getName()); + maptemp.put("url","http://localhost:8080/jeecg-boot/sys/common/static/"+seCourse.getImg()); + listmap.add(maptemp); + } + return org.jeecg.common.api.vo.Result.OK(listmap); + } + /** * 添加保存信息 diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/entity/PyBasicInfo.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/entity/PyBasicInfo.java index 6c0553f..36f3f24 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/entity/PyBasicInfo.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/py/entity/PyBasicInfo.java @@ -86,4 +86,7 @@ public class PyBasicInfo implements Serializable { @Dict(dictTable = "set_status", dicText = "type", dicCode = "id") private String startorstop;//启用或停用 + @ApiModelProperty(value = "是否置顶") + private String isTop; + }