parent
47757ba059
commit
e1015c43a1
25 changed files with 684 additions and 19 deletions
@ -0,0 +1,111 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.common.exception.BusinessException; |
||||
import com.huoran.iasf.common.exception.code.BaseResponseCode; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.Category; |
||||
import com.huoran.iasf.service.SysCategoryService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import io.swagger.annotations.ApiParam; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 产品与课程分类表控制类 |
||||
* 提供分类管理相关接口 |
||||
* |
||||
* @author Rong |
||||
* @date 2024-06-12 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/categoryService/Category") |
||||
@Api(value = "产品与课程分类管理接口", tags = "A-产品与课程分类管理") |
||||
public class CategoryController { |
||||
|
||||
@Autowired |
||||
private SysCategoryService service; |
||||
|
||||
/** |
||||
* 保存或更新分类信息 |
||||
* |
||||
* @param category 分类对象 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperation("保存或更新分类") |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R saveOrUpdate(@RequestBody @Validated Category category) { |
||||
try { |
||||
// 增加重复检查逻辑
|
||||
boolean isDuplicate = false; |
||||
if (category.getCategoryId() != null) { |
||||
// 更新逻辑,排除当前记录自身
|
||||
isDuplicate = service.existsOtherByName(category.getName(), category.getCategoryId()); |
||||
} else { |
||||
// 新增逻辑,直接检查名称是否存在
|
||||
isDuplicate = service.existsByName(category.getName()); |
||||
} |
||||
|
||||
if (isDuplicate) { |
||||
return R.fail("分类名称已存在,请检查后重新提交"); |
||||
} |
||||
|
||||
boolean operationResult = service.saveOrUpdate(category); |
||||
|
||||
return R.result(operationResult, operationResult ? "操作成功" : "操作失败"); |
||||
} catch (Exception e) { |
||||
throw new BusinessException(BaseResponseCode.SYSTEM_BUSY); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取分类列表,支持类型筛选 |
||||
* |
||||
* @param type 类型标识,如"course"或"product" |
||||
* @return 分类列表 |
||||
*/ |
||||
@PostMapping("/list") |
||||
@ApiOperation("根据类型获取分类列表") |
||||
public R categoryList(@ApiParam(value = "类型标识,区分课程或产品", allowableValues = "0:课程,1:产品") @RequestParam(required = false) Integer type) { |
||||
QueryWrapper<Category> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("type", type); |
||||
List<Category> categories = service.list(queryWrapper); |
||||
return R.success(categories); |
||||
} |
||||
|
||||
/** |
||||
* 查询分类详情 |
||||
* |
||||
* @param id 分类ID |
||||
* @return 分类详情 |
||||
*/ |
||||
@PostMapping("/findById") |
||||
@ApiOperation("根据ID查询分类详情") |
||||
public R findById(@ApiParam(name = "id", value = "分类ID", required = true) @RequestParam Integer id) { |
||||
Category category = service.getById(id); |
||||
return R.success(category); |
||||
} |
||||
|
||||
/** |
||||
* 批量删除分类 |
||||
* |
||||
* @param ids 分类ID列表 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/batchDelete") |
||||
@ApiOperation("批量删除分类") |
||||
public R batchDeletion(@RequestBody List<Integer> ids) { |
||||
if (ids == null || ids.isEmpty()) { |
||||
return R.fail("请选择要删除的分类"); |
||||
} |
||||
boolean delState = service.removeByIds(ids); |
||||
return R.result(delState, delState ? "批量删除成功" : "批量删除失败"); |
||||
} |
||||
} |
@ -0,0 +1,110 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
import com.huoran.iasf.common.exception.BusinessException; |
||||
import com.huoran.iasf.common.exception.code.BaseResponseCode; |
||||
import com.huoran.iasf.common.utils.R; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import com.huoran.iasf.service.SysProductDetailsService; |
||||
import com.huoran.iasf.service.SysSubjectSpecialtyService; |
||||
import io.swagger.annotations.Api; |
||||
import io.swagger.annotations.ApiOperation; |
||||
import lombok.extern.slf4j.Slf4j; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.transaction.annotation.Transactional; |
||||
import org.springframework.validation.annotation.Validated; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* 综合产品与课程详情信息表控制类 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/productDetails") |
||||
@Api(value = "A-综合产品与课程详情", tags = "A-综合产品与课程详情") |
||||
@Slf4j |
||||
public class ProductDetailsController { |
||||
|
||||
@Autowired |
||||
private SysProductDetailsService service; |
||||
|
||||
@Autowired |
||||
private SysSubjectSpecialtyService subjectSpecialtyService; |
||||
|
||||
|
||||
/** |
||||
* 保存或更新综合产品与课程详情信息 |
||||
* 根据实体中的ID判断是保存还是更新 |
||||
* |
||||
* @param productDetails 要保存或更新的实体 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/saveOrUpdate") |
||||
@ApiOperation("保存或更新综合产品与课程详情信息") |
||||
@Transactional(rollbackFor = Exception.class) |
||||
public R saveOrUpdate(@RequestBody @Validated ProductDetails productDetails) { |
||||
try { |
||||
// 增加重复检查逻辑
|
||||
boolean isDuplicate = false; |
||||
if (productDetails.getId() != null) { |
||||
// 更新逻辑,排除当前记录自身
|
||||
isDuplicate = service.existsOtherByProductName(productDetails.getName(), productDetails.getId()); |
||||
} else { |
||||
// 新增逻辑,直接检查名称是否存在
|
||||
isDuplicate = service.existsByProductName(productDetails.getName()); |
||||
} |
||||
|
||||
if (isDuplicate) { |
||||
return R.fail("名称已存在,请检查后重新提交"); |
||||
} |
||||
|
||||
boolean addState = service.saveOrUpdate(productDetails); |
||||
|
||||
if (addState && productDetails.getSubjectSpecialtyList() != null && !productDetails.getSubjectSpecialtyList().isEmpty()) { |
||||
// 确保每个subjectSpecialty都关联到正确的templateDetailsId
|
||||
productDetails.getSubjectSpecialtyList().forEach(subjectSpecialty -> subjectSpecialty.setTemplateDetailsId(productDetails.getId())); |
||||
subjectSpecialtyService.removeByTemplateDetailsId(productDetails.getId()); |
||||
subjectSpecialtyService.saveBatch(productDetails.getSubjectSpecialtyList()); |
||||
} |
||||
|
||||
return R.result(addState, addState ? "操作成功" : "操作失败"); |
||||
} catch (Exception e) { |
||||
log.error("保存或更新产品详情时发生错误", e); |
||||
throw new BusinessException(BaseResponseCode.SYSTEM_BUSY); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 根据ID查询详情 |
||||
* |
||||
* @param id 主键ID |
||||
* @return 查询结果 |
||||
*/ |
||||
@PostMapping("/findById") |
||||
@ApiOperation("根据ID查询详情") |
||||
public R findById(@RequestParam("id") Integer id) { |
||||
ProductDetails productDetails = service.getById(id); |
||||
return R.success(productDetails); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
/** |
||||
* 批量删除记录 |
||||
* |
||||
* @param ids 主键ID列表 |
||||
* @return 操作结果 |
||||
*/ |
||||
@PostMapping("/batchDelete") |
||||
@ApiOperation("批量删除记录") |
||||
public R batchDelete(@RequestBody List<Integer> ids) { |
||||
if (ids == null || ids.isEmpty()) { |
||||
return R.fail("请选择要删除的记录"); |
||||
} |
||||
boolean delState = service.removeByIds(ids); |
||||
return R.result(delState, delState ? "批量删除成功" : "批量删除失败"); |
||||
} |
||||
} |
@ -0,0 +1,21 @@ |
||||
package com.huoran.iasf.controller; |
||||
|
||||
|
||||
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
||||
import org.springframework.web.bind.annotation.RestController; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 前端控制器 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("//sys-subject-specialty") |
||||
public class SysSubjectSpecialtyController { |
||||
|
||||
} |
||||
|
@ -0,0 +1,51 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品与课程分类表 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@TableName("sys_category") |
||||
@ApiModel(value = "Category对象", description = "产品与课程分类表") |
||||
public class Category implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "分类ID") |
||||
@TableId(value = "category_id", type = IdType.AUTO) |
||||
private Integer categoryId; |
||||
|
||||
@ApiModelProperty(value = "分类名称") |
||||
private String name; |
||||
|
||||
@ApiModelProperty(value = "类型标识,区分是课程还是产品)0:课程,1:产品(0:课程,1:产品)") |
||||
private Integer type; |
||||
|
||||
@ApiModelProperty(value = "分类描述") |
||||
private String description; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
@TableField(fill = FieldFill.INSERT) |
||||
private Date createTime; |
||||
|
||||
@ApiModelProperty(value = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,93 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.*; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
|
||||
import java.io.Serializable; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @描述:综合产品与课程详情信息表 |
||||
* @作者: Rong |
||||
* @日期: 2024-06-13 |
||||
*/ |
||||
@Data |
||||
@ApiModel(value = "综合产品与课程详情信息表") |
||||
@TableName("sys_product_details") |
||||
public class ProductDetails implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@TableId(type = IdType.AUTO) |
||||
@ApiModelProperty(value = "主键ID") |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "模板ID") |
||||
private Integer templateId; |
||||
|
||||
@ApiModelProperty(value = "名称,课程或产品的名称,根据类型区分") |
||||
private String name; |
||||
|
||||
@ApiModelProperty(value = "类型标识,区分是课程还是产品") |
||||
private String type; |
||||
|
||||
@ApiModelProperty(value = "课程分类id或产品分类id,根据类型使用") |
||||
private String categoryId; |
||||
|
||||
@ApiModelProperty(value = "产品分类标签id,根据类型区分使用") |
||||
private String classificationTagId; |
||||
|
||||
@ApiModelProperty(value = "封面图片URL,课程封面或产品封面") |
||||
private String coverImageUrl; |
||||
|
||||
@ApiModelProperty(value = "来源信息,仅课程详情使用,可为空") |
||||
private String source; |
||||
|
||||
@ApiModelProperty(value = "按钮跳转名称") |
||||
private String jumpButtonName; |
||||
|
||||
@ApiModelProperty(value = "按钮跳转链接") |
||||
private String jumpLinkUrl; |
||||
|
||||
@ApiModelProperty(value = "简介,课程介绍或产品简介,根据类型区分使用") |
||||
private String introduction; |
||||
|
||||
@ApiModelProperty(value = "详细描述,课程或产品的详细说明") |
||||
private String detailedDescription; |
||||
|
||||
@ApiModelProperty(value = "发布状态,0草稿,1已发布") |
||||
private Boolean publishStatus; |
||||
|
||||
@ApiModelProperty(value = "创建时间") |
||||
@TableField(fill = FieldFill.INSERT) |
||||
private Date createTime; |
||||
|
||||
@ApiModelProperty(value = "更新时间") |
||||
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||
private Date updateTime; |
||||
|
||||
@ApiModelProperty(value = "是否删除(1未删除;0已删除)") |
||||
@TableLogic |
||||
private Integer deleted; |
||||
|
||||
@ApiModelProperty(value = "课程类型,仅课程使用,可为空") |
||||
private String courseType; |
||||
|
||||
@ApiModelProperty(value = "匹配课程,仅产品使用,可存储课程ID列表") |
||||
private String matchedCourses; |
||||
|
||||
@ApiModelProperty(value = "预计课时,仅产品使用,可为空") |
||||
private Integer estimatedHours; |
||||
|
||||
@ApiModelProperty(value = "适用场景,仅产品使用,可为空") |
||||
private String applicableScenarios; |
||||
|
||||
@ApiModelProperty(value = "学科专业类") |
||||
@TableField(exist = false) |
||||
private List<SysSubjectSpecialty> subjectSpecialtyList; |
||||
|
||||
|
||||
} |
@ -0,0 +1,44 @@ |
||||
package com.huoran.iasf.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import io.swagger.annotations.ApiModel; |
||||
import io.swagger.annotations.ApiModelProperty; |
||||
import lombok.Data; |
||||
import lombok.EqualsAndHashCode; |
||||
|
||||
import java.io.Serializable; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
@Data |
||||
@EqualsAndHashCode(callSuper = false) |
||||
@ApiModel(value = "SysSubjectSpecialty对象", description = "适用学科专业配置") |
||||
public class SysSubjectSpecialty implements Serializable { |
||||
|
||||
private static final long serialVersionUID = 1L; |
||||
|
||||
@ApiModelProperty(value = "主键") |
||||
@TableId(value = "id", type = IdType.AUTO) |
||||
private Integer id; |
||||
|
||||
@ApiModelProperty(value = "模板详情id") |
||||
private Integer templateDetailsId; |
||||
|
||||
@ApiModelProperty(value = "学科类别id,仅产品使用,可为空") |
||||
private Integer subjectCategoryId; |
||||
|
||||
@ApiModelProperty(value = "专业类别id,仅产品使用,可为空") |
||||
private Integer professionalCategoryId; |
||||
|
||||
@ApiModelProperty(value = "专业id,仅产品使用,可为空") |
||||
private Integer majorId; |
||||
|
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.Category; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品与课程分类表 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
public interface CategoryMapper extends BaseMapper<Category> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 综合产品与课程详情信息表 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
public interface ProductDetailsMapper extends BaseMapper<ProductDetails> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
|
||||
/** |
||||
* <p> |
||||
* 综合产品与课程详情信息表 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
public interface SysProductDetailsMapper extends BaseMapper<ProductDetails> { |
||||
|
||||
} |
@ -0,0 +1,16 @@ |
||||
package com.huoran.iasf.mapper; |
||||
|
||||
import com.huoran.iasf.entity.SysSubjectSpecialty; |
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 Mapper 接口 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
public interface SysSubjectSpecialtyMapper extends BaseMapper<SysSubjectSpecialty> { |
||||
|
||||
} |
@ -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="com.huoran.iasf.mapper.CategoryMapper"> |
||||
|
||||
</mapper> |
@ -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="com.huoran.iasf.mapper.ProductDetailsMapper"> |
||||
|
||||
</mapper> |
@ -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="com.huoran.iasf.mapper.SysProductDetailsMapper"> |
||||
|
||||
</mapper> |
@ -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="com.huoran.iasf.mapper.SysSubjectSpecialtyMapper"> |
||||
|
||||
</mapper> |
@ -0,0 +1,19 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.Category; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品与课程分类表 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
public interface SysCategoryService extends IService<Category> { |
||||
|
||||
boolean existsOtherByName(String name, Integer categoryId); |
||||
|
||||
boolean existsByName(String name); |
||||
} |
@ -0,0 +1,19 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
|
||||
/** |
||||
* <p> |
||||
* 综合产品与课程详情信息表 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
public interface SysProductDetailsService extends IService<ProductDetails> { |
||||
|
||||
boolean existsByProductName(String name); |
||||
|
||||
boolean existsOtherByProductName(String name, Integer currentId); |
||||
} |
@ -0,0 +1,17 @@ |
||||
package com.huoran.iasf.service; |
||||
|
||||
import com.huoran.iasf.entity.SysSubjectSpecialty; |
||||
import com.baomidou.mybatisplus.extension.service.IService; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 服务类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
public interface SysSubjectSpecialtyService extends IService<SysSubjectSpecialty> { |
||||
|
||||
void removeByTemplateDetailsId(Integer id); |
||||
} |
@ -0,0 +1,40 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.entity.Category; |
||||
import com.huoran.iasf.mapper.CategoryMapper; |
||||
import com.huoran.iasf.service.SysCategoryService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 产品与课程分类表 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
@Service |
||||
public class CategoryServiceImpl extends ServiceImpl<CategoryMapper, Category> implements SysCategoryService { |
||||
|
||||
@Override |
||||
public boolean existsOtherByName(String name, Integer categoryId) { |
||||
QueryWrapper<Category> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("name", name); |
||||
if (categoryId != null) { |
||||
queryWrapper.ne("category_id", categoryId); |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean existsByName(String name) { |
||||
QueryWrapper<Category> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("name", name); |
||||
if (baseMapper.selectCount(queryWrapper) > 0) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,37 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.entity.ProductDetails; |
||||
import com.huoran.iasf.mapper.SysProductDetailsMapper; |
||||
import com.huoran.iasf.service.SysProductDetailsService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 综合产品与课程详情信息表 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-12 |
||||
*/ |
||||
@Service |
||||
public class SysProductDetailsServiceImpl extends ServiceImpl<SysProductDetailsMapper, ProductDetails> implements SysProductDetailsService { |
||||
|
||||
|
||||
@Override |
||||
public boolean existsByProductName(String name) { |
||||
if (this.count(new QueryWrapper<ProductDetails>().eq("product_name", name)) > 0) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
@Override |
||||
public boolean existsOtherByProductName(String name, Integer currentId) { |
||||
if (this.count(new QueryWrapper<ProductDetails>().eq("product_name", name).ne("id", currentId)) > 0) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
} |
@ -0,0 +1,27 @@ |
||||
package com.huoran.iasf.service.impl; |
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
import com.huoran.iasf.entity.SysSubjectSpecialty; |
||||
import com.huoran.iasf.mapper.SysSubjectSpecialtyMapper; |
||||
import com.huoran.iasf.service.SysSubjectSpecialtyService; |
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
/** |
||||
* <p> |
||||
* 适用学科专业配置 服务实现类 |
||||
* </p> |
||||
* |
||||
* @author cheney |
||||
* @since 2024-06-13 |
||||
*/ |
||||
@Service |
||||
public class SysSubjectSpecialtyServiceImpl extends ServiceImpl<SysSubjectSpecialtyMapper, SysSubjectSpecialty> implements SysSubjectSpecialtyService { |
||||
|
||||
@Override |
||||
public void removeByTemplateDetailsId(Integer id) { |
||||
QueryWrapper<SysSubjectSpecialty> queryWrapper = new QueryWrapper<>(); |
||||
queryWrapper.eq("template_details_id", id); |
||||
this.remove(queryWrapper); |
||||
} |
||||
} |
Loading…
Reference in new issue