添加培训

This commit is contained in:
zhangyanan 2025-10-17 20:24:51 +08:00
parent 5d05277e3c
commit a2cdaf630f
17 changed files with 1309 additions and 1 deletions

View File

@ -75,7 +75,9 @@ public interface SpringSecurityConstant {
"/scrHideData/list",
"/scrMeterData/list",
"/scrRiskData/list",
"/scrWorkTask/list"
"/scrWorkTask/list",
"/scrTrainData/list",
"/scrTrainSche/list"
};

View File

@ -0,0 +1,141 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.controller;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.scrtraindata.param.ScrTrainDataParam;
import vip.xiaonuo.modular.scrtraindata.service.ScrTrainDataService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
/**
* 培训控制器
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@RestController
public class ScrTrainDataController {
@Resource
private ScrTrainDataService scrTrainDataService;
/**
* 查询培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/page")
@BusinessLog(title = "培训_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.page(scrTrainDataParam));
}
/**
* 添加培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/add")
@BusinessLog(title = "培训_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrTrainDataParam.add.class) ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.add(scrTrainDataParam);
return new SuccessResponseData();
}
/**
* 删除培训可批量删除
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/delete")
@BusinessLog(title = "培训_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrTrainDataParam.delete.class) List<ScrTrainDataParam> scrTrainDataParamList) {
scrTrainDataService.delete(scrTrainDataParamList);
return new SuccessResponseData();
}
/**
* 编辑培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@PostMapping("/scrTrainData/edit")
@BusinessLog(title = "培训_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrTrainDataParam.edit.class) ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.edit(scrTrainDataParam);
return new SuccessResponseData();
}
/**
* 查看培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/detail")
@BusinessLog(title = "培训_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrTrainDataParam.detail.class) ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.detail(scrTrainDataParam));
}
/**
* 培训列表
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/list")
@BusinessLog(title = "培训_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrTrainDataParam scrTrainDataParam) {
return new SuccessResponseData(scrTrainDataService.list(scrTrainDataParam));
}
/**
* 导出系统用户
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@GetMapping("/scrTrainData/export")
@BusinessLog(title = "培训_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrTrainDataParam scrTrainDataParam) {
scrTrainDataService.export(scrTrainDataParam);
}
}

View File

@ -0,0 +1,81 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.entity;
import com.baomidou.mybatisplus.annotation.*;
import vip.xiaonuo.core.pojo.base.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.*;
import cn.afterturn.easypoi.excel.annotation.Excel;
/**
* 培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("scr_train_data")
public class ScrTrainData extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 培训类型
*/
@Excel(name = "培训类型")
private String type;
/**
* 数量
*/
@Excel(name = "数量")
private Integer num;
/**
* 内部还是外部
*/
@Excel(name = "内部还是外部")
private Integer nborwb;
/**
* 日期
*/
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 部门
*/
@Excel(name = "部门")
private String workPlace;
}

View File

