| @@ -0,0 +1,40 @@ | |||||
| package com.iformall.controller; | |||||
| import com.github.pagehelper.PageInfo; | |||||
| import com.iformall.common.ResultData; | |||||
| import com.iformall.domain.po.MallUserInfo; | |||||
| import com.iformall.domain.po.WxMerchantSubsidy; | |||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | |||||
| import com.iformall.service.WxMerchantSubsidyService; | |||||
| import io.swagger.annotations.ApiImplicitParam; | |||||
| import io.swagger.annotations.ApiImplicitParams; | |||||
| import io.swagger.annotations.ApiOperation; | |||||
| import org.slf4j.Logger; | |||||
| import org.slf4j.LoggerFactory; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.web.bind.annotation.*; | |||||
| @RestController | |||||
| @RequestMapping("subsidy") | |||||
| public class WxMerchantSubsidyController extends BaseController { | |||||
| private final Logger logger = LoggerFactory.getLogger(this.getClass()); | |||||
| @Autowired | |||||
| WxMerchantSubsidyService wxMerchantSubsidyService; | |||||
| @ApiOperation("补贴记录") | |||||
| @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 listMonth(@ModelAttribute WxMerchantSubsidy wxMerchantSubsidy, Integer pageNum, Integer pageSize) { | |||||
| String ipStr = getIpAddr(); | |||||
| logger.info("subsidylist: " + ipStr + " :" + wxMerchantSubsidy.toString()); | |||||
| if (wxMerchantSubsidy == null) wxMerchantSubsidy = new WxMerchantSubsidy(); | |||||
| MallUserInfo user = getUser(); | |||||
| wxMerchantSubsidy.setTenantId(user.getTenantId()); | |||||
| final PageInfo<WxMerchantSubsidyVo> page = wxMerchantSubsidyService.listAsPage(wxMerchantSubsidy, pageNum, pageSize); | |||||
| return new ResultData(page); | |||||
| } | |||||
| } | |||||
| @@ -0,0 +1,85 @@ | |||||
| package com.iformall.domain.vo; | |||||
| import com.iformall.domain.po.WxMerchantSubsidy; | |||||
| public class WxMerchantSubsidyVo extends WxMerchantSubsidy { | |||||
| /**卡信息*/ | |||||
| /**封面图**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="封面图",name="coverImg") | |||||
| private String coverImg; | |||||
| /**券名称**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="券名称",name="title") | |||||
| private String title; | |||||
| /**副标题**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="副标题",name="subTitle") | |||||
| private String subTitle; | |||||
| /**单位**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="单位0:钱分,1:小时",name="unit") | |||||
| private Integer unit; | |||||
| /**须知**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="须知",name="detail") | |||||
| private String detail; | |||||
| /**购买须知**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="购买须知",name="remark") | |||||
| private String remark; | |||||
| /**使用商户名**/ | |||||
| @io.swagger.annotations.ApiModelProperty(value="商户名",name="name") | |||||
| private String merchantName; | |||||
| public String getCoverImg() { | |||||
| return coverImg; | |||||
| } | |||||
| public void setCoverImg(String coverImg) { | |||||
| this.coverImg = coverImg; | |||||
| } | |||||
| public String getTitle() { | |||||
| return title; | |||||
| } | |||||
| public void setTitle(String title) { | |||||
| this.title = title; | |||||
| } | |||||
| public String getSubTitle() { | |||||
| return subTitle; | |||||
| } | |||||
| public void setSubTitle(String subTitle) { | |||||
| this.subTitle = subTitle; | |||||
| } | |||||
| public Integer getUnit() { | |||||
| return unit; | |||||
| } | |||||
| public void setUnit(Integer unit) { | |||||
| this.unit = unit; | |||||
| } | |||||
| public String getDetail() { | |||||
| return detail; | |||||
| } | |||||
| public void setDetail(String detail) { | |||||
| this.detail = detail; | |||||
| } | |||||
| public String getRemark() { | |||||
| return remark; | |||||
| } | |||||
| public void setRemark(String remark) { | |||||
| this.remark = remark; | |||||
| } | |||||
| public String getMerchantName() { | |||||
| return merchantName; | |||||
| } | |||||
| public void setMerchantName(String merchantName) { | |||||
| this.merchantName = merchantName; | |||||
| } | |||||
| } | |||||
| @@ -3,10 +3,13 @@ package com.iformall.mapper; | |||||
| import java.util.*; | import java.util.*; | ||||
| import com.iformall.common.CommonMapper; | import com.iformall.common.CommonMapper; | ||||
| import com.iformall.domain.po.WxMerchantSubsidy; | import com.iformall.domain.po.WxMerchantSubsidy; | ||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | |||||
| public interface WxMerchantSubsidyMapper extends CommonMapper<WxMerchantSubsidy, Long> { | public interface WxMerchantSubsidyMapper extends CommonMapper<WxMerchantSubsidy, Long> { | ||||
| List<WxMerchantSubsidy> findList(WxMerchantSubsidy wxMerchantSubsidy); | List<WxMerchantSubsidy> findList(WxMerchantSubsidy wxMerchantSubsidy); | ||||
| List<WxMerchantSubsidyVo> findVoList(WxMerchantSubsidy wxMerchantSubsidy); | |||||
| @@ -2,6 +2,7 @@ package com.iformall.service; | |||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxMerchantSubsidy; | import com.iformall.domain.po.WxMerchantSubsidy; | ||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | |||||
| public interface WxMerchantSubsidyService { | public interface WxMerchantSubsidyService { | ||||
| @@ -13,7 +14,7 @@ public interface WxMerchantSubsidyService { | |||||
| * @param pageSize | * @param pageSize | ||||
| * @return | * @return | ||||
| */ | */ | ||||
| PageInfo<WxMerchantSubsidy> listAsPage(WxMerchantSubsidy record, Integer pageIndex, Integer pageSize); | |||||
| PageInfo<WxMerchantSubsidyVo> listAsPage(WxMerchantSubsidy record, Integer pageIndex, Integer pageSize); | |||||
| /** | /** | ||||
| * 根据Id获得实体 | * 根据Id获得实体 | ||||
| @@ -3,6 +3,7 @@ package com.iformall.service.impl; | |||||
| import com.github.pagehelper.PageHelper; | import com.github.pagehelper.PageHelper; | ||||
| import com.github.pagehelper.PageInfo; | import com.github.pagehelper.PageInfo; | ||||
| import com.iformall.domain.po.WxMerchantSubsidy; | import com.iformall.domain.po.WxMerchantSubsidy; | ||||
| import com.iformall.domain.vo.WxMerchantSubsidyVo; | |||||
| import com.iformall.mapper.WxMerchantSubsidyMapper; | import com.iformall.mapper.WxMerchantSubsidyMapper; | ||||
| import com.iformall.service.WxMerchantSubsidyService; | import com.iformall.service.WxMerchantSubsidyService; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | import org.springframework.beans.factory.annotation.Autowired; | ||||
| @@ -17,8 +18,8 @@ public class WxMerchantSubsidyServiceImpl implements WxMerchantSubsidyService { | |||||
| @Override | @Override | ||||
| public PageInfo<WxMerchantSubsidy> listAsPage(WxMerchantSubsidy record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantSubsidyMapper.findList(record)); | |||||
| public PageInfo<WxMerchantSubsidyVo> listAsPage(WxMerchantSubsidy record, Integer pageIndex, Integer pageSize) { | |||||
| return PageHelper.startPage(pageIndex, pageSize).doSelectPageInfo(() -> wxMerchantSubsidyMapper.findVoList(record)); | |||||
| } | } | ||||
| @Override | @Override | ||||
| @@ -79,6 +79,101 @@ | |||||
| select <include refid="allColumns" /> from wx_merchant_subsidy | select <include refid="allColumns" /> from wx_merchant_subsidy | ||||
| <include refid="dynamicWhereConditions" /> | <include refid="dynamicWhereConditions" /> | ||||
| </select> | </select> | ||||
| <resultMap id="VoBaseResultMap" type="com.iformall.domain.po.WxMerchantSubsidyVo"> | |||||
| <id column="id" jdbcType="BIGINT" property="id" /> | |||||
| <result column="order_id" jdbcType="BIGINT" property="orderId" /> | |||||
| <result column="order_type" jdbcType="INTEGER" property="orderType" /> | |||||
| <result column="merchant_id" jdbcType="BIGINT" property="merchantId" /> | |||||
| <result column="coupon_order_id" jdbcType="BIGINT" property="couponOrderId" /> | |||||
| <result column="coupon_type" jdbcType="INTEGER" property="couponType" /> | |||||
| <result column="order_payment" jdbcType="INTEGER" property="orderPayment" /> | |||||
| <result column="receiver_payment" jdbcType="INTEGER" property="receiverPayment" /> | |||||
| <result column="real_payment" jdbcType="INTEGER" property="realPayment" /> | |||||
| <result column="subsidy" jdbcType="INTEGER" property="subsidy" /> | |||||
| <result column="real_subsidy" jdbcType="INTEGER" property="realSubsidy" /> | |||||
| <result column="status" jdbcType="INTEGER" property="status" /> | |||||
| <result column="create_date" jdbcType="TIMESTAMP" property="createDate" /> | |||||
| <result column="update_date" jdbcType="TIMESTAMP" property="updateDate" /> | |||||
| <result column="cover_img" jdbcType="VARCHAR" property="coverImg" /> | |||||
| <result column="title" jdbcType="VARCHAR" property="title" /> | |||||
| <result column="sub_title" jdbcType="VARCHAR" property="subTitle" /> | |||||
| <result column="detail" jdbcType="VARCHAR" property="detail" /> | |||||
| <result column="unit" jdbcType="INTEGER" property="unit" /> | |||||
| <result column="remark" jdbcType="VARCHAR" property="remark" /> | |||||
| <result column="name" jdbcType="VARCHAR" property="merchantName" /> | |||||
| </resultMap> | |||||
| <sql id="allVoColumns"> | |||||
| ms.`id`,ms.`order_id`,ms.`order_type`,ms.`merchant_id`,ms.`coupon_order_id`,ms.`coupon_type`, | |||||
| ms.`order_payment`,ms.`receiver_payment`,ms.`real_payment`, | |||||
| ms.`subsidy`,ms.`real_subsidy`,ms.`status`,ms.`create_date`,ms.`update_date`, | |||||
| c.`title`,c.`sub_title`,c.`unit`,m.`name` | |||||
| </sql> | |||||
| <sql id="dynamicVoWhereConditions"> | |||||
| where 1 = 1 | |||||
| <if test=" null != id "> | |||||
| and ms.`id` = #{id} | |||||
| </if> | |||||
| <if test=" null != orderId "> | |||||
| and ms.`order_id` = #{orderId} | |||||
| </if> | |||||
| <if test=" null != orderType "> | |||||
| and ms.`order_type` = #{orderType} | |||||
| </if> | |||||
| <if test=" null != merchantId "> | |||||
| and ms.`merchant_id` = #{merchantId} | |||||
| </if> | |||||
| <if test=" null != couponOrderId "> | |||||
| and ms.`coupon_order_id` = #{couponOrderId} | |||||
| </if> | |||||
| <if test=" null != couponType "> | |||||
| and ms.`coupon_type` = #{couponType} | |||||
| </if> | |||||
| <if test=" null != orderPayment "> | |||||
| and ms.`order_payment` = #{orderPayment} | |||||
| </if> | |||||
| <if test=" null != receiverPayment "> | |||||
| and ms.`receiver_payment` = #{receiverPayment} | |||||
| </if> | |||||
| <if test=" null != realPayment "> | |||||
| and ms.`real_payment` = #{realPayment} | |||||
| </if> | |||||
| <if test=" null != subsidy "> | |||||
| and ms.`subsidy` = #{subsidy} | |||||
| </if> | |||||
| <if test=" null != realSubsidy "> | |||||
| and ms.`real_subsidy` = #{realSubsidy} | |||||
| </if> | |||||
| <if test=" null != status "> | |||||
| and ms.`status` = #{status} | |||||
| </if> | |||||
| <if test=" null != createDate "> | |||||
| and ms.`create_date` = #{createDate} | |||||
| </if> | |||||
| <if test=" null != updateDate "> | |||||
| and ms.`update_date` = #{updateDate} | |||||
| </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="findVoList" parameterType="com.iformall.domain.po.WxMerchantSubsidy" resultMap="BaseResultMap"> | |||||
| select <include refid="allVoColumns" /> | |||||
| from wx_merchant_subsidy ms | |||||
| left join wx_coupon_order co on co.id = ms.coupon_order_id | |||||
| left join wx_coupon c on c.id = co.coupon_id | |||||
| left join wx_merchant m on m.id = ms.merchant_id | |||||
| <include refid="dynamicVoWhereConditions" /> | |||||
| </select> | |||||