作者 mxy

我的彩页 增,改,查

... ... @@ -10,6 +10,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -31,7 +32,7 @@ public class CommentController {
@ApiOperation("存储评论")
@PostMapping("/saveComment")
public AjaxResult saveComment(CCommentsBo bo){
public AjaxResult saveComment(@RequestBody CCommentsBo bo){
log.info("<<<<<<接收的参数::"+bo);
... ...
... ... @@ -3,6 +3,7 @@ package com.example.client.controller;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CExperienceEducationBo;
import com.example.client.domain.bo.CExperienceJobBo;
import com.example.client.domain.bo.COtherBo;
import com.example.client.service.EducationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
... ... @@ -12,6 +13,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -33,7 +35,7 @@ public class EducationController {
@ApiOperation("存储教育/培训经历")
@PostMapping("/saveEducation")
public AjaxResult saveEducation(CExperienceEducationBo bo){
public AjaxResult saveEducation(@RequestBody CExperienceEducationBo bo){
log.info("<<<接收的参数<<<::"+bo);
... ... @@ -67,7 +69,7 @@ public class EducationController {
@ApiOperation("存储工作经历")
@PostMapping("/saveJob")
public AjaxResult saveJob(CExperienceJobBo bo){
public AjaxResult saveJob(@RequestBody CExperienceJobBo bo){
log.info("<<<接收的参数<<<::"+bo);
... ... @@ -95,4 +97,34 @@ public class EducationController {
return educationService.updateJobSecret(secret);
}
@ApiOperation("存储其他(爱好,技能...)")
@PostMapping("/saveOther")
public AjaxResult saveOther(@RequestBody COtherBo bo){
log.info("<<<接收到的参数<<<::"+bo);
return educationService.saveOther(bo);
}
@ApiImplicitParam(name = "otherId",value = "其他经历表得Id",dataType = "Long",required = true,paramType = "query")
@ApiOperation("删除其他(爱好,语言...)")
@PostMapping("/deleteOther")
public AjaxResult deleteOther(Long otherId){
log.info("<<<接收的参数<<<::"+otherId);
return educationService.deleteOther(otherId);
}
@ApiImplicitParam(name = "secret",value = "可见/不可见",dataType = "Integer",required = true,paramType = "query")
@ApiOperation("修改其他经历的可见,不可见")
@PostMapping("/updateOtherSecret")
public AjaxResult updateOtherSecret(Integer secret){
log.info("<<<接收的参数<<<::"+secret);
return educationService.updateOtherSecret(secret);
}
}
... ...
... ... @@ -14,6 +14,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
... ... @@ -41,7 +42,7 @@ public class GetLikeController {
@ApiOperation("点赞和取消点赞")
@PostMapping("/like")
public AjaxResult like(CGetLikeBo bo){
public AjaxResult like(@RequestBody CGetLikeBo bo){
log.info("<<<接收的参数<<<::"+bo);
... ... @@ -50,7 +51,7 @@ public class GetLikeController {
@ApiOperation("收藏和取消收藏")
@PostMapping("/collect")
public AjaxResult collect(CMycollectBo bo){
public AjaxResult collect(@RequestBody CMycollectBo bo){
log.info("<<<接收的参数<<<::"+bo);
... ... @@ -77,7 +78,7 @@ public class GetLikeController {
@ApiOperation("关注和取消关注")
@PostMapping("/follower")
public AjaxResult follower(CFollowerBo bo){
public AjaxResult follower(@RequestBody CFollowerBo bo){
log.info("<<<接收的参数<<<::"+bo);
... ...
... ... @@ -97,6 +97,7 @@ public class MineController {
return mineService.openMyExperience(userId);
}
// TODO: 2021/9/16
@ApiOperation("打开我的档案")
@PostMapping("/openmyarchive")
public AjaxResult openMyArchive(Long userId){
... ... @@ -106,9 +107,9 @@ public class MineController {
@ApiOperation("打开我的彩页")
@PostMapping("/openmycolor")
public AjaxResult openMyColor(Long userId){
public AjaxResult openMyColor(){
return null;
return mineService.openMyColor();
}
}
... ...
package com.example.client.controller;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CMyStudentBo;
import com.example.client.service.MyColorService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* Created with IDEA
* author: MaDongXu
* Date:2021/9/16
* Time:10:34
* */
@Slf4j
@Api(tags = "彩页,修改,新建,初始化")
@Validated
@RestController
@RequestMapping("/tree/mycolor")
public class MyColorController {
@Autowired
private MyColorService myColorService;
@ApiImplicitParam(name = "templateId",value = "模板Id",dataType = "Long",required = true,paramType = "query")
@ApiOperation("初始化我的彩页模板")
@PostMapping("/getTemplate")
public AjaxResult getTemplate(Long templateId){
log.info("<<<接收的参数<<<::"+templateId);
return myColorService.getTemplate(templateId);
}
@ApiOperation("新建我的彩页")
@PostMapping("/saveMyColor")
public AjaxResult saveMyColor(@RequestBody CMyStudentBo bo){
log.info("<<<接收的参数<<<::"+bo);
return myColorService.saveMyColor(bo);
}
@ApiImplicitParam(name = "myColorId",value = "我的彩页Id",dataType = "Long",required = true,paramType = "query")
@ApiOperation("需要修改的彩页信息")
@PostMapping("/getMyColor")
public AjaxResult getMyColor(Long myColorId){
log.info("<<<接收的参数<<<::"+myColorId);
return myColorService.getMyColor(myColorId);
}
@ApiOperation("修改彩页信息")
@PostMapping("/updateMyColor")
public AjaxResult updateMyColor(@RequestBody CMyStudentBo bo){
log.info("<<<接收的参数<<<::"+bo);
return myColorService.updateMyColor(bo);
}
}
... ...
... ... @@ -9,6 +9,7 @@ import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.Date;
/**
... ... @@ -57,12 +58,12 @@ public class CMyStudent implements Serializable {
* $column.columnComment
*/
@TableField(fill = FieldFill.INSERT)
private Date createTime;
private LocalDateTime createTime;
/**
* $column.columnComment
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
private LocalDateTime updateTime;
}
... ...
... ... @@ -13,4 +13,6 @@ Mapper接口
*/
public interface CMyStudentMapper extends BaseMapperPlus<CMyStudent> {
CMyStudent getMyColor(Long uid);
}
... ...
... ... @@ -3,6 +3,7 @@ package com.example.client.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CExperienceEducationBo;
import com.example.client.domain.bo.CExperienceJobBo;
import com.example.client.domain.bo.COtherBo;
/**
* Created with IDEA
... ... @@ -12,22 +13,68 @@ import com.example.client.domain.bo.CExperienceJobBo;
* */
public interface EducationService {
//存储教育/培训经历
/**
* 存储教育或培训经历
* @param bo
* @return
*/
AjaxResult saveEducation(CExperienceEducationBo bo);
//删除教育/培训经历
/**
* 删除教育或培训经历
* @param eductionId
* @return
*/
AjaxResult deleteEducation(Long eductionId);
//修改教育/培训经历的可见
/**
* 修改教育或培训的可见,不可见
* @param type
* @param secret
* @return
*/
AjaxResult updateSecret(Integer type, Integer secret);
//存储工作经历
/**
* 存储工作经历
* @param bo
* @return
*/
AjaxResult saveJob(CExperienceJobBo bo);
//删除工作经历
/**
* 删除工作经历
* @param jobId
* @return
*/
AjaxResult deleteJob(Long jobId);
//修改工作经历的可见/不可见
/**
* 修改工作经历的可见,不可见
* @param secret
* @return
*/
AjaxResult updateJobSecret(Integer secret);
/**
* 保存其他经历(爱好,技能,语言,头衔)
* @param bo
* @return
*/
AjaxResult saveOther(COtherBo bo);
/**
* 删除其他经历(爱好,技能,语言,头衔)
* @param otherId
* @return
*/
AjaxResult deleteOther(Long otherId);
/**
* 修改其他经历的可见.不可见
* @param secret
* @return
*/
AjaxResult updateOtherSecret(Integer secret);
}
... ...
... ... @@ -11,18 +11,44 @@ import com.example.client.domain.bo.CPersonalInformationBo;
* */
public interface MineService {
//打开我的
/**
* 打开我的
* @param userId
* @return
*/
AjaxResult openMine(Long userId);
//打开我的主页
/**
* 打开我的主页
* @param userId
* @return
*/
AjaxResult openMyHomepage(Long userId);
//打开我的个人信息
/**
* 打开我的个人信息
* @return
*/
AjaxResult openMyInfo();
//编辑个人信息
/**
* 编辑个人信息
* @param bo
* @return
*/
AjaxResult updateMyInfo(CPersonalInformationBo bo);
//打开我的履历
/**
* 打开我的履历
* @param userId
* @return
*/
AjaxResult openMyExperience(Long userId);
/**
* 打开我的彩页
* @param userId
* @return
*/
AjaxResult openMyColor();
}
... ...
package com.example.client.service;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.bo.CMyStudentBo;
/**
* Created with IDEA
* author: MaDongXu
* Date:2021/9/16
* Time:10:34
* */
public interface MyColorService {
/**
* 彩页的初始化模板
* @param templateId
* @return
*/
AjaxResult getTemplate(Long templateId);
/**
* 保存我的彩页
* @param bo
* @return
*/
AjaxResult saveMyColor(CMyStudentBo bo);
/**
* 获取需要修改的彩页信息
* @param myColorId
* @return
*/
AjaxResult getMyColor(Long myColorId);
/**
* 修改彩页的信息
* @param bo
* @return
*/
AjaxResult updateMyColor(CMyStudentBo bo);
}
... ...
... ... @@ -4,13 +4,17 @@ import cn.bronet.admin.common.core.domain.AjaxResult;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.example.client.domain.CExperienceEducation;
import com.example.client.domain.CExperienceJob;
import com.example.client.domain.COther;
import com.example.client.domain.bo.CExperienceEducationBo;
import com.example.client.domain.bo.CExperienceJobBo;
import com.example.client.domain.bo.COtherBo;
import com.example.client.domin.UserContext;
import com.example.client.mapper.CExperienceEducationMapper;
import com.example.client.mapper.CExperienceJobMapper;
import com.example.client.mapper.COtherMapper;
import com.example.client.service.EducationService;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.weaver.loadtime.Aj;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
... ... @@ -34,6 +38,9 @@ public class EducationServiceImpl implements EducationService {
@Autowired
private CExperienceJobMapper cExperienceJobMapper;
@Autowired
private COtherMapper cOtherMapper;
/**
* 存储教育/培训经历
... ... @@ -147,4 +154,53 @@ public class EducationServiceImpl implements EducationService {
return AjaxResult.success();
}
/**
* 存储其他(爱好,语言...)
* @param bo
* @return
*/
@Transactional
@Override
public AjaxResult saveOther(COtherBo bo) {
COther cOther = new COther();
BeanUtils.copyProperties(bo,cOther);
cOtherMapper.insert(cOther);
return AjaxResult.success();
}
/**
* 删除其他经历(爱好,语言...)
* @param otherId
* @return
*/
@Transactional
@Override
public AjaxResult deleteOther(Long otherId) {
cOtherMapper.deleteById(otherId);
return AjaxResult.success();
}
/**
* 修改其他经历的可见
* @param secret
* @return
*/
@Override
public AjaxResult updateOtherSecret(Integer secret) {
Long uId = UserContext.currentUserId();
COther other = cOtherMapper.getOther(uId);
other.setSecret(secret);
cOtherMapper.updateById(other);
return AjaxResult.success();
}
}
... ...
... ... @@ -50,6 +50,12 @@ public class MineServiceImpl implements MineService {
@Autowired
private COtherMapper cOtherMapper;
@Autowired
private CMyStudentMapper cMyStudentMapper;
@Autowired
private CTemplateStudentMapper cTemplateStudentMapper;
/**
* 打开我的
... ... @@ -317,7 +323,7 @@ public class MineServiceImpl implements MineService {
}
//添加教育经历
if (!education.isEmpty() && education.get(0).getSecret() == 1) {
if (!education.isEmpty() && education.get(0).getSecret() == 1 ) {
List<CExperienceEducationVo> educationVos = new ArrayList<>();
for (CExperienceEducation cExperienceEducation : education) {
... ... @@ -366,7 +372,7 @@ public class MineServiceImpl implements MineService {
//添加其他
if (other != null && other.getSecret() ==1) {
if (other != null ) {
COtherVo otherVo = new COtherVo();
BeanUtils.copyProperties(other, otherVo);
... ... @@ -449,5 +455,83 @@ public class MineServiceImpl implements MineService {
return AjaxResult.success(vo);
}
}
/**
* 打开我的彩页
* @return
*/
@Transactional
@Override
public AjaxResult openMyColor() {
Long uId = UserContext.currentUserId();
CMyStudent myColor = cMyStudentMapper.getMyColor(uId);
//判断 不是null 返回myColor
if (myColor != null){
CMyStudentVo myColorVo = new CMyStudentVo();
BeanUtils.copyProperties(myColor,myColorVo);
return AjaxResult.success(myColorVo);
}else {
//根据登录人ID查询用户表
CUser cUser = cUserMapper.selectById(uId);
//判断 登录人身份 等于2 学生
if (cUser.getIdentityType() == 2) {
//根据模板表种类 查询模板 type ==1 学生模板
LambdaQueryWrapper<CTemplateStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CTemplateStudent::getType, 1L);
List<CTemplateStudent> cTemplateStudents = cTemplateStudentMapper.selectList(wrapper);
List<CTemplateStudentVo> studentVos = new ArrayList<CTemplateStudentVo>();
//循环遍历查询到的学生模板集合
for (CTemplateStudent cTemplateStudent : cTemplateStudents) {
//把所有模板添加到返回值集合
CTemplateStudentVo studentVo = new CTemplateStudentVo();
BeanUtils.copyProperties(cTemplateStudent, studentVo);
studentVos.add(studentVo);
}
return AjaxResult.success(studentVos);
//判断 等于1 老师
}else if (cUser.getIdentityType() == 1){
//根据模板表种类 查询模板 type ==1 学生模板
LambdaQueryWrapper<CTemplateStudent> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(CTemplateStudent::getType,2L);
List<CTemplateStudent> cTemplateTeachers = cTemplateStudentMapper.selectList(wrapper);
List<CTemplateStudentVo> teacherVos = new ArrayList<CTemplateStudentVo>();
//循环遍历查询到的老师模板集合
for (CTemplateStudent cTemplateTeacher : cTemplateTeachers) {
//把所有模板添加到返回值集合
CTemplateStudentVo teacherVo = new CTemplateStudentVo();
BeanUtils.copyProperties(cTemplateTeacher, teacherVo);
teacherVos.add(teacherVo);
}
return AjaxResult.success(teacherVos);
}
}
return AjaxResult.error("错误");
}
}
... ...
package com.example.client.service.impl;
import cn.bronet.admin.common.core.domain.AjaxResult;
import com.example.client.domain.CMyStudent;
import com.example.client.domain.CTemplateStudent;
import com.example.client.domain.bo.CMyStudentBo;
import com.example.client.domain.vo.CMyStudentVo;
import com.example.client.domain.vo.CTemplateStudentVo;
import com.example.client.mapper.CMyStudentMapper;
import com.example.client.mapper.CTemplateStudentMapper;
import com.example.client.mapper.CUserMapper;
import com.example.client.service.MyColorService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.time.LocalDateTime;
/**
* Created with IDEA
* author: MaDongXu
* Date:2021/9/16
* Time:10:34
* */
@Slf4j
@Service
public class MyColorServiceImpl implements MyColorService {
@Autowired
private CMyStudentMapper cMyStudentMapper;
@Autowired
private CTemplateStudentMapper cTemplateStudentMapper;
@Autowired
private CUserMapper cUserMapper;
/**
* 我的彩页的初始化模板
* @param templateId
* @return
*/
@Override
public AjaxResult getTemplate(Long templateId) {
//根据模板Id查询模板表
CTemplateStudent cTemplate= cTemplateStudentMapper.selectById(templateId);
//创建返回值并添加数据
CTemplateStudentVo templateVo = new CTemplateStudentVo();
BeanUtils.copyProperties(cTemplate,templateVo);
return AjaxResult.success(templateVo);
}
/**
* 保存我的彩页
* @param bo
* @return
*/
@Transactional
@Override
public AjaxResult saveMyColor(CMyStudentBo bo) {
CMyStudent cMyColor= new CMyStudent();
BeanUtils.copyProperties(bo,cMyColor);
cMyColor.setCreateTime(LocalDateTime.now())
.setUpdateTime(LocalDateTime.now());
cMyStudentMapper.insert(cMyColor);
return AjaxResult.success();
}
/**
* 获取需要修改的彩页信息
* @param myColorId
* @return
*/
@Override
public AjaxResult getMyColor(Long myColorId) {
CMyStudent myColor = cMyStudentMapper.selectById(myColorId);
CMyStudentVo myColorVo = new CMyStudentVo();
BeanUtils.copyProperties(myColor,myColorVo);
return AjaxResult.success(myColorVo);
}
/**
* 修改彩页的信息
* @param bo
* @return
*/
@Override
public AjaxResult updateMyColor(CMyStudentBo bo) {
CMyStudent myColor = new CMyStudent();
BeanUtils.copyProperties(bo,myColor);
myColor.setUpdateTime(LocalDateTime.now());
cMyStudentMapper.updateById(myColor);
return AjaxResult.success();
}
}
... ...
... ... @@ -14,5 +14,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="updateTime" column="update_time"/>
</resultMap>
<select id="getMyColor" resultMap="CMyStudentResult">
SELECT * FROM c_my_student WHERE user_id =#{uid};
</select>
</mapper>
... ...