Merge remote-tracking branch 'origin/master'
New file |
| | |
| | | package com.yeshi.fanli.controller.admin;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.io.InputStream;
|
| | | import java.io.PrintWriter;
|
| | | import java.util.HashMap;
|
| | | import java.util.List;
|
| | | import java.util.Map;
|
| | | import java.util.UUID;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.multipart.MultipartFile;
|
| | | import org.springframework.web.multipart.MultipartHttpServletRequest;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | | import org.yeshi.utils.tencentcloud.COSManager;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | | import com.google.gson.GsonBuilder;
|
| | | import com.yeshi.fanli.dto.dynamic.ActivityUserRule;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | | import com.yeshi.fanli.tag.PageEntity;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | import net.sf.json.JSONArray;
|
| | | import net.sf.json.JSONObject;
|
| | |
|
| | | @Controller
|
| | | @RequestMapping("admin/new/api/v1/activityuser")
|
| | | public class ActivityUserAdminController {
|
| | |
|
| | | @Resource
|
| | | private ActivityUserService activityUserService;
|
| | |
|
| | | private String uploadPic(MultipartFile file) {
|
| | | // 文件解析
|
| | | try {
|
| | | InputStream inputStream = file.getInputStream();
|
| | | String contentType = file.getContentType();
|
| | | String type = contentType.substring(contentType.indexOf("/") + 1);
|
| | | // 文件路径
|
| | | String filePath = "/img/GoodsSubClass/" + UUID.randomUUID().toString().replace("-", "") + "." + type;
|
| | | // 执行上传
|
| | | String fileLink = COSManager.getInstance().uploadFile(inputStream, filePath).getUrl();
|
| | | return fileLink;
|
| | | } catch (IOException e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return null;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取活动用户列表
|
| | | * |
| | | * @param callback
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listActivityUserRules")
|
| | | public void listActivityUserRules(String callback, PrintWriter out) {
|
| | | ActivityUserRule[] rules = ActivityRuleUser.RULES;
|
| | | JSONArray array = new JSONArray();
|
| | | for (ActivityUserRule rule : rules) {
|
| | | array.add(rule);
|
| | | }
|
| | | out.print(callback + "(" + JsonUtil.loadTrueResult(array) + ")");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 获取用户列表
|
| | | * |
| | | * @param callback
|
| | | * @param rule
|
| | | * @param out
|
| | | */
|
| | | @RequestMapping(value = "listActivityUser")
|
| | | public void listActivityUser(String callback, Integer rule, int pageIndex, int pageSize, PrintWriter out) {
|
| | | List<ActivityRuleUser> list = activityUserService.listByRuleCode(rule, 1, 100);
|
| | | long count = activityUserService.countByRuleCode(rule);
|
| | | JSONObject data = new JSONObject();
|
| | | JSONArray dataArray = new JSONArray();
|
| | | Map<Integer, ActivityUserRule> ruleMap = new HashMap<>();
|
| | |
|
| | | Gson gson = new GsonBuilder().setDateFormat("yyyy-MM-dd HH:mm").create();
|
| | |
|
| | | for (ActivityUserRule r : ActivityRuleUser.RULES)
|
| | | ruleMap.put(r.getRuleCode(), r);
|
| | |
|
| | | for (ActivityRuleUser r : list) {
|
| | | if (r.getRuleCode() != null)
|
| | | r.setRule(ruleMap.get(r.getRuleCode()));
|
| | | dataArray.add(gson.toJson(r));
|
| | | }
|
| | | data.put("data", dataArray);
|
| | | data.put("pe", new PageEntity(pageIndex, pageSize, count,
|
| | | (int) (count % pageSize == 0 ? count / pageSize : count / pageSize + 1)));
|
| | | if (StringUtil.isNullOrEmpty(callback)) {
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | } else {
|
| | | out.print(callback + "(" + JsonUtil.loadTrueResult(data) + ")");
|
| | | }
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "deleteActivityUser")
|
| | | public void deleteActivityUsers(String callback, String ids, PrintWriter out) {
|
| | | JSONArray array = JSONArray.fromObject(ids);
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | // 删除
|
| | | if (array.optLong(i) != 1L) {
|
| | | activityUserService.deleteByRuleUserId(array.optLong(i));
|
| | | }
|
| | | }
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("删除成功"));
|
| | | }
|
| | |
|
| | | @RequestMapping(value = "saveActivityUser")
|
| | | public void save(String callback, ActivityRuleUser user, HttpServletRequest request, PrintWriter out) {
|
| | |
|
| | | if (user == null || user.getRuleCode() == null || user.getActivityUser() == null) {
|
| | | out.print(callback + "(" + JsonUtil.loadFalseResult("数据不完整") + ")");
|
| | | return;
|
| | | }
|
| | |
|
| | | String picUrl = null;
|
| | |
|
| | | if (request instanceof MultipartHttpServletRequest) {
|
| | | MultipartHttpServletRequest fileRequest = (MultipartHttpServletRequest) request;
|
| | | MultipartFile multipartFile = fileRequest.getFile("file");
|
| | | if (multipartFile != null)
|
| | | picUrl = uploadPic(multipartFile);
|
| | | }
|
| | |
|
| | | if (user.getId() != null)// 更改
|
| | | {
|
| | | ActivityRuleUser old = activityUserService.selectRuleUserByPrimaryKey(user.getId());
|
| | | if (old != null) {
|
| | | // 更改里面的用户与昵称
|
| | | if (old.getActivityUser() != null) {
|
| | | ActivityUser update = new ActivityUser(old.getActivityUser().getId());
|
| | | update.setNickName(user.getActivityUser().getNickName());
|
| | | update.setPortrait(picUrl);
|
| | | activityUserService.updateActivityUser(update);
|
| | | }
|
| | | }
|
| | | user.setActivityUser(null);
|
| | | activityUserService.updateActivityRuleUser(user);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | } else {// 新增
|
| | | user.getActivityUser().setPortrait(picUrl);
|
| | | activityUserService.addActivityRuleUser(user);
|
| | | JsonUtil.printMode(out, callback, JsonUtil.loadTrueResult("保存成功"));
|
| | | }
|
| | |
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | public void insertIOSDeviceToken(AcceptData acceptData, String deviceToken, PrintWriter out) {
|
| | | if (!StringUtil.isNullOrEmpty(acceptData.getDevice()) && !StringUtil.isNullOrEmpty(deviceToken)) {
|
| | | // 添加设备活跃记录
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDeviceToken(deviceToken);
|
| | | da.setPlatform(DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setDevice(acceptData.getDevice());
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | iosPushService.addDeviceToken(null, Integer.parseInt(acceptData.getVersion()), deviceToken,
|
| | | acceptData.getDevice());
|
| | | out.print(JsonUtil.loadTrue(0, null, "成功"));
|
| | |
| | | @RequestMapping(value = "/uidBindDeviceToken", method = RequestMethod.POST)
|
| | | public void uidBindIOSDeviceToken(AcceptData acceptData, Long uid, String deviceToken, PrintWriter out) {
|
| | | if (uid != null && uid != 0 && !StringUtil.isNullOrEmpty(deviceToken)) {
|
| | | // 添加设备活跃记录
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDeviceToken(deviceToken);
|
| | | da.setPlatform(DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setDevice(acceptData.getDevice());
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | // 添加token
|
| | | iosPushService.addDeviceToken(uid, Integer.parseInt(acceptData.getVersion()), deviceToken,
|
| | | acceptData.getDevice());
|
| | |
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | | import javax.servlet.http.HttpServletRequest;
|
| | |
|
| | | import org.apache.commons.beanutils.PropertyUtils;
|
| | | import org.springframework.stereotype.Controller;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.yeshi.utils.IPUtil;
|
| | | import org.yeshi.utils.JsonUtil;
|
| | |
|
| | | import com.google.gson.Gson;
|
| | |
| | |
|
| | | @Resource
|
| | | private DeviceActiveService deviceActiveService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private CustomerContentService customerContentService;
|
| | |
|
| | | @RequestMapping("getsystemclientparams")
|
| | | public void getSystemClientParams(AcceptData acceptData, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(), acceptData.getPackages());
|
| | | public void getSystemClientParams(AcceptData acceptData, HttpServletRequest request, PrintWriter out) {
|
| | | BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
|
| | | acceptData.getPackages());
|
| | | if (system == null) {
|
| | | out.print("系统不存在");
|
| | | return;
|
| | | }
|
| | | List<SystemClientParams> systemClientParamsList = systemClientParamsService
|
| | | .getSystemClientParamsBySystemId(system.getId(),Integer.parseInt(acceptData.getVersion()));
|
| | | .getSystemClientParamsBySystemId(system.getId(), Integer.parseInt(acceptData.getVersion()));
|
| | | if (systemClientParamsList == null || systemClientParamsList.size() == 0) {
|
| | | out.print(JsonUtil.loadFalseResult("暂无数据"));
|
| | | return;
|
| | |
| | | // 老版本weex(1.5.1之前的)
|
| | | ssp.setValue("http://ec-1255749512.file.myqcloud.com/resource/weex/flq_index_v2.js");
|
| | | } else if ("ios".equalsIgnoreCase(acceptData.getPlatform())
|
| | | && Integer.parseInt(acceptData.getVersion()) < 44&&system.getId().longValue()!=5L)
|
| | | && Integer.parseInt(acceptData.getVersion()) < 44 && system.getId().longValue() != 5L)
|
| | | ssp.setValue("http://ec-1255749512.file.myqcloud.com/resource/weex/flq_index_v2.js");
|
| | | }
|
| | | list.add(ssp);
|
| | |
| | | data.put("count", list.size());
|
| | | data.put("systemClientParamsList", gson.toJson(list));
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | | String ipInfo = IPUtil.getRemotIP(request) + ":" + request.getRemotePort();
|
| | | ThreadUtil.run(new Runnable() {
|
| | | @Override
|
| | | public void run() {
|
| | | try {
|
| | | // 安卓平台添加设备活跃记录
|
| | | if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDevice(acceptData.getDevice());
|
| | | da.setPlatform(DeviceActive.PLATFORM_ANDROID);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | }
|
| | |
|
| | | DeviceActive da = new DeviceActive();
|
| | | da.setDevice(acceptData.getDevice());
|
| | | da.setPlatform("android".equalsIgnoreCase(acceptData.getPlatform()) ? DeviceActive.PLATFORM_ANDROID
|
| | | : DeviceActive.PLATFORM_IOS);
|
| | | da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
|
| | | da.setIpInfo(ipInfo);
|
| | | deviceActiveService.addDeviceActive(da);
|
| | | } catch (Exception e) {
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.activity; |
| | | |
| | | import java.util.List; |
| | | |
| | | import org.apache.ibatis.annotations.Param; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser; |
| | | |
| | | public interface ActivityRuleUserMapper extends BaseMapper<ActivityRuleUser> { |
| | | |
| | | /** |
| | | * 根据用户ID与规则码查询 |
| | | * |
| | | * @param userId |
| | | * @param ruleCode |
| | | * @return |
| | | */ |
| | | ActivityRuleUser selectByUserIdAndRuleCode(@Param("userId") Long userId, @Param("ruleCode") int ruleCode); |
| | | |
| | | /** |
| | | * 根据角色获取列表 |
| | | * |
| | | * @param ruleCode |
| | | * @param start |
| | | * @param count |
| | | * @return |
| | | */ |
| | | List<ActivityRuleUser> listByRuleCode(@Param("ruleCode")Integer ruleCode,@Param("start") int start,@Param("count") int count); |
| | | |
| | | /** |
| | | * 根据 |
| | | * @param ruleCode |
| | | * @return |
| | | */ |
| | | long countByRuleCode(Integer ruleCode); |
| | | |
| | | } |
| | |
| | | * @return |
| | | */ |
| | | List<ActivityUser> listRand(@Param("count") int count); |
| | | |
| | | /** |
| | | * 根据名称检索 |
| | | * @param name |
| | | * @return |
| | | */ |
| | | ActivityUser selectByName(String name); |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.dto.dynamic;
|
| | |
|
| | | /**
|
| | | * 动态用户身份
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public class ActivityUserRule {
|
| | | private int ruleCode;
|
| | | private String ruleName;
|
| | |
|
| | | public ActivityUserRule() {
|
| | |
|
| | | }
|
| | |
|
| | | public ActivityUserRule(int ruleCode, String ruleName) {
|
| | | this.ruleCode = ruleCode;
|
| | | this.ruleName = ruleName;
|
| | | }
|
| | |
|
| | | public int getRuleCode() {
|
| | | return ruleCode;
|
| | | }
|
| | |
|
| | | public void setRuleCode(int ruleCode) {
|
| | | this.ruleCode = ruleCode;
|
| | | }
|
| | |
|
| | | public String getRuleName() {
|
| | | return ruleName;
|
| | | }
|
| | |
|
| | | public void setRuleName(String ruleName) {
|
| | | this.ruleName = ruleName;
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.entity.bus.activity;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | import com.yeshi.fanli.dto.dynamic.ActivityUserRule;
|
| | |
|
| | | /**
|
| | | * 动态用户列表
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_activity_rule_user")
|
| | | public class ActivityRuleUser {
|
| | |
|
| | | public final static int RULE_DEFAULT = 1;// 默认
|
| | | public final static int RULE_HOT = 100;
|
| | | public final static int RULE_HOT_JUJIA = 100 + 4;
|
| | | public final static int RULE_HOT_MEISHI = 100 + 6;
|
| | | public final static int RULE_HOT_MUYIN = 100 + 2;
|
| | | public final static int RULE_HOT_MEIZHUANG = 100 + 3;
|
| | | public final static int RULE_HOT_NVZHUANG = 100 + 1;
|
| | | public final static int RULE_HOT_SHUMAJIADIAN = 100 + 8;
|
| | | public final static int RULE_HOT_WENYUCHEPIN = 100 + 7;
|
| | | public final static int RULE_HOT_NEIYI = 100 + 10;
|
| | | public final static int RULE_HOT_JIAZHUANGJIAFANG = 100 + 14;
|
| | | public final static int RULE_HOT_XIEPIN = 100 + 5;
|
| | | public final static int RULE_HOT_NANZHUANG = 100 + 9;
|
| | | public final static int RULE_HOT_PEISHI = 100 + 12;
|
| | | public final static int RULE_HOT_HUWAI = 100 + 13;
|
| | | public final static int RULE_HOT_XIANGBAO = 100 + 11;
|
| | | public final static int RULE_HAOHUO = 200;
|
| | |
|
| | | public static ActivityUserRule[] RULES = new ActivityUserRule[] { new ActivityUserRule(RULE_DEFAULT, "默认"),
|
| | | new ActivityUserRule(RULE_HOT, "单品热销"), new ActivityUserRule(RULE_HOT_JUJIA, "居家百货"),
|
| | | new ActivityUserRule(RULE_HOT_MEISHI, "美食"), new ActivityUserRule(RULE_HOT_MUYIN, "母婴"),
|
| | | new ActivityUserRule(RULE_HOT_MEIZHUANG, "美妆"), new ActivityUserRule(RULE_HOT_NVZHUANG, "女装"),
|
| | | new ActivityUserRule(RULE_HOT_SHUMAJIADIAN, "数码家电"), new ActivityUserRule(RULE_HOT_WENYUCHEPIN, "文娱车品"),
|
| | | new ActivityUserRule(RULE_HOT_NEIYI, "内衣"), new ActivityUserRule(RULE_HOT_JIAZHUANGJIAFANG, "家装家纺"),
|
| | | new ActivityUserRule(RULE_HOT_XIEPIN, "鞋品"), new ActivityUserRule(RULE_HOT_NANZHUANG, "男装"),
|
| | | new ActivityUserRule(RULE_HOT_PEISHI, "配饰"), new ActivityUserRule(RULE_HOT_HUWAI, "户外"),
|
| | | new ActivityUserRule(RULE_HOT_XIANGBAO, "箱包"), new ActivityUserRule(RULE_HAOHUO, "好货推荐"), };
|
| | |
|
| | | @Column(name = "aru_id")
|
| | | private Long id;
|
| | | @Column(name = "aru_id_user_id")
|
| | | private ActivityUser activityUser;
|
| | | @Column(name = "aru_rule_code")
|
| | | private Integer ruleCode;// 规则编码
|
| | | @Column(name = "aru_order_by")
|
| | | private Integer orderBy;
|
| | | @Column(name = "aru_create_time")
|
| | | private Date createTime;
|
| | |
|
| | | private ActivityUserRule rule;// 身份
|
| | |
|
| | | public ActivityUserRule getRule() {
|
| | | return rule;
|
| | | }
|
| | |
|
| | | public void setRule(ActivityUserRule rule) {
|
| | | this.rule = rule;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public ActivityUser getActivityUser() {
|
| | | return activityUser;
|
| | | }
|
| | |
|
| | | public void setActivityUser(ActivityUser activityUser) {
|
| | | this.activityUser = activityUser;
|
| | | }
|
| | |
|
| | | public Integer getRuleCode() {
|
| | | return ruleCode;
|
| | | }
|
| | |
|
| | | public void setRuleCode(Integer ruleCode) {
|
| | | this.ruleCode = ruleCode;
|
| | | }
|
| | |
|
| | | public Integer getOrderBy() {
|
| | | return orderBy;
|
| | | }
|
| | |
|
| | | public void setOrderBy(Integer orderBy) {
|
| | | this.orderBy = orderBy;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | private Date createTime;
|
| | | @Column(name = "da_updatetime")
|
| | | private Date updateTime;
|
| | | @Column(name = "da_ip")
|
| | | private String ipInfo;
|
| | |
|
| | | public String getIpInfo() {
|
| | | return ipInfo;
|
| | | }
|
| | |
|
| | | public void setIpInfo(String ipInfo) {
|
| | | this.ipInfo = ipInfo;
|
| | | }
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
New file |
| | |
| | | <?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.yeshi.fanli.dao.mybatis.activity.ActivityRuleUserMapper"> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.activity.ActivityRuleUser"> |
| | | <id column="aru_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="aru_rule_code" property="ruleCode" jdbcType="INTEGER" /> |
| | | <result column="aru_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | <result column="aru_create_time" property="createTime" |
| | | jdbcType="TIMESTAMP" /> |
| | | <association property="activityUser" column="aru_id_user_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper.selectByPrimaryKey"></association> |
| | | |
| | | </resultMap> |
| | | <sql id="Base_Column_List">aru_id,aru_id_user_id,aru_rule_code,aru_order_by,aru_create_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_activity_rule_user where aru_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByUserIdAndRuleCode" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_activity_rule_user where aru_id_user_id = #{userId} and |
| | | aru_rule_code=#{ruleCode} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="listByRuleCode" resultMap="BaseResultMap"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_activity_rule_user where aru_rule_code=#{ruleCode} order |
| | | by aru_order_by limit #{start},#{count} |
| | | </select> |
| | | |
| | | |
| | | <select id="countByRuleCode" resultType="java.lang.Long" |
| | | parameterType="java.lang.Integer"> |
| | | select |
| | | count(aru_id) |
| | | from yeshi_ec_activity_rule_user |
| | | where aru_rule_code=#{0} |
| | | </select> |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_activity_rule_user where aru_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.ActivityRuleUser" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_activity_rule_user |
| | | (aru_id,aru_id_user_id,aru_rule_code,aru_order_by,aru_create_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{activityUser.id,jdbcType=BIGINT},#{ruleCode,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.ActivityRuleUser" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_activity_rule_user |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">aru_id,</if> |
| | | <if test="activityUser != null">aru_id_user_id,</if> |
| | | <if test="ruleCode != null">aru_rule_code,</if> |
| | | <if test="orderBy != null">aru_order_by,</if> |
| | | <if test="createTime != null">aru_create_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="activityUser != null">#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="ruleCode != null">#{ruleCode,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.ActivityRuleUser">update yeshi_ec_activity_rule_user set aru_id_user_id = |
| | | #{activityUser.id,jdbcType=BIGINT},aru_rule_code = |
| | | #{ruleCode,jdbcType=INTEGER},aru_order_by = |
| | | #{orderBy,jdbcType=INTEGER},aru_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP} where aru_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.ActivityRuleUser"> |
| | | update yeshi_ec_activity_rule_user |
| | | <set> |
| | | <if test="activityUser != null">aru_id_user_id=#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="ruleCode != null">aru_rule_code=#{ruleCode,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">aru_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">aru_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where aru_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_activity_user ORDER BY RAND() LIMIT #{count} |
| | | </select> |
| | | |
| | | <select id="selectByName" resultMap="BaseResultMap" parameterType="java.lang.String"> |
| | | SELECT |
| | | <include refid="Base_Column_List" /> |
| | | FROM yeshi_ec_activity_user where au_nick_name=#{0} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_activity_user where au_id = #{id,jdbcType=BIGINT} |
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.bus.activity.RecommendActivity"> |
| | | <id column="ar_id" property="id" jdbcType="BIGINT"/> |
| | | <result column="ar_title" property="title" jdbcType="VARCHAR"/> |
| | | <result column="ar_type" property="type" jdbcType="INTEGER"/> |
| | | <result column="ar_order_by" property="orderBy" jdbcType="INTEGER"/> |
| | | <result column="ar_share_count" property="shareCount" jdbcType="INTEGER"/> |
| | | <result column="ar_total_getmoney" property="totalGetMoney" jdbcType="VARCHAR"/> |
| | | <result column="ar_video_post_picture" property="videoPostPictire" jdbcType="VARCHAR"/> |
| | | <result column="ar_video_url" property="videoUrl" jdbcType="VARCHAR"/> |
| | | <result column="ar_create_time" property="createTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ar_top" property="top" jdbcType="BOOLEAN"/> |
| | | <result column="ar_start_time" property="startTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ar_end_time" property="endTime" jdbcType="TIMESTAMP"/> |
| | | <result column="ar_state" property="state" jdbcType="INTEGER"/> |
| | | |
| | | <association property="activityUser" column="ar_activity_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper.BaseResultMap" /> |
| | | <resultMap id="BaseResultMap" |
| | | type="com.yeshi.fanli.entity.bus.activity.RecommendActivity"> |
| | | <id column="ar_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="ar_title" property="title" jdbcType="VARCHAR" /> |
| | | <result column="ar_type" property="type" jdbcType="INTEGER" /> |
| | | <result column="ar_order_by" property="orderBy" jdbcType="INTEGER" /> |
| | | <result column="ar_share_count" property="shareCount" jdbcType="INTEGER" /> |
| | | <result column="ar_total_getmoney" property="totalGetMoney" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="ar_video_post_picture" property="videoPostPictire" |
| | | jdbcType="VARCHAR" /> |
| | | <result column="ar_video_url" property="videoUrl" jdbcType="VARCHAR" /> |
| | | <result column="ar_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="ar_top" property="top" jdbcType="BOOLEAN" /> |
| | | <result column="ar_start_time" property="startTime" jdbcType="TIMESTAMP" /> |
| | | <result column="ar_end_time" property="endTime" jdbcType="TIMESTAMP" /> |
| | | <result column="ar_state" property="state" jdbcType="INTEGER" /> |
| | | |
| | | <association property="goodsList" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityTaoBaoGoodsMapper.selectByActivityId"> |
| | | </association> |
| | | <association property="imageList" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgByActivityId"> |
| | | </association> |
| | | <association property="activityUser" column="ar_activity_uid" |
| | | resultMap="com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper.BaseResultMap" /> |
| | | |
| | | <association property="widthAndHeight" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgWithAndHeightByActivityId"> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state</sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" parameterType="java.lang.Long"> |
| | | select *,ar_activity_uid AS au_id from yeshi_ec_activity_recommend |
| | | where ar_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | <association property="goodsList" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityTaoBaoGoodsMapper.selectByActivityId"> |
| | | </association> |
| | | <association property="imageList" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgByActivityId"> |
| | | </association> |
| | | |
| | | <association property="widthAndHeight" column="ar_id" |
| | | select="com.yeshi.fanli.dao.mybatis.activity.RecommendActivityImgMapper.getImgWithAndHeightByActivityId"> |
| | | </association> |
| | | |
| | | </resultMap> |
| | | |
| | | <sql id="Base_Column_List">ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state |
| | | </sql> |
| | | |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select *,ar_activity_uid AS au_id from yeshi_ec_activity_recommend |
| | | where ar_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | <select id="getRecommendActivityList" resultMap="BaseResultMap"> |
| | | SELECT *,IF(ar_start_time IS NULL,ar_create_time,ar_start_time) AS orderbyTime FROM yeshi_ec_activity_recommend |
| | | LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid=au_id |
| | | WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW()) |
| | | ORDER BY ar_top DESC,ar_order_by ASC,orderbyTime DESC |
| | | SELECT *,IF(ar_start_time IS NULL,ar_create_time,ar_start_time) AS |
| | | orderbyTime FROM yeshi_ec_activity_recommend |
| | | LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid=au_id |
| | | WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> |
| | | NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> |
| | | NOW()) |
| | | ORDER BY ar_top DESC,ar_order_by ASC,orderbyTime DESC |
| | | LIMIT #{start},#{count} |
| | | </select> |
| | | |
| | | <select id="getRecommendActivityEffectiveCount" resultType="java.lang.Long"> |
| | | SELECT count(ar_id) FROM yeshi_ec_activity_recommend |
| | | WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW()) |
| | | SELECT count(ar_id) FROM yeshi_ec_activity_recommend |
| | | WHERE IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> |
| | | NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> |
| | | NOW()) |
| | | </select> |
| | | |
| | | |
| | | <select id="queryRecommendActivityList" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_activity_recommend t |
| | | LEFT JOIN yeshi_ec_activity_user u ON t.ar_activity_uid=u.au_id |
| | | LEFT JOIN |
| | | yeshi_ec_activity_user u ON t.ar_activity_uid=u.au_id |
| | | WHERE 1=1 |
| | | <if test="title != null and title != '' "> |
| | | AND t.ar_title LIKE '%${title}%' |
| | | </if> |
| | | ORDER BY t.ar_top DESC,t.ar_order_by ASC,t.ar_create_time DESC |
| | | LIMIT ${start},${count} |
| | | <if test="title != null and title != '' "> |
| | | AND t.ar_title LIKE '%${title}%' |
| | | </if> |
| | | ORDER BY t.ar_top DESC,t.ar_order_by ASC,t.ar_create_time DESC |
| | | LIMIT ${start},${count} |
| | | </select> |
| | | |
| | | <select id="getRecommendActivityCount" resultType="java.lang.Long"> |
| | | SELECT IFNULL(COUNT(t.ar_id),0) FROM yeshi_ec_activity_recommend t |
| | | WHERE 1=1 |
| | | <if test="title != null and title != '' "> |
| | | AND t.ar_title LIKE '%${title}%' |
| | | </if> |
| | | WHERE 1=1 |
| | | <if test="title != null and title != '' "> |
| | | AND t.ar_title LIKE '%${title}%' |
| | | </if> |
| | | </select> |
| | | |
| | | |
| | |
| | | #{arids} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | |
| | | <select id="getNeedPublish" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_activity_recommend |
| | | LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid= au_id |
| | | WHERE ar_state = 0 AND IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> NOW()) |
| | | |
| | | |
| | | <select id="getNeedPublish" resultMap="BaseResultMap"> |
| | | SELECT * FROM yeshi_ec_activity_recommend |
| | | LEFT JOIN yeshi_ec_activity_user ON ar_activity_uid= au_id |
| | | WHERE ar_state = 0 AND IF(ar_start_time IS NULL,TRUE, ar_start_time<![CDATA[<=]]> |
| | | NOW()) |
| | | AND IF(ar_end_time IS NULL,TRUE, ar_end_time <![CDATA[>=]]> |
| | | NOW()) |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT}</delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state) values (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER})</insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_activity_recommend |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ar_id,</if> |
| | | <if test="title != null">ar_title,</if> |
| | | <if test="type != null">ar_type,</if> |
| | | <if test="orderBy != null">ar_order_by,</if> |
| | | <if test="activityUser != null">ar_activity_uid,</if> |
| | | <if test="shareCount != null">ar_share_count,</if> |
| | | <if test="totalGetMoney != null">ar_total_getmoney,</if> |
| | | <if test="videoPostPictire != null">ar_video_post_picture,</if> |
| | | <if test="videoUrl != null">ar_video_url,</if> |
| | | <if test="createTime != null">ar_create_time,</if> |
| | | <if test="top != null">ar_top,</if> |
| | | <if test="startTime != null">ar_start_time,</if> |
| | | <if test="endTime != null">ar_end_time,</if> |
| | | <if test="state != null">ar_state,</if> |
| | | </trim>values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="activityUser != null">#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="shareCount != null">#{shareCount,jdbcType=INTEGER},</if> |
| | | <if test="totalGetMoney != null">#{totalGetMoney,jdbcType=VARCHAR},</if> |
| | | <if test="videoPostPictire != null">#{videoPostPictire,jdbcType=VARCHAR},</if> |
| | | <if test="videoUrl != null">#{videoUrl,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="top != null">#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title = #{title,jdbcType=VARCHAR},ar_type = #{type,jdbcType=INTEGER},ar_order_by = #{orderBy,jdbcType=INTEGER},ar_activity_uid = #{activityUser.id,jdbcType=BIGINT},ar_share_count = #{shareCount,jdbcType=INTEGER},ar_total_getmoney = #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture = #{videoPostPictire,jdbcType=VARCHAR},ar_video_url = #{videoUrl,jdbcType=VARCHAR},ar_create_time = #{createTime,jdbcType=TIMESTAMP},ar_top = #{top,jdbcType=BOOLEAN},ar_start_time = #{startTime,jdbcType=TIMESTAMP},ar_end_time = #{endTime,jdbcType=TIMESTAMP},ar_state = #{state,jdbcType=INTEGER} where ar_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend |
| | | <set> |
| | | <if test="title != null">ar_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">ar_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">ar_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="activityUser != null">ar_activity_uid=#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="shareCount != null">ar_share_count=#{shareCount,jdbcType=INTEGER},</if> |
| | | <if test="totalGetMoney != null">ar_total_getmoney=#{totalGetMoney,jdbcType=VARCHAR},</if> |
| | | <if test="videoPostPictire != null">ar_video_post_picture=#{videoPostPictire,jdbcType=VARCHAR},</if> |
| | | <if test="videoUrl != null">ar_video_url=#{videoUrl,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">ar_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="top != null">ar_top=#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">ar_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">ar_state=#{state,jdbcType=INTEGER},</if> |
| | | </set> where ar_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | |
| | | <update id="addShareCount"> |
| | | update yeshi_ec_activity_recommend r set |
| | | r.ar_share_count=ar_share_count+#{count} where ar_id=#{id} |
| | | </update> |
| | | |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_activity_recommend where ar_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_activity_recommend |
| | | (ar_id,ar_title,ar_type,ar_order_by,ar_activity_uid,ar_share_count,ar_total_getmoney,ar_video_post_picture,ar_video_url,ar_create_time,ar_top,ar_start_time,ar_end_time,ar_state) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{title,jdbcType=VARCHAR},#{type,jdbcType=INTEGER},#{orderBy,jdbcType=INTEGER},#{activityUser.id,jdbcType=BIGINT},#{shareCount,jdbcType=INTEGER},#{totalGetMoney,jdbcType=VARCHAR},#{videoPostPictire,jdbcType=VARCHAR},#{videoUrl,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{top,jdbcType=BOOLEAN},#{startTime,jdbcType=TIMESTAMP},#{endTime,jdbcType=TIMESTAMP},#{state,jdbcType=INTEGER}) |
| | | </insert> |
| | | <insert id="insertSelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_activity_recommend |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">ar_id,</if> |
| | | <if test="title != null">ar_title,</if> |
| | | <if test="type != null">ar_type,</if> |
| | | <if test="orderBy != null">ar_order_by,</if> |
| | | <if test="activityUser != null">ar_activity_uid,</if> |
| | | <if test="shareCount != null">ar_share_count,</if> |
| | | <if test="totalGetMoney != null">ar_total_getmoney,</if> |
| | | <if test="videoPostPictire != null">ar_video_post_picture,</if> |
| | | <if test="videoUrl != null">ar_video_url,</if> |
| | | <if test="createTime != null">ar_create_time,</if> |
| | | <if test="top != null">ar_top,</if> |
| | | <if test="startTime != null">ar_start_time,</if> |
| | | <if test="endTime != null">ar_end_time,</if> |
| | | <if test="state != null">ar_state,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="title != null">#{title,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">#{type,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="activityUser != null">#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="shareCount != null">#{shareCount,jdbcType=INTEGER},</if> |
| | | <if test="totalGetMoney != null">#{totalGetMoney,jdbcType=VARCHAR},</if> |
| | | <if test="videoPostPictire != null">#{videoPostPictire,jdbcType=VARCHAR},</if> |
| | | <if test="videoUrl != null">#{videoUrl,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="top != null">#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="endTime != null">#{endTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">#{state,jdbcType=INTEGER},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity">update yeshi_ec_activity_recommend set ar_title = |
| | | #{title,jdbcType=VARCHAR},ar_type = |
| | | #{type,jdbcType=INTEGER},ar_order_by = |
| | | #{orderBy,jdbcType=INTEGER},ar_activity_uid = |
| | | #{activityUser.id,jdbcType=BIGINT},ar_share_count = |
| | | #{shareCount,jdbcType=INTEGER},ar_total_getmoney = |
| | | #{totalGetMoney,jdbcType=VARCHAR},ar_video_post_picture = |
| | | #{videoPostPictire,jdbcType=VARCHAR},ar_video_url = |
| | | #{videoUrl,jdbcType=VARCHAR},ar_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},ar_top = |
| | | #{top,jdbcType=BOOLEAN},ar_start_time = |
| | | #{startTime,jdbcType=TIMESTAMP},ar_end_time = |
| | | #{endTime,jdbcType=TIMESTAMP},ar_state = #{state,jdbcType=INTEGER} |
| | | where ar_id = #{id,jdbcType=BIGINT}</update> |
| | | <update id="updateByPrimaryKeySelective" |
| | | parameterType="com.yeshi.fanli.entity.bus.activity.RecommendActivity"> |
| | | update yeshi_ec_activity_recommend |
| | | <set> |
| | | <if test="title != null">ar_title=#{title,jdbcType=VARCHAR},</if> |
| | | <if test="type != null">ar_type=#{type,jdbcType=INTEGER},</if> |
| | | <if test="orderBy != null">ar_order_by=#{orderBy,jdbcType=INTEGER},</if> |
| | | <if test="activityUser != null">ar_activity_uid=#{activityUser.id,jdbcType=BIGINT},</if> |
| | | <if test="shareCount != null">ar_share_count=#{shareCount,jdbcType=INTEGER},</if> |
| | | <if test="totalGetMoney != null">ar_total_getmoney=#{totalGetMoney,jdbcType=VARCHAR},</if> |
| | | <if test="videoPostPictire != null">ar_video_post_picture=#{videoPostPictire,jdbcType=VARCHAR}, |
| | | </if> |
| | | <if test="videoUrl != null">ar_video_url=#{videoUrl,jdbcType=VARCHAR},</if> |
| | | <if test="createTime != null">ar_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="top != null">ar_top=#{top,jdbcType=BOOLEAN},</if> |
| | | <if test="startTime != null">ar_start_time=#{startTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="state != null">ar_state=#{state,jdbcType=INTEGER},</if> |
| | | </set> |
| | | where ar_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
| | |
| | | |
| | | |
| | | <update id="setAllMsgRead"> |
| | | update yeshi_ec_msg_device_read_state |
| | | update yeshi_ec_msg_device_read_state set |
| | | mdrs_read_time=now(),mdrs_unread_count=0,mdrs_update_time=now() |
| | | where mdrs_device=#{device} and |
| | | where |
| | | mdrs_device=#{device} and |
| | | mdrs_platform=#{platform} |
| | | </update> |
| | | |
| | |
| | | jdbcType="INTEGER" /> |
| | | <result column="da_createtime" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="da_updatetime" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | <result column="da_ip" property="ipInfo" jdbcType="VARCHAR" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime |
| | | <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceActive" |
| | | useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_device_active |
| | | (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime) |
| | | (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{ipInfo,jdbcType=VARCHAR}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | |
| | | <if test="versionCode != null">da_version_code,</if> |
| | | <if test="createTime != null">da_createtime,</if> |
| | | <if test="updateTime != null">da_updatetime,</if> |
| | | <if test="ipInfo != null">da_ip,</if> |
| | | |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | |
| | | <if test="versionCode != null">#{versionCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceActive">update |
| | |
| | | #{deviceToken,jdbcType=VARCHAR},da_version_code = |
| | | #{versionCode,jdbcType=INTEGER},da_createtime = |
| | | #{createTime,jdbcType=TIMESTAMP},da_updatetime = |
| | | #{updateTime,jdbcType=TIMESTAMP} where da_id = #{id,jdbcType=BIGINT} |
| | | #{updateTime,jdbcType=TIMESTAMP},da_ip = |
| | | #{ipInfo,jdbcType=VARCHAR} |
| | | where da_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive"> |
| | | update yeshi_ec_device_active |
| | |
| | | <if test="versionCode != null">da_version_code=#{versionCode,jdbcType=INTEGER},</if> |
| | | <if test="createTime != null">da_createtime=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">da_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="ipInfo != null">da_ip=#{ipInfo,jdbcType=VARCHAR},</if> |
| | | </set> |
| | | where da_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | |
| | | package com.yeshi.fanli.service.impl.activity;
|
| | |
|
| | | import java.util.Date;
|
| | | import java.util.List;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.activity.ActivityRuleUserMapper;
|
| | | import com.yeshi.fanli.dao.mybatis.activity.ActivityUserMapper;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | | import com.yeshi.fanli.service.inter.activity.ActivityUserService;
|
| | |
|
| | |
| | | @Resource
|
| | | private ActivityUserMapper activityUserMapper;
|
| | |
|
| | | @Resource
|
| | | private ActivityRuleUserMapper activityRuleUserMapper;
|
| | |
|
| | | @Override
|
| | | public ActivityUser selectByPrimaryKey(Long id) {
|
| | | return activityUserMapper.selectByPrimaryKey(id);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public List<ActivityUser> listRand(int count) {
|
| | | return activityUserMapper.listRand(count);
|
| | | }
|
| | | |
| | |
|
| | | @Override
|
| | | public void addActivityRuleUser(ActivityRuleUser ruleUser) {
|
| | | if (ruleUser == null || ruleUser.getActivityUser() == null)
|
| | | return;
|
| | | // 添加用户
|
| | | ActivityUser user = activityUserMapper.selectByName(ruleUser.getActivityUser().getNickName());
|
| | | if (user == null) {
|
| | | user = ruleUser.getActivityUser();
|
| | | user.setCreateTime(new Date());
|
| | | activityUserMapper.insertSelective(user);
|
| | | }
|
| | | ActivityRuleUser oldRuleUser = activityRuleUserMapper.selectByUserIdAndRuleCode(user.getId(),
|
| | | ruleUser.getRuleCode());
|
| | | if (oldRuleUser == null) {
|
| | | ruleUser.setActivityUser(user);
|
| | | ruleUser.setCreateTime(new Date());
|
| | | activityRuleUserMapper.insertSelective(ruleUser);
|
| | | } else {
|
| | | ActivityRuleUser update = new ActivityRuleUser();
|
| | | update.setId(oldRuleUser.getId());
|
| | | update.setOrderBy(ruleUser.getOrderBy());
|
| | | activityRuleUserMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public List<ActivityRuleUser> listByRuleCode(Integer ruleCode, int page, int pageSize) {
|
| | | return activityRuleUserMapper.listByRuleCode(ruleCode, (page - 1) * pageSize, pageSize);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public long countByRuleCode(Integer ruleCode) {
|
| | | return activityRuleUserMapper.countByRuleCode(ruleCode);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void deleteByRuleUserId(Long id) {
|
| | | ActivityRuleUser user = activityRuleUserMapper.selectByPrimaryKey(id);
|
| | | if (user.getActivityUser() != null)
|
| | | activityUserMapper.deleteByPrimaryKey(user.getActivityUser().getId());
|
| | | activityRuleUserMapper.deleteByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ActivityRuleUser selectRuleUserByPrimaryKey(Long id) {
|
| | |
|
| | | return activityRuleUserMapper.selectByPrimaryKey(id);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateActivityUser(ActivityUser au) {
|
| | | activityUserMapper.updateByPrimaryKeySelective(au);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void updateActivityRuleUser(ActivityRuleUser au) {
|
| | | activityRuleUserMapper.updateByPrimaryKeySelective(au);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ActivityUser getRandomByDaTaoKeCid(int cid) {
|
| | | int ruleId = 100 + cid;
|
| | | List<ActivityRuleUser> ruleList = activityRuleUserMapper.listByRuleCode(ruleId, 0, 100);
|
| | | return ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser();
|
| | | }
|
| | |
|
| | | @Override
|
| | | public ActivityUser getRandomHaoHuo() {
|
| | | List<ActivityRuleUser> ruleList = activityRuleUserMapper.listByRuleCode(ActivityRuleUser.RULE_HAOHUO, 0, 100);
|
| | | return ruleList.get((int) (ruleList.size() * Math.random())).getActivityUser();
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | UserShareGoodsHistory update = new UserShareGoodsHistory();
|
| | | update.setId(userShareGoodsHistory.getId());
|
| | | userShareGoodsHistory.setTkCode(history.getTkCode());
|
| | | userShareGoodsHistory.setCreateTime(new Date());
|
| | | userShareGoodsHistoryMapper.updateByPrimaryKeySelective(userShareGoodsHistory);
|
| | | } else
|
| | | userShareGoodsHistoryMapper.insertSelective(history);
|
| | |
|
| | | }
|
| | |
|
| | | @Override
|
| | |
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityRuleUser;
|
| | | import com.yeshi.fanli.entity.bus.activity.ActivityUser;
|
| | |
|
| | | /**
|
| | |
| | | *
|
| | | */
|
| | | public interface ActivityUserService {
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 随机抽取
|
| | | * |
| | | * @param count
|
| | | * @return
|
| | | */
|
| | | public List<ActivityUser> listRand(int count);
|
| | |
|
| | | /**
|
| | | * 更改
|
| | | * |
| | | * @param au
|
| | | */
|
| | | public void updateActivityUser(ActivityUser au);
|
| | |
|
| | | /**
|
| | | * 修改角色用户
|
| | | * @param au
|
| | | */
|
| | | public void updateActivityRuleUser(ActivityRuleUser au);
|
| | |
|
| | | /**
|
| | | *
|
| | |
| | | * @return
|
| | | */
|
| | | public ActivityUser selectByPrimaryKey(Long id);
|
| | |
|
| | | /**
|
| | | * 增加动态规则用户
|
| | | * |
| | | * @param ruleUser
|
| | | */
|
| | | public void addActivityRuleUser(ActivityRuleUser ruleUser);
|
| | |
|
| | | /**
|
| | | * 获取列表
|
| | | * |
| | | * @param ruleCode
|
| | | * @param page
|
| | | * @param pageSize
|
| | | * @return
|
| | | */
|
| | | public List<ActivityRuleUser> listByRuleCode(Integer ruleCode, int page, int pageSize);
|
| | |
|
| | | /**
|
| | | * 根据身份ID获取数量
|
| | | * |
| | | * @param ruleCode
|
| | | * @return
|
| | | */
|
| | | public long countByRuleCode(Integer ruleCode);
|
| | |
|
| | | /**
|
| | | * 根据角色用户ID删除
|
| | | * |
| | | * @param id
|
| | | */
|
| | | public void deleteByRuleUserId(Long id);
|
| | |
|
| | | /**
|
| | | * 通过主键检索规则用户
|
| | | * |
| | | * @param id
|
| | | * @return
|
| | | */
|
| | | public ActivityRuleUser selectRuleUserByPrimaryKey(Long id);
|
| | | |
| | | |
| | | /**
|
| | | * 根据大淘客分类ID随机获取用户
|
| | | * @param cid
|
| | | * @return
|
| | | */
|
| | | public ActivityUser getRandomByDaTaoKeCid(int cid);
|
| | | |
| | | /**
|
| | | * 获取好货推荐的随机用户
|
| | | * @return
|
| | | */
|
| | | public ActivityUser getRandomHaoHuo();
|
| | | }
|