提交代码

main
rong.liu 11 months ago
parent 1e6be8154d
commit 1c4250adf0
  1. 41
      competition/src/main/java/com/huoran/competition/mapper/xml/CompetitionRegistrationMapper.xml
  2. 120
      nakadai/src/main/java/com/huoran/nakadai/controller/ExplosiveRecommendationController.java
  3. 89
      nakadai/src/main/java/com/huoran/nakadai/entity/ExplosiveRecommendation.java
  4. 36
      nakadai/src/main/java/com/huoran/nakadai/entity/req/ExplosiveRecommendationReq.java
  5. 16
      nakadai/src/main/java/com/huoran/nakadai/mapper/ExplosiveRecommendationMapper.java
  6. 5
      nakadai/src/main/java/com/huoran/nakadai/mapper/xml/ExplosiveRecommendationMapper.xml
  7. 16
      nakadai/src/main/java/com/huoran/nakadai/service/ExplosiveRecommendationService.java
  8. 24
      nakadai/src/main/java/com/huoran/nakadai/service/impl/ExplosiveRecommendationServiceImpl.java
  9. 2
      nakadai/src/test/java/com/huoran/nakadai/code/CodeGenerator.java

@ -21,7 +21,17 @@
</select>
<select id="selectRegistrationByCondition" resultType="com.huoran.competition.entity.vo.RegistrationVO">
SELECT
*
temp.* ,
(SELECT
u.user_name
FROM
nakadai.hr_user_account ua
INNER JOIN nakadai.hr_user_info u ON u.user_id = ua.user_id
AND u.is_del = 0
WHERE
ua.is_del = 0
AND ua.app_open_id = temp.app_open_id
AND ua.platform_id = 7) as username
FROM
(
SELECT
@ -36,21 +46,30 @@
ua.work_number,
( SELECT school_name FROM nakadai.school s WHERE s.school_id = ua.school_id ) AS school,
ua.school_id,
u.user_name AS username,
u.user_name AS enterpriseName,
u.user_id,
qa.account_id,
u.user_avatars,
qa.create_time,
qa.identification,ct.team_name,ct.captain,
qa.identification,
ct.team_name,
ct.captain,
CASE
WHEN ct.captain = 0 THEN ct.team_id
WHEN ct.captain = 1 THEN ct.pid
END AS team_id
WHEN ct.captain = 0 THEN
ct.team_id
WHEN ct.captain = 1 THEN
ct.pid
END AS team_id,
ua.app_open_id
FROM
c_competition_registration qa
INNER JOIN nakadai.hr_user_account ua ON ua.id = qa.account_id and ua.is_del = 0
INNER JOIN nakadai.hr_user_info u ON u.user_id = ua.user_id and u.is_del = 0
LEFT JOIN c_competition_team ct ON ct.competition_id = qa.competition_id AND ct.account_id = qa.account_id
INNER JOIN nakadai.hr_user_account ua ON ua.id = qa.account_id
AND ua.is_del = 0
INNER JOIN nakadai.hr_user_info u ON u.user_id = ua.user_id
AND u.is_del = 0
LEFT JOIN c_competition_team ct ON ct.competition_id = qa.competition_id
AND ct.account_id = qa.account_id
WHERE
qa.competition_id = #{req.competitionId}
GROUP BY
@ -59,7 +78,9 @@
qa.create_time DESC
) a
LEFT JOIN ( SELECT @rownum := 0 ) b ON 1 = 1
) temp WHERE 1=1
) temp
WHERE
1 =1
<if test=" req.keyWord!=null and req.keyWord!='' ">
AND CONCAT( IFNULL( temp.phone, '' ),
IFNULL( temp.username, '' ),

@ -0,0 +1,120 @@
package com.huoran.nakadai.controller;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.huoran.api.UserClient;
import com.huoran.common.response.R;
import com.huoran.common.utils.TokenUtils;
import com.huoran.nakadai.entity.ExplosiveRecommendation;
import com.huoran.nakadai.entity.req.ExplosiveRecommendationReq;
import com.huoran.nakadai.service.ExplosiveRecommendationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.ObjectUtils;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
/**
* @描述控制类
* @作者: Rong
* @日期: 2023-12-28
*/
@RestController
@RequestMapping("/explosiveRecommendation")
@Api(value = "营销管理/banner管理:ExplosiveRecommendationController", tags = "营销管理/banner管理")
public class ExplosiveRecommendationController {
@Autowired
public ExplosiveRecommendationService service;
@Autowired
private UserClient userClient;
@PostMapping("/explosiveList")
@ApiOperation(value = "爆款推荐列表", response = ExplosiveRecommendation.class)
public R explosiveList(@RequestBody ExplosiveRecommendationReq explosiveRecommendation) {
IPage<ExplosiveRecommendation> iPage = new Page<>(explosiveRecommendation.getPageNum(), explosiveRecommendation.getPageSize());
QueryWrapper<ExplosiveRecommendation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type",explosiveRecommendation.getType());
if (!ObjectUtils.isEmpty(explosiveRecommendation.getEnabledState())) {
queryWrapper.eq("enabled_state", explosiveRecommendation.getEnabledState());
}
queryWrapper.orderByDesc("create_time");
IPage<ExplosiveRecommendation> pageList = service.page(iPage, queryWrapper);
return R.ok().put("data", pageList);
}
//排序
@PostMapping("/sort")
@ApiOperation(value = "排序", response = ExplosiveRecommendation.class)
public R sort(@RequestBody LinkedList<ExplosiveRecommendation> explosiveRecommendation) {
//获取类型(0.爆款推荐 1.banner管理)
ExplosiveRecommendation firstRecommendation = explosiveRecommendation.stream()
.findFirst()
.orElse(null);
Integer type = firstRecommendation.getType();
QueryWrapper<ExplosiveRecommendation> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("type", type);
//删除原集合
service.remove(queryWrapper);
//todo 还需要对中间表进行删除信息
Integer serialNumber = 0;
for (ExplosiveRecommendation item : explosiveRecommendation) {
item.setSequence(++serialNumber);
}
//添加排序后的集合
service.saveBatch(explosiveRecommendation);
return R.ok();
}
@PostMapping("/findById")
@ApiOperation(value = "查询详情", response = ExplosiveRecommendation.class)
public R findById(@ApiParam(name = "id", value = "主键", required = true) @RequestParam Integer id) {
ExplosiveRecommendation explosiveRecommendation = service.getById(id);
return R.ok().put("data", explosiveRecommendation);
}
@PostMapping("/save")
@ApiOperation(value = "新增", response = ExplosiveRecommendation.class)
public R save(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) ExplosiveRecommendation explosiveRecommendation, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
Integer schoolId = userClient.getSchoolIdByAccountId(accountId);
boolean addState = service.save(explosiveRecommendation);
return addState ? R.ok() : R.error("新增失败");
}
@PostMapping("/update")
@ApiOperation(value = "修改", response = ExplosiveRecommendation.class)
public R update(@RequestBody @ApiParam(name = "对象", value = "传入json格式", required = true) ExplosiveRecommendation explosiveRecommendation, HttpServletRequest request) {
String accountId = TokenUtils.getIdByJwtToken(request);
boolean updateState = service.updateById(explosiveRecommendation);
return updateState ? R.ok() : R.error("编辑失败");
}
@PostMapping("/batchDeletion")
@ApiOperation(value = "批量删除", response = ExplosiveRecommendation.class)
public R batchDeletion(@ApiParam(name = "ids", value = "主键", required = true) @RequestBody List<Integer> ids) {
boolean delState = service.removeByIds(ids);
return delState ? R.ok() : R.error("删除失败");
}
}

