提交 a8a946b0 authored 作者: 潘鹏's avatar 潘鹏

记录用户行为

上级 08abbfe3
......@@ -27,11 +27,11 @@ import java.util.Map;
@Controller
@RequestMapping("activity")
public class ActivityController {
@Autowired
private ActivityService activityService;
/**
* 查看列表
*/
......@@ -43,6 +43,7 @@ public class ActivityController {
Query query = new Query(params);
List<ActivityEntity> activityList = activityService.queryList(query);
int total = activityService.queryTotal(query);
PageUtils pageUtil = new PageUtils(activityList, total, query.getLimit(), query.getPage());
......
......@@ -30,6 +30,7 @@ import java.util.Map;
@Controller
@RequestMapping("advertisement")
public class AdvertisementController {
@Autowired
private AdvertisementService advertisementService;
......@@ -50,6 +51,7 @@ public class AdvertisementController {
Query query = new Query(params);
List<AdvertisementEntity> advertisementList = advertisementService.queryList(query);
int total = advertisementService.queryTotal(query);
PageUtils pageUtil = new PageUtils(advertisementList, total, query.getLimit(), query.getPage());
......
......@@ -32,6 +32,7 @@ import java.util.stream.Collectors;
@Controller
@RequestMapping("advertisementitem")
public class AdvertisementItemController {
@Autowired
private AdvertisementItemService advertisementItemService;
......@@ -83,6 +84,7 @@ public class AdvertisementItemController {
@ResponseBody
public R saveBatch(@RequestParam("aId") String aId, @RequestParam("itemIds") String itemIds) {
String itemIdArr[] = itemIds.split(",");
for (int i = 0; i < itemIdArr.length; i++) {
Map map = new HashMap();
map.put("adId", aId);
......@@ -95,6 +97,7 @@ public class AdvertisementItemController {
advertisementItem.setItemId(itemIdArr[i]);
advertisementItemService.save(advertisementItem);
}
return R.ok();
}
......
......@@ -36,9 +36,9 @@ public class ApiSmsController {
/**
* 发送短信
* mobile:电话号码字符串,中间用英文逗号间隔
* mobile: 电话号码字符串,中间用英文逗号间隔
* content:内容字符串
* stime:追加发送时间,可为空,为空为及时发送
* stime: 追加发送时间,可为空,为空为及时发送
*/
@IgnoreAuth
@RequestMapping("/sendSms")
......
package com.platform.controller;
import com.platform.entity.TbCfCountBehaviorEntity;
import com.platform.service.TbCfCountBehaviorService;
import com.platform.utils.PageUtils;
import com.platform.utils.Query;
import com.platform.utils.R;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
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.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
import java.util.Map;
/**
* 记录用户点击购买或者加入购物车次数Controller
*
* @author lipengjun
* @date 2021-03-26 16:17:11
*/
@Controller
@RequestMapping("tbcfcountbehavior")
public class TbCfCountBehaviorController {
@Autowired
private TbCfCountBehaviorService tbCfCountBehaviorService;
/**
* 查看列表
*/
@RequestMapping("/list")
@RequiresPermissions("tbcfcountbehavior:list")
@ResponseBody
public R list(@RequestParam Map<String, Object> params) {
//查询列表数据
Query query = new Query(params);
List<TbCfCountBehaviorEntity> tbCfCountBehaviorList = tbCfCountBehaviorService.queryList(query);
int total = tbCfCountBehaviorService.queryTotal(query);
PageUtils pageUtil = new PageUtils(tbCfCountBehaviorList, total, query.getLimit(), query.getPage());
return R.ok().put("page", pageUtil);
}
/**
* 查看信息
*/
@RequestMapping("/info/{id}")
@RequiresPermissions("tbcfcountbehavior:info")
@ResponseBody
public R info(@PathVariable("id") String id) {
TbCfCountBehaviorEntity tbCfCountBehavior = tbCfCountBehaviorService.queryObject(id);
return R.ok().put("tbCfCountBehavior", tbCfCountBehavior);
}
/**
* 保存
*/
@RequestMapping("/save")
@RequiresPermissions("tbcfcountbehavior:save")
@ResponseBody
public R save(@RequestBody TbCfCountBehaviorEntity tbCfCountBehavior) {
tbCfCountBehaviorService.save(tbCfCountBehavior);
return R.ok();
}
/**
* 修改
*/
@RequestMapping("/update")
@RequiresPermissions("tbcfcountbehavior:update")
@ResponseBody
public R update(@RequestBody TbCfCountBehaviorEntity tbCfCountBehavior) {
tbCfCountBehaviorService.update(tbCfCountBehavior);
return R.ok();
}
/**
* 删除
*/
@RequestMapping("/delete")
@RequiresPermissions("tbcfcountbehavior:delete")
@ResponseBody
public R delete(@RequestBody String[] ids) {
tbCfCountBehaviorService.deleteBatch(ids);
return R.ok();
}
/**
* 查看所有列表
*/
@RequestMapping("/queryAll")
@ResponseBody
public R queryAll(@RequestParam Map<String, Object> params) {
List<TbCfCountBehaviorEntity> list = tbCfCountBehaviorService.queryList(params);
return R.ok().put("list", list);
}
}
......@@ -44,6 +44,7 @@ public class TermController {
Query query = new Query(params);
List<TermEntity> termList = termService.queryList(query);
int total = termService.queryTotal(query);
PageUtils pageUtil = new PageUtils(termList, total, query.getLimit(), query.getPage());
......
package com.platform.dao;
import com.platform.entity.TbCfCountBehaviorEntity;
/**
* 记录用户点击购买或者加入购物车次数Dao
*
* @author lipengjun
* @date 2021-03-26 16:17:11
*/
public interface TbCfCountBehaviorDao extends BaseDao<TbCfCountBehaviorEntity> {
}
package com.platform.entity;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 记录用户点击购买或者加入购物车次数实体
* 表名 tb_cf_count_behavior
*
* @author chenzhihao
* @date 2021-03-26 16:17:11
*/
public class TbCfCountBehaviorEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* id
*/
private String id;
/**
* 用户id
*/
private String userId;
/**
* 商品id
*/
private String itemId;
/**
* skuId
*/
private String itemSku;
/**
* SKU商品详情数量
*/
private Integer skuNumber;
/**
* 商品总额
*/
private BigDecimal itemSkuTotal;
/**
* 创建时间
*/
private Date createDate;
/**
* 记录在那个接口进行计数
*/
private String apiUrl;
/**
* 记录当前api总数
*/
private Integer count;
/**
* 1/APP - 2/PC - 3/M端
*/
private String soure;
/**
* 设置:id
*/
public void setId(String id) {
this.id = id;
}
/**
* 获取:id
*/
public String getId() {
return id;
}
/**
* 设置:用户id
*/
public void setUserId(String userId) {
this.userId = userId;
}
/**
* 获取:用户id
*/
public String getUserId() {
return userId;
}
/**
* 设置:商品id
*/
public void setItemId(String itemId) {
this.itemId = itemId;
}
/**
* 获取:商品id
*/
public String getItemId() {
return itemId;
}
/**
* 设置:skuId
*/
public void setItemSku(String itemSku) {
this.itemSku = itemSku;
}
/**
* 获取:skuId
*/
public String getItemSku() {
return itemSku;
}
/**
* 设置:SKU商品详情数量
*/
public void setSkuNumber(Integer skuNumber) {
this.skuNumber = skuNumber;
}
/**
* 获取:SKU商品详情数量
*/
public Integer getSkuNumber() {
return skuNumber;
}
/**
* 设置:商品总额
*/
public void setItemSkuTotal(BigDecimal itemSkuTotal) {
this.itemSkuTotal = itemSkuTotal;
}
/**
* 获取:商品总额
*/
public BigDecimal getItemSkuTotal() {
return itemSkuTotal;
}
/**
* 设置:创建时间
*/
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
/**
* 获取:创建时间
*/
public Date getCreateDate() {
return createDate;
}
/**
* 设置:记录在那个接口进行计数
*/
public void setApiUrl(String apiUrl) {
this.apiUrl = apiUrl;
}
/**
* 获取:记录在那个接口进行计数
*/
public String getApiUrl() {
return apiUrl;
}
/**
* 设置:记录当前api总数
*/
public void setCount(Integer count) {
this.count = count;
}
/**
* 获取:记录当前api总数
*/
public Integer getCount() {
return count;
}
/**
* 设置:1/APP - 2/PC - 3/M端
*/
public void setSoure(String soure) {
this.soure = soure;
}
/**
* 获取:1/APP - 2/PC - 3/M端
*/
public String getSoure() {
return soure;
}
}
package com.platform.service;
import com.platform.entity.TbCfCountBehaviorEntity;
import java.util.List;
import java.util.Map;
/**
* 记录用户点击购买或者加入购物车次数Service接口
*
* @author lipengjun
* @date 2021-03-26 16:17:11
*/
public interface TbCfCountBehaviorService {
/**
* 根据主键查询实体
*
* @param id 主键
* @return 实体
*/
TbCfCountBehaviorEntity queryObject(String id);
/**
* 分页查询
*
* @param map 参数
* @return list
*/
List<TbCfCountBehaviorEntity> queryList(Map<String, Object> map);
/**
* 分页统计总数
*
* @param map 参数
* @return 总数
*/
int queryTotal(Map<String, Object> map);
/**
* 保存实体
*
* @param tbCfCountBehavior 实体
* @return 保存条数
*/
int save(TbCfCountBehaviorEntity tbCfCountBehavior);
/**
* 根据主键更新实体
*
* @param tbCfCountBehavior 实体
* @return 更新条数
*/
int update(TbCfCountBehaviorEntity tbCfCountBehavior);
/**
* 根据主键删除
*
* @param id
* @return 删除条数
*/
int delete(String id);
/**
* 根据主键批量删除
*
* @param ids
* @return 删除条数
*/
int deleteBatch(String[] ids);
}
package com.platform.service.impl;
import com.platform.dao.TbCfCountBehaviorDao;
import com.platform.entity.TbCfCountBehaviorEntity;
import com.platform.service.TbCfCountBehaviorService;
import com.platform.utils.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.Map;
/**
* 记录用户点击购买或者加入购物车次数Service实现类
*
* @author lipengjun
* @date 2021-03-26 16:17:11
*/
@Service("tbCfCountBehaviorService")
public class TbCfCountBehaviorServiceImpl implements TbCfCountBehaviorService {
@Autowired
private TbCfCountBehaviorDao tbCfCountBehaviorDao;
@Override
public TbCfCountBehaviorEntity queryObject(String id) {
return tbCfCountBehaviorDao.queryObject(id);
}
@Override
public List<TbCfCountBehaviorEntity> queryList(Map<String, Object> map) {
return tbCfCountBehaviorDao.queryList(map);
}
@Override
public int queryTotal(Map<String, Object> map) {
return tbCfCountBehaviorDao.queryTotal(map);
}
@Override
public int save(TbCfCountBehaviorEntity tbCfCountBehavior) {
tbCfCountBehavior.setId(IdUtil.createIdbyUUID());
return tbCfCountBehaviorDao.save(tbCfCountBehavior);
}
@Override
public int update(TbCfCountBehaviorEntity tbCfCountBehavior) {
return tbCfCountBehaviorDao.update(tbCfCountBehavior);
}
@Override
public int delete(String id) {
return tbCfCountBehaviorDao.delete(id);
}
@Override
public int deleteBatch(String[] ids) {
return tbCfCountBehaviorDao.deleteBatch(ids);
}
}
<?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.platform.dao.TbCfCountBehaviorDao">
<resultMap type="com.platform.entity.TbCfCountBehaviorEntity" id="tbCfCountBehaviorMap">
<result property="id" column="id"/>
<result property="userId" column="user_Id"/>
<result property="itemId" column="item_id"/>
<result property="itemSku" column="item_sku"/>
<result property="skuNumber" column="sku_number"/>
<result property="itemSkuTotal" column="item_sku_total"/>
<result property="createDate" column="create_date"/>
<result property="apiUrl" column="api_url"/>
<result property="count" column="count"/>
<result property="soure" column="soure"/>
</resultMap>
<select id="queryObject" resultType="com.platform.entity.TbCfCountBehaviorEntity">
select
`id`,
`user_Id`,
`item_id`,
`item_sku`,
`sku_number`,
`item_sku_total`,
`create_date`,
`api_url`,
`count`,
`soure`
from tb_cf_count_behavior
where id = #{id}
</select>
<select id="queryList" resultType="com.platform.entity.TbCfCountBehaviorEntity">
select
`id`,
`user_Id`,
`item_id`,
`item_sku`,
`sku_number`,
`item_sku_total`,
`create_date`,
`api_url`,
`count`,
`soure`
from tb_cf_count_behavior
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
<choose>
<when test="sidx != null and sidx.trim() != ''">
order by ${sidx} ${order}
</when>
<otherwise>
order by id desc
</otherwise>
</choose>
<if test="offset != null and limit != null">
limit #{offset}, #{limit}
</if>
</select>
<select id="queryTotal" resultType="int">
select count(*) from tb_cf_count_behavior
WHERE 1=1
<if test="name != null and name.trim() != ''">
AND name LIKE concat('%',#{name},'%')
</if>
</select>
<insert id="save" parameterType="com.platform.entity.TbCfCountBehaviorEntity">
insert into tb_cf_count_behavior(
`id`,
`user_Id`,
`item_id`,
`item_sku`,
`sku_number`,
`item_sku_total`,
`create_date`,
`api_url`,
`count`,
`soure`)
values(
#{id},
#{userId},
#{itemId},
#{itemSku},
#{skuNumber},
#{itemSkuTotal},
#{createDate},
#{apiUrl},
#{count},
#{soure})
</insert>
<update id="update" parameterType="com.platform.entity.TbCfCountBehaviorEntity">
update tb_cf_count_behavior
<set>
<if test="userId != null">`user_Id` = #{userId}, </if>
<if test="itemId != null">`item_id` = #{itemId}, </if>
<if test="itemSku != null">`item_sku` = #{itemSku}, </if>
<if test="skuNumber != null">`sku_number` = #{skuNumber}, </if>
<if test="itemSkuTotal != null">`item_sku_total` = #{itemSkuTotal}, </if>
<if test="createDate != null">`create_date` = #{createDate}, </if>
<if test="apiUrl != null">`api_url` = #{apiUrl}, </if>
<if test="count != null">`count` = #{count}, </if>
<if test="soure != null">`soure` = #{soure}</if>
</set>
where id = #{id}
</update>
<delete id="delete">
delete from tb_cf_count_behavior where id = #{value}
</delete>
<delete id="deleteBatch">
delete from tb_cf_count_behavior where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>
\ No newline at end of file
......@@ -114,19 +114,24 @@
<when test="tested != null and tested.trim() != ''">
AND o.tested=#{tested}
</when>
<otherwise>
AND o.tested is null
</otherwise>
</choose>
<if test="name != null and name.trim() != ''">
AND o.order_no LIKE concat('%',#{name},'%')
</if>
<if test="userName != null and userName.trim() != ''">
AND o.user_name LIKE concat('%',#{userName},'%')
</if>
<if test="orderStatus != null and orderStatus.trim() != ''">
AND o.order_status LIKE concat('%',#{orderStatus},'%')
</if>
<!-- <if test="start != null and start.trim() != '' ">
AND o.order_time <![CDATA[>=]]> CONCAT('', #{start},' 00:00:00')
</if>
......@@ -136,15 +141,19 @@
<if test="start != null and start.trim() != '' and end != null and end.trim() != ''">
AND o.order_time between #{start} and #{end}
</if>
<if test="payWayCode != null and payWayCode.trim() != ''">
AND f.pay_way_code =#{payWayCode}
</if>
<if test="deliveryFlag != null and deliveryFlag.trim() != ''">
AND o.delivery_flag =#{deliveryFlag}
</if>
<if test="payStatus != null and payStatus.trim() != ''">
AND o.pay_status =#{payStatus}
</if>
</select>
<!--查询代购订单列表-->
......
......@@ -7,9 +7,7 @@
#jdbc.password=diaoyun666
#jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.url: jdbc:mysql://159.138.48.71:3306/test?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.url: jdbc:mysql://159.138.48.71:3306/chinafrica?useUnicode=true&characterEncoding=UTF-8&rewriteBatchedStatements=true&autoReconnect=true&failOverReadOnly=false&zeroDateTimeBehavior=convertToNull&useSSL=false
jdbc.username: root
jdbc.password: AfriShop_date@2#!&*8
......
......@@ -9,14 +9,19 @@ import java.util.List;
*/
public class PageUtils implements Serializable {
private static final long serialVersionUID = 1L;
//总记录数
private int totalCount;
//每页记录数
private int pageSize;
//总页数
private int totalPage;
//当前页数
private int currPage;
//列表数据
private List<?> list;
......
......@@ -10,6 +10,7 @@ import java.util.Map;
*
*/
public class Query extends LinkedHashMap<String, Object> {
private static final long serialVersionUID = 1L;
//当前页码
private int page;
......@@ -22,6 +23,7 @@ public class Query extends LinkedHashMap<String, Object> {
//分页参数
this.page = Integer.parseInt(params.get("page").toString());
this.limit = Integer.parseInt(params.get("limit").toString());
this.put("offset", (page - 1) * limit);
this.put("page", page);
this.put("limit", limit);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论