username 4 лет назад
Родитель
Сommit
d2daf4c309

+ 129 - 0
src/main/java/org/springblade/ldt/channel/controller/PointChannelController.java

@@ -0,0 +1,129 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.controller;
+
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
+import lombok.AllArgsConstructor;
+import javax.validation.Valid;
+
+import org.springblade.core.mp.support.Condition;
+import org.springblade.core.mp.support.Query;
+import org.springblade.core.tool.api.R;
+import org.springblade.core.tool.utils.Func;
+import org.springframework.web.bind.annotation.*;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import org.springblade.ldt.channel.entity.PointChannel;
+import org.springblade.ldt.channel.vo.PointChannelVO;
+import org.springblade.ldt.channel.wrapper.PointChannelWrapper;
+import org.springblade.ldt.channel.service.IPointChannelService;
+import org.springblade.core.boot.ctrl.BladeController;
+
+/**
+ *  控制器
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+@RestController
+@AllArgsConstructor
+@RequestMapping("ldt_channel/pointchannel")
+@Api(value = "", tags = "接口")
+public class PointChannelController extends BladeController {
+
+	private final IPointChannelService pointChannelService;
+
+	/**
+	 * 详情
+	 */
+	@GetMapping("/detail")
+	@ApiOperationSupport(order = 1)
+	@ApiOperation(value = "详情", notes = "传入pointChannel")
+	public R<PointChannelVO> detail(PointChannel pointChannel) {
+		PointChannel detail = pointChannelService.getOne(Condition.getQueryWrapper(pointChannel));
+		return R.data(PointChannelWrapper.build().entityVO(detail));
+	}
+
+	/**
+	 * 分页
+	 */
+	@GetMapping("/list")
+	@ApiOperationSupport(order = 2)
+	@ApiOperation(value = "分页", notes = "传入pointChannel")
+	public R<IPage<PointChannelVO>> list(PointChannel pointChannel, Query query) {
+		IPage<PointChannel> pages = pointChannelService.page(Condition.getPage(query), Condition.getQueryWrapper(pointChannel));
+		return R.data(PointChannelWrapper.build().pageVO(pages));
+	}
+
+
+	/**
+	 * 自定义分页
+	 */
+	@GetMapping("/page")
+	@ApiOperationSupport(order = 3)
+	@ApiOperation(value = "分页", notes = "传入pointChannel")
+	public R<IPage<PointChannelVO>> page(PointChannelVO pointChannel, Query query) {
+		IPage<PointChannelVO> pages = pointChannelService.selectPointChannelPage(Condition.getPage(query), pointChannel);
+		return R.data(pages);
+	}
+
+	/**
+	 * 新增
+	 */
+	@PostMapping("/save")
+	@ApiOperationSupport(order = 4)
+	@ApiOperation(value = "新增", notes = "传入pointChannel")
+	public R save(@Valid @RequestBody PointChannel pointChannel) {
+		return R.status(pointChannelService.save(pointChannel));
+	}
+
+	/**
+	 * 修改
+	 */
+	@PostMapping("/update")
+	@ApiOperationSupport(order = 5)
+	@ApiOperation(value = "修改", notes = "传入pointChannel")
+	public R update(@Valid @RequestBody PointChannel pointChannel) {
+		return R.status(pointChannelService.updateById(pointChannel));
+	}
+
+	/**
+	 * 新增或修改
+	 */
+	@PostMapping("/submit")
+	@ApiOperationSupport(order = 6)
+	@ApiOperation(value = "新增或修改", notes = "传入pointChannel")
+	public R submit(@Valid @RequestBody PointChannel pointChannel) {
+		return R.status(pointChannelService.saveOrUpdate(pointChannel));
+	}
+
+
+	/**
+	 * 删除
+	 */
+	@PostMapping("/remove")
+	@ApiOperationSupport(order = 7)
+	@ApiOperation(value = "逻辑删除", notes = "传入ids")
+	public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
+		return R.status(pointChannelService.deleteLogic(Func.toLongList(ids)));
+	}
+
+
+}

