|
|
@@ -0,0 +1,123 @@
|
|
|
+package com.lc.ibps.components.employee.provider;
|
|
|
+
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestParam;
|
|
|
+
|
|
|
+import com.lc.ibps.api.base.constants.StateEnum;
|
|
|
+import com.lc.ibps.api.base.query.QueryFilter;
|
|
|
+import com.lc.ibps.base.core.constants.StringPool;
|
|
|
+import com.lc.ibps.base.core.util.BeanUtils;
|
|
|
+import com.lc.ibps.cloud.entity.APIPageList;
|
|
|
+import com.lc.ibps.cloud.entity.APIRequest;
|
|
|
+import com.lc.ibps.cloud.entity.APIResult;
|
|
|
+import com.lc.ibps.cloud.provider.GenericProvider;
|
|
|
+import com.lc.ibps.components.employee.api.IScheduleConfigService;
|
|
|
+import com.lc.ibps.components.employee.domain.ScheduleConfig;
|
|
|
+import com.lc.ibps.components.employee.persistence.entity.ScheduleConfigPo;
|
|
|
+import com.lc.ibps.components.employee.repository.ScheduleConfigRepository;
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.ApiParam;
|
|
|
+import io.swagger.annotations.Extension;
|
|
|
+import io.swagger.annotations.ExtensionProperty;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 排班配置表 服务类
|
|
|
+ * <pre>
|
|
|
+ * 构建组:ibps-provider-scheduleConfig
|
|
|
+ * 开发公司:深圳市金源信通科技有限公司
|
|
|
+ * 开发人员:codegen
|
|
|
+ * 创建时间:2024-08-13 11:04:11
|
|
|
+ *</pre>
|
|
|
+ */
|
|
|
+@Api(tags = "排班配置表管理", value = "排班配置表数据")
|
|
|
+@Service
|
|
|
+public class ScheduleConfigProvider extends GenericProvider implements IScheduleConfigService{
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private ScheduleConfigRepository scheduleConfigRepository;
|
|
|
+
|
|
|
+ @ApiOperation(value = "排班配置表列表(分页条件查询)数据", notes = "排班配置表列表(分页条件查询)数据")
|
|
|
+ @Override
|
|
|
+ public APIResult<APIPageList<ScheduleConfigPo>> query(
|
|
|
+ @ApiParam(name = "request", value = "传入查询请求json字符串", required = true)
|
|
|
+ @RequestBody(required = true) APIRequest request) {
|
|
|
+ APIResult<APIPageList<ScheduleConfigPo>> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ QueryFilter queryFilter = getQueryFilter(request);
|
|
|
+ List<ScheduleConfigPo> data = scheduleConfigRepository.query(queryFilter);
|
|
|
+ APIPageList<ScheduleConfigPo> apiPageData = getAPIPageList(data);
|
|
|
+ result.setData(apiPageData);
|
|
|
+ } catch (Exception e) {
|
|
|
+ // TODO ERROR => other error message
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据id查询排班配置表", notes = "根据id查询排班配置表")
|
|
|
+ @Override
|
|
|
+ public APIResult<ScheduleConfigPo> get(
|
|
|
+ @ApiParam(name = "id", value = "查询id", required = true)
|
|
|
+ @RequestParam(name = "id", required = true) String id) {
|
|
|
+ APIResult<ScheduleConfigPo> result = new APIResult<>();
|
|
|
+ try {
|
|
|
+ ScheduleConfigPo scheduleConfigPo = scheduleConfigRepository.get(id);
|
|
|
+ result.setData(scheduleConfigPo);
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "保存", notes = "保存排班配置表信息",
|
|
|
+ extensions = {
|
|
|
+ @Extension(properties = {
|
|
|
+ @ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ @Override
|
|
|
+ public APIResult<Void> save(
|
|
|
+ @ApiParam(name = "scheduleConfigPo", value = "排班配置表对象", required = true)
|
|
|
+ @RequestBody(required = true) ScheduleConfigPo scheduleConfigPo) {
|
|
|
+ APIResult<Void> result = new APIResult<Void>();
|
|
|
+ try {
|
|
|
+ logger.info(" com.lc.ibps.components.provider.ScheduleConfigProvider.save()--->scheduleConfigPo: {}", scheduleConfigPo.toString());
|
|
|
+ ScheduleConfig domain = scheduleConfigRepository.newInstance(scheduleConfigPo);
|
|
|
+ domain.save();
|
|
|
+ result.setMessage("保存排班配置表成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "删除", notes = "删除排班配置表",
|
|
|
+ extensions = {
|
|
|
+ @Extension(properties = {
|
|
|
+ @ExtensionProperty(name = "submitCtrl", value = StringPool.Y)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ @Override
|
|
|
+ public APIResult<Void> remove(
|
|
|
+ @ApiParam(name = "ids", value = "排班配置表ID数组", required = true)
|
|
|
+ @RequestParam(name = "ids", required = true) String[] ids) {
|
|
|
+ APIResult<Void> result = new APIResult<Void>();
|
|
|
+ try {
|
|
|
+ ScheduleConfig domain = scheduleConfigRepository.newInstance();
|
|
|
+ domain.deleteByIds(ids);
|
|
|
+ result.setMessage("删除排班配置表成功");
|
|
|
+ } catch (Exception e) {
|
|
|
+ setExceptionResult(result, StateEnum.ERROR.getCode(), StateEnum.ERROR.getText(), e);
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|