add - 自定义数据维护
parent
bc02b7352e
commit
ab1bfed6b4
@ -0,0 +1,103 @@
|
||||
package com.aucma.base.controller;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.aucma.common.utils.DateUtils;
|
||||
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.aucma.common.annotation.Log;
|
||||
import com.aucma.common.core.controller.BaseController;
|
||||
import com.aucma.common.core.domain.AjaxResult;
|
||||
import com.aucma.common.enums.BusinessType;
|
||||
import com.aucma.base.domain.BaseCustomData;
|
||||
import com.aucma.base.service.IBaseCustomDataService;
|
||||
import com.aucma.common.utils.poi.ExcelUtil;
|
||||
import com.aucma.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 自定义数据维护Controller
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-08
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/base/customData")
|
||||
public class BaseCustomDataController extends BaseController {
|
||||
@Autowired
|
||||
private IBaseCustomDataService baseCustomDataService;
|
||||
|
||||
/**
|
||||
* 查询自定义数据维护列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(BaseCustomData baseCustomData) {
|
||||
startPage();
|
||||
List<BaseCustomData> list = baseCustomDataService.selectBaseCustomDataList(baseCustomData);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出自定义数据维护列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:export')")
|
||||
@Log(title = "自定义数据维护", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, BaseCustomData baseCustomData) {
|
||||
List<BaseCustomData> list = baseCustomDataService.selectBaseCustomDataList(baseCustomData);
|
||||
ExcelUtil<BaseCustomData> util = new ExcelUtil<BaseCustomData>(BaseCustomData.class);
|
||||
util.exportExcel(response, list, "自定义数据维护数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取自定义数据维护详细信息
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:query')")
|
||||
@GetMapping(value = "/{objId}")
|
||||
public AjaxResult getInfo(@PathVariable("objId") Long objId) {
|
||||
return success(baseCustomDataService.selectBaseCustomDataByObjId(objId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自定义数据维护
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:add')")
|
||||
@Log(title = "自定义数据维护", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody BaseCustomData baseCustomData) {
|
||||
baseCustomData.setCreatedBy(getUsername());
|
||||
baseCustomData.setCreatedTime(DateUtils.getNowDate());
|
||||
return toAjax(baseCustomDataService.insertBaseCustomData(baseCustomData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义数据维护
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:edit')")
|
||||
@Log(title = "自定义数据维护", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody BaseCustomData baseCustomData) {
|
||||
baseCustomData.setUpdatedBy(getUsername());
|
||||
baseCustomData.setUpdatedTime(DateUtils.getNowDate());
|
||||
return toAjax(baseCustomDataService.updateBaseCustomData(baseCustomData));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自定义数据维护
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('base:customData:remove')")
|
||||
@Log(title = "自定义数据维护", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{objIds}")
|
||||
public AjaxResult remove(@PathVariable Long[] objIds) {
|
||||
return toAjax(baseCustomDataService.deleteBaseCustomDataByObjIds(objIds));
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.aucma.base.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.aucma.base.domain.BaseCustomData;
|
||||
|
||||
/**
|
||||
* 自定义数据维护Mapper接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-08
|
||||
*/
|
||||
public interface BaseCustomDataMapper
|
||||
{
|
||||
/**
|
||||
* 查询自定义数据维护
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 自定义数据维护
|
||||
*/
|
||||
public BaseCustomData selectBaseCustomDataByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询自定义数据维护列表
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 自定义数据维护集合
|
||||
*/
|
||||
public List<BaseCustomData> selectBaseCustomDataList(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 新增自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseCustomData(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 修改自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseCustomData(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 删除自定义数据维护
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseCustomDataByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 批量删除自定义数据维护
|
||||
*
|
||||
* @param objIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseCustomDataByObjIds(Long[] objIds);
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
package com.aucma.base.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.aucma.base.domain.BaseCustomData;
|
||||
|
||||
/**
|
||||
* 自定义数据维护Service接口
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-08
|
||||
*/
|
||||
public interface IBaseCustomDataService
|
||||
{
|
||||
/**
|
||||
* 查询自定义数据维护
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 自定义数据维护
|
||||
*/
|
||||
public BaseCustomData selectBaseCustomDataByObjId(Long objId);
|
||||
|
||||
/**
|
||||
* 查询自定义数据维护列表
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 自定义数据维护集合
|
||||
*/
|
||||
public List<BaseCustomData> selectBaseCustomDataList(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 新增自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertBaseCustomData(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 修改自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateBaseCustomData(BaseCustomData baseCustomData);
|
||||
|
||||
/**
|
||||
* 批量删除自定义数据维护
|
||||
*
|
||||
* @param objIds 需要删除的自定义数据维护主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseCustomDataByObjIds(Long[] objIds);
|
||||
|
||||
/**
|
||||
* 删除自定义数据维护信息
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteBaseCustomDataByObjId(Long objId);
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
package com.aucma.base.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.aucma.base.mapper.BaseCustomDataMapper;
|
||||
import com.aucma.base.domain.BaseCustomData;
|
||||
import com.aucma.base.service.IBaseCustomDataService;
|
||||
|
||||
/**
|
||||
* 自定义数据维护Service业务层处理
|
||||
*
|
||||
* @author Yinq
|
||||
* @date 2023-11-08
|
||||
*/
|
||||
@Service
|
||||
public class BaseCustomDataServiceImpl implements IBaseCustomDataService
|
||||
{
|
||||
@Autowired
|
||||
private BaseCustomDataMapper baseCustomDataMapper;
|
||||
|
||||
/**
|
||||
* 查询自定义数据维护
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 自定义数据维护
|
||||
*/
|
||||
@Override
|
||||
public BaseCustomData selectBaseCustomDataByObjId(Long objId)
|
||||
{
|
||||
return baseCustomDataMapper.selectBaseCustomDataByObjId(objId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询自定义数据维护列表
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 自定义数据维护
|
||||
*/
|
||||
@Override
|
||||
public List<BaseCustomData> selectBaseCustomDataList(BaseCustomData baseCustomData)
|
||||
{
|
||||
return baseCustomDataMapper.selectBaseCustomDataList(baseCustomData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertBaseCustomData(BaseCustomData baseCustomData)
|
||||
{
|
||||
return baseCustomDataMapper.insertBaseCustomData(baseCustomData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义数据维护
|
||||
*
|
||||
* @param baseCustomData 自定义数据维护
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateBaseCustomData(BaseCustomData baseCustomData)
|
||||
{
|
||||
return baseCustomDataMapper.updateBaseCustomData(baseCustomData);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除自定义数据维护
|
||||
*
|
||||
* @param objIds 需要删除的自定义数据维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseCustomDataByObjIds(Long[] objIds)
|
||||
{
|
||||
return baseCustomDataMapper.deleteBaseCustomDataByObjIds(objIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除自定义数据维护信息
|
||||
*
|
||||
* @param objId 自定义数据维护主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteBaseCustomDataByObjId(Long objId)
|
||||
{
|
||||
return baseCustomDataMapper.deleteBaseCustomDataByObjId(objId);
|
||||
}
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
<?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.aucma.base.mapper.BaseCustomDataMapper">
|
||||
|
||||
<resultMap type="BaseCustomData" id="BaseCustomDataResult">
|
||||
<result property="objId" column="obj_id"/>
|
||||
<result property="customType" column="custom_type"/>
|
||||
<result property="customFunction" column="custom_function"/>
|
||||
<result property="customCode" column="custom_code"/>
|
||||
<result property="customData" column="custom_data"/>
|
||||
<result property="customSort" column="custom_sort"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="isFlag" column="is_flag"/>
|
||||
<result property="createdBy" column="created_by"/>
|
||||
<result property="createdTime" column="created_time"/>
|
||||
<result property="updatedBy" column="updated_by"/>
|
||||
<result property="updatedTime" column="updated_time"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectBaseCustomDataVo">
|
||||
select obj_id,
|
||||
custom_type,
|
||||
custom_function,
|
||||
custom_code,
|
||||
custom_data,
|
||||
custom_sort,
|
||||
remark,
|
||||
is_flag,
|
||||
created_by,
|
||||
created_time,
|
||||
updated_by,
|
||||
updated_time
|
||||
from base_custom_data
|
||||
</sql>
|
||||
|
||||
<select id="selectBaseCustomDataList" parameterType="BaseCustomData" resultMap="BaseCustomDataResult">
|
||||
<include refid="selectBaseCustomDataVo"/>
|
||||
<where>
|
||||
<if test="customType != null ">and custom_type = #{customType}</if>
|
||||
<if test="customFunction != null and customFunction != ''">and custom_function = #{customFunction}</if>
|
||||
<if test="customCode != null and customCode != ''">and custom_code = #{customCode}</if>
|
||||
<if test="customData != null and customData != ''">and custom_data = #{customData}</if>
|
||||
<if test="customSort != null ">and custom_sort = #{customSort}</if>
|
||||
<if test="isFlag != null ">and is_flag = #{isFlag}</if>
|
||||
<if test="createdBy != null and createdBy != ''">and created_by = #{createdBy}</if>
|
||||
<if test="createdTime != null ">and created_time = #{createdTime}</if>
|
||||
<if test="updatedBy != null and updatedBy != ''">and updated_by = #{updatedBy}</if>
|
||||
<if test="updatedTime != null ">and updated_time = #{updatedTime}</if>
|
||||
</where>
|
||||
order by custom_type,custom_sort
|
||||
</select>
|
||||
|
||||
<select id="selectBaseCustomDataByObjId" parameterType="Long" resultMap="BaseCustomDataResult">
|
||||
<include refid="selectBaseCustomDataVo"/>
|
||||
where obj_id = #{objId}
|
||||
</select>
|
||||
|
||||
<insert id="insertBaseCustomData" parameterType="BaseCustomData">
|
||||
<selectKey keyProperty="objId" resultType="long" order="BEFORE">
|
||||
SELECT seq_base_custom_data.NEXTVAL as objId FROM DUAL
|
||||
</selectKey>
|
||||
insert into base_custom_data
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="objId != null">obj_id,</if>
|
||||
<if test="customType != null">custom_type,</if>
|
||||
<if test="customFunction != null">custom_function,</if>
|
||||
<if test="customCode != null">custom_code,</if>
|
||||
<if test="customData != null">custom_data,</if>
|
||||
<if test="customSort != null">custom_sort,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
<if test="isFlag != null">is_flag,</if>
|
||||
<if test="createdBy != null">created_by,</if>
|
||||
<if test="createdTime != null">created_time,</if>
|
||||
<if test="updatedBy != null">updated_by,</if>
|
||||
<if test="updatedTime != null">updated_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="objId != null">#{objId},</if>
|
||||
<if test="customType != null">#{customType},</if>
|
||||
<if test="customFunction != null">#{customFunction},</if>
|
||||
<if test="customCode != null">#{customCode},</if>
|
||||
<if test="customData != null">#{customData},</if>
|
||||
<if test="customSort != null">#{customSort},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
<if test="isFlag != null">#{isFlag},</if>
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="createdTime != null">#{createdTime},</if>
|
||||
<if test="updatedBy != null">#{updatedBy},</if>
|
||||
<if test="updatedTime != null">#{updatedTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateBaseCustomData" parameterType="BaseCustomData">
|
||||
update base_custom_data
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="customType != null">custom_type = #{customType},</if>
|
||||
<if test="customFunction != null">custom_function = #{customFunction},</if>
|
||||
<if test="customCode != null">custom_code = #{customCode},</if>
|
||||
<if test="customData != null">custom_data = #{customData},</if>
|
||||
<if test="customSort != null">custom_sort = #{customSort},</if>
|
||||
<if test="remark != null">remark = #{remark},</if>
|
||||
<if test="isFlag != null">is_flag = #{isFlag},</if>
|
||||
<if test="createdBy != null">created_by = #{createdBy},</if>
|
||||
<if test="createdTime != null">created_time = #{createdTime},</if>
|
||||
<if test="updatedBy != null">updated_by = #{updatedBy},</if>
|
||||
<if test="updatedTime != null">updated_time = #{updatedTime},</if>
|
||||
</trim>
|
||||
where obj_id = #{objId}
|
||||
</update>
|
||||
|
||||
<delete id="deleteBaseCustomDataByObjId" parameterType="Long">
|
||||
delete
|
||||
from base_custom_data
|
||||
where obj_id = #{objId}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteBaseCustomDataByObjIds" parameterType="String">
|
||||
delete from base_custom_data where obj_id in
|
||||
<foreach item="objId" collection="array" open="(" separator="," close=")">
|
||||
#{objId}
|
||||
</foreach>
|
||||
</delete>
|
||||
</mapper>
|
Loading…
Reference in New Issue