智慧保安后台管理项目备份
tangzy
2021-07-14 371a518ef74f8012684ce590f969330d75aff58e
1.处罚
8 files added
424 ■■■■■ changed files
src/main/java/org/springblade/modules/punish/controller/PunishController.java 130 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/dto/PunishDTO.java 34 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/entity/Punish.java 80 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/mapper/PunishMapper.java 42 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/mapper/PunishMapper.xml 20 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/service/IPunishService.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/service/impl/PunishServiceImpl.java 41 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/vo/PunishVO.java 36 ●●●●● patch | view | raw | blame | history
src/main/java/org/springblade/modules/punish/controller/PunishController.java
New file
@@ -0,0 +1,130 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.controller;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import lombok.AllArgsConstructor;
import javax.validation.Valid;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.mp.support.Query;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.Func;
import org.springblade.modules.information.entity.Information;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.modules.punish.entity.Punish;
import org.springblade.modules.punish.vo.PunishVO;
import org.springblade.modules.punish.service.IPunishService;
import org.springblade.core.boot.ctrl.BladeController;
import springfox.documentation.annotations.ApiIgnore;
import java.util.Map;
/**
 *  控制器
 *
 * @author BladeX
 * @since 2021-07-14
 */
@RestController
@AllArgsConstructor
@RequestMapping("blade-punish/punish")
@Api(value = "", tags = "接口")
public class PunishController extends BladeController {
    private final IPunishService punishService;
    /**
     * 详情
     */
    @GetMapping("/detail")
    @ApiOperationSupport(order = 1)
    @ApiOperation(value = "详情", notes = "传入punish")
    public R<Punish> detail(Punish punish) {
        Punish detail = punishService.getOne(Condition.getQueryWrapper(punish));
        return R.data(detail);
    }
    /**
     * 分页
     */
    @GetMapping("/list")
    @ApiOperationSupport(order = 2)
    @ApiOperation(value = "分页", notes = "传入punish")
    public R<IPage<Punish>> list(@ApiIgnore @RequestParam Map<String, Object> punish, Query query) {
        IPage<Punish> pages = punishService.page(Condition.getPage(query), Condition.getQueryWrapper(punish, Punish.class));
        return R.data(pages);
    }
    /**
     * 自定义分页
     */
    @GetMapping("/page")
    @ApiOperationSupport(order = 3)
    @ApiOperation(value = "分页", notes = "传入punish")
    public R<IPage<PunishVO>> page(PunishVO punish, Query query) {
        IPage<PunishVO> pages = punishService.selectPunishPage(Condition.getPage(query), punish);
        return R.data(pages);
    }
    /**
     * 新增
     */
    @PostMapping("/save")
    @ApiOperationSupport(order = 4)
    @ApiOperation(value = "新增", notes = "传入punish")
    public R save(@Valid @RequestBody Punish punish) {
        return R.status(punishService.save(punish));
    }
    /**
     * 修改
     */
    @PostMapping("/update")
    @ApiOperationSupport(order = 5)
    @ApiOperation(value = "修改", notes = "传入punish")
    public R update(@Valid @RequestBody Punish punish) {
        return R.status(punishService.updateById(punish));
    }
    /**
     * 新增或修改
     */
    @PostMapping("/submit")
    @ApiOperationSupport(order = 6)
    @ApiOperation(value = "新增或修改", notes = "传入punish")
    public R submit(@Valid @RequestBody Punish punish) {
        return R.status(punishService.saveOrUpdate(punish));
    }
    /**
     * 删除
     */
    @PostMapping("/remove")
    @ApiOperationSupport(order = 8)
    @ApiOperation(value = "删除", notes = "传入ids")
    public R remove(@ApiParam(value = "主键集合", required = true) @RequestParam String ids) {
        return R.status(punishService.removeByIds(Func.toLongList(ids)));
    }
}
src/main/java/org/springblade/modules/punish/dto/PunishDTO.java
New file
@@ -0,0 +1,34 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.dto;
import org.springblade.modules.punish.entity.Punish;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
 * 数据传输对象实体类
 *
 * @author BladeX
 * @since 2021-07-14
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class PunishDTO extends Punish {
    private static final long serialVersionUID = 1L;
}
src/main/java/org/springblade/modules/punish/entity/Punish.java
New file
@@ -0,0 +1,80 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.TableId;
import java.io.Serializable;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
/**
 * 实体类
 *
 * @author BladeX
 * @since 2021-07-14
 */
