diff --git a/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java new file mode 100644 index 0000000000..c392df375b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-client/src/main/java/com/epmet/dto/WorkdiaryServiceTypeDTO.java @@ -0,0 +1,74 @@ +package com.epmet.dto; + +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceTypeDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 主键 + */ + private String id; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 服务类型名称 + */ + private String serviceName; + + /** + * 是否启用。0:禁用,1:启用 + */ + private Integer enabled; + + /** + * 删除标识 0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java new file mode 100755 index 0000000000..7ec0167414 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/controller/WorkdiaryServiceTypeController.java @@ -0,0 +1,83 @@ +package com.epmet.controller; + +import com.epmet.commons.tools.aop.NoRepeatSubmit; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.ActSummaryDTO; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeExcel; +import com.epmet.service.WorkdiaryServiceTypeService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@RestController +@RequestMapping("workdiaryServiceType") +public class WorkdiaryServiceTypeController { + + @Autowired + private WorkdiaryServiceTypeService workdiaryServiceTypeService; + + @RequestMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = workdiaryServiceTypeService.page(params); + return new Result>().ok(page); + } + + @RequestMapping(value = "{id}",method = {RequestMethod.POST,RequestMethod.GET}) + public Result get(@PathVariable("id") String id){ + WorkdiaryServiceTypeDTO data = workdiaryServiceTypeService.get(id); + return new Result().ok(data); + } + + @NoRepeatSubmit + @PostMapping("save") + public Result save(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.save(dto); + return new Result(); + } + + @NoRepeatSubmit + @PostMapping("update") + public Result update(@RequestBody WorkdiaryServiceTypeDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + workdiaryServiceTypeService.update(dto); + return new Result(); + } + + @PostMapping("delete") + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + workdiaryServiceTypeService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = workdiaryServiceTypeService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, WorkdiaryServiceTypeExcel.class); + } + + + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java new file mode 100755 index 0000000000..fe37602384 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/dao/WorkdiaryServiceTypeDao.java @@ -0,0 +1,16 @@ +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.WorkdiaryServiceTypeEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Mapper +public interface WorkdiaryServiceTypeDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java new file mode 100755 index 0000000000..3a7464aa7b --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeEntity.java @@ -0,0 +1,44 @@ +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("workdiary_service_type") +public class WorkdiaryServiceTypeEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户id + */ + private String customerId; + + /** + * 服务类型 + */ + private String serviceType; + + /** + * 服务类型名称 + */ + private String serviceName; + + /** + * 是否启用。0:禁用,1:启用 + */ + private Integer enabled; + +} diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java new file mode 100755 index 0000000000..a8c3340c73 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/entity/WorkdiaryServiceTypeExcel.java @@ -0,0 +1,51 @@ +package com.epmet.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Data +public class WorkdiaryServiceTypeExcel { + + @Excel(name = "主键") + private String id; + + @Excel(name = "客户id") + private String customerId; + + @Excel(name = "服务类型") + private String serviceType; + + @Excel(name = "服务类型名称") + private String serviceName; + + @Excel(name = "是否启用。0:禁用,1:启用") + private Integer enabled; + + @Excel(name = "删除标识 0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java new file mode 100755 index 0000000000..bf4dc2ffc1 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/redis/WorkdiaryServiceTypeRedis.java @@ -0,0 +1,30 @@ +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Component +public class WorkdiaryServiceTypeRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java new file mode 100755 index 0000000000..88318950a4 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/WorkdiaryServiceTypeService.java @@ -0,0 +1,78 @@ +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeEntity; + +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +public interface WorkdiaryServiceTypeService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2022-08-23 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2022-08-23 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return WorkdiaryServiceTypeDTO + * @author generator + * @date 2022-08-23 + */ + WorkdiaryServiceTypeDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void save(WorkdiaryServiceTypeDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2022-08-23 + */ + void update(WorkdiaryServiceTypeDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2022-08-23 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java new file mode 100755 index 0000000000..2058e93c47 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/service/impl/WorkdiaryServiceTypeServiceImpl.java @@ -0,0 +1,87 @@ +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.WorkdiaryServiceTypeDao; +import com.epmet.dto.WorkdiaryServiceTypeDTO; +import com.epmet.entity.WorkdiaryServiceTypeEntity; +import com.epmet.redis.WorkdiaryServiceTypeRedis; +import com.epmet.service.WorkdiaryServiceTypeService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 工作日志(服务)-服务类型 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2022-08-23 + */ +@Service +public class WorkdiaryServiceTypeServiceImpl extends BaseServiceImpl implements WorkdiaryServiceTypeService { + + @Autowired + private WorkdiaryServiceTypeRedis workdiaryServiceTypeRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, WorkdiaryServiceTypeDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, WorkdiaryServiceTypeDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public WorkdiaryServiceTypeDTO get(String id) { + WorkdiaryServiceTypeEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, WorkdiaryServiceTypeDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(WorkdiaryServiceTypeDTO dto) { + WorkdiaryServiceTypeEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceTypeEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(WorkdiaryServiceTypeDTO dto) { + WorkdiaryServiceTypeEntity entity = ConvertUtils.sourceToTarget(dto, WorkdiaryServiceTypeEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql index 63869fa0c2..809e8078cf 100644 --- a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/db/migration/workdiary_service.sql @@ -24,3 +24,23 @@ CREATE TABLE `workdiary_service_record` PRIMARY KEY (`ID`) ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-记录' + + +# 工作日志-服务分类 +CREATE TABLE `workdiary_service_type` +( + `ID` varchar(64) NOT NULL COMMENT '主键', + `CUSTOMER_ID` varchar(64) NOT NULL COMMENT '客户id', + `SERVICE_TYPE` varchar(32) NOT NULL COMMENT '服务类型', + `SERVICE_NAME` varchar(32) NOT NULL COMMENT '服务类型名称', + `ENABLED` tinyint(1) NOT NULL COMMENT '是否启用。0:禁用,1:启用', + `DEL_FLAG` int(11) NOT NULL DEFAULT '0' COMMENT '删除标识 0.未删除 1.已删除', + `REVISION` int(11) NOT NULL COMMENT '乐观锁', + `CREATED_BY` varchar(64) NOT NULL COMMENT '创建人', + `CREATED_TIME` datetime NOT NULL COMMENT '创建时间', + `UPDATED_BY` varchar(64) NOT NULL COMMENT '更新人', + `UPDATED_TIME` datetime NOT NULL COMMENT '更新时间', + PRIMARY KEY (`ID`), + unique index cust_service_type(CUSTOMER_ID asc , SERVICE_TYPE asc , DEL_FLAG asc) using btree +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4 COMMENT ='工作日志(服务)-服务类型' diff --git a/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml new file mode 100755 index 0000000000..5679d1cb91 --- /dev/null +++ b/epmet-module/epmet-heart/epmet-heart-server/src/main/resources/mapper/WorkdiaryServiceTypeDao.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file