Commit 107fa145 by 宋珺琪

配置管理模块(重庆)

parent 1f226062
package com.founder.commonutils.model.newPublicEntity.ServiceConfig;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("sk_service_config")
public class ServiceConfigEntity {
@TableId(type = IdType.INPUT)
@TableField("id")
private String id;
@TableField("province")
private String province;
@TableField("map_address")
private String mapAddress;
@TableField("config_address")
private String configAddress;
@TableField("time")
private String time;
@TableField("is_deleted")
private String isDeleted;
@TableField(exist = false)
private int page;//当前第几页
@TableField(exist = false)
private int limit;//每页多少行
}
package com.founder.publicapi.controller.ServiceConfig;
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.founder.commonutils.model.newPublicEntity.MapRestResult;
import com.founder.commonutils.model.newPublicEntity.ServiceConfig.ServiceConfigEntity;
import com.founder.commonutils.util.KeyUtilNaotu;
import com.founder.publicapi.mapper.mysqlMapper.ServiceConfigMapper;
import com.founder.servicebase.logs.OperLog;
import com.founder.servicebase.logs.OperationType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.text.SimpleDateFormat;
import java.util.Date;
@RestController
@RequestMapping("/config")
@Api(tags = "配置管理")
public class ServiceConfigController {
@Autowired
ServiceConfigMapper serviceConfigMapper;
@PostMapping("configAdd")
@ApiOperation(value = "配置管理新增")
@OperLog(message = "配置管理新增", operation = OperationType.ADD)
public MapRestResult configAdd(@RequestBody ServiceConfigEntity serviceConfigEntity){
serviceConfigEntity.setId(KeyUtilNaotu.getJzKey("PZ"));
int insert = serviceConfigMapper.insert(serviceConfigEntity);
if (insert > 0){
return new MapRestResult(200,"新增成功",null);
} else {
return new MapRestResult().error("保存失败");
}
}
/**
* 删
* @return
*/
@PostMapping("configDelete")
@ApiOperation(value = "配置管理删除")
@OperLog(message = "配置管理删除", operation = OperationType.DELETE)
public MapRestResult configDelete(@RequestBody ServiceConfigEntity serviceConfigEntity){
serviceConfigEntity.setIsDeleted("1");
int update = serviceConfigMapper.updateById(serviceConfigEntity);
if ( update > 0 ){
return new MapRestResult(200,"删除成功",null);
}else {
return new MapRestResult(200,"删除失败",null);
}
}
/**
* 改
* @return
*/
@PostMapping("configUpdate")
@ApiOperation(value = "配置管理修改")
@OperLog(message = "配置管理修改", operation = OperationType.UPDATE)
public MapRestResult configUpdate(@RequestBody ServiceConfigEntity serviceConfigEntity){
int update = serviceConfigMapper.updateById(serviceConfigEntity);
if ( update > 0 ){
return new MapRestResult(200,"修改成功",null);
}else {
return new MapRestResult(200,"修改失败",null);
}
}
/**
* 查
* @return
*/
@PostMapping("configQuery")
@ApiOperation(value = "配置管理列表")
@OperLog(message = "配置管理列表", operation = OperationType.QUERY)
public MapRestResult configQuery(@RequestBody ServiceConfigEntity serviceConfigEntity){
QueryWrapper wrapper = new QueryWrapper<>();
wrapper.like("province",serviceConfigEntity.getProvince());
wrapper.eq("is_deleted","0");
IPage iPage = serviceConfigMapper.selectPage(new Page<>(serviceConfigEntity.getPage(), serviceConfigEntity.getLimit()), wrapper);
return new MapRestResult(200,"ok",iPage.getTotal(),iPage.getRecords());
}
/**
* 详情
* @return
*/
@PostMapping("configDetails")
@ApiOperation(value = "详情")
@OperLog(message = "详情", operation = OperationType.QUERY)
public MapRestResult configDetails(@RequestBody ServiceConfigEntity serviceConfigEntity){
ServiceConfigEntity serviceConfigEntity1 = serviceConfigMapper.selectById(serviceConfigEntity.getId());
return new MapRestResult(200,"ok",serviceConfigEntity1);
}
/**
* 当前时间
* @return
*/
public String nowTime(){
Date date = new Date();
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
return formatter.format(date);
}
}
package com.founder.publicapi.mapper.mysqlMapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.founder.commonutils.model.newPublicEntity.ServiceConfig.ServiceConfigEntity;
import org.springframework.stereotype.Repository;
@Repository
public interface ServiceConfigMapper extends BaseMapper<ServiceConfigEntity> {
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment