移除套餐模板(无用模块)
This commit is contained in:
parent
b48c4dcbc9
commit
8a0a9475ad
|
@ -1,11 +1,8 @@
|
|||
package com.ruoyi.common.validRule.modelExist;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.ss.model.domain.SmModelQuery;
|
||||
import com.ruoyi.ss.model.service.ModelService;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
|
|
@ -4,8 +4,6 @@ import com.ruoyi.common.utils.SecurityUtils;
|
|||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.ss.suit.domain.SuitQuery;
|
||||
import com.ruoyi.ss.suit.service.SuitService;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
|
|
@ -1,40 +0,0 @@
|
|||
package com.ruoyi.common.validRule.suitTempExist;
|
||||
|
||||
import javax.validation.Constraint;
|
||||
import javax.validation.Payload;
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 判断设备是否存在
|
||||
* @author wjh
|
||||
* 2024/6/13
|
||||
*/
|
||||
@Documented
|
||||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Repeatable(SuitTempExist.List.class)
|
||||
@Constraint(validatedBy = { SuitTempExistValidator.class })
|
||||
public @interface SuitTempExist {
|
||||
String message() default "{*.validation.constraint.Enum.message}";
|
||||
|
||||
Class<?>[] groups() default {};
|
||||
|
||||
Class<? extends Payload>[] payload() default {};
|
||||
|
||||
/**
|
||||
* 是否允许null值,默认是允许
|
||||
*/
|
||||
boolean allowNull() default true;
|
||||
|
||||
/**
|
||||
* 校验是否归属商户
|
||||
*/
|
||||
boolean checkBelong() default false;
|
||||
|
||||
@Documented
|
||||
@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.CONSTRUCTOR, ElementType.PARAMETER, ElementType.TYPE_USE })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@interface List {
|
||||
SuitTempExist[] value();
|
||||
}
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
package com.ruoyi.common.validRule.suitTempExist;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.common.utils.spring.SpringUtils;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
|
||||
import javax.validation.ConstraintValidator;
|
||||
import javax.validation.ConstraintValidatorContext;
|
||||
|
||||
/**
|
||||
* 2023/10/20
|
||||
* 枚举值校验
|
||||
*/
|
||||
public class SuitTempExistValidator implements ConstraintValidator<SuitTempExist, Long> {
|
||||
|
||||
private SuitTempExist annotation;
|
||||
|
||||
@Override
|
||||
public void initialize(SuitTempExist constraintAnnotation) {
|
||||
this.annotation = constraintAnnotation;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否校验成功
|
||||
* @param value 待校验的值
|
||||
* @return 校验结果
|
||||
*/
|
||||
@Override
|
||||
public boolean isValid(Long value, ConstraintValidatorContext context) {
|
||||
// 如果待校验的值为null,是否校验通过
|
||||
if (value == null) {
|
||||
return annotation.allowNull();
|
||||
}
|
||||
try {
|
||||
SuitTempService service = SpringUtils.getBean(SuitTempService.class);
|
||||
SuitTempQuery query = new SuitTempQuery();
|
||||
query.setTempId(value);
|
||||
if (annotation.checkBelong()) {
|
||||
query.setUserId(SecurityUtils.getUserId());
|
||||
}
|
||||
return service.selectOne(query) != null;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,68 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.domain;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.validRule.suitTempExist.SuitTempExist;
|
||||
import com.ruoyi.ss.device.domain.DeviceView;
|
||||
import lombok.Data;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
/**
|
||||
* 套餐模板对象 sm_suit_temp
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-15
|
||||
*/
|
||||
@Data
|
||||
public class SuitTemp extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 模板ID */
|
||||
@SuitTempExist(message = "模板不存在", checkBelong = true, groups = { ValidGroup.FrontUpdate.class})
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Long tempId;
|
||||
|
||||
/** 用户ID */
|
||||
@Excel(name = "用户ID")
|
||||
@NotNull(message = "用户不允许为空", groups = {ValidGroup.Create.class})
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private Long userId;
|
||||
|
||||
/** 套餐名称 */
|
||||
@Excel(name = "套餐名称")
|
||||
@NotNull(message = "套餐名称不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
@Size(min = 1, max = 50, message = "套餐名称长度在1~50个字符之间")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String name;
|
||||
|
||||
/** 价格(元) */
|
||||
@Excel(name = "价格(元)")
|
||||
@NotNull(message = "价格不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
@Min(value = 0, message = "价格不允许小于0")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private BigDecimal price;
|
||||
|
||||
/** 通电时间(分钟) */
|
||||
@Excel(name = "通电时间", readConverterExp = "分=钟")
|
||||
@NotNull(message = "通电时间不允许为空", groups = {ValidGroup.Create.class, ValidGroup.FrontCreate.class})
|
||||
@Min(value = 1, message = "通电时间不允许小于1分钟")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private BigDecimal value;
|
||||
|
||||
/** 详细说明 */
|
||||
@Excel(name = "详细说明")
|
||||
@Size(max = 200, message = "详细说明长度不能超过200个字符")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
private String description;
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
@Data
|
||||
public class SuitTempQuery extends SuitTemp{
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
@Data
|
||||
public class SuitTempVO extends SuitTemp{
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
|
||||
/**
|
||||
* 套餐模板Mapper接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-15
|
||||
*/
|
||||
public interface SuitTempMapper
|
||||
{
|
||||
/**
|
||||
* 查询套餐模板
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 套餐模板
|
||||
*/
|
||||
public SuitTempVO selectSuitTempByTempId(Long tempId);
|
||||
|
||||
/**
|
||||
* 查询套餐模板列表
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 套餐模板集合
|
||||
*/
|
||||
public List<SuitTempVO> selectSuitTempList(SuitTempQuery suitTemp);
|
||||
|
||||
/**
|
||||
* 新增套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSuitTemp(SuitTemp suitTemp);
|
||||
|
||||
/**
|
||||
* 修改套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSuitTemp(SuitTemp suitTemp);
|
||||
|
||||
/**
|
||||
* 删除套餐模板
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuitTempByTempId(Long tempId);
|
||||
|
||||
/**
|
||||
* 批量删除套餐模板
|
||||
*
|
||||
* @param tempIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuitTempByTempIds(Long[] tempIds);
|
||||
|
||||
/**
|
||||
* 查询一个
|
||||
*/
|
||||
SuitTempVO selectOne(SuitTempQuery query);
|
||||
}
|
|
@ -1,91 +0,0 @@
|
|||
<?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.ruoyi.ss.suitTemp.mapper.SuitTempMapper">
|
||||
|
||||
<resultMap type="SuitTempVO" id="SuitTempResult" autoMapping="true"/>
|
||||
|
||||
<sql id="selectSuitTempVo">
|
||||
select
|
||||
sst.temp_id,
|
||||
sst.user_id,
|
||||
sst.name,
|
||||
sst.price,
|
||||
sst.value,
|
||||
sst.description,
|
||||
sst.create_time
|
||||
from sm_suit_temp sst
|
||||
</sql>
|
||||
|
||||
<sql id="searchCondition">
|
||||
<if test="tempId != null "> and sst.temp_id = #{tempId}</if>
|
||||
<if test="userId != null "> and sst.user_id = #{userId}</if>
|
||||
<if test="name != null and name != ''"> and sst.name like concat('%', #{name}, '%')</if>
|
||||
<if test="description != null and description != ''"> and sst.description like concat('%', #{description}, '%')</if>
|
||||
</sql>
|
||||
|
||||
<select id="selectSuitTempList" parameterType="SuitTemp" resultMap="SuitTempResult">
|
||||
<include refid="selectSuitTempVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectSuitTempByTempId" parameterType="Long" resultMap="SuitTempResult">
|
||||
<include refid="selectSuitTempVo"/>
|
||||
where temp_id = #{tempId}
|
||||
</select>
|
||||
|
||||
<select id="selectOne" resultMap="SuitTempResult">
|
||||
<include refid="selectSuitTempVo"/>
|
||||
<where>
|
||||
<include refid="searchCondition"/>
|
||||
</where>
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
<insert id="insertSuitTemp" parameterType="SuitTemp" useGeneratedKeys="true" keyProperty="tempId">
|
||||
insert into sm_suit_temp
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="name != null and name != ''">`name`,</if>
|
||||
<if test="price != null">price,</if>
|
||||
<if test="value != null">`value`,</if>
|
||||
<if test="description != null">`description`,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="price != null">#{price},</if>
|
||||
<if test="value != null">#{value},</if>
|
||||
<if test="description != null">#{description},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateSuitTemp" parameterType="SuitTemp">
|
||||
update sm_suit_temp
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="name != null and name != ''">`name` = #{name},</if>
|
||||
<if test="price != null">price = #{price},</if>
|
||||
<if test="value != null">`value` = #{value},</if>
|
||||
<if test="description != null">`description` = #{description},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
</trim>
|
||||
where temp_id = #{tempId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteSuitTempByTempId" parameterType="Long">
|
||||
delete from sm_suit_temp where temp_id = #{tempId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteSuitTempByTempIds" parameterType="String">
|
||||
delete from sm_suit_temp where temp_id in
|
||||
<foreach item="tempId" collection="array" open="(" separator="," close=")">
|
||||
#{tempId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
|
@ -1,21 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service;
|
||||
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
public interface SuitTempConverter {
|
||||
|
||||
/**
|
||||
* 创建时,APP VO 转为 PO
|
||||
*/
|
||||
SuitTemp toPoByAppCreate(SuitTempVO vo);
|
||||
|
||||
/**
|
||||
* 修改时,APP VO 转为 PO
|
||||
*/
|
||||
SuitTemp toPoByAppUpdate(SuitTempVO vo);
|
||||
}
|
|
@ -1,68 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
|
||||
/**
|
||||
* 套餐模板Service接口
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-15
|
||||
*/
|
||||
public interface SuitTempService
|
||||
{
|
||||
/**
|
||||
* 查询套餐模板
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 套餐模板
|
||||
*/
|
||||
public SuitTempVO selectSuitTempByTempId(Long tempId);
|
||||
|
||||
/**
|
||||
* 查询套餐模板列表
|
||||
*
|
||||
* @param query 套餐模板
|
||||
* @return 套餐模板集合
|
||||
*/
|
||||
public List<SuitTempVO> selectSuitTempList(SuitTempQuery query);
|
||||
|
||||
/**
|
||||
* 新增套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertSuitTemp(SuitTemp suitTemp);
|
||||
|
||||
/**
|
||||
* 修改套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateSuitTemp(SuitTemp suitTemp);
|
||||
|
||||
/**
|
||||
* 批量删除套餐模板
|
||||
*
|
||||
* @param tempIds 需要删除的套餐模板主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuitTempByTempIds(Long[] tempIds);
|
||||
|
||||
/**
|
||||
* 删除套餐模板信息
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteSuitTempByTempId(Long tempId);
|
||||
|
||||
/**
|
||||
* 查询一个
|
||||
*/
|
||||
SuitTempVO selectOne(SuitTempQuery query);
|
||||
}
|
|
@ -1,21 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service;
|
||||
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
public interface SuitTempValidator {
|
||||
|
||||
/**
|
||||
* 判断套餐模板是否属于用户
|
||||
*/
|
||||
boolean checkBelong(SuitTemp temp, Long userId);
|
||||
|
||||
/**
|
||||
* 判断套餐模板是否属于用户
|
||||
*/
|
||||
boolean checkBelong(Long tempId, Long userId);
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service.impl;
|
||||
|
||||
import com.ruoyi.common.utils.SecurityUtils;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempConverter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
@Service
|
||||
public class SuitTempConverterImpl implements SuitTempConverter {
|
||||
/**
|
||||
* 创建时,APP VO 转为 PO
|
||||
*/
|
||||
@Override
|
||||
public SuitTemp toPoByAppCreate(SuitTempVO vo) {
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
SuitTemp po = new SuitTemp();
|
||||
po.setUserId(vo.getUserId());
|
||||
po.setName(vo.getName());
|
||||
po.setPrice(vo.getPrice());
|
||||
po.setValue(vo.getValue());
|
||||
po.setDescription(vo.getDescription());
|
||||
return po;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改时,APP VO 转为 PO
|
||||
*/
|
||||
@Override
|
||||
public SuitTemp toPoByAppUpdate(SuitTempVO vo) {
|
||||
if (vo == null) {
|
||||
return null;
|
||||
}
|
||||
SuitTemp po = new SuitTemp();
|
||||
po.setTempId(vo.getTempId());
|
||||
po.setName(vo.getName());
|
||||
po.setPrice(vo.getPrice());
|
||||
po.setValue(vo.getValue());
|
||||
po.setDescription(vo.getDescription());
|
||||
return po;
|
||||
}
|
||||
}
|
|
@ -1,102 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.ss.suitTemp.mapper.SuitTempMapper;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
|
||||
/**
|
||||
* 套餐模板Service业务层处理
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-15
|
||||
*/
|
||||
@Service
|
||||
public class SuitTempServiceImpl implements SuitTempService
|
||||
{
|
||||
@Autowired
|
||||
private SuitTempMapper suitTempMapper;
|
||||
|
||||
/**
|
||||
* 查询套餐模板
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 套餐模板
|
||||
*/
|
||||
@Override
|
||||
public SuitTempVO selectSuitTempByTempId(Long tempId)
|
||||
{
|
||||
return suitTempMapper.selectSuitTempByTempId(tempId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询套餐模板列表
|
||||
*
|
||||
* @param query 套餐模板
|
||||
* @return 套餐模板
|
||||
*/
|
||||
@Override
|
||||
public List<SuitTempVO> selectSuitTempList(SuitTempQuery query)
|
||||
{
|
||||
return suitTempMapper.selectSuitTempList(query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertSuitTemp(SuitTemp suitTemp)
|
||||
{
|
||||
suitTemp.setCreateTime(DateUtils.getNowDate());
|
||||
return suitTempMapper.insertSuitTemp(suitTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改套餐模板
|
||||
*
|
||||
* @param suitTemp 套餐模板
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateSuitTemp(SuitTemp suitTemp)
|
||||
{
|
||||
return suitTempMapper.updateSuitTemp(suitTemp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除套餐模板
|
||||
*
|
||||
* @param tempIds 需要删除的套餐模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSuitTempByTempIds(Long[] tempIds)
|
||||
{
|
||||
return suitTempMapper.deleteSuitTempByTempIds(tempIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除套餐模板信息
|
||||
*
|
||||
* @param tempId 套餐模板主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteSuitTempByTempId(Long tempId)
|
||||
{
|
||||
return suitTempMapper.deleteSuitTempByTempId(tempId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuitTempVO selectOne(SuitTempQuery query) {
|
||||
return suitTempMapper.selectOne(query);
|
||||
}
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
package com.ruoyi.ss.suitTemp.service.impl;
|
||||
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempValidator;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
@Service
|
||||
public class SuitTempValidatorImpl implements SuitTempValidator {
|
||||
|
||||
@Autowired
|
||||
private SuitTempService suitTempService;
|
||||
|
||||
@Override
|
||||
public boolean checkBelong(SuitTemp temp, Long userId) {
|
||||
return userId != null && Objects.equals(temp.getUserId(), userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean checkBelong(Long tempId, Long userId) {
|
||||
SuitTempVO temp = suitTempService.selectSuitTempByTempId(tempId);
|
||||
return this.checkBelong(temp, userId);
|
||||
}
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
package com.ruoyi.web.controller.app;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonView;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.JsonViewProfile;
|
||||
import com.ruoyi.common.core.domain.ValidGroup;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempConverter;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempValidator;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wjh
|
||||
* 2024/7/15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/app/suit/temp")
|
||||
public class AppSuitTempController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private SuitTempService suitTempService;
|
||||
|
||||
@Autowired
|
||||
private SuitTempValidator suitTempValidator;
|
||||
|
||||
@Autowired
|
||||
private SuitTempConverter suitTempConverter;
|
||||
|
||||
@ApiOperation("查询本人套餐模板列表")
|
||||
@GetMapping("/list")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
public TableDataInfo list(SuitTempQuery query)
|
||||
{
|
||||
startPage();
|
||||
query.setUserId(getUserId());
|
||||
List<SuitTempVO> list = suitTempService.selectSuitTempList(query);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("获取套餐模板详细信息")
|
||||
@GetMapping(value = "/{tempId}")
|
||||
@JsonView(JsonViewProfile.App.class)
|
||||
public AjaxResult getInfo(@PathVariable("tempId") Long tempId)
|
||||
{
|
||||
SuitTempVO temp = suitTempService.selectSuitTempByTempId(tempId);
|
||||
if (!suitTempValidator.checkBelong(temp, getUserId())) {
|
||||
return error("这不是您的套餐模板,无权查看");
|
||||
}
|
||||
return success(temp);
|
||||
}
|
||||
|
||||
@ApiOperation("新增套餐模板")
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody @Validated(ValidGroup.FrontCreate.class) SuitTempVO vo) {
|
||||
vo.setUserId(getUserId());
|
||||
return toAjax(suitTempService.insertSuitTemp(suitTempConverter.toPoByAppCreate(vo)));
|
||||
}
|
||||
|
||||
@ApiOperation("修改套餐模板")
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody @Validated(ValidGroup.FrontUpdate.class) SuitTempVO vo) {
|
||||
return toAjax(suitTempService.updateSuitTemp(suitTempConverter.toPoByAppUpdate(vo)));
|
||||
}
|
||||
|
||||
@ApiOperation("删除套餐模板")
|
||||
@DeleteMapping("/{tempId}")
|
||||
public AjaxResult remove(@PathVariable Long tempId) {
|
||||
if (!suitTempValidator.checkBelong(tempId, getUserId())) {
|
||||
return error("这不是您的套餐模板,无权删除");
|
||||
}
|
||||
return toAjax(suitTempService.deleteSuitTempByTempId(tempId));
|
||||
}
|
||||
|
||||
}
|
|
@ -1,107 +0,0 @@
|
|||
package com.ruoyi.web.controller.ss;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempQuery;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTempVO;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
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.PutMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.ss.suitTemp.domain.SuitTemp;
|
||||
import com.ruoyi.ss.suitTemp.service.SuitTempService;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 套餐模板Controller
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2024-07-15
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/ss/suitTemp")
|
||||
public class SuitTempController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private SuitTempService suitTempService;
|
||||
|
||||
/**
|
||||
* 查询套餐模板列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(SuitTempQuery suitTemp)
|
||||
{
|
||||
startPage();
|
||||
List<SuitTempVO> list = suitTempService.selectSuitTempList(suitTemp);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出套餐模板列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:export')")
|
||||
@Log(title = "套餐模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, SuitTempQuery suitTemp)
|
||||
{
|
||||
List<SuitTempVO> list = suitTempService.selectSuitTempList(suitTemp);
|
||||
ExcelUtil<SuitTempVO> util = new ExcelUtil<SuitTempVO>(SuitTempVO.class);
|
||||
util.exportExcel(response, list, "套餐模板数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取套餐模板详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:query')")
|
||||
@GetMapping(value = "/{tempId}")
|
||||
public AjaxResult getInfo(@PathVariable("tempId") Long tempId)
|
||||
{
|
||||
return success(suitTempService.selectSuitTempByTempId(tempId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增套餐模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:add')")
|
||||
@Log(title = "套餐模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody SuitTemp suitTemp)
|
||||
{
|
||||
return toAjax(suitTempService.insertSuitTemp(suitTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改套餐模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:edit')")
|
||||
@Log(title = "套餐模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody SuitTemp suitTemp)
|
||||
{
|
||||
return toAjax(suitTempService.updateSuitTemp(suitTemp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除套餐模板
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('ss:suitTemp:remove')")
|
||||
@Log(title = "套餐模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{tempIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] tempIds)
|
||||
{
|
||||
return toAjax(suitTempService.deleteSuitTempByTempIds(tempIds));
|
||||
}
|
||||
}
|
|
@ -43,7 +43,7 @@ spring:
|
|||
# 数据库索引
|
||||
database: 1
|
||||
# 密码
|
||||
password: YgUIGNudqOQaRxHZ
|
||||
password:
|
||||
# 连接超时时间
|
||||
timeout: 10s
|
||||
lettuce:
|
||||
|
|
Loading…
Reference in New Issue
Block a user