| @@ -42,7 +42,32 @@ public class WxProductController extends BaseController { | |||||
| @Autowired | @Autowired | ||||
| SysConfigService sysConfigService; | SysConfigService sysConfigService; | ||||
| @Autowired | |||||
| WxProductService wxProductService; | |||||
| @GetMapping("/detail") | @GetMapping("/detail") | ||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "id", value = "id", dataType = "Long", paramType = "query", required = true) | |||||
| }) | |||||
| public ResultData payOrderDetail(Long id) { | |||||
| Map retMap = new HashMap(); | |||||
| TenantEntity tenantEntity = getCUser(); | |||||
| SysConfig salePrice = sysConfigService.getByKey(SysConfigConstant.sale_price, tenantEntity); | |||||
| SysConfig price = sysConfigService.getByKey(SysConfigConstant.price, tenantEntity); | |||||
| SysConfig days = sysConfigService.getByKey(SysConfigConstant.expired_days, tenantEntity); | |||||
| SysConfig img = sysConfigService.getByKey(SysConfigConstant.productImg, tenantEntity); | |||||
| retMap.put("price", price.getConfigItemValue()); | |||||
| retMap.put("salePrice", salePrice.getConfigItemValue()); | |||||
| retMap.put("days", days.getConfigItemValue()); | |||||
| retMap.put("productImg", img.getConfigItemValue()); | |||||
| return new ResultData(retMap); | |||||
| } | |||||
| @GetMapping("/list") | |||||
| @ApiImplicitParams({ | |||||
| @ApiImplicitParam(name = "pageNum", value = "页数", dataType = "int", paramType = "query", required = true), | |||||
| @ApiImplicitParam(name = "pageSize", value = "每页条数", dataType = "int", paramType = "query", required = true), | |||||
| }) | |||||
| public ResultData payOrderDetail() { | public ResultData payOrderDetail() { | ||||
| Map retMap = new HashMap(); | Map retMap = new HashMap(); | ||||
| TenantEntity tenantEntity = getCUser(); | TenantEntity tenantEntity = getCUser(); | ||||
| @@ -0,0 +1,33 @@ | |||||
| package com.iformall.domain.po; | |||||
| import com.baomidou.mybatisplus.annotation.TableName; | |||||
| import com.iformall.domain.po.base.TenantEntity; | |||||
| import lombok.Data; | |||||
| import lombok.EqualsAndHashCode; | |||||
| import lombok.ToString; | |||||
| import java.util.*; | |||||
| @TableName(value = "wx_product") | |||||
| @Data | |||||
| @EqualsAndHashCode(callSuper = true) | |||||
| @ToString | |||||
| public class WxProduct extends TenantEntity { | |||||
| private static final long serialVersionUID = -5094915301794376964L; | |||||
| protected Long id; | |||||
| @io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime") | |||||
| private Date createTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime") | |||||
| private Date updateTime; | |||||
| @io.swagger.annotations.ApiModelProperty(value="产品名称",name="name") | |||||
| private String name; | |||||
| @io.swagger.annotations.ApiModelProperty(value="原价",name="price") | |||||
| private Integer price; | |||||
| @io.swagger.annotations.ApiModelProperty(value="售价",name="salePrice") | |||||
| private Integer salePrice; | |||||
| @io.swagger.annotations.ApiModelProperty(value="天数",name="days") | |||||
| private Integer days; | |||||
| @io.swagger.annotations.ApiModelProperty(value="返佣",name="rebate") | |||||
| private Integer rebate; | |||||
| } | |||||
| @@ -0,0 +1,15 @@ | |||||
| package com.iformall.mapper; | |||||
| import java.util.*; | |||||
| import org.apache.ibatis.annotations.Param; | |||||
| import com.iformall.common.CommonMapper; | |||||
| import com.iformall.domain.po.WxProduct; | |||||
| public interface WxProductMapper extends CommonMapper<WxProduct, Long> { | |||||
| WxProduct selectById(@Param("id")Long id,@Param("tenantId")String tenantId); | |||||
| List<WxProduct> findList(WxProduct wxProduct); | |||||
| } | |||||
| @@ -0,0 +1,18 @@ | |||||
| package com.iformall.service; | |||||
| import com.iformall.domain.po.WxProduct; | |||||
| import java.util.List; | |||||
| public interface WxProductService { | |||||
| /** | |||||
| * 根据Id获得实体 | |||||
| * | |||||
| * @param id | |||||
| * @return | |||||
| */ | |||||
| WxProduct getById(Long id,String tenantId); | |||||
| List<WxProduct> productList(WxProduct product); | |||||
| } | |||||
| @@ -0,0 +1,31 @@ | |||||
| package com.iformall.service.impl; | |||||
| import com.iformall.domain.po.*; | |||||
| import com.iformall.mapper.WxProductMapper; | |||||
| import com.iformall.service.*; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.stereotype.Service; | |||||
| import java.util.List; | |||||
| @Service | |||||
| public class WxProductServiceImpl implements WxProductService { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxProductMapper wxProductMapper; | |||||
| @Override | |||||
| public WxProduct getById(Long id, String tenantId) { | |||||
| return wxProductMapper.selectById(id, tenantId); | |||||
| } | |||||
| @Override | |||||
| public List<WxProduct> productList(WxProduct product) { | |||||
| return wxProductMapper.findList(product); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,72 @@ | |||||
| <?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.iformall.mapper.WxProductMapper"> | |||||
| <resultMap id="BaseResultMap" type="com.iformall.domain.po.WxProduct"> | |||||
| <id column="id" jdbcType="BIGINT" property="id"/> | |||||
| <result column="tenant_id" jdbcType="VARCHAR" property="tenantId"/> | |||||
| <result column="parent_tenant_id" jdbcType="VARCHAR" property="parentTenantId" /> | |||||
| <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/> | |||||
| <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/> | |||||
| <result column="name" jdbcType="VARCHAR" property="name"/> | |||||
| <result column="price" jdbcType="INTEGER" property="price"/> | |||||
| <result column="salePrice" jdbcType="INTEGER" property="sale_price"/> | |||||
| <result column="days" jdbcType="INTEGER" property="days"/> | |||||
| <result column="rebate" jdbcType="INTEGER" property="rebate"/> | |||||
| </resultMap> | |||||
| <sql id="allColumns"> | |||||
| `id`,`tenant_id`,`parent_tenant_id`,`create_time`,`update_time`,`name`,`price`,`salePrice`, | |||||
| `days`,`rebate` | |||||
| </sql> | |||||
| <sql id="dynamicWhereConditions"> | |||||
| where `tenant_id` = #{tenantId} | |||||
| <if test=" null != id "> | |||||
| and `id` = #{id} | |||||
| </if> | |||||
| <if test=" null != parentTenantId and '' != parentTenantId"> | |||||
| and `parent_tenant_id` = #{parentTenantId} | |||||
| </if> | |||||
| <if test=" null != createTime "> | |||||
| and `create_time` = #{createTime} | |||||
| </if> | |||||
| <if test=" null != updateTime "> | |||||
| and `update_time` = #{updateTime} | |||||
| </if> | |||||
| <if test=" null != name "> | |||||
| and `name` like concat('%', #{name},'%') | |||||
| </if> | |||||
| <if test=" null != userIds "> | |||||
| and c_user_id in | |||||
| <foreach collection="userIds" index="index" item="uidItem" open="(" separator="," close=")"> | |||||
| #{uidItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != ids "> | |||||
| and id in | |||||
| <foreach collection="ids" index="index" item="idItem" open="(" separator="," close=")"> | |||||
| #{idItem} | |||||
| </foreach> | |||||
| </if> | |||||
| <if test=" null != sortColumns">order by ${sortColumns}</if> | |||||
| </sql> | |||||
| <select id="selectById" parameterType="java.util.HashMap" resultMap="BaseResultMap"> | |||||
| select <include refid="allColumns"/> from wx_product where id = #{id} and tenant_id = #{tenantId} | |||||
| </select> | |||||
| <select id="findList" parameterType="com.iformall.domain.po.WxProduct" resultMap="BaseResultMap"> | |||||
| select | |||||
| <include refid="allColumns"/> | |||||
| from wx_product | |||||
| <include refid="dynamicWhereConditions"/> | |||||
| </select> | |||||
| </mapper> | |||||