新建资料模块
This commit is contained in:
parent
ae488c77d0
commit
678d50ced2
|
|
@ -0,0 +1,79 @@
|
|||
package com.rzyc.bean.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: inventory-api
|
||||
* @BelongsPackage: com.rzyc.bean.pojo.dto
|
||||
* @Author: SYZ
|
||||
* @CreateTime: 2023-03-29 19:37
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class AddEducationResourceDto {
|
||||
|
||||
@ApiModelProperty(value = "主键",required = true)
|
||||
@NotBlank(message = "主键id不能为空")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "行业id",required = true)
|
||||
@NotBlank(message = "行业id 不能为空")
|
||||
private String industryId;
|
||||
|
||||
@ApiModelProperty(value = "上传人id",required = true)
|
||||
@NotBlank(message = "上传人id 不能为空")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "资料名")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "富文本")
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIndustryId() {
|
||||
return industryId;
|
||||
}
|
||||
|
||||
public void setIndustryId(String industryId) {
|
||||
this.industryId = industryId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
package com.rzyc.bean.educationStudy.dto;
|
||||
package com.rzyc.bean.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: inventory-api
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
package com.rzyc.bean.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: inventory-api
|
||||
* @BelongsPackage: com.rzyc.bean.pojo.vo
|
||||
* @Author: SYZ
|
||||
* @CreateTime: 2023-03-29 20:07
|
||||
* @Version: 1.0
|
||||
*/
|
||||
public class EducationResourceVo {
|
||||
@ApiModelProperty(value = "主键")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "行业id")
|
||||
private String industryId;
|
||||
|
||||
@ApiModelProperty(value = "上传人id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "资料名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "富文本")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private String createTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getIndustryId() {
|
||||
return industryId;
|
||||
}
|
||||
|
||||
public void setIndustryId(String industryId) {
|
||||
this.industryId = industryId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
|
||||
public String getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(String createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1,11 +1,9 @@
|
|||
package com.rzyc.bean.educationStudy.vo;
|
||||
package com.rzyc.bean.pojo.vo;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* @BelongsProject: inventory-api
|
||||
* @BelongsPackage: com.rzyc.bean.educationStudy.vo
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package com.rzyc.bean.educationStudy.vo;
|
||||
package com.rzyc.bean.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
package com.rzyc.mapper;
|
||||
|
||||
import com.rzyc.bean.pojo.vo.EducationResourceVo;
|
||||
import com.rzyc.model.EducationResource;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-03-29
|
||||
*/
|
||||
@Repository
|
||||
public interface EducationResourceMapper extends BaseMapper<EducationResource> {
|
||||
|
||||
List<EducationResourceVo> selectEducationResourceList(@Param("queryWord") String queryWord,
|
||||
@Param("industryId") String industryId);
|
||||
|
||||
}
|
||||
|
|
@ -1,12 +1,11 @@
|
|||
package com.rzyc.mapper;
|
||||
|
||||
import com.rzyc.bean.educationStudy.vo.EducationStudyListVo;
|
||||
import com.rzyc.bean.pojo.vo.EducationStudyListVo;
|
||||
import com.rzyc.model.EducationStudy;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -22,6 +21,7 @@ public interface EducationStudyMapper extends BaseMapper<EducationStudy> {
|
|||
|
||||
List<EducationStudyListVo> selectEducationStudyList(@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime,
|
||||
@Param("enterpriseId") String enterpriseId,
|
||||
@Param("queryWord") String queryWord);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,115 @@
|
|||
package com.rzyc.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.util.Date;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author
|
||||
* @since 2023-03-29
|
||||
*/
|
||||
@TableName("education_resource")
|
||||
@ApiModel(value="EducationResource对象", description="")
|
||||
public class EducationResource implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "主键")
|
||||
@TableId("id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "行业id")
|
||||
@TableField("industry_id")
|
||||
private String industryId;
|
||||
|
||||
@ApiModelProperty(value = "上传人id")
|
||||
@TableField("user_id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "资料名")
|
||||
@TableField("name")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "富文本")
|
||||
@TableField("content")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@TableField("create_time")
|
||||
private Date createTime;
|
||||
|
||||
@ApiModelProperty(value = "最后修改时间")
|
||||
@TableField("modify_time")
|
||||
private Date modifyTime;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
public String getIndustryId() {
|
||||
return industryId;
|
||||
}
|
||||
|
||||
public void setIndustryId(String industryId) {
|
||||
this.industryId = industryId;
|
||||
}
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public void setContent(String content) {
|
||||
this.content = content;
|
||||
}
|
||||
public Date getCreateTime() {
|
||||
return createTime;
|
||||
}
|
||||
|
||||
public void setCreateTime(Date createTime) {
|
||||
this.createTime = createTime;
|
||||
}
|
||||
public Date getModifyTime() {
|
||||
return modifyTime;
|
||||
}
|
||||
|
||||
public void setModifyTime(Date modifyTime) {
|
||||
this.modifyTime = modifyTime;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "EducationResource{" +
|
||||
"id=" + id +
|
||||
", industryId=" + industryId +
|
||||
", userId=" + userId +
|
||||
", name=" + name +
|
||||
", content=" + content +
|
||||
", createTime=" + createTime +
|
||||
", modifyTime=" + modifyTime +
|
||||
"}";
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
<?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.rzyc.mapper.EducationResourceMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="BaseResultMap" type="com.rzyc.model.EducationResource">
|
||||
<id column="id" property="id"/>
|
||||
<result column="industry_id" property="industryId"/>
|
||||
<result column="user_id" property="userId"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="content" property="content"/>
|
||||
<result column="create_time" property="createTime"/>
|
||||
<result column="modify_time" property="modifyTime"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 通用查询结果列 -->
|
||||
<sql id="Base_Column_List">
|
||||
id
|
||||
, industry_id, user_id, name, content, create_time, modify_time
|
||||
</sql>
|
||||
<select id="selectEducationResourceList" resultType="com.rzyc.bean.pojo.vo.EducationResourceVo">
|
||||
SELECT id,industry_id,user_id,`name`,content,DATE_FORMAT(create_time,'%Y-%m-%d')create_time
|
||||
FROM `education_resource`
|
||||
WHERE industry_id = #{industryId}
|
||||
<if test="queryWord!=null and queryWord!=''">
|
||||
and `name` like concat('%',#{queryWord},'%')
|
||||
</if>
|
||||
Order By create_time DESC
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
@ -19,13 +19,17 @@
|
|||
<sql id="Base_Column_List">
|
||||
id, enterprise_id, title, content, user_id, study_date, study_unit, create_time
|
||||
</sql>
|
||||
<select id="selectEducationStudyList" resultType="com.rzyc.bean.educationStudy.vo.EducationStudyListVo">
|
||||
<select id="selectEducationStudyList" resultType="com.rzyc.bean.pojo.vo.EducationStudyListVo">
|
||||
SELECT id,enterprise_id,title,content,user_id,DATE_FORMAT(study_date,'%Y-%m-%d')'study_date',study_unit
|
||||
FROM `education_study`
|
||||
WHERE study_date <![CDATA[ >= ]]> #{startTime} and study_date <![CDATA[ < ]]> #{endTime}
|
||||
WHERE enterprise_id = #{enterpriseId}
|
||||
<if test="queryWord!=null and queryWord!=''">
|
||||
and title like concat('%',#{queryWord},'%')
|
||||
</if>
|
||||
<if test="startTime!=null and startTime!='' and endTime!=null and endTime!=''">
|
||||
and study_date <![CDATA[>=]]> #{startTime}
|
||||
and study_date <![CDATA[<]]> #{endTime}
|
||||
</if>
|
||||
Order By create_time DESC
|
||||
</select>
|
||||
|
||||
|
|
|
|||
|
|
@ -118,7 +118,7 @@ public class ExceptionAdvice {
|
|||
logger.info("MethodArgumentNotValidException message -> "+e.getMessage());
|
||||
SingleResult<String> result = new SingleResult<>();
|
||||
result.setCode(Code.EX_PARAM.getCode());
|
||||
result.setMessage(e.getMessage());
|
||||
result.setMessage(e.getBindingResult().getFieldError().getDefaultMessage());
|
||||
return result;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -576,6 +576,10 @@ public class BaseController {
|
|||
@Autowired
|
||||
protected EducationStudyMapper educationStudyMapper;
|
||||
|
||||
//培训资料
|
||||
@Autowired
|
||||
protected EducationResourceMapper educationResourceMapper;
|
||||
|
||||
|
||||
/*高敏感场所*/
|
||||
protected String HIGH_SENSITIVE_PLACES = "502b1ff4-bd01-11eb-9d3c-00163e0c1c62";
|
||||
|
|
|
|||
|
|
@ -1,26 +1,35 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.common.utils.DateUtils;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.model.Code;
|
||||
import com.common.utils.model.SingleResult;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.rzyc.bean.educationStudy.dto.AddEducationStudyDto;
|
||||
import com.rzyc.bean.educationStudy.vo.EducationStudyListVo;
|
||||
import com.rzyc.bean.educationStudy.vo.ListPageVo;
|
||||
import com.rzyc.bean.pojo.dto.AddEducationResourceDto;
|
||||
import com.rzyc.bean.pojo.dto.AddEducationStudyDto;
|
||||
import com.rzyc.bean.pojo.vo.EducationResourceVo;
|
||||
import com.rzyc.bean.pojo.vo.EducationStudyListVo;
|
||||
import com.rzyc.bean.pojo.vo.ListPageVo;
|
||||
import com.rzyc.bean.task.dto.PageDto;
|
||||
import com.rzyc.model.EducationResource;
|
||||
import com.rzyc.model.EducationStudy;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @BelongsProject: inventory-api
|
||||
|
|
@ -38,20 +47,29 @@ import java.util.Date;
|
|||
public class EducationStudyController extends BaseController {
|
||||
|
||||
/**
|
||||
* 检查记录详细
|
||||
*/
|
||||
@ApiOperation(value = "获取列表")
|
||||
* @description:获取培训学习列表
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:09
|
||||
* @param: [dto, year, enterpriseId]
|
||||
* @return: com.common.utils.model.SingleResult<com.rzyc.bean.pojo.vo.ListPageVo<com.rzyc.bean.pojo.vo.EducationStudyListVo>>
|
||||
**/
|
||||
@ApiOperation(value = "获取培训学习列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "year",value = "年份",dataType = "int",paramType = "query",required = true)
|
||||
@ApiImplicitParam(name = "year", value = "年份", dataType = "int", paramType = "query"),
|
||||
@ApiImplicitParam(name = "enterpriseId", value = "企业id", dataType = "string", paramType = "query", required = true)
|
||||
})
|
||||
@GetMapping("/getList")
|
||||
@ResponseBody
|
||||
public SingleResult<ListPageVo<EducationStudyListVo>> getList(@Valid PageDto dto, int year) throws Exception{
|
||||
public SingleResult<ListPageVo<EducationStudyListVo>> getList(@Valid PageDto dto, Integer year, String enterpriseId) throws Exception {
|
||||
SingleResult<ListPageVo<EducationStudyListVo>> result = new SingleResult<>();
|
||||
String startDate = DateUtils.parseDate2String(DateUtils.getFirstDayOfMonth(year,1), "yyyy-MM-dd HH:mm:ss");
|
||||
String endDate = DateUtils.parseDate2String(DateUtils.getLastDayOfMonth(year,12), "yyyy-MM-dd HH:mm:ss");
|
||||
String startDate = "";
|
||||
String endDate = "";
|
||||
if (null != year) {
|
||||
startDate = DateUtils.parseDate2String(DateUtils.getFirstDayOfMonth(year, 1), "yyyy-MM-dd HH:mm:ss");
|
||||
endDate = DateUtils.parseDate2String(DateUtils.getLastDayOfMonth(year, 12), "yyyy-MM-dd HH:mm:ss");
|
||||
}
|
||||
PageHelper.startPage(dto.getPage(), dto.getPageSize());
|
||||
Page<EducationStudyListVo> list = (Page<EducationStudyListVo>) educationStudyMapper.selectEducationStudyList(startDate, endDate, dto.getCondition());
|
||||
Page<EducationStudyListVo> list = (Page<EducationStudyListVo>) educationStudyMapper.selectEducationStudyList(startDate, endDate, enterpriseId, dto.getCondition());
|
||||
ListPageVo<EducationStudyListVo> pageVo = new ListPageVo<>();
|
||||
pageVo.setRows(list);
|
||||
pageVo.setTotal(list.getTotal());
|
||||
|
|
@ -61,11 +79,21 @@ public class EducationStudyController extends BaseController {
|
|||
return result;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "添加")
|
||||
/**
|
||||
* @description:添加培训学习
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:09
|
||||
* @param: [dto]
|
||||
* @return: com.common.utils.model.SingleResult
|
||||
**/
|
||||
@ApiOperation(value = "添加培训学习")
|
||||
@PostMapping("/addOne")
|
||||
@ResponseBody
|
||||
public SingleResult addOne(@Valid AddEducationStudyDto dto) {
|
||||
SingleResult<Object> result = new SingleResult<>();
|
||||
Integer count = educationStudyMapper.selectCount(
|
||||
new QueryWrapper<EducationStudy>().select("1").eq("id", dto.getId())
|
||||
);
|
||||
EducationStudy educationStudy = new EducationStudy();
|
||||
educationStudy.setId(dto.getId());
|
||||
educationStudy.setEnterpriseId(dto.getEnterpriseId());
|
||||
|
|
@ -75,20 +103,35 @@ public class EducationStudyController extends BaseController {
|
|||
educationStudy.setStudyDate(DateUtils.parseString2Date(dto.getStudyDate(), "yyyy-MM-dd"));
|
||||
educationStudy.setStudyUnit(StringUtils.isBlank(dto.getStudyUnit()) ? "" : dto.getStudyUnit());
|
||||
educationStudy.setCreateTime(new Date());
|
||||
if (0 == count){
|
||||
int insertRow = educationStudyMapper.insert(educationStudy);
|
||||
return (0 == insertRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.ERROR.getCode(), "成功");
|
||||
|
||||
return (0 == insertRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "成功");
|
||||
}else{
|
||||
int updateRow = educationStudyMapper.updateById(educationStudy);
|
||||
return (0 == updateRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "成功");
|
||||
}
|
||||
}
|
||||
|
||||
@ApiOperation(value = "删除")
|
||||
/**
|
||||
* @description:删除培训学习
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:09
|
||||
* @param: [id]
|
||||
* @return: com.common.utils.model.SingleResult
|
||||
**/
|
||||
@ApiOperation(value = "删除培训学习")
|
||||
@GetMapping("/delOne")
|
||||
@ApiImplicitParam(name = "id", value = "主键id", dataType = "string", paramType = "query", required = true)
|
||||
@ResponseBody
|
||||
public SingleResult delOne(@NotBlank(message = "id不能为空") String id) {
|
||||
SingleResult<Object> result = new SingleResult<>();
|
||||
int delRow = educationStudyMapper.deleteById(id);
|
||||
return (0 == delRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.ERROR.getCode(), "成功");
|
||||
return (0 == delRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,6 +48,14 @@ import java.util.*;
|
|||
*/
|
||||
public class BaseController {
|
||||
|
||||
//培训学习
|
||||
@Autowired
|
||||
protected EducationStudyMapper educationStudyMapper;
|
||||
|
||||
//培训资料
|
||||
@Autowired
|
||||
protected EducationResourceMapper educationResourceMapper;
|
||||
|
||||
/*用户*/
|
||||
@Autowired
|
||||
protected SysUserMapper sysUserMapper;
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
package com.rzyc.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.common.utils.DateUtils;
|
||||
import com.common.utils.RandomNumber;
|
||||
import com.common.utils.StringUtils;
|
||||
import com.common.utils.model.*;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.rzyc.bean.pojo.dto.AddEducationResourceDto;
|
||||
import com.rzyc.bean.pojo.vo.EducationResourceVo;
|
||||
import com.rzyc.bean.pojo.vo.ListPageVo;
|
||||
import com.rzyc.bean.task.dto.PageDto;
|
||||
import com.rzyc.enums.PostListType;
|
||||
import com.rzyc.model.EducationResource;
|
||||
import com.rzyc.model.InPost;
|
||||
import com.rzyc.model.InPostItem;
|
||||
import com.rzyc.model.InPostList;
|
||||
|
|
@ -18,6 +24,8 @@ import com.rzyc.model.ent.InListItem;
|
|||
import com.rzyc.service.PcBusinessService;
|
||||
import com.rzyc.service.SaveIndustryPostThread;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
|
@ -25,6 +33,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import javax.validation.Valid;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.InputStream;
|
||||
|
|
@ -367,7 +376,79 @@ public class IndustryListController extends BaseController{
|
|||
|
||||
|
||||
|
||||
/**
|
||||
* @description:获取培训资料列表
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:18
|
||||
* @param: [dto]
|
||||
* @return: com.common.utils.model.SingleResult<com.rzyc.bean.pojo.vo.ListPageVo<com.rzyc.bean.pojo.vo.EducationResourceVo>>
|
||||
**/
|
||||
@ApiOperation(value = "获取培训资料列表")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "industryId",value = "行业id",dataType = "string",paramType = "query",required = true)
|
||||
})
|
||||
@GetMapping("/getEducationResourceList")
|
||||
@ResponseBody
|
||||
public SingleResult<ListPageVo<EducationResourceVo>> getEducationResourceList(@Valid PageDto dto,String industryId){
|
||||
SingleResult<ListPageVo<EducationResourceVo>> result = new SingleResult<>();
|
||||
PageHelper.startPage(dto.getPage(), dto.getPageSize());
|
||||
Page<EducationResourceVo> page = (Page<EducationResourceVo>) educationResourceMapper.selectEducationResourceList(dto.getCondition(),industryId);
|
||||
ListPageVo<EducationResourceVo> pageVo = new ListPageVo<>();
|
||||
pageVo.setRows(page);
|
||||
pageVo.setTotal(page.getTotal());
|
||||
pageVo.setPage(page.getPageNum());
|
||||
pageVo.setPageSize(page.getPageSize());
|
||||
result.setData(pageVo);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:添加培训资料
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:07
|
||||
* @param: [dto]
|
||||
* @return: com.common.utils.model.SingleResult
|
||||
**/
|
||||
@ApiOperation(value = "添加培训资料")
|
||||
@PostMapping("/addEducationResourceOne")
|
||||
@ResponseBody
|
||||
public SingleResult addEducationResourceOne(@RequestBody @Valid AddEducationResourceDto dto){
|
||||
SingleResult<Object> result = new SingleResult<>();
|
||||
Integer count = educationResourceMapper.selectCount(
|
||||
new QueryWrapper<EducationResource>().select("1").eq("id", dto.getId())
|
||||
);
|
||||
EducationResource educationResource = new EducationResource();
|
||||
BeanUtils.copyProperties(dto,educationResource);
|
||||
educationResource.setName(StringUtils.isBlank(dto.getName()) ? "" : dto.getName());
|
||||
educationResource.setContent(StringUtils.isBlank(dto.getContent()) ? "" : dto.getContent());
|
||||
if (0 == count){
|
||||
educationResource.setCreateTime(new Date());
|
||||
educationResource.setModifyTime(new Date());
|
||||
int insertRow = educationResourceMapper.insert(educationResource);
|
||||
return 0 == insertRow ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "成功");
|
||||
}else {
|
||||
educationResource.setModifyTime(new Date());
|
||||
int updateRow = educationResourceMapper.updateById(educationResource);
|
||||
return 0 == updateRow ? result.setCodeMessageChain(Code.ERROR.getCode(), "修改失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "修改成功");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @description:删除培训资料
|
||||
* @author: SYZ
|
||||
* @date: 2023/3/29 20:06
|
||||
* @param: [id]
|
||||
* @return: com.common.utils.model.SingleResult
|
||||
**/
|
||||
@ApiOperation(value = "删除培训资料")
|
||||
@GetMapping("/delEducationResourceOne")
|
||||
@ApiImplicitParam(name = "id", value = "主键id", dataType = "string", paramType = "query", required = true)
|
||||
@ResponseBody
|
||||
public SingleResult delEducationResourceOne(@NotBlank(message = "id不能为空") String id){
|
||||
SingleResult<Object> result = new SingleResult<>();
|
||||
int delRow = educationResourceMapper.deleteById(id);
|
||||
return (0 == delRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.SUCCESS.getCode(), "成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user