+ 34 - 0
src/main/java/org/springblade/ldt/channel/dto/PointChannelDTO.java

@@ -0,0 +1,34 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.dto;
+
+import org.springblade.ldt.channel.entity.PointChannel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * 数据传输对象实体类
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class PointChannelDTO extends PointChannel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 79 - 0
src/main/java/org/springblade/ldt/channel/entity/PointChannel.java

@@ -0,0 +1,79 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.entity;
+
+import java.math.BigDecimal;
+import com.baomidou.mybatisplus.annotation.TableName;
+import org.springblade.core.mp.base.BaseEntity;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+
+/**
+ * 实体类
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+@Data
+@TableName("ldt_point_channel")
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PointChannel对象", description = "PointChannel对象")
+public class PointChannel extends BaseEntity {
+
+	private static final long serialVersionUID = 1L;
+
+	/**
+	* 渠道名称
+	*/
+		@ApiModelProperty(value = "渠道名称")
+		private String name;
+	/**
+	* 渠道logo
+	*/
+		@ApiModelProperty(value = "渠道logo")
+		private String logo;
+	/**
+	* 100积分等于多少积分价值
+	*/
+		@ApiModelProperty(value = "100积分等于多少积分价值")
+		private BigDecimal pointRate;
+	/**
+	* 抵扣顺序
+	*/
+		@ApiModelProperty(value = "抵扣顺序")
+		private Integer sort;
+	/**
+	* 类型:1-内部应用 2-商场 3-代理 4-外部
+	*/
+		@ApiModelProperty(value = "类型:1-内部应用 2-商场 3-代理 4-外部")
+		private Integer type;
+	/**
+	* 折扣
+	*/
+		@ApiModelProperty(value = "折扣")
+		private BigDecimal discount;
+	/**
+	* 账期
+	*/
+		@ApiModelProperty(value = "账期")
+		private Integer paymentDays;
+	private Long relationId;
+
+
+}

+ 42 - 0
src/main/java/org/springblade/ldt/channel/mapper/PointChannelMapper.java

@@ -0,0 +1,42 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.mapper;
+
+import org.springblade.ldt.channel.entity.PointChannel;
+import org.springblade.ldt.channel.vo.PointChannelVO;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+import java.util.List;
+
+/**
+ *  Mapper 接口
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+public interface PointChannelMapper extends BaseMapper<PointChannel> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param pointChannel
+	 * @return
+	 */
+	List<PointChannelVO> selectPointChannelPage(IPage page, PointChannelVO pointChannel);
+
+}

+ 30 - 0
src/main/java/org/springblade/ldt/channel/mapper/PointChannelMapper.xml

@@ -0,0 +1,30 @@
+<?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="org.springblade.ldt.channel.mapper.PointChannelMapper">
+
+    <!-- 通用查询映射结果 -->
+    <resultMap id="pointChannelResultMap" type="org.springblade.ldt.channel.entity.PointChannel">
+        <result column="id" property="id"/>
+        <result column="create_user" property="createUser"/>
+        <result column="create_dept" property="createDept"/>
+        <result column="create_time" property="createTime"/>
+        <result column="update_user" property="updateUser"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="status" property="status"/>
+        <result column="is_deleted" property="isDeleted"/>
+        <result column="name" property="name"/>
+        <result column="logo" property="logo"/>
+        <result column="point_rate" property="pointRate"/>
+        <result column="sort" property="sort"/>
+        <result column="type" property="type"/>
+        <result column="discount" property="discount"/>
+        <result column="payment_days" property="paymentDays"/>
+        <result column="relation_id" property="relationId"/>
+    </resultMap>
+
+
+    <select id="selectPointChannelPage" resultMap="pointChannelResultMap">
+        select * from ldt_point_channel where is_deleted = 0
+    </select>
+
+</mapper>

