44 changed files with 730 additions and 8 deletions
@ -0,0 +1,10 @@ |
|||||
|
package com.project.base.domain.param; |
||||
|
|
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class BaseParam { |
||||
|
private Integer current = 1; |
||||
|
private Integer size = 10; |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.project.base.domain.result; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import lombok.Data; |
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
public class PageResult<T> implements Serializable { |
||||
|
private List<T> content; // 数据列表
|
||||
|
private long total; // 总条数
|
||||
|
private long size; // 每页条数
|
||||
|
private long current; // 当前页码 (从1开始)
|
||||
|
private long pages; // 总页数
|
||||
|
|
||||
|
public PageResult(IPage<T> mpPage) { |
||||
|
this.content = mpPage.getRecords(); |
||||
|
this.total = mpPage.getTotal(); |
||||
|
this.size = mpPage.getSize(); |
||||
|
this.current = mpPage.getCurrent(); |
||||
|
this.pages = mpPage.getPages(); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.project.base.domain.utils; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
||||
|
import com.project.base.domain.param.BaseParam; |
||||
|
|
||||
|
public class PageConverter { |
||||
|
|
||||
|
/** |
||||
|
* 将任意 BaseParam 子类转换为 MyBatis-Plus 的 Page 对象 |
||||
|
*/ |
||||
|
public static <T> Page<T> toMpPage(BaseParam param) { |
||||
|
return new Page<>(param.getCurrent(), param.getSize()); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,18 @@ |
|||||
|
package com.project.ding.application; |
||||
|
|
||||
|
import com.project.base.domain.result.PageResult; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.ding.domain.dto.UserDTO; |
||||
|
import com.project.ding.domain.param.UserParam; |
||||
|
|
||||
|
public interface UserApplicationService { |
||||
|
|
||||
|
Result<PageResult<UserDTO>> search(UserParam param) throws Exception; |
||||
|
|
||||
|
Result<UserDTO> getDetail(Long id) throws Exception; |
||||
|
|
||||
|
|
||||
|
|
||||
|
Result<String> getLastSyncTime() throws Exception; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
package com.project.ding.application.impl; |
||||
|
|
||||
|
import com.project.base.domain.result.PageResult; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.ding.application.UserApplicationService; |
||||
|
import com.project.ding.domain.dto.UserDTO; |
||||
|
import com.project.ding.domain.param.UserParam; |
||||
|
import com.project.ding.domain.service.GetLastSyncTimeSyncLogDomainService; |
||||
|
import com.project.ding.domain.service.SearchUserDomainService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.data.domain.Page; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class UserApplicationServiceImpl implements UserApplicationService { |
||||
|
@Autowired |
||||
|
private SearchUserDomainService searchUserDomainService; |
||||
|
|
||||
|
@Autowired |
||||
|
private GetLastSyncTimeSyncLogDomainService getLastSyncTimeSyncLogDomainService; |
||||
|
|
||||
|
@Override |
||||
|
public Result<PageResult<UserDTO>> search(UserParam param) throws Exception { |
||||
|
return searchUserDomainService.search(param); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<UserDTO> getDetail(Long id) throws Exception { |
||||
|
return searchUserDomainService.getDetail(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<String> getLastSyncTime() throws Exception { |
||||
|
return getLastSyncTimeSyncLogDomainService.getLastSyncTime(); |
||||
|
} |
||||
|
} |
||||
|
|
||||
@ -0,0 +1,36 @@ |
|||||
|
package com.project.ding.controller; |
||||
|
|
||||
|
|
||||
|
import com.project.base.domain.result.PageResult; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.ding.application.UserApplicationService; |
||||
|
import com.project.ding.domain.dto.UserDTO; |
||||
|
import com.project.ding.domain.param.UserParam; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
@RestController |
||||
|
@Slf4j |
||||
|
@RequestMapping("/dingUser") |
||||
|
public class UserController { |
||||
|
@Autowired |
||||
|
private UserApplicationService userApplicationService; |
||||
|
|
||||
|
@GetMapping("/search") |
||||
|
public Result<PageResult<UserDTO>> search(UserParam param) throws Exception { |
||||
|
return userApplicationService.search(param); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getLastSyncTime") |
||||
|
public Result<String> getLastSyncTime() throws Exception { |
||||
|
return userApplicationService.getLastSyncTime(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/getDetail") |
||||
|
public Result<UserDTO> getDetail(Long id) throws Exception { |
||||
|
return userApplicationService.getDetail(id); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.project.ding.domain.param; |
||||
|
|
||||
|
|
||||
|
import com.project.base.domain.param.BaseParam; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class UserParam extends BaseParam{ |
||||
|
private String name; |
||||
|
|
||||
|
private Long searchDeptId; |
||||
|
} |
||||
@ -0,0 +1,7 @@ |
|||||
|
package com.project.ding.domain.service; |
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
|
||||
|
public interface GetLastSyncTimeSyncLogDomainService { |
||||
|
Result<String> getLastSyncTime() throws Exception; |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package com.project.ding.domain.service; |
||||
|
|
||||
|
import com.project.base.domain.result.PageResult; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.ding.domain.dto.UserDTO; |
||||
|
import com.project.ding.domain.param.UserParam; |
||||
|
|
||||
|
public interface SearchUserDomainService { |
||||
|
|
||||
|
Result<PageResult<UserDTO>> search(UserParam param) throws Exception; |
||||
|
|
||||
|
Result<UserDTO> getDetail(Long id) throws Exception; |
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package com.project.ding.domain.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.date.DateUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.ding.domain.entity.SyncLogEntity; |
||||
|
import com.project.ding.domain.service.GetLastSyncTimeSyncLogDomainService; |
||||
|
import com.project.ding.mapper.SyncLogMapper; |
||||
|
import io.vavr.control.Try; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class GetLastSyncTimeSyncLogDomainServiceImpl implements GetLastSyncTimeSyncLogDomainService { |
||||
|
|
||||
|
@Autowired |
||||
|
private SyncLogMapper syncLogMapper; |
||||
|
private final static String timeFormatStr = "yyyy-MM-dd HH:mm:ss"; |
||||
|
@Override |
||||
|
public Result<String> getLastSyncTime() throws Exception { |
||||
|
// 1. 查询最后一条成功的记录
|
||||
|
SyncLogEntity lastLog = syncLogMapper.selectOne( |
||||
|
new LambdaQueryWrapper<SyncLogEntity>() |
||||
|
.eq(SyncLogEntity::getStatus, 1) // 1-成功
|
||||
|
.orderByDesc(SyncLogEntity::getId) |
||||
|
.last("LIMIT 1") |
||||
|
); |
||||
|
return Result.success(Try.of(() -> |
||||
|
DateUtil.format(lastLog.getEndTime() , timeFormatStr)) |
||||
|
.getOrElse("")); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,59 @@ |
|||||
|
package com.project.ding.domain.service.impl; |
||||
|
|
||||
|
import cn.hutool.core.util.StrUtil; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.project.base.domain.result.PageResult; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.base.domain.utils.PageConverter; |
||||
|
import com.project.ding.domain.dto.UserDTO; |
||||
|
import com.project.ding.domain.entity.UserEntity; |
||||
|
import com.project.ding.domain.param.UserParam; |
||||
|
import com.project.ding.domain.service.SearchUserDomainService; |
||||
|
import com.project.ding.mapper.UserMapper; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.Objects; |
||||
|
|
||||
|
@Service |
||||
|
public class SearchUserDomainServiceImpl implements SearchUserDomainService { |
||||
|
|
||||
|
@Autowired |
||||
|
private UserMapper userMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Result<PageResult<UserDTO>> search(UserParam param) throws Exception { |
||||
|
LambdaQueryWrapper<UserEntity> queryWrapper = new LambdaQueryWrapper<>(); |
||||
|
if (StrUtil.isNotBlank(param.getName())) { |
||||
|
queryWrapper.like(UserEntity::getName , param.getName()); |
||||
|
} |
||||
|
|
||||
|
if (Objects.nonNull(param.getSearchDeptId())) { |
||||
|
queryWrapper.apply("{0} MEMBER OF(dept_id_list)", param.getSearchDeptId()); |
||||
|
} |
||||
|
|
||||
|
queryWrapper.orderByDesc(UserEntity::getDeptIdStr); |
||||
|
IPage<UserEntity> userEntityPage = userMapper.selectPage( |
||||
|
PageConverter.toMpPage(param), |
||||
|
queryWrapper); |
||||
|
IPage<UserDTO> userDtoPage = userEntityPage.convert(entity -> buildDTO(entity) |
||||
|
.desensitize()); |
||||
|
|
||||
|
return Result.page(userDtoPage); |
||||
|
} |
||||
|
|
||||
|
private UserDTO buildDTO(UserEntity entity) { |
||||
|
UserDTO dto = entity.toDTO(UserDTO::new); |
||||
|
// todo 构建考试信息
|
||||
|
|
||||
|
|
||||
|
return entity.toDTO(UserDTO::new); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<UserDTO> getDetail(Long id) throws Exception { |
||||
|
UserEntity entity = userMapper.selectById(id); |
||||
|
return Result.success(buildDTO(entity)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
package com.project.information.application; |
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.param.BusinessGroupParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface BusinessGroupApplicationService { |
||||
|
Result<List<BusinessGroupDTO>> list(BusinessGroupParam param) throws Exception; |
||||
|
|
||||
|
Result<List<BusinessGroupDTO>> batchSave(String batchSaveStr) throws Exception; |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.project.information.application.impl; |
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.application.BusinessGroupApplicationService; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.param.BusinessGroupParam; |
||||
|
import com.project.information.domain.service.BatchSaveBusinessGroupDomainService; |
||||
|
import com.project.information.domain.service.SearchBusinessGroupDomainService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@Service |
||||
|
public class BusinessGroupApplicationServiceImpl implements BusinessGroupApplicationService { |
||||
|
@Autowired |
||||
|
private SearchBusinessGroupDomainService searchBusinessGroupDomainService; |
||||
|
|
||||
|
@Autowired |
||||
|
private BatchSaveBusinessGroupDomainService batchSaveBusinessGroupDomainService; |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<BusinessGroupDTO>> list(BusinessGroupParam param) throws Exception { |
||||
|
return searchBusinessGroupDomainService.list(param); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<BusinessGroupDTO>> batchSave(String batchSaveStr) throws Exception { |
||||
|
return batchSaveBusinessGroupDomainService.batchSave(batchSaveStr); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
package com.project.information.controller; |
||||
|
|
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.application.BusinessGroupApplicationService; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.param.BusinessGroupParam; |
||||
|
import lombok.extern.slf4j.Slf4j; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.GetMapping; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
@RestController |
||||
|
@Slf4j |
||||
|
@RequestMapping("/businessGroup") |
||||
|
public class BusinessGroupController { |
||||
|
@Autowired |
||||
|
private BusinessGroupApplicationService businessGroupApplicationService; |
||||
|
|
||||
|
@GetMapping("/list") |
||||
|
public Result<List<BusinessGroupDTO>> list(BusinessGroupParam param) throws Exception { |
||||
|
return businessGroupApplicationService.list(param); |
||||
|
} |
||||
|
|
||||
|
@PostMapping("/batchSave") |
||||
|
public Result<List<BusinessGroupDTO>> batchSave(String batchSaveStr) throws Exception { |
||||
|
return businessGroupApplicationService.batchSave(batchSaveStr); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.project.information.domain.dto; |
||||
|
|
||||
|
import com.project.base.domain.dto.BaseDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class BusinessGroupDTO extends BaseDTO { |
||||
|
private String name; |
||||
|
private String sort; |
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.project.information.domain.dto; |
||||
|
|
||||
|
import com.project.base.domain.dto.BaseDTO; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class InformationDTO extends BaseDTO { |
||||
|
private Long subLineId; |
||||
|
private String subLineName; |
||||
|
private String name; |
||||
|
private String filePath; |
||||
|
private Integer parseStatus; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,14 @@ |
|||||
|
package com.project.information.domain.dto; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class ProductLineDTO { |
||||
|
private String name; |
||||
|
private Integer sort; |
||||
|
private Boolean leaf; |
||||
|
private String business; |
||||
|
private Long parentId; |
||||
|
private String parentName; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.project.information.domain.entity; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.project.base.domain.entity.BaseEntity; |
||||
|
import jakarta.persistence.Column; |
||||
|
import jakarta.persistence.Entity; |
||||
|
import jakarta.persistence.Index; |
||||
|
import jakarta.persistence.Table; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import org.hibernate.annotations.Comment; |
||||
|
|
||||
|
@Data |
||||
|
@Table(name = "evaluator_business_group", indexes = {@Index(name = "Idx_sort", columnList = "sort")}) |
||||
|
@Entity |
||||
|
@TableName(value = "evaluator_business_group") |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
public class BusinessGroupEntity extends BaseEntity { |
||||
|
|
||||
|
@Column(name = "name" , columnDefinition="varchar(255) comment '事业部名称'") |
||||
|
private String name; |
||||
|
|
||||
|
|
||||
|
@Column(name = "sort", nullable = false) |
||||
|
@Comment("排序权重") |
||||
|
private Integer sort = 0; // 默认值为0
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,41 @@ |
|||||
|
package com.project.information.domain.entity; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.project.base.domain.entity.BaseEntity; |
||||
|
import jakarta.persistence.Column; |
||||
|
import jakarta.persistence.Entity; |
||||
|
import jakarta.persistence.Table; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import org.hibernate.annotations.Comment; |
||||
|
|
||||
|
@Data |
||||
|
@Table(name = "evaluator_information") |
||||
|
@Entity |
||||
|
@TableName(value = "evaluator_information") |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
public class InformationEntity extends BaseEntity { |
||||
|
@Column(name = "sub_line_id") |
||||
|
@Comment("所属子产品线ID") |
||||
|
@TableField("sub_line_id") |
||||
|
private Long subLineId; |
||||
|
|
||||
|
@Column(name = "sub_line_name" , columnDefinition="varchar(550) comment '所属子产品线名称'") |
||||
|
@Comment("所属子产品线名称") |
||||
|
@TableField("sub_line_name") |
||||
|
private String subLineName; |
||||
|
|
||||
|
@Column(name = "name" , columnDefinition="varchar(550) comment '文件名称'") |
||||
|
private String name; |
||||
|
|
||||
|
|
||||
|
@Column(name = "file_path" , columnDefinition="varchar(550) comment '文件存储路径'") |
||||
|
@TableField("file_path") |
||||
|
private String filePath; |
||||
|
|
||||
|
@Column(name = "parse_status") |
||||
|
@TableField("parse_status") |
||||
|
@Comment("排序权重") |
||||
|
private Integer parseStatus; |
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
package com.project.information.domain.entity; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.annotation.TableField; |
||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||
|
import com.project.base.domain.entity.BaseEntity; |
||||
|
import jakarta.persistence.Column; |
||||
|
import jakarta.persistence.Entity; |
||||
|
import jakarta.persistence.Index; |
||||
|
import jakarta.persistence.Table; |
||||
|
import lombok.Data; |
||||
|
import lombok.EqualsAndHashCode; |
||||
|
import org.hibernate.annotations.Comment; |
||||
|
|
||||
|
@Data |
||||
|
@Table(name = "evaluator_product_line" , indexes = {@Index(name = "Idx_parentId_sort", columnList = "parent_id,sort")}) |
||||
|
@Entity |
||||
|
@TableName(value = "evaluator_product_line") |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
public class ProductLineEntity extends BaseEntity { |
||||
|
@Column(name = "name" , columnDefinition="varchar(550) comment '部门名称'") |
||||
|
private String name; |
||||
|
|
||||
|
@Column(name = "sort", nullable = false) |
||||
|
@Comment("排序权重") |
||||
|
private Integer sort = 0; // 默认值为0
|
||||
|
|
||||
|
@Column(name = "leaf", nullable = false) |
||||
|
@Comment("是否是子产品线") |
||||
|
private Boolean leaf; |
||||
|
|
||||
|
@Column(name = "business", columnDefinition="varchar(100) comment '所属BG名称'") |
||||
|
private String business; |
||||
|
|
||||
|
@Column(name = "parent_id") |
||||
|
@TableField("parent_id") |
||||
|
@Comment("父级ID") |
||||
|
private Long parentId; |
||||
|
|
||||
|
@Column(name = "parent_name", columnDefinition="varchar(550) comment '父级名称'") |
||||
|
@TableField("parent_name") |
||||
|
private String parentName; |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.project.information.domain.param; |
||||
|
|
||||
|
import com.project.base.domain.param.BaseParam; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class BusinessGroupParam extends BaseParam { |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.project.information.domain.param; |
||||
|
|
||||
|
import com.project.base.domain.param.BaseParam; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class InformationParam extends BaseParam { |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.project.information.domain.param; |
||||
|
|
||||
|
import com.project.base.domain.param.BaseParam; |
||||
|
import lombok.Data; |
||||
|
|
||||
|
@Data |
||||
|
public class ProductLineParam extends BaseParam { |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.project.information.domain.service; |
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface BatchSaveBusinessGroupDomainService { |
||||
|
Result<List<BusinessGroupDTO>> batchSave(String batchSaveStr) throws Exception; |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
package com.project.information.domain.service; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
import com.project.ding.domain.entity.UserEntity; |
||||
|
import com.project.information.domain.entity.BusinessGroupEntity; |
||||
|
|
||||
|
public interface BusinessGroupBaseService extends IService<BusinessGroupEntity> { |
||||
|
} |
||||
@ -0,0 +1,12 @@ |
|||||
|
package com.project.information.domain.service; |
||||
|
|
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.param.BusinessGroupParam; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
public interface SearchBusinessGroupDomainService { |
||||
|
Result<List<BusinessGroupDTO>> list(BusinessGroupParam param) throws Exception; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,38 @@ |
|||||
|
package com.project.information.domain.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.entity.BusinessGroupEntity; |
||||
|
import com.project.information.domain.service.BatchSaveBusinessGroupDomainService; |
||||
|
import com.project.information.domain.service.BusinessGroupBaseService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Service |
||||
|
public class BatchSaveBusinessGroupDomainServiceImpl implements BatchSaveBusinessGroupDomainService { |
||||
|
|
||||
|
@Autowired |
||||
|
private BusinessGroupBaseService businessGroupBaseService; |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<BusinessGroupDTO>> batchSave(String batchSaveStr) throws Exception { |
||||
|
// 全量删掉
|
||||
|
businessGroupBaseService.remove(new LambdaQueryWrapper<>()); |
||||
|
|
||||
|
List<BusinessGroupEntity> res = new ArrayList<>(); |
||||
|
for (String saveStr : batchSaveStr.split(",")) { |
||||
|
BusinessGroupEntity businessGroupEntity = new BusinessGroupEntity(); |
||||
|
businessGroupEntity.setName(saveStr); |
||||
|
businessGroupBaseService.save(businessGroupEntity); |
||||
|
res.add(businessGroupEntity); |
||||
|
} |
||||
|
return Result.success(res.stream() |
||||
|
.map(entity -> entity.toDTO(BusinessGroupDTO::new)) |
||||
|
.collect(Collectors.toList())); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,11 @@ |
|||||
|
package com.project.information.domain.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
|
import com.project.information.domain.entity.BusinessGroupEntity; |
||||
|
import com.project.information.domain.service.BusinessGroupBaseService; |
||||
|
import com.project.information.mapper.BusinessGroupMapper; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
@Service |
||||
|
public class BusinessGroupBaseServiceImpl extends ServiceImpl<BusinessGroupMapper, BusinessGroupEntity> implements BusinessGroupBaseService { |
||||
|
} |
||||
@ -0,0 +1,29 @@ |
|||||
|
package com.project.information.domain.service.impl; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||
|
import com.project.base.domain.result.Result; |
||||
|
import com.project.information.domain.dto.BusinessGroupDTO; |
||||
|
import com.project.information.domain.entity.BusinessGroupEntity; |
||||
|
import com.project.information.domain.param.BusinessGroupParam; |
||||
|
import com.project.information.domain.service.SearchBusinessGroupDomainService; |
||||
|
import com.project.information.mapper.BusinessGroupMapper; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.stream.Collectors; |
||||
|
|
||||
|
@Service |
||||
|
public class SearchBusinessGroupDomainServiceImpl implements SearchBusinessGroupDomainService { |
||||
|
|
||||
|
@Autowired |
||||
|
private BusinessGroupMapper businessGroupMapper; |
||||
|
@Override |
||||
|
public Result<List<BusinessGroupDTO>> list(BusinessGroupParam param) throws Exception { |
||||
|
LambdaQueryWrapper<BusinessGroupEntity> queryWrapper = new LambdaQueryWrapper<>(); |
||||
|
List<BusinessGroupEntity> entityList = businessGroupMapper.selectList(queryWrapper); |
||||
|
return Result.success(entityList.stream() |
||||
|
.map(entity -> entity.toDTO(BusinessGroupDTO::new)) |
||||
|
.collect(Collectors.toList())); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,10 @@ |
|||||
|
package com.project.information.mapper; |
||||
|
|
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.project.information.domain.entity.BusinessGroupEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface BusinessGroupMapper extends BaseMapper<BusinessGroupEntity> { |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.project.information.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.project.information.domain.entity.InformationEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface InformationMapper extends BaseMapper<InformationEntity> { |
||||
|
} |
||||
@ -0,0 +1,9 @@ |
|||||
|
package com.project.information.mapper; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
import com.project.information.domain.entity.ProductLineEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
@Mapper |
||||
|
public interface ProductLineMapper extends BaseMapper<ProductLineEntity> { |
||||
|
} |
||||
Loading…
Reference in new issue