parent
e05b1c792e
commit
1ae735b193
13 changed files with 192 additions and 27 deletions
@ -0,0 +1,67 @@ |
|||||||
|
package org.springblade.modules.business.controller; |
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||||
|
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport; |
||||||
|
import io.swagger.annotations.Api; |
||||||
|
import io.swagger.annotations.ApiOperation; |
||||||
|
import lombok.RequiredArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.common.constant.CommonConstant; |
||||||
|
import org.springblade.core.boot.ctrl.BladeController; |
||||||
|
import org.springblade.core.tenant.annotation.TenantDS; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.modules.business.entity.MorningEvening; |
||||||
|
import org.springblade.modules.business.service.IMorningEveningService; |
||||||
|
import org.springframework.web.bind.annotation.*; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.List; |
||||||
|
|
||||||
|
/** |
||||||
|
* 控制器 |
||||||
|
* |
||||||
|
* @author chents |
||||||
|
*/ |
||||||
|
@TenantDS |
||||||
|
@Slf4j |
||||||
|
@RestController |
||||||
|
@RequestMapping(CommonConstant.APPLICATION_BUSINESS_NAME + "/poc_morning_evening") |
||||||
|
@RequiredArgsConstructor |
||||||
|
@Api(value = "早晚高峰", tags = "早晚高峰接口") |
||||||
|
public class MorningEveningController extends BladeController { |
||||||
|
|
||||||
|
private final IMorningEveningService morningEveningService; |
||||||
|
|
||||||
|
|
||||||
|
/** |
||||||
|
* 查询所有数据 |
||||||
|
* |
||||||
|
* @return |
||||||
|
*/ |
||||||
|
@ApiOperationSupport(order = 1) |
||||||
|
@ApiOperation(value = "查询所有数据") |
||||||
|
@GetMapping("get-list-all") |
||||||
|
public R listAll() { |
||||||
|
QueryWrapper<MorningEvening> queryWrapper = new QueryWrapper<>(); |
||||||
|
queryWrapper.select("id","morning_start","morning_end","evening_start","evening_end"); |
||||||
|
List<MorningEvening> morningEveningList = morningEveningService.list(queryWrapper); |
||||||
|
return R.data(morningEveningList); |
||||||
|
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 修改早晚高峰 |
||||||
|
*/ |
||||||
|
@ApiOperationSupport(order = 2) |
||||||
|
@ApiOperation(value = "修改数据") |
||||||
|
@PostMapping("update") |
||||||
|
public R update(@RequestBody MorningEvening morningEvening) { |
||||||
|
boolean result = morningEveningService.updateById(morningEvening); |
||||||
|
if (result) { |
||||||
|
return R.success("修改成功"); |
||||||
|
} else { |
||||||
|
return R.fail("修改失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
|
||||||
@ -0,0 +1,46 @@ |
|||||||
|
package org.springblade.modules.business.entity; |
||||||
|
import com.baomidou.mybatisplus.annotation.IdType; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableId; |
||||||
|
import com.baomidou.mybatisplus.annotation.TableName; |
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat; |
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize; |
||||||
|
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; |
||||||
|
import io.swagger.annotations.ApiModelProperty; |
||||||
|
import lombok.Data; |
||||||
|
import lombok.EqualsAndHashCode; |
||||||
|
import org.springblade.core.mp.base.BaseEntity; |
||||||
|
|
||||||
|
import java.time.LocalTime; |
||||||
|
|
||||||
|
/** |
||||||
|
* 早晚高峰表 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
@Data |
||||||
|
@EqualsAndHashCode(callSuper = true) |
||||||
|
@TableName("poc_morning_evening") |
||||||
|
public class MorningEvening extends BaseEntity { |
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L; |
||||||
|
|
||||||
|
@JsonSerialize( |
||||||
|
using = ToStringSerializer.class |
||||||
|
) |
||||||
|
@ApiModelProperty("主键id") |
||||||
|
@TableId( |
||||||
|
value = "id", |
||||||
|
type = IdType.ASSIGN_ID |
||||||
|
) |
||||||
|
private Long id; |
||||||
|
|
||||||
|
@JsonFormat(pattern = "HH:mm") |
||||||
|
private LocalTime morningStart; |
||||||
|
@JsonFormat(pattern = "HH:mm") |
||||||
|
private LocalTime morningEnd; |
||||||
|
@JsonFormat(pattern = "HH:mm") |
||||||
|
private LocalTime eveningStart; |
||||||
|
@JsonFormat(pattern = "HH:mm") |
||||||
|
private LocalTime eveningEnd; |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,13 @@ |
|||||||
|
package org.springblade.modules.business.mapper; |
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||||
|
import org.springblade.modules.business.entity.CarLiveChannel; |
||||||
|
import org.springblade.modules.business.entity.MorningEvening; |
||||||
|
|
||||||
|
/** |
||||||
|
* Mapper 接口 |
||||||
|
* |
||||||
|
* @author Chill |
||||||
|
*/ |
||||||
|
public interface MorningEveningMapper extends BaseMapper<MorningEvening> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,14 @@ |
|||||||
|
<?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="org.springblade.modules.business.mapper.MorningEveningMapper"> |
||||||
|
|
||||||
|
<!-- 通用查询映射结果 --> |
||||||
|
<resultMap id="MorningEveningResultMap" type="org.springblade.modules.business.entity.MorningEvening"> |
||||||
|
<result column="id" property="id"/> |
||||||
|
<result column="morning_start" property="morningStart"/> |
||||||
|
<result column="morning_end" property="morningEnd"/> |
||||||
|
<result column="evening_start" property="eveningStart"/> |
||||||
|
<result column="evening_end" property="eveningEnd"/> |
||||||
|
</resultMap> |
||||||
|
|
||||||
|
</mapper> |
||||||
@ -0,0 +1,15 @@ |
|||||||
|
package org.springblade.modules.business.service; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseService; |
||||||
|
import org.springblade.core.tool.api.R; |
||||||
|
import org.springblade.modules.business.entity.CarLiveChannel; |
||||||
|
import org.springblade.modules.business.entity.MorningEvening; |
||||||
|
|
||||||
|
/** |
||||||
|
* 服务类 |
||||||
|
* |
||||||
|
* @author chents |
||||||
|
*/ |
||||||
|
public interface IMorningEveningService extends BaseService<MorningEvening> { |
||||||
|
|
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
package org.springblade.modules.business.service.impl; |
||||||
|
|
||||||
|
import org.springblade.core.mp.base.BaseServiceImpl; |
||||||
|
import org.springblade.modules.business.entity.MorningEvening; |
||||||
|
import org.springblade.modules.business.mapper.MorningEveningMapper; |
||||||
|
import org.springblade.modules.business.service.IMorningEveningService; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
/** |
||||||
|
*@Author: Chents |
||||||
|
*@Create: 2023-05-16 |
||||||
|
*/ |
||||||
|
@Service |
||||||
|
public class MorningEveningServiceImpl extends BaseServiceImpl<MorningEveningMapper, MorningEvening> implements IMorningEveningService { |
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue