新建教育培训模块
This commit is contained in:
parent
7d8017705b
commit
ae488c77d0
|
|
@ -0,0 +1,100 @@
|
||||||
|
package com.rzyc.bean.educationStudy.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.educationStudy.dto
|
||||||
|
* @Author: SYZ
|
||||||
|
* @CreateTime: 2023-03-27 10:58
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class AddEducationStudyDto {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键",required = true)
|
||||||
|
@NotBlank(message = "不能为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业id",required = true)
|
||||||
|
@NotBlank(message = "不能为空")
|
||||||
|
private String enterpriseId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "摘要")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上传人id",required = true)
|
||||||
|
@NotBlank(message = "不能为空")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习时间")
|
||||||
|
private String studyDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习单位")
|
||||||
|
private String studyUnit;
|
||||||
|
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnterpriseId() {
|
||||||
|
return enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseId(String enterpriseId) {
|
||||||
|
this.enterpriseId = enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudyDate() {
|
||||||
|
return studyDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyDate(String studyDate) {
|
||||||
|
this.studyDate = studyDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudyUnit() {
|
||||||
|
return studyUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyUnit(String studyUnit) {
|
||||||
|
this.studyUnit = studyUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,101 @@
|
||||||
|
package com.rzyc.bean.educationStudy.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
|
||||||
|
* @Author: SYZ
|
||||||
|
* @CreateTime: 2023-03-27 11:11
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
public class EducationStudyListVo {
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
@TableId("id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业id")
|
||||||
|
@TableField("enterprise_id")
|
||||||
|
private String enterpriseId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "摘要")
|
||||||
|
@TableField("title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
@TableField("content")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上传人id")
|
||||||
|
@TableField("user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习时间")
|
||||||
|
@TableField("study_date")
|
||||||
|
private String studyDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习单位")
|
||||||
|
@TableField("study_unit")
|
||||||
|
private String studyUnit;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEnterpriseId() {
|
||||||
|
return enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseId(String enterpriseId) {
|
||||||
|
this.enterpriseId = enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudyDate() {
|
||||||
|
return studyDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyDate(String studyDate) {
|
||||||
|
this.studyDate = studyDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStudyUnit() {
|
||||||
|
return studyUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyUnit(String studyUnit) {
|
||||||
|
this.studyUnit = studyUnit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.rzyc.bean.educationStudy.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@ApiModel("分页返回实体")
|
||||||
|
public class ListPageVo<T>{
|
||||||
|
@ApiModelProperty(value = "每页条数")
|
||||||
|
private Integer pageSize = 10;//每页显示多少条
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "当前页码")
|
||||||
|
private Integer page = 1;//当前页
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "总条数")
|
||||||
|
private Long total = 0L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "分页数据")
|
||||||
|
private List<T> rows = new ArrayList<T>();
|
||||||
|
|
||||||
|
public Integer getPageSize() {
|
||||||
|
return pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPageSize(Integer pageSize) {
|
||||||
|
this.pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getPage() {
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPage(Integer page) {
|
||||||
|
this.page = page;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getTotal() {
|
||||||
|
return total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTotal(Long total) {
|
||||||
|
this.total = total;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<T> getRows() {
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRows(List<T> rows) {
|
||||||
|
this.rows = rows;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
package com.rzyc.mapper;
|
||||||
|
|
||||||
|
import com.rzyc.bean.educationStudy.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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 教育培训表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author
|
||||||
|
* @since 2023-03-27
|
||||||
|
*/
|
||||||
|
@Repository
|
||||||
|
public interface EducationStudyMapper extends BaseMapper<EducationStudy> {
|
||||||
|
|
||||||
|
List<EducationStudyListVo> selectEducationStudyList(@Param("startTime") String startTime,
|
||||||
|
@Param("endTime") String endTime,
|
||||||
|
@Param("queryWord") String queryWord);
|
||||||
|
|
||||||
|
}
|
||||||
127
inventory-dao/src/main/java/com/rzyc/model/EducationStudy.java
Normal file
127
inventory-dao/src/main/java/com/rzyc/model/EducationStudy.java
Normal file
|
|
@ -0,0 +1,127 @@
|
||||||
|
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-27
|
||||||
|
*/
|
||||||
|
@TableName("education_study")
|
||||||
|
@ApiModel(value="EducationStudy对象", description="教育培训表")
|
||||||
|
public class EducationStudy implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "主键")
|
||||||
|
@TableId("id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "企业id")
|
||||||
|
@TableField("enterprise_id")
|
||||||
|
private String enterpriseId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "摘要")
|
||||||
|
@TableField("title")
|
||||||
|
private String title;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "内容")
|
||||||
|
@TableField("content")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "上传人id")
|
||||||
|
@TableField("user_id")
|
||||||
|
private String userId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习时间")
|
||||||
|
@TableField("study_date")
|
||||||
|
private Date studyDate;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "培训的学习单位")
|
||||||
|
@TableField("study_unit")
|
||||||
|
private String studyUnit;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间")
|
||||||
|
@TableField("create_time")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
public String getEnterpriseId() {
|
||||||
|
return enterpriseId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEnterpriseId(String enterpriseId) {
|
||||||
|
this.enterpriseId = enterpriseId;
|
||||||
|
}
|
||||||
|
public String getTitle() {
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTitle(String title) {
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
public String getContent() {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setContent(String content) {
|
||||||
|
this.content = content;
|
||||||
|
}
|
||||||
|
public String getUserId() {
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
public Date getStudyDate() {
|
||||||
|
return studyDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyDate(Date studyDate) {
|
||||||
|
this.studyDate = studyDate;
|
||||||
|
}
|
||||||
|
public String getStudyUnit() {
|
||||||
|
return studyUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStudyUnit(String studyUnit) {
|
||||||
|
this.studyUnit = studyUnit;
|
||||||
|
}
|
||||||
|
public Date getCreateTime() {
|
||||||
|
return createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateTime(Date createTime) {
|
||||||
|
this.createTime = createTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "EducationStudy{" +
|
||||||
|
"id=" + id +
|
||||||
|
", enterpriseId=" + enterpriseId +
|
||||||
|
", title=" + title +
|
||||||
|
", content=" + content +
|
||||||
|
", userId=" + userId +
|
||||||
|
", studyDate=" + studyDate +
|
||||||
|
", studyUnit=" + studyUnit +
|
||||||
|
", createTime=" + createTime +
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?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.EducationStudyMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- 通用查询映射结果 -->
|
||||||
|
<resultMap id="BaseResultMap" type="com.rzyc.model.EducationStudy">
|
||||||
|
<id column="id" property="id" />
|
||||||
|
<result column="enterprise_id" property="enterpriseId" />
|
||||||
|
<result column="title" property="title" />
|
||||||
|
<result column="content" property="content" />
|
||||||
|
<result column="user_id" property="userId" />
|
||||||
|
<result column="study_date" property="studyDate" />
|
||||||
|
<result column="study_unit" property="studyUnit" />
|
||||||
|
<result column="create_time" property="createTime" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<!-- 通用查询结果列 -->
|
||||||
|
<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,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}
|
||||||
|
<if test="queryWord!=null and queryWord!=''">
|
||||||
|
and title like concat('%',#{queryWord},'%')
|
||||||
|
</if>
|
||||||
|
Order By create_time DESC
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
|
|
@ -25,14 +25,14 @@ import java.util.Scanner;
|
||||||
public class CodeGenerator {
|
public class CodeGenerator {
|
||||||
|
|
||||||
//java路径
|
//java路径
|
||||||
public static String jarStr = "/citysafexc-api/src/main/java";
|
public static String jarStr = "/inventory-dao/src/main/java";
|
||||||
//mapper路径
|
//mapper路径
|
||||||
public static String mapperStr = "/citysafexc-api/src/main/resources/mapper/";
|
public static String mapperStr = "/inventory-dao/src/main/resources/mapper/";
|
||||||
//根目录报名
|
//根目录报名
|
||||||
public static String packgerParent = "com.rzyc";
|
public static String packgerParent = "com.rzyc";
|
||||||
|
|
||||||
//mysql相关信息
|
//mysql相关信息
|
||||||
public static String url = "jdbc:mysql://121.40.106.103:3306/citysafe_xc_db?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false";
|
public static String url = "jdbc:mysql://121.40.106.103:3306/inventory_db?useUnicode=true&characterEncoding=UTF-8&serverTimezone=GMT%2B8&useSSL=false";
|
||||||
public static String DriverName = "com.mysql.cj.jdbc.Driver";
|
public static String DriverName = "com.mysql.cj.jdbc.Driver";
|
||||||
public static String Username = "rzyc";
|
public static String Username = "rzyc";
|
||||||
public static String Password = "admin@rzyc2022.com##";
|
public static String Password = "admin@rzyc2022.com##";
|
||||||
|
|
|
||||||
|
|
@ -572,6 +572,10 @@ public class BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
protected RkCompanyDiagnosisMapper rkCompanyDiagnosisMapper;
|
protected RkCompanyDiagnosisMapper rkCompanyDiagnosisMapper;
|
||||||
|
|
||||||
|
//培训学习
|
||||||
|
@Autowired
|
||||||
|
protected EducationStudyMapper educationStudyMapper;
|
||||||
|
|
||||||
|
|
||||||
/*高敏感场所*/
|
/*高敏感场所*/
|
||||||
protected String HIGH_SENSITIVE_PLACES = "502b1ff4-bd01-11eb-9d3c-00163e0c1c62";
|
protected String HIGH_SENSITIVE_PLACES = "502b1ff4-bd01-11eb-9d3c-00163e0c1c62";
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.rzyc.controller;
|
||||||
|
|
||||||
|
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.task.dto.PageDto;
|
||||||
|
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.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.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @BelongsProject: inventory-api
|
||||||
|
* @BelongsPackage: com.rzyc.controller
|
||||||
|
* @Author: SYZ
|
||||||
|
* @CreateTime: 2023-03-27 10:39
|
||||||
|
* @Version: 1.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Api(tags = "教育培训接口")
|
||||||
|
@CrossOrigin("*")
|
||||||
|
@RequestMapping("education")
|
||||||
|
@Controller
|
||||||
|
@Validated
|
||||||
|
public class EducationStudyController extends BaseController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检查记录详细
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "获取列表")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "year",value = "年份",dataType = "int",paramType = "query",required = true)
|
||||||
|
})
|
||||||
|
@GetMapping("/getList")
|
||||||
|
@ResponseBody
|
||||||
|
public SingleResult<ListPageVo<EducationStudyListVo>> getList(@Valid PageDto dto, int year) 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");
|
||||||
|
PageHelper.startPage(dto.getPage(), dto.getPageSize());
|
||||||
|
Page<EducationStudyListVo> list = (Page<EducationStudyListVo>) educationStudyMapper.selectEducationStudyList(startDate, endDate, dto.getCondition());
|
||||||
|
ListPageVo<EducationStudyListVo> pageVo = new ListPageVo<>();
|
||||||
|
pageVo.setRows(list);
|
||||||
|
pageVo.setTotal(list.getTotal());
|
||||||
|
pageVo.setPage(list.getPageNum());
|
||||||
|
pageVo.setPageSize(list.getPageSize());
|
||||||
|
result.setData(pageVo);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiOperation(value = "添加")
|
||||||
|
@PostMapping("/addOne")
|
||||||
|
@ResponseBody
|
||||||
|
public SingleResult addOne(@Valid AddEducationStudyDto dto) {
|
||||||
|
SingleResult<Object> result = new SingleResult<>();
|
||||||
|
EducationStudy educationStudy = new EducationStudy();
|
||||||
|
educationStudy.setId(dto.getId());
|
||||||
|
educationStudy.setEnterpriseId(dto.getEnterpriseId());
|
||||||
|
educationStudy.setTitle(StringUtils.isBlank(dto.getTitle()) ? "" : dto.getTitle());
|
||||||
|
educationStudy.setContent(StringUtils.isBlank(dto.getContent()) ? "" : dto.getContent());
|
||||||
|
educationStudy.setUserId(StringUtils.isBlank(dto.getUserId()) ? "" : dto.getUserId());
|
||||||
|
educationStudy.setStudyDate(DateUtils.parseString2Date(dto.getStudyDate(),"yyyy-MM-dd"));
|
||||||
|
educationStudy.setStudyUnit(StringUtils.isBlank(dto.getStudyUnit()) ? "" : dto.getStudyUnit());
|
||||||
|
educationStudy.setCreateTime(new Date());
|
||||||
|
int insertRow = educationStudyMapper.insert(educationStudy);
|
||||||
|
return (0 == insertRow) ? result.setCodeMessageChain(Code.ERROR.getCode(), "失败") : result.setCodeMessageChain(Code.ERROR.getCode(), "成功");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@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(), "成功");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -476,5 +476,53 @@ public final class DateUtils {
|
||||||
return DateUtils.parseCalendar2String(calendar,"yyyy-MM-dd");
|
return DateUtils.parseCalendar2String(calendar,"yyyy-MM-dd");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定某年某月的最后一天,最后一秒最后的时间
|
||||||
|
* @Version: 1.0
|
||||||
|
* @Author: SYZ
|
||||||
|
* @Date: 2023/1/3 18:18
|
||||||
|
*/
|
||||||
|
public static Date getLastDayOfMonth(int year, int month) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
//设置年份
|
||||||
|
cal.set(Calendar.YEAR, year);
|
||||||
|
//设置月份
|
||||||
|
cal.set(Calendar.MONTH, month-1);
|
||||||
|
//获取某月最大天数
|
||||||
|
int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
||||||
|
//设置日历中月份的最大天数
|
||||||
|
cal.set(Calendar.DAY_OF_MONTH, lastDay);
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, 23);
|
||||||
|
cal.set(Calendar.MINUTE, 59);
|
||||||
|
cal.set(Calendar.SECOND, 59);
|
||||||
|
//格式化日期
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
//
|
||||||
|
// String lastDayOfMonth = sdf.format(cal.getTime());
|
||||||
|
return cal.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指定某年某月的第一天第一秒
|
||||||
|
* @Version: 1.0
|
||||||
|
* @Author: SYZ
|
||||||
|
* @Date: 2023/1/3 18:18
|
||||||
|
*/
|
||||||
|
public static Date getFirstDayOfMonth(int year, int month) {
|
||||||
|
Calendar cal = Calendar.getInstance();
|
||||||
|
//设置年份
|
||||||
|
cal.set(Calendar.YEAR, year);
|
||||||
|
//设置月份
|
||||||
|
cal.set(Calendar.MONTH, month -1);
|
||||||
|
|
||||||
|
cal.set(Calendar.DAY_OF_MONTH, 1);
|
||||||
|
cal.set(Calendar.HOUR_OF_DAY, 00);
|
||||||
|
cal.set(Calendar.MINUTE, 00);
|
||||||
|
cal.set(Calendar.SECOND, 00);
|
||||||
|
//格式化日期
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
||||||
|
// String lastDayOfMonth = sdf.format(cal.getTime());
|
||||||
|
return cal.getTime();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -30,4 +30,10 @@ public class SingleResult<T> extends Result {
|
||||||
this.data = (T) pager;
|
this.data = (T) pager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public SingleResult<T> setCodeMessageChain(int code,String msg) {
|
||||||
|
super.setCode(code);
|
||||||
|
super.setMessage(msg);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user