@ -0,0 +1,64 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.enums;
import vip.xiaonuo.core.annotion.ExpEnumType;
import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum;
import vip.xiaonuo.core.factory.ExpEnumCodeFactory;
import vip.xiaonuo.sys.core.consts.SysExpEnumConstant;
/**
* 培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
public enum ScrTrainDataExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
private final Integer code;
private final String message;
ScrTrainDataExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
@Override
public Integer getCode() {
return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
}
@Override
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,37 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vip.xiaonuo.modular.scrtraindata.entity.ScrTrainData;
/**
* 培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
public interface ScrTrainDataMapper extends BaseMapper<ScrTrainData> {
}

View File

@ -0,0 +1,5 @@
<?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="vip.xiaonuo.modular.scrtraindata.mapper.ScrTrainDataMapper">
</mapper>

View File

@ -0,0 +1,80 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.param;
import vip.xiaonuo.core.pojo.base.param.BaseParam;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import java.util.*;
/**
* 培训参数类
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@Data
public class ScrTrainDataParam extends BaseParam {
/**
* 主键
*/
@NotNull(message = "主键不能为空请检查id参数", groups = {edit.class, delete.class, detail.class})
private Long id;
/**
* 培训类型
*/
@NotBlank(message = "培训类型不能为空请检查type参数", groups = {add.class, edit.class})
private String type;
/**
* 数量
*/
@NotNull(message = "数量不能为空请检查num参数", groups = {add.class, edit.class})
private Integer num;
/**
* 内部还是外部
*/
@NotNull(message = "内部还是外部不能为空请检查nborwb参数", groups = {add.class, edit.class})
private Integer nborwb;
/**
* 日期
*/
@NotNull(message = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 部门
*/
@NotBlank(message = "部门不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
private Integer year;
private Integer month;
}

View File

@ -0,0 +1,97 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.scrtraindata.entity.ScrTrainData;
import vip.xiaonuo.modular.scrtraindata.param.ScrTrainDataParam;
import java.util.List;
/**
* 培训service接口
*
* @author 1
* @date 2025-10-17 19:55:20
*/
public interface ScrTrainDataService extends IService<ScrTrainData> {
/**
* 查询培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
PageResult<ScrTrainData> page(ScrTrainDataParam scrTrainDataParam);
/**
* 培训列表
*
* @author 1
* @date 2025-10-17 19:55:20
*/
List<ScrTrainData> list(ScrTrainDataParam scrTrainDataParam);
/**
* 添加培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void add(ScrTrainDataParam scrTrainDataParam);
/**
* 删除培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void delete(List<ScrTrainDataParam> scrTrainDataParamList);
/**
* 编辑培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void edit(ScrTrainDataParam scrTrainDataParam);
/**
* 查看培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
ScrTrainData detail(ScrTrainDataParam scrTrainDataParam);
/**
* 导出培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
void export(ScrTrainDataParam scrTrainDataParam);
}

View File

@ -0,0 +1,155 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtraindata.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vip.xiaonuo.core.consts.CommonConstant;
import vip.xiaonuo.core.enums.CommonStatusEnum;
import vip.xiaonuo.core.exception.ServiceException;
import vip.xiaonuo.core.factory.PageFactory;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.core.util.PoiUtil;
import vip.xiaonuo.modular.scrhidedata.entity.ScrHideData;
import vip.xiaonuo.modular.scrtraindata.entity.ScrTrainData;
import vip.xiaonuo.modular.scrtraindata.enums.ScrTrainDataExceptionEnum;
import vip.xiaonuo.modular.scrtraindata.mapper.ScrTrainDataMapper;
import vip.xiaonuo.modular.scrtraindata.param.ScrTrainDataParam;
import vip.xiaonuo.modular.scrtraindata.service.ScrTrainDataService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
* 培训service接口实现类
*
* @author 1
* @date 2025-10-17 19:55:20
*/
@Service
public class ScrTrainDataServiceImpl extends ServiceImpl<ScrTrainDataMapper, ScrTrainData> implements ScrTrainDataService {
@Override
public PageResult<ScrTrainData> page(ScrTrainDataParam scrTrainDataParam) {
QueryWrapper<ScrTrainData> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainDataParam)) {
// 根据培训类型 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getType())) {
queryWrapper.lambda().like(ScrTrainData::getType, scrTrainDataParam.getType());
}
// 根据数量 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getNum())) {
queryWrapper.lambda().eq(ScrTrainData::getNum, scrTrainDataParam.getNum());
}
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrTrainDataParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
// 根据部门 查询
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getWorkPlace())) {
queryWrapper.lambda().like(ScrTrainData::getWorkPlace, scrTrainDataParam.getWorkPlace());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
}
@Override
public List<ScrTrainData> list(ScrTrainDataParam scrTrainDataParam) {
QueryWrapper<ScrTrainData> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainDataParam)) {
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getType())) {
queryWrapper.lambda().eq(ScrTrainData::getType, scrTrainDataParam.getType());
}
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getWorkPlace())) {
queryWrapper.lambda().eq(ScrTrainData::getWorkPlace, scrTrainDataParam.getWorkPlace());
}
if (ObjectUtil.isNotEmpty(scrTrainDataParam.getYear()) && ObjectUtil.isNotEmpty(scrTrainDataParam.getMonth())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainDataParam.getYear());
queryWrapper.apply("Month(happen_time) = {0}", scrTrainDataParam.getMonth());
} else if (ObjectUtil.isNotEmpty(scrTrainDataParam.getYear())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainDataParam.getYear());
}
}
return this.list(queryWrapper);
}
@Override
public void add(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = new ScrTrainData();
BeanUtil.copyProperties(scrTrainDataParam, scrTrainData);
this.save(scrTrainData);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<ScrTrainDataParam> scrTrainDataParamList) {
scrTrainDataParamList.forEach(scrTrainDataParam -> {
this.removeById(scrTrainDataParam.getId());
});
}
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = this.queryScrTrainData(scrTrainDataParam);
BeanUtil.copyProperties(scrTrainDataParam, scrTrainData);
this.updateById(scrTrainData);
}
@Override
public ScrTrainData detail(ScrTrainDataParam scrTrainDataParam) {
return this.queryScrTrainData(scrTrainDataParam);
}
/**
* 获取培训
*
* @author 1
* @date 2025-10-17 19:55:20
*/
private ScrTrainData queryScrTrainData(ScrTrainDataParam scrTrainDataParam) {
ScrTrainData scrTrainData = this.getById(scrTrainDataParam.getId());
if (ObjectUtil.isNull(scrTrainData)) {
throw new ServiceException(ScrTrainDataExceptionEnum.NOT_EXIST);
}
return scrTrainData;
}
@Override
public void export(ScrTrainDataParam scrTrainDataParam) {
List<ScrTrainData> list = this.list(scrTrainDataParam);
PoiUtil.exportExcelWithStream("SnowyScrTrainData.xls", ScrTrainData.class, list);
}
}

