Commit 679b0e56 authored by 周昊's avatar 周昊

1、初始化法律法规库

parent 5d6abb25
package com.censoft.censoftrongtong.controller;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.censoft.censoftrongtong.domain.LawList;
import com.censoft.censoftrongtong.service.ILawListService;
import org.springframework.security.access.prepost.PreAuthorize;
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.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 法律法规库Controller
*
* @author ruoyi
* @date 2023-06-26
*/
@RestController
@RequestMapping("/system/law/list")
public class LawListController extends BaseController
{
@Autowired
private ILawListService lawListService;
/**
* 查询法律法规库列表
*/
@PreAuthorize("@ss.hasPermi('system:law:list')")
@GetMapping("/list")
public TableDataInfo list(LawList lawList)
{
startPage();
List<LawList> list = lawListService.selectLawListList(lawList);
return getDataTable(list);
}
/**
* 导出法律法规库列表
*/
@PreAuthorize("@ss.hasPermi('system:law:export')")
@Log(title = "法律法规库", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, LawList lawList)
{
List<LawList> list = lawListService.selectLawListList(lawList);
ExcelUtil<LawList> util = new ExcelUtil<LawList>(LawList.class);
util.exportExcel(response, list, "法律法规库数据");
}
/**
* 获取法律法规库详细信息
*/
@PreAuthorize("@ss.hasPermi('system:law:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable("id") Long id)
{
return success(lawListService.selectLawListById(id));
}
/**
* 新增法律法规库
*/
@PreAuthorize("@ss.hasPermi('system:law:add')")
@Log(title = "法律法规库", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody LawList lawList)
{
return toAjax(lawListService.insertLawList(lawList));
}
/**
* 修改法律法规库
*/
@PreAuthorize("@ss.hasPermi('system:law:edit')")
@Log(title = "法律法规库", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody LawList lawList)
{
return toAjax(lawListService.updateLawList(lawList));
}
/**
* 删除法律法规库
*/
@PreAuthorize("@ss.hasPermi('system:law:remove')")
@Log(title = "法律法规库", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
return toAjax(lawListService.deleteLawListByIds(ids));
}
}
package com.censoft.censoftrongtong.domain;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 法律法规库对象 law_list
*
* @author ruoyi
* @date 2023-06-26
*/
public class LawList extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 标题 */
@Excel(name = "标题")
private String name;
/** 类型 */
@Excel(name = "类型")
private String type;
/** 简述 */
@Excel(name = "简述")
private String sketch;
/** 范围 */
@Excel(name = "范围")
private String range;
/** 规范性引用文件 */
@Excel(name = "规范性引用文件")
private String normativeReferences;
/** 颁布日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "颁布日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date issueDate;
/** 实施日期 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "实施日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date implementationDate;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setName(String name)
{
this.name = name;
}
public String getName()
{
return name;
}
public void setType(String type)
{
this.type = type;
}
public String getType()
{
return type;
}
public void setSketch(String sketch)
{
this.sketch = sketch;
}
public String getSketch()
{
return sketch;
}
public void setRange(String range)
{
this.range = range;
}
public String getRange()
{
return range;
}
public void setNormativeReferences(String normativeReferences)
{
this.normativeReferences = normativeReferences;
}
public String getNormativeReferences()
{
return normativeReferences;
}
public void setIssueDate(Date issueDate)
{
this.issueDate = issueDate;
}
public Date getIssueDate()
{
return issueDate;
}
public void setImplementationDate(Date implementationDate)
{
this.implementationDate = implementationDate;
}
public Date getImplementationDate()
{
return implementationDate;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("name", getName())
.append("type", getType())
.append("sketch", getSketch())
.append("range", getRange())
.append("normativeReferences", getNormativeReferences())
.append("issueDate", getIssueDate())
.append("implementationDate", getImplementationDate())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.toString();
}
}
package com.censoft.censoftrongtong.mapper;
import com.censoft.censoftrongtong.domain.LawList;
import java.util.List;
/**
* 法律法规库Mapper接口
*
* @author ruoyi
* @date 2023-06-26
*/
public interface LawListMapper
{
/**
* 查询法律法规库
*
* @param id 法律法规库主键
* @return 法律法规库
*/
public LawList selectLawListById(Long id);
/**
* 查询法律法规库列表
*
* @param lawList 法律法规库
* @return 法律法规库集合
*/
public List<LawList> selectLawListList(LawList lawList);
/**
* 新增法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
public int insertLawList(LawList lawList);
/**
* 修改法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
public int updateLawList(LawList lawList);
/**
* 删除法律法规库
*
* @param id 法律法规库主键
* @return 结果
*/
public int deleteLawListById(Long id);
/**
* 批量删除法律法规库
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteLawListByIds(Long[] ids);
}
package com.censoft.censoftrongtong.service;
import com.censoft.censoftrongtong.domain.LawList;
import java.util.List;
/**
* 法律法规库Service接口
*
* @author ruoyi
* @date 2023-06-26
*/
public interface ILawListService
{
/**
* 查询法律法规库
*
* @param id 法律法规库主键
* @return 法律法规库
*/
public LawList selectLawListById(Long id);
/**
* 查询法律法规库列表
*
* @param lawList 法律法规库
* @return 法律法规库集合
*/
public List<LawList> selectLawListList(LawList lawList);
/**
* 新增法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
public int insertLawList(LawList lawList);
/**
* 修改法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
public int updateLawList(LawList lawList);
/**
* 批量删除法律法规库
*
* @param ids 需要删除的法律法规库主键集合
* @return 结果
*/
public int deleteLawListByIds(Long[] ids);
/**
* 删除法律法规库信息
*
* @param id 法律法规库主键
* @return 结果
*/
public int deleteLawListById(Long id);
}
package com.censoft.censoftrongtong.service.impl;
import java.util.List;
import com.censoft.censoftrongtong.domain.LawList;
import com.censoft.censoftrongtong.mapper.LawListMapper;
import com.censoft.censoftrongtong.service.ILawListService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 法律法规库Service业务层处理
*
* @author ruoyi
* @date 2023-06-26
*/
@Service
public class LawListServiceImpl implements ILawListService
{
@Autowired
private LawListMapper lawListMapper;
/**
* 查询法律法规库
*
* @param id 法律法规库主键
* @return 法律法规库
*/
@Override
public LawList selectLawListById(Long id)
{
return lawListMapper.selectLawListById(id);
}
/**
* 查询法律法规库列表
*
* @param lawList 法律法规库
* @return 法律法规库
*/
@Override
public List<LawList> selectLawListList(LawList lawList)
{
return lawListMapper.selectLawListList(lawList);
}
/**
* 新增法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
@Override
public int insertLawList(LawList lawList)
{
lawList.setCreateTime(DateUtils.getNowDate());
return lawListMapper.insertLawList(lawList);
}
/**
* 修改法律法规库
*
* @param lawList 法律法规库
* @return 结果
*/
@Override
public int updateLawList(LawList lawList)
{
lawList.setUpdateTime(DateUtils.getNowDate());
return lawListMapper.updateLawList(lawList);
}
/**
* 批量删除法律法规库
*
* @param ids 需要删除的法律法规库主键
* @return 结果
*/
@Override
public int deleteLawListByIds(Long[] ids)
{
return lawListMapper.deleteLawListByIds(ids);
}
/**
* 删除法律法规库信息
*
* @param id 法律法规库主键
* @return 结果
*/
@Override
public int deleteLawListById(Long id)
{
return lawListMapper.deleteLawListById(id);
}
}
<?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="com.censoft.censoftrongtong.mapper.LawListMapper">
<resultMap type="com.censoft.censoftrongtong.domain.LawList" id="LawListResult">
<result property="id" column="id" />
<result property="name" column="name" />
<result property="type" column="type" />
<result property="sketch" column="sketch" />
<result property="range" column="range" />
<result property="normativeReferences" column="normative_references" />
<result property="issueDate" column="issue_date" />
<result property="implementationDate" column="implementation_date" />
<result property="delFlag" column="del_flag" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectLawListVo">
select id, name, type, sketch, range, normative_references, issue_date, implementation_date, del_flag, create_by, create_time, update_by, update_time from law_list
</sql>
<select id="selectLawListList" parameterType="com.censoft.censoftrongtong.domain.LawList" resultMap="LawListResult">
<include refid="selectLawListVo"/>
<where>
<if test="name != null and name != ''"> and name like concat('%', #{name}, '%')</if>
<if test="type != null and type != ''"> and type = #{type}</if>
<if test="sketch != null and sketch != ''"> and sketch = #{sketch}</if>
<if test="range != null and range != ''"> and range = #{range}</if>
<if test="normativeReferences != null and normativeReferences != ''"> and normative_references = #{normativeReferences}</if>
<if test="issueDate != null "> and issue_date = #{issueDate}</if>
<if test="implementationDate != null "> and implementation_date = #{implementationDate}</if>
</where>
</select>
<select id="selectLawListById" parameterType="Long" resultMap="LawListResult">
<include refid="selectLawListVo"/>
where id = #{id}
</select>
<insert id="insertLawList" parameterType="com.censoft.censoftrongtong.domain.LawList" useGeneratedKeys="true" keyProperty="id">
insert into law_list
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="name != null">name,</if>
<if test="type != null">type,</if>
<if test="sketch != null">sketch,</if>
<if test="range != null">range,</if>
<if test="normativeReferences != null">normative_references,</if>
<if test="issueDate != null">issue_date,</if>
<if test="implementationDate != null">implementation_date,</if>
<if test="delFlag != null">del_flag,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null">#{name},</if>
<if test="type != null">#{type},</if>
<if test="sketch != null">#{sketch},</if>
<if test="range != null">#{range},</if>
<if test="normativeReferences != null">#{normativeReferences},</if>
<if test="issueDate != null">#{issueDate},</if>
<if test="implementationDate != null">#{implementationDate},</if>
<if test="delFlag != null">#{delFlag},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
</trim>
</insert>
<update id="updateLawList" parameterType="com.censoft.censoftrongtong.domain.LawList">
update law_list
<trim prefix="SET" suffixOverrides=",">
<if test="name != null">name = #{name},</if>
<if test="type != null">type = #{type},</if>
<if test="sketch != null">sketch = #{sketch},</if>
<if test="range != null">range = #{range},</if>
<if test="normativeReferences != null">normative_references = #{normativeReferences},</if>
<if test="issueDate != null">issue_date = #{issueDate},</if>
<if test="implementationDate != null">implementation_date = #{implementationDate},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteLawListById" parameterType="Long">
delete from law_list where id = #{id}
</delete>
<delete id="deleteLawListByIds" parameterType="String">
delete from law_list where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</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