+ 41 - 0
src/main/java/org/springblade/ldt/channel/service/IPointChannelService.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.service;
+
+import org.springblade.ldt.channel.entity.PointChannel;
+import org.springblade.ldt.channel.vo.PointChannelVO;
+import org.springblade.core.mp.base.BaseService;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务类
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+public interface IPointChannelService extends BaseService<PointChannel> {
+
+	/**
+	 * 自定义分页
+	 *
+	 * @param page
+	 * @param pointChannel
+	 * @return
+	 */
+	IPage<PointChannelVO> selectPointChannelPage(IPage<PointChannelVO> page, PointChannelVO pointChannel);
+
+}

+ 41 - 0
src/main/java/org/springblade/ldt/channel/service/impl/PointChannelServiceImpl.java

@@ -0,0 +1,41 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.service.impl;
+
+import org.springblade.ldt.channel.entity.PointChannel;
+import org.springblade.ldt.channel.vo.PointChannelVO;
+import org.springblade.ldt.channel.mapper.PointChannelMapper;
+import org.springblade.ldt.channel.service.IPointChannelService;
+import org.springblade.core.mp.base.BaseServiceImpl;
+import org.springframework.stereotype.Service;
+import com.baomidou.mybatisplus.core.metadata.IPage;
+
+/**
+ *  服务实现类
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+@Service
+public class PointChannelServiceImpl extends BaseServiceImpl<PointChannelMapper, PointChannel> implements IPointChannelService {
+
+	@Override
+	public IPage<PointChannelVO> selectPointChannelPage(IPage<PointChannelVO> page, PointChannelVO pointChannel) {
+		return page.setRecords(baseMapper.selectPointChannelPage(page, pointChannel));
+	}
+
+}

+ 36 - 0
src/main/java/org/springblade/ldt/channel/vo/PointChannelVO.java

@@ -0,0 +1,36 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.vo;
+
+import org.springblade.ldt.channel.entity.PointChannel;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import io.swagger.annotations.ApiModel;
+
+/**
+ * 视图实体类
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ApiModel(value = "PointChannelVO对象", description = "PointChannelVO对象")
+public class PointChannelVO extends PointChannel {
+	private static final long serialVersionUID = 1L;
+
+}

+ 49 - 0
src/main/java/org/springblade/ldt/channel/wrapper/PointChannelWrapper.java

@@ -0,0 +1,49 @@
+/*
+ *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are met:
+ *
+ *  Redistributions of source code must retain the above copyright notice,
+ *  this list of conditions and the following disclaimer.
+ *  Redistributions in binary form must reproduce the above copyright
+ *  notice, this list of conditions and the following disclaimer in the
+ *  documentation and/or other materials provided with the distribution.
+ *  Neither the name of the dreamlu.net developer nor the names of its
+ *  contributors may be used to endorse or promote products derived from
+ *  this software without specific prior written permission.
+ *  Author: Chill 庄骞 (smallchill@163.com)
+ */
+package org.springblade.ldt.channel.wrapper;
+
+import org.springblade.core.mp.support.BaseEntityWrapper;
+import org.springblade.core.tool.utils.BeanUtil;
+import org.springblade.ldt.channel.entity.PointChannel;
+import org.springblade.ldt.channel.vo.PointChannelVO;
+import java.util.Objects;
+
+/**
+ * 包装类,返回视图层所需的字段
+ *
+ * @author BladeX
+ * @since 2021-09-02
+ */
+public class PointChannelWrapper extends BaseEntityWrapper<PointChannel, PointChannelVO>  {
+
+	public static PointChannelWrapper build() {
+		return new PointChannelWrapper();
+ 	}
+
+	@Override
+	public PointChannelVO entityVO(PointChannel pointChannel) {
+		PointChannelVO pointChannelVO = Objects.requireNonNull(BeanUtil.copy(pointChannel, PointChannelVO.class));
+
+		//User createUser = UserCache.getUser(pointChannel.getCreateUser());
+		//User updateUser = UserCache.getUser(pointChannel.getUpdateUser());
+		//pointChannelVO.setCreateUserName(createUser.getName());
+		//pointChannelVO.setUpdateUserName(updateUser.getName());
+
+		return pointChannelVO;
+	}
+
+}