View File

@ -0,0 +1,141 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.controller;
import vip.xiaonuo.core.annotion.BusinessLog;
import vip.xiaonuo.core.annotion.Permission;
import vip.xiaonuo.core.enums.LogAnnotionOpTypeEnum;
import vip.xiaonuo.core.pojo.response.ResponseData;
import vip.xiaonuo.core.pojo.response.SuccessResponseData;
import vip.xiaonuo.modular.scrtrainsche.param.ScrTrainScheParam;
import vip.xiaonuo.modular.scrtrainsche.service.ScrTrainScheService;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import javax.annotation.Resource;
import java.util.List;
/**
* 培训安排控制器
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@RestController
public class ScrTrainScheController {
@Resource
private ScrTrainScheService scrTrainScheService;
/**
* 查询培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/page")
@BusinessLog(title = "培训安排_查询", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData page(ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.page(scrTrainScheParam));
}
/**
* 添加培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/add")
@BusinessLog(title = "培训安排_增加", opType = LogAnnotionOpTypeEnum.ADD)
public ResponseData add(@RequestBody @Validated(ScrTrainScheParam.add.class) ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.add(scrTrainScheParam);
return new SuccessResponseData();
}
/**
* 删除培训安排可批量删除
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/delete")
@BusinessLog(title = "培训安排_删除", opType = LogAnnotionOpTypeEnum.DELETE)
public ResponseData delete(@RequestBody @Validated(ScrTrainScheParam.delete.class) List<ScrTrainScheParam> scrTrainScheParamList) {
scrTrainScheService.delete(scrTrainScheParamList);
return new SuccessResponseData();
}
/**
* 编辑培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@PostMapping("/scrTrainSche/edit")
@BusinessLog(title = "培训安排_编辑", opType = LogAnnotionOpTypeEnum.EDIT)
public ResponseData edit(@RequestBody @Validated(ScrTrainScheParam.edit.class) ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.edit(scrTrainScheParam);
return new SuccessResponseData();
}
/**
* 查看培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/detail")
@BusinessLog(title = "培训安排_查看", opType = LogAnnotionOpTypeEnum.DETAIL)
public ResponseData detail(@Validated(ScrTrainScheParam.detail.class) ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.detail(scrTrainScheParam));
}
/**
* 培训安排列表
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/list")
@BusinessLog(title = "培训安排_列表", opType = LogAnnotionOpTypeEnum.QUERY)
public ResponseData list(ScrTrainScheParam scrTrainScheParam) {
return new SuccessResponseData(scrTrainScheService.list(scrTrainScheParam));
}
/**
* 导出系统用户
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@GetMapping("/scrTrainSche/export")
@BusinessLog(title = "培训安排_导出", opType = LogAnnotionOpTypeEnum.EXPORT)
public void export(ScrTrainScheParam scrTrainScheParam) {
scrTrainScheService.export(scrTrainScheParam);
}
}

View File

@ -0,0 +1,81 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.entity;
import com.baomidou.mybatisplus.annotation.*;
import vip.xiaonuo.core.pojo.base.entity.BaseEntity;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.*;
import cn.afterturn.easypoi.excel.annotation.Excel;
/**
* 培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName("scr_train_sche")
public class ScrTrainSche extends BaseEntity {
/**
* 主键
*/
@TableId(type = IdType.ASSIGN_ID)
private Long id;
/**
* 培训计划
*/
@Excel(name = "培训计划")
private String name;
/**
* 线上培训
*/
@Excel(name = "线上培训")
private String uppx;
/**
* 线下培训
*/
@Excel(name = "线下培训")
private String downpx;
/**
* 日期
*/
@Excel(name = "日期", databaseFormat = "yyyy-MM-dd HH:mm:ss", format = "yyyy-MM-dd", width = 20)
private Date happenTime;
/**
* 在线考试
*/
@Excel(name = "在线考试")
private String workPlace;
}