@ -0,0 +1,89 @@
package com.huoran.nakadai.entity;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
/**
* <p>
*
* </p>
*
* @author chen
* @since 2023-12-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="ExplosiveRecommendation对象", description="")
public class ExplosiveRecommendation implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.AUTO)
private Integer id;
@ApiModelProperty(value = "产品名称")
private String productName;
@ApiModelProperty(value = "封面图(多张逗号隔开)")
private String coverUrl;
@ApiModelProperty(value = "顺序")
private Integer sequence;
@ApiModelProperty(value = "(0.爆款推荐 1.banner管理")
private Integer type;
@ApiModelProperty(value = "启用状态(0开启 1未开启 默认0)")
private Integer enabledState;
@ApiModelProperty(value = "产品详情(1详情/2链接)")
private String details;
@ApiModelProperty(value = "链接类型(1小程序链接/2.外链接)")
private String link;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
@TableField(fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty(value = "选择链接内容(1.商品、2.活动、3.供应商、4.店铺)")
private String selectLinkId;
@ApiModelProperty(value = "对应链接id的主键(如:选择活动则保存的活动id)")
private Integer correspondingLinkId;
@ApiModelProperty(value = "跳转链接")
private String jumpLink;
@ApiModelProperty(value = "发布状态(0默认未发布/1已发布)")
private Integer publishStatus;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
@TableField(fill = FieldFill.INSERT_UPDATE)
private Date updateTime;
}

@ -0,0 +1,36 @@
package com.huoran.nakadai.entity.req;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author chen
* @since 2023-12-28
*/
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class ExplosiveRecommendationReq extends PageReq{
@ApiModelProperty(value = "启用状态(0开启 1未开启 默认0)")
private Integer enabledState;
@ApiModelProperty(value = "(0.爆款推荐 1.banner管理")
private Integer type;
}

@ -0,0 +1,16 @@
package com.huoran.nakadai.mapper;
import com.huoran.nakadai.entity.ExplosiveRecommendation;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* <p>
* Mapper 接口
* </p>
*
* @author chen
* @since 2023-12-28
*/
public interface ExplosiveRecommendationMapper extends BaseMapper<ExplosiveRecommendation> {
}

@ -0,0 +1,5 @@
<?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.huoran.nakadai.mapper.ExplosiveRecommendationMapper">
</mapper>

@ -0,0 +1,16 @@
package com.huoran.nakadai.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.huoran.nakadai.entity.ExplosiveRecommendation;
/**
* <p>
* 服务类
* </p>
*
* @author chen
* @since 2023-12-28
*/
public interface ExplosiveRecommendationService extends IService<ExplosiveRecommendation> {
}

@ -0,0 +1,24 @@
package com.huoran.nakadai.service.impl;
import com.huoran.nakadai.entity.ExplosiveRecommendation;
import com.huoran.nakadai.mapper.ExplosiveRecommendationMapper;
import com.huoran.nakadai.service.ExplosiveRecommendationService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
/**
* <p>
* 服务实现类
* </p>
*
* @author chen
* @since 2023-12-28
*/
@Service
public class ExplosiveRecommendationServiceImpl extends ServiceImpl<ExplosiveRecommendationMapper, ExplosiveRecommendation> implements ExplosiveRecommendationService {
}

@ -63,7 +63,7 @@ public class CodeGenerator {
// 5、策略配置
StrategyConfig strategy = new StrategyConfig();
strategy.setInclude("supplier_classification_config");
strategy.setInclude("explosive_recommendation");
strategy.setNaming(NamingStrategy.underline_to_camel);//数据库表映射到实体的命名策略
strategy.setTablePrefix("k_"); //生成实体时去掉表前缀

Loading…
Cancel
Save