@Data
@TableName("sys_punish")
@ApiModel(value = "Punish对象", description = "Punish对象")
public class Punish implements Serializable {
    private static final long serialVersionUID = 1L;
    /**
     * 单位id
     */
    @ApiModelProperty(value = "单位id")
    private Integer deptid;
    /**
     * 处罚类别 0:警告 1:罚款  2:没收违法所得、没收非法财物 3: 责令停业 4:暂扣或者吊销许可证
     */
    @ApiModelProperty(value = "处罚类别 0:警告 1:罚款  2:没收违法所得、没收非法财物 3: 责令停业 4:暂扣或者吊销许可证")
    private String punishtype;
    /**
     * 处罚原因
     */
    @ApiModelProperty(value = "处罚原因")
    private String punishreason;
    /**
     * 处罚结果
     */
    @ApiModelProperty(value = "处罚结果")
    private String punishresult;
    /**
     * 处罚日期
     */
    @ApiModelProperty(value = "处罚日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date punishtime;
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
}
src/main/java/org/springblade/modules/punish/mapper/PunishMapper.java
New file
@@ -0,0 +1,42 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.mapper;
import org.springblade.modules.punish.entity.Punish;
import org.springblade.modules.punish.vo.PunishVO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import java.util.List;
/**
 *  Mapper 接口
 *
 * @author BladeX
 * @since 2021-07-14
 */
public interface PunishMapper extends BaseMapper<Punish> {
    /**
     * 自定义分页
     *
     * @param page
     * @param punish
     * @return
     */
    List<PunishVO> selectPunishPage(IPage page, PunishVO punish);
}
src/main/java/org/springblade/modules/punish/mapper/PunishMapper.xml
New file
@@ -0,0 +1,20 @@
<?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.punish.mapper.PunishMapper">
    <!-- 通用查询映射结果 -->
    <resultMap id="punishResultMap" type="org.springblade.modules.punish.entity.Punish">
        <id column="id" property="id"/>
        <result column="deptid" property="deptid"/>
        <result column="punishtype" property="punishtype"/>
        <result column="punishreason" property="punishreason"/>
        <result column="punishresult" property="punishresult"/>
        <result column="punishtime" property="punishtime"/>
    </resultMap>
    <select id="selectPunishPage" resultMap="punishResultMap">
        select * from sys_punish
    </select>
</mapper>
src/main/java/org/springblade/modules/punish/service/IPunishService.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.service;
import org.springblade.modules.punish.entity.Punish;
import org.springblade.modules.punish.vo.PunishVO;
import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务类
 *
 * @author BladeX
 * @since 2021-07-14
 */
public interface IPunishService extends IService<Punish> {
    /**
     * 自定义分页
     *
     * @param page
     * @param punish
     * @return
     */
    IPage<PunishVO> selectPunishPage(IPage<PunishVO> page, PunishVO punish);
}
src/main/java/org/springblade/modules/punish/service/impl/PunishServiceImpl.java
New file
@@ -0,0 +1,41 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.service.impl;
import org.springblade.modules.punish.entity.Punish;
import org.springblade.modules.punish.vo.PunishVO;
import org.springblade.modules.punish.mapper.PunishMapper;
import org.springblade.modules.punish.service.IPunishService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.core.metadata.IPage;
/**
 *  服务实现类
 *
 * @author BladeX
 * @since 2021-07-14
 */
@Service
public class PunishServiceImpl extends ServiceImpl<PunishMapper, Punish> implements IPunishService {
    @Override
    public IPage<PunishVO> selectPunishPage(IPage<PunishVO> page, PunishVO punish) {
        return page.setRecords(baseMapper.selectPunishPage(page, punish));
    }
}
src/main/java/org/springblade/modules/punish/vo/PunishVO.java
New file
@@ -0,0 +1,36 @@
/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.punish.vo;
import org.springblade.modules.punish.entity.Punish;
import lombok.Data;
import lombok.EqualsAndHashCode;
import io.swagger.annotations.ApiModel;
/**
 * 视图实体类
 *
 * @author BladeX
 * @since 2021-07-14
 */
@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "PunishVO对象", description = "PunishVO对象")
public class PunishVO extends Punish {
    private static final long serialVersionUID = 1L;
}