parent
3e05b6a517
commit
2cfb1e1327
12 changed files with 207 additions and 5 deletions
@ -0,0 +1,70 @@ |
|||||||
|
package com.huoran.competition.controller; |
||||||
|
|
||||||
|
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.competition.entity.CompetitionClassification; |
||||||
|
import com.huoran.competition.service.CompetitionClassificationService; |
||||||
|
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.web.bind.annotation.*; |
||||||
|
|
||||||
|
import javax.servlet.http.HttpServletRequest; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* @描述:活动活动分类控制类 |
||||||
|
* @作者: Rong |
||||||
|
* @日期: 2023-12-27 |
||||||
|
*/ |
||||||
|
@RestController |
||||||
|
@RequestMapping("/competitionClassification") |
||||||
|
@Api(value = "活动分类:CompetitionClassificationController", tags = "活动分类") |
||||||
|
public class CompetitionClassificationController { |
||||||
|
|
||||||
|
@Autowired |
||||||
|
public CompetitionClassificationService service; |
||||||
|
|
||||||
|
@Autowired |
||||||
|
private UserClient userClient; |
||||||
|
|
||||||
|
@PostMapping("/categoryList") |
||||||
|
@ApiOperation(value = "分类列表", response = CompetitionClassification.class) |
||||||
|
public R categoryList() { |
||||||
|
List<CompetitionClassification> list = service.list( null); |
||||||
|
return R.ok().put("page",list); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/save") |
||||||
|
@ApiOperation(value = "自定义新增活动分类", response = CompetitionClassification.class) |
||||||
|
public R save(@RequestBody @ApiParam(name = "活动活动分类对象", value = "传入json格式", required = true) CompetitionClassification competitionClassification, HttpServletRequest request) { |
||||||
|
String accountId = TokenUtils.getIdByJwtToken(request); |
||||||
|
competitionClassification.setAccountId(Integer.valueOf(accountId)); |
||||||
|
boolean addState = service.save(competitionClassification); |
||||||
|
return addState ? R.ok() : R.error("新增失败"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/update") |
||||||
|
@ApiOperation(value = "修改活动分类", response = CompetitionClassification.class) |
||||||
|
public R update(@RequestBody @ApiParam(name = "活动活动分类对象", value = "传入json格式", required = true) CompetitionClassification competitionClassification, HttpServletRequest request) { |
||||||
|
String accountId = TokenUtils.getIdByJwtToken(request); |
||||||
|
competitionClassification.setAccountId(Integer.valueOf(accountId)); |
||||||
|
boolean updateState = service.updateById(competitionClassification); |
||||||
|
return updateState ? R.ok() : R.error("编辑失败"); |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@PostMapping("/batchDeletion") |
||||||
|
@ApiOperation(value = "批量删除活动分类", response = CompetitionClassification.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,43 @@ |
|||||||
|
package com.huoran.competition.entity; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||||
|
import io.swagger.annotations.ApiModel; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
|
||||||
|
import java.io.Serializable; |
||||||
|
import java.util.Date; |
||||||
|
|
||||||
|
/** |
||||||
|
* @描述:活动分类 |
||||||
|
* @作者: Rong |
||||||
|
* @日期: 2023-12-27 |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@ApiModel(value = "活动分类") |
||||||
|
@TableName("c_competition_classification") |
||||||
|
public class CompetitionClassification implements Serializable { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@TableId(type = IdType.AUTO) |
||||||
|
@ApiModelProperty(value = "活动分类主键") |
||||||
|
private Integer id; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "活动分类名称") |
||||||
|
private String classificationName; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建人") |
||||||
|
private Integer accountId; |
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "创建时间") |
||||||
|
@TableField(fill = FieldFill.INSERT) |
||||||
|
private Date createTime; |
||||||
|
|
||||||
|
@ApiModelProperty(value = "更新时间") |
||||||
|
@TableField(fill = FieldFill.INSERT_UPDATE) |
||||||
|
private Date updateTime; |
||||||
|
|
||||||
|
|
||||||
|
} |
@ -0,0 +1,16 @@ |
|||||||
|
package com.huoran.competition.mapper; |
||||||
|
|
||||||
|
import com.huoran.competition.entity.CompetitionClassification; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 活动分类 Mapper 接口 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author cheney |
||||||
|
* @since 2023-12-27 |
||||||
|
*/ |
||||||
|
public interface CompetitionClassificationMapper extends BaseMapper<CompetitionClassification> { |
||||||
|
|
||||||
|
} |
@ -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.competition.mapper.CompetitionClassificationMapper"> |
||||||
|
|
||||||
|
</mapper> |
@ -0,0 +1,16 @@ |
|||||||
|
package com.huoran.competition.service; |
||||||
|
|
||||||
|
import com.huoran.competition.entity.CompetitionClassification; |
||||||
|
import com.baomidou.mybatisplus.extension.service.IService; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 活动分类 服务类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author cheney |
||||||
|
* @since 2023-12-27 |
||||||
|
*/ |
||||||
|
public interface CompetitionClassificationService extends IService<CompetitionClassification> { |
||||||
|
|
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
package com.huoran.competition.service.impl; |
||||||
|
|
||||||
|
import com.huoran.competition.entity.CompetitionClassification; |
||||||
|
import com.huoran.competition.mapper.CompetitionClassificationMapper; |
||||||
|
import com.huoran.competition.service.CompetitionClassificationService; |
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
* <p> |
||||||
|
* 活动分类 服务实现类 |
||||||
|
* </p> |
||||||
|
* |
||||||
|
* @author cheney |
||||||
|
* @since 2023-12-27 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class CompetitionClassificationServiceImpl extends ServiceImpl<CompetitionClassificationMapper, CompetitionClassification> implements CompetitionClassificationService { |
||||||
|
|
||||||
|
} |
Loading…
Reference in new issue