View File

@ -0,0 +1,64 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.enums;
import vip.xiaonuo.core.annotion.ExpEnumType;
import vip.xiaonuo.core.exception.enums.abs.AbstractBaseExceptionEnum;
import vip.xiaonuo.core.factory.ExpEnumCodeFactory;
import vip.xiaonuo.sys.core.consts.SysExpEnumConstant;
/**
* 培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@ExpEnumType(module = SysExpEnumConstant.SNOWY_SYS_MODULE_EXP_CODE)
public enum ScrTrainScheExceptionEnum implements AbstractBaseExceptionEnum {
/**
* 数据不存在
*/
NOT_EXIST(1, "此数据不存在");
private final Integer code;
private final String message;
ScrTrainScheExceptionEnum(Integer code, String message) {
this.code = code;
this.message = message;
}
@Override
public Integer getCode() {
return ExpEnumCodeFactory.getExpEnumCode(this.getClass(), code);
}
@Override
public String getMessage() {
return message;
}
}

View File

@ -0,0 +1,37 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import vip.xiaonuo.modular.scrtrainsche.entity.ScrTrainSche;
/**
* 培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
public interface ScrTrainScheMapper extends BaseMapper<ScrTrainSche> {
}

View File

@ -0,0 +1,5 @@
<?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="vip.xiaonuo.modular.scrtrainsche.mapper.ScrTrainScheMapper">
</mapper>

View File

@ -0,0 +1,80 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.param;
import vip.xiaonuo.core.pojo.base.param.BaseParam;
import lombok.Data;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.NotBlank;
import java.util.*;
/**
* 培训安排参数类
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@Data
public class ScrTrainScheParam extends BaseParam {
/**
* 主键
*/
@NotNull(message = "主键不能为空请检查id参数", groups = {edit.class, delete.class, detail.class})
private Long id;
/**
* 培训计划
*/
@NotBlank(message = "培训计划不能为空请检查name参数", groups = {add.class, edit.class})
private String name;
/**
* 线上培训
*/
@NotBlank(message = "线上培训不能为空请检查uppx参数", groups = {add.class, edit.class})
private String uppx;
/**
* 线下培训
*/
@NotBlank(message = "线下培训不能为空请检查downpx参数", groups = {add.class, edit.class})
private String downpx;
/**
* 日期
*/
@NotNull(message = "日期不能为空请检查happenTime参数", groups = {add.class, edit.class})
private String happenTime;
/**
* 在线考试
*/
@NotBlank(message = "在线考试不能为空请检查workPlace参数", groups = {add.class, edit.class})
private String workPlace;
private Integer year;
private Integer month;
}

View File

