package com.ruoyi.busi.controller;

import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
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.RestController;
import com.ruoyi.common.log.annotation.Log;
import com.ruoyi.common.log.enums.BusinessType;
import com.ruoyi.common.security.annotation.RequiresPermissions;
import com.ruoyi.busi.domain.JzObject;
import com.ruoyi.busi.service.IJzObjectService;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.utils.poi.ExcelUtil;
import com.ruoyi.common.core.web.page.TableDataInfo;

/**
 * 社区矫正对象基础信息(标准7)Controller
 * 
 * @author ruoyi
 * @date 2026-07-23
 */
@RestController
@RequestMapping("/OBJECT")
public class JzObjectController extends BaseController
{
    @Autowired
    private IJzObjectService jzObjectService;

    /**
     * 查询社区矫正对象基础信息(标准7)列表
     */
    @RequiresPermissions("busi:OBJECT:list")
    @GetMapping("/list")
    public TableDataInfo list(JzObject jzObject)
    {
        startPage();
        List<JzObject> list = jzObjectService.selectJzObjectList(jzObject);
        return getDataTable(list);
    }

    /**
     * 导出社区矫正对象基础信息(标准7)列表
     */
    @RequiresPermissions("busi:OBJECT:export")
    @Log(title = "社区矫正对象基础信息(标准7)", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, JzObject jzObject)
    {
        List<JzObject> list = jzObjectService.selectJzObjectList(jzObject);
        ExcelUtil<JzObject> util = new ExcelUtil<JzObject>(JzObject.class);
        util.exportExcel(response, list, "社区矫正对象基础信息(标准7)数据");
    }

    /**
     * 获取社区矫正对象基础信息(标准7)详细信息
     */
    @RequiresPermissions("busi:OBJECT:query")
    @GetMapping(value = "/{SQJZDXBH}")
    public AjaxResult getInfo(@PathVariable("SQJZDXBH") String SQJZDXBH)
    {
        return success(jzObjectService.selectJzObjectBySQJZDXBH(SQJZDXBH));
    }

    /**
     * 新增社区矫正对象基础信息(标准7)
     */
    @RequiresPermissions("busi:OBJECT:add")
    @Log(title = "社区矫正对象基础信息(标准7)", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody JzObject jzObject)
    {
        return toAjax(jzObjectService.insertJzObject(jzObject));
    }

    /**
     * 修改社区矫正对象基础信息(标准7)
     */
    @RequiresPermissions("busi:OBJECT:edit")
    @Log(title = "社区矫正对象基础信息(标准7)", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody JzObject jzObject)
    {
        return toAjax(jzObjectService.updateJzObject(jzObject));
    }

    /**
     * 删除社区矫正对象基础信息(标准7)
     */
    @RequiresPermissions("busi:OBJECT:remove")
    @Log(title = "社区矫正对象基础信息(标准7)", businessType = BusinessType.DELETE)
	@DeleteMapping("/{SQJZDXBHs}")
    public AjaxResult remove(@PathVariable String[] SQJZDXBHs)
    {
        return toAjax(jzObjectService.deleteJzObjectBySQJZDXBHs(SQJZDXBHs));
    }
}
