Commit 15f913dc5cd5a876d85580538e188812dc01c798
1 parent
ab7f3317
商品价格显示修改
Showing
7 changed files
with
126 additions
and
0 deletions
ser.bin
0 → 100644
No preview for this file type
shop/src/main/java/com/canrd/shop/controller/SwitchControlController.java
0 → 100644
1 | +package com.canrd.shop.controller; | |
2 | + | |
3 | + | |
4 | +import org.springframework.web.bind.annotation.RequestMapping; | |
5 | + | |
6 | +import org.springframework.stereotype.Controller; | |
7 | + | |
8 | +/** | |
9 | + * <p> | |
10 | + * 前端控制器 | |
11 | + * </p> | |
12 | + * | |
13 | + * @author zhongnanhuang | |
14 | + * @since 2024-11-07 | |
15 | + */ | |
16 | +@Controller | |
17 | +@RequestMapping("/switch-control") | |
18 | +public class SwitchControlController { | |
19 | + | |
20 | +} | ... | ... |
shop/src/main/java/com/canrd/shop/mapper/SwitchControlMapper.java
0 → 100644
1 | +package com.canrd.shop.mapper; | |
2 | + | |
3 | +import com.canrd.shop.module.dto.SwitchControl; | |
4 | +import com.baomidou.mybatisplus.core.mapper.BaseMapper; | |
5 | + | |
6 | +/** | |
7 | + * <p> | |
8 | + * Mapper 接口 | |
9 | + * </p> | |
10 | + * | |
11 | + * @author zhongnanhuang | |
12 | + * @since 2024-11-07 | |
13 | + */ | |
14 | +public interface SwitchControlMapper extends BaseMapper<SwitchControl> { | |
15 | + | |
16 | +} | ... | ... |
shop/src/main/java/com/canrd/shop/module/dto/SwitchControl.java
0 → 100644
1 | +package com.canrd.shop.module.dto; | |
2 | + | |
3 | +import com.baomidou.mybatisplus.annotation.TableName; | |
4 | +import com.baomidou.mybatisplus.annotation.IdType; | |
5 | +import com.baomidou.mybatisplus.annotation.TableId; | |
6 | +import java.io.Serializable; | |
7 | +import lombok.Data; | |
8 | +import lombok.EqualsAndHashCode; | |
9 | +import lombok.experimental.Accessors; | |
10 | + | |
11 | +/** | |
12 | + * <p> | |
13 | + * | |
14 | + * </p> | |
15 | + * | |
16 | + * @author zhongnanhuang | |
17 | + * @since 2024-11-07 | |
18 | + */ | |
19 | +@Data | |
20 | +@EqualsAndHashCode(callSuper = false) | |
21 | +@Accessors(chain = true) | |
22 | +@TableName("switch_control") | |
23 | +public class SwitchControl implements Serializable { | |
24 | + | |
25 | + private static final long serialVersionUID = 1L; | |
26 | + | |
27 | + @TableId(value = "id", type = IdType.AUTO) | |
28 | + private Integer id; | |
29 | + | |
30 | + private String switchName; | |
31 | + | |
32 | + private Boolean isEnabled; | |
33 | + | |
34 | + | |
35 | +} | ... | ... |
shop/src/main/java/com/canrd/shop/service/ISwitchControlService.java
0 → 100644
1 | +package com.canrd.shop.service; | |
2 | + | |
3 | +import com.canrd.shop.module.dto.SwitchControl; | |
4 | +import com.baomidou.mybatisplus.extension.service.IService; | |
5 | + | |
6 | +/** | |
7 | + * <p> | |
8 | + * 服务类 | |
9 | + * </p> | |
10 | + * | |
11 | + * @author zhongnanhuang | |
12 | + * @since 2024-11-07 | |
13 | + */ | |
14 | +public interface ISwitchControlService extends IService<SwitchControl> { | |
15 | + | |
16 | + Boolean getEnabledByName(String switchName); | |
17 | +} | ... | ... |
shop/src/main/java/com/canrd/shop/service/impl/SwitchControlServiceImpl.java
0 → 100644
1 | +package com.canrd.shop.service.impl; | |
2 | + | |
3 | +import com.canrd.shop.module.dto.SwitchControl; | |
4 | +import com.canrd.shop.mapper.SwitchControlMapper; | |
5 | +import com.canrd.shop.service.ISwitchControlService; | |
6 | +import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | |
7 | +import org.apache.commons.collections.CollectionUtils; | |
8 | +import org.apache.commons.lang3.BooleanUtils; | |
9 | +import org.springframework.stereotype.Service; | |
10 | + | |
11 | +import java.util.List; | |
12 | + | |
13 | +/** | |
14 | + * <p> | |
15 | + * 服务实现类 | |
16 | + * </p> | |
17 | + * | |
18 | + * @author zhongnanhuang | |
19 | + * @since 2024-11-07 | |
20 | + */ | |
21 | +@Service | |
22 | +public class SwitchControlServiceImpl extends ServiceImpl<SwitchControlMapper, SwitchControl> implements ISwitchControlService { | |
23 | + | |
24 | + @Override | |
25 | + public Boolean getEnabledByName(String switchName) { | |
26 | + List<SwitchControl> switchControls = this.lambdaQuery().eq(SwitchControl::getSwitchName, switchName).list(); | |
27 | + if(CollectionUtils.isEmpty(switchControls)){ | |
28 | + return false; | |
29 | + } | |
30 | + SwitchControl switchControl = switchControls.get(0); | |
31 | + return BooleanUtils.isTrue(switchControl.getIsEnabled()); | |
32 | + } | |
33 | +} | ... | ... |
shop/src/main/resources/mapper/SwitchControlMapper.xml
0 → 100644