@ -0,0 +1,97 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.service;
import com.baomidou.mybatisplus.extension.service.IService;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.modular.scrtrainsche.entity.ScrTrainSche;
import vip.xiaonuo.modular.scrtrainsche.param.ScrTrainScheParam;
import java.util.List;
/**
* 培训安排service接口
*
* @author 1
* @date 2025-10-17 20:13:05
*/
public interface ScrTrainScheService extends IService<ScrTrainSche> {
/**
* 查询培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
PageResult<ScrTrainSche> page(ScrTrainScheParam scrTrainScheParam);
/**
* 培训安排列表
*
* @author 1
* @date 2025-10-17 20:13:05
*/
List<ScrTrainSche> list(ScrTrainScheParam scrTrainScheParam);
/**
* 添加培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void add(ScrTrainScheParam scrTrainScheParam);
/**
* 删除培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void delete(List<ScrTrainScheParam> scrTrainScheParamList);
/**
* 编辑培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void edit(ScrTrainScheParam scrTrainScheParam);
/**
* 查看培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
ScrTrainSche detail(ScrTrainScheParam scrTrainScheParam);
/**
* 导出培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
void export(ScrTrainScheParam scrTrainScheParam);
}

View File

@ -0,0 +1,141 @@
/*
Copyright [2020] [https://www.xiaonuo.vip]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Snowy采用APACHE LICENSE 2.0开源协议您在使用过程中需要注意以下几点
1.请不要删除和修改根目录下的LICENSE文件
2.请不要删除和修改Snowy源码头部的版权声明
3.请保留源码和相关描述文件的项目出处作者声明等
4.分发源码时候请注明软件出处 https://gitee.com/xiaonuobase/snowy
5.在修改包名模块名称项目代码等时请注明软件出处 https://gitee.com/xiaonuobase/snowy
6.若您的项目无法满足以上几点可申请商业授权获取Snowy商业授权许可请在官网购买授权地址为 https://www.xiaonuo.vip
*/
package vip.xiaonuo.modular.scrtrainsche.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import vip.xiaonuo.core.consts.CommonConstant;
import vip.xiaonuo.core.enums.CommonStatusEnum;
import vip.xiaonuo.core.exception.ServiceException;
import vip.xiaonuo.core.factory.PageFactory;
import vip.xiaonuo.core.pojo.page.PageResult;
import vip.xiaonuo.core.util.PoiUtil;
import vip.xiaonuo.modular.scrhidedata.entity.ScrHideData;
import vip.xiaonuo.modular.scrtrainsche.entity.ScrTrainSche;
import vip.xiaonuo.modular.scrtrainsche.enums.ScrTrainScheExceptionEnum;
import vip.xiaonuo.modular.scrtrainsche.mapper.ScrTrainScheMapper;
import vip.xiaonuo.modular.scrtrainsche.param.ScrTrainScheParam;
import vip.xiaonuo.modular.scrtrainsche.service.ScrTrainScheService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.time.LocalDate;
import java.util.List;
/**
* 培训安排service接口实现类
*
* @author 1
* @date 2025-10-17 20:13:05
*/
@Service
public class ScrTrainScheServiceImpl extends ServiceImpl<ScrTrainScheMapper, ScrTrainSche> implements ScrTrainScheService {
@Override
public PageResult<ScrTrainSche> page(ScrTrainScheParam scrTrainScheParam) {
QueryWrapper<ScrTrainSche> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainScheParam)) {
// 根据培训计划 查询
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getName())) {
queryWrapper.lambda().like(ScrTrainSche::getName, scrTrainScheParam.getName());
}
// 根据日期 查询
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getHappenTime())) {
LocalDate happenTime = LocalDate.parse(scrTrainScheParam.getHappenTime());
queryWrapper.apply("YEAR(happen_time) = {0}", happenTime.getYear());
queryWrapper.apply("MONTH(happen_time) = {0}", happenTime.getMonthValue());
}
}
return new PageResult<>(this.page(PageFactory.defaultPage(), queryWrapper));
}
@Override
public List<ScrTrainSche> list(ScrTrainScheParam scrTrainScheParam) {
QueryWrapper<ScrTrainSche> queryWrapper = new QueryWrapper<>();
if (ObjectUtil.isNotNull(scrTrainScheParam)) {
if (ObjectUtil.isNotEmpty(scrTrainScheParam.getYear()) && ObjectUtil.isNotEmpty(scrTrainScheParam.getMonth())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainScheParam.getYear());
queryWrapper.apply("Month(happen_time) = {0}", scrTrainScheParam.getMonth());
} else if (ObjectUtil.isNotEmpty(scrTrainScheParam.getYear())) {
queryWrapper.apply("YEAR(happen_time) = {0}", scrTrainScheParam.getYear());
}
}
return this.list(queryWrapper);
}
@Override
public void add(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = new ScrTrainSche();
BeanUtil.copyProperties(scrTrainScheParam, scrTrainSche);
this.save(scrTrainSche);
}
@Transactional(rollbackFor = Exception.class)
@Override
public void delete(List<ScrTrainScheParam> scrTrainScheParamList) {
scrTrainScheParamList.forEach(scrTrainScheParam -> {
this.removeById(scrTrainScheParam.getId());
});
}
@Transactional(rollbackFor = Exception.class)
@Override
public void edit(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = this.queryScrTrainSche(scrTrainScheParam);
BeanUtil.copyProperties(scrTrainScheParam, scrTrainSche);
this.updateById(scrTrainSche);
}
@Override
public ScrTrainSche detail(ScrTrainScheParam scrTrainScheParam) {
return this.queryScrTrainSche(scrTrainScheParam);
}
/**
* 获取培训安排
*
* @author 1
* @date 2025-10-17 20:13:05
*/
private ScrTrainSche queryScrTrainSche(ScrTrainScheParam scrTrainScheParam) {
ScrTrainSche scrTrainSche = this.getById(scrTrainScheParam.getId());
if (ObjectUtil.isNull(scrTrainSche)) {
throw new ServiceException(ScrTrainScheExceptionEnum.NOT_EXIST);
}
return scrTrainSche;
}
@Override
public void export(ScrTrainScheParam scrTrainScheParam) {
List<ScrTrainSche> list = this.list(scrTrainScheParam);
PoiUtil.exportExcelWithStream("SnowyScrTrainSche.xls", ScrTrainSche.class, list);
}
}