Commit 6d4c6ebe by rongkailun

【新增】物流管理功能

parent cbf85bd1
package io.office.modules.manage.controller;
import java.util.Arrays;
import java.util.Date;
import java.util.Map;
import io.office.modules.manage.utils.IdKeysConstant;
import io.office.modules.manage.utils.IdWorkerUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import io.office.modules.manage.entity.LogisticsEntity;
import io.office.modules.manage.service.LogisticsService;
import io.office.common.utils.PageUtils;
import io.office.common.utils.R;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-21 15:48:47
*/
@RestController
@RequestMapping("/logistics")
public class LogisticsController {
@Autowired
private LogisticsService logisticsService;
/**
* 列表
*/
@RequestMapping("/list")
// @RequiresPermissions("manage:logistics:list")
public R list(@RequestParam Map<String, Object> params){
PageUtils page = logisticsService.queryPage(params);
return R.ok().put("page", page);
}
/**
* 信息
*/
@RequestMapping("/info/{id}")
// @RequiresPermissions("manage:logistics:info")
public R info(@PathVariable("id") String id){
LogisticsEntity logistics = logisticsService.getById(id);
return R.ok().put("logistics", logistics);
}
/**
* 保存
*/
@RequestMapping("/save")
// @RequiresPermissions("manage:logistics:save")
public R save(@RequestBody LogisticsEntity logistics){
logistics.setId(IdWorkerUtils.getSEQByKey(IdKeysConstant.ID_SEQ_KEY));
logistics.setInputdate(new Date());
logisticsService.save(logistics);
return R.ok("新增成功!");
}
/**
* 修改
*/
@RequestMapping("/update")
// @RequiresPermissions("manage:logistics:update")
public R update(@RequestBody LogisticsEntity logistics){
logisticsService.updateById(logistics);
return R.ok("修改成功!");
}
/**
* 删除
*/
@RequestMapping("/delete")
// @RequiresPermissions("manage:logistics:delete")
public R delete(@RequestBody String[] ids){
logisticsService.removeByIds(Arrays.asList(ids));
return R.ok("删除成功!");
}
}
package io.office.modules.manage.dao;
import io.office.modules.manage.entity.LogisticsEntity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-21 15:48:47
*/
@Mapper
public interface LogisticsDao extends BaseMapper<LogisticsEntity> {
}
package io.office.modules.manage.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-21 15:48:47
*/
@Data
@TableName("logistics")
public class LogisticsEntity implements Serializable {
private static final long serialVersionUID = 1L;
/**
* $column.comments
*/
@TableId(type = IdType.INPUT)
private String id;
/**
* $column.comments
*/
private String title;
/**
* $column.comments
*/
private String type;
/**
* $column.comments
*/
private Integer level;
/**
* $column.comments
*/
private String jumppath;
/**
* $column.comments
*/
private String keyword;
/**
* $column.comments
*/
private String source;
/**
* $column.comments
*/
private String author;
/**
* $column.comments
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:smm:ss")
private Date releasetime;
/**
* $column.comments
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date implementationtime;
/**
* $column.comments
*/
private String remarks;
/**
* $column.comments
*/
private String content;
/**
* $column.comments
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@TableId("inputdate")
private Date inputdate;
}
package io.office.modules.manage.service;
import com.baomidou.mybatisplus.extension.service.IService;
import io.office.common.utils.PageUtils;
import io.office.modules.manage.entity.LogisticsEntity;
import java.util.Map;
/**
* ${comments}
*
* @author wudi
* @email
* @date 2021-11-21 15:48:47
*/
public interface LogisticsService extends IService<LogisticsEntity> {
PageUtils queryPage(Map<String, Object> params);
}
package io.office.modules.manage.service.impl;
import com.qiniu.util.StringUtils;
import org.springframework.stereotype.Service;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.office.common.utils.PageUtils;
import io.office.common.utils.Query;
import io.office.modules.manage.dao.LogisticsDao;
import io.office.modules.manage.entity.LogisticsEntity;
import io.office.modules.manage.service.LogisticsService;
@Service("logisticsService")
public class LogisticsServiceImpl extends ServiceImpl<LogisticsDao, LogisticsEntity> implements LogisticsService {
@Override
public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper<LogisticsEntity> logisticsEntityQueryWrapper = new QueryWrapper<>();
if(!StringUtils.isNullOrEmpty(String.valueOf(params.get("title")))){
logisticsEntityQueryWrapper.eq("title",params.get("title"));
}
if(!StringUtils.isNullOrEmpty(String.valueOf(params.get("keyword")))){
logisticsEntityQueryWrapper.eq("keyword",params.get("keyword"));
}
if(!StringUtils.isNullOrEmpty(String.valueOf(params.get("type")))){
logisticsEntityQueryWrapper.eq("type",params.get("type"));
}
IPage<LogisticsEntity> page = this.page(
new Query<LogisticsEntity>().getPage(params),
new QueryWrapper<LogisticsEntity>()
);
return new PageUtils(page);
}
}
\ No newline at end of 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="io.office.modules.manage.dao.LogisticsDao">
<!-- 可根据自己的需求,是否要使用 -->
<resultMap type="io.office.modules.manage.entity.LogisticsEntity" id="logisticsMap">
<result property="id" column="id"/>
<result property="title" column="title"/>
<result property="type" column="type"/>
<result property="level" column="level"/>
<result property="jumppath" column="jumppath"/>
<result property="keyword" column="keyword"/>
<result property="source" column="source"/>
<result property="author" column="author"/>
<result property="releasetime" column="releaseTime"/>
<result property="implementationtime" column="implementationTime"/>
<result property="remarks" column="remarks"/>
<result property="content" column="content"/>
<result property="inputdate" column="inputDate"/>
</resultMap>
</mapper>
\ No newline at end of file
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