mirror of
https://gitee.com/elegant_wings/dbd-meeting.git
synced 2025-06-21 09:09:37 +08:00
新增了房间物品的初始化代码
This commit is contained in:
parent
97eda73e9b
commit
52f9c6dda5
@ -0,0 +1,76 @@
|
||||
package com.ics.admin.controller.meeting;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.ics.common.core.domain.R;
|
||||
import com.ics.common.core.controller.BaseController;
|
||||
import com.ics.admin.domain.meeting.RoomItem;
|
||||
import com.ics.admin.service.meeting.IRoomItemService;
|
||||
import org.wf.jwtp.annotation.RequiresPermissions;
|
||||
|
||||
/**
|
||||
* 房间物品 提供者
|
||||
*
|
||||
* @author chen
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("item")
|
||||
public class RoomItemController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private IRoomItemService roomItemService;
|
||||
|
||||
/**
|
||||
* 查询房间物品
|
||||
*/
|
||||
@GetMapping("get/{id}")
|
||||
public RoomItem get(@PathVariable("id") Long id) {
|
||||
return roomItemService.selectRoomItemById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询房间物品列表
|
||||
*/
|
||||
@RequiresPermissions("meeting:item:list")
|
||||
@GetMapping("list")
|
||||
public R list(RoomItem roomItem) {
|
||||
startPage();
|
||||
return result(roomItemService.selectRoomItemList(roomItem));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增保存房间物品
|
||||
*/
|
||||
@RequiresPermissions("meeting:item:add")
|
||||
@PostMapping("save")
|
||||
public R addSave(@RequestBody RoomItem roomItem) {
|
||||
return toAjax(roomItemService.insertRoomItem(roomItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存房间物品
|
||||
*/
|
||||
@RequiresPermissions("meeting:item:edit")
|
||||
@PostMapping("update")
|
||||
public R editSave(@RequestBody RoomItem roomItem) {
|
||||
return toAjax(roomItemService.updateRoomItem(roomItem));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除房间物品
|
||||
*/
|
||||
@RequiresPermissions("meeting:item:remove")
|
||||
@PostMapping("remove")
|
||||
public R remove(String ids) {
|
||||
return toAjax(roomItemService.deleteRoomItemByIds(ids));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package com.ics.admin.domain.meeting;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.ics.common.core.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 房间物品对象 tb_room_item
|
||||
*
|
||||
* @author chen
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@Data
|
||||
@TableName("tb_room_item")
|
||||
public class RoomItem extends BaseEntity<RoomItem> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 名称 */
|
||||
private String name;
|
||||
|
||||
/** 品牌 */
|
||||
private String brand;
|
||||
|
||||
/** 规格 */
|
||||
private String specification;
|
||||
|
||||
/** 图片url */
|
||||
private String picUrl;
|
||||
|
||||
/** 附件url */
|
||||
private String fileUrl;
|
||||
|
||||
/** 备注 */
|
||||
private String remark;
|
||||
|
||||
/** 删除标志(0代表存在 2代表删除) */
|
||||
private String delFlag;
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
package com.ics.admin.mapper.meeting;
|
||||
|
||||
import com.ics.admin.domain.meeting.RoomItem;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 房间物品Mapper接口
|
||||
*
|
||||
* @author chen
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@Mapper
|
||||
public interface RoomItemMapper extends BaseMapper<RoomItem> {
|
||||
/**
|
||||
* 查询房间物品
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 房间物品
|
||||
*/
|
||||
RoomItem selectRoomItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询房间物品列表
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 房间物品集合
|
||||
*/
|
||||
List<RoomItem> selectRoomItemList(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 新增房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
int insertRoomItem(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 修改房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
int updateRoomItem(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 删除房间物品
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteRoomItemById(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除房间物品
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteRoomItemByIds(String[] ids);
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package com.ics.admin.service.impl.meeting;
|
||||
|
||||
import java.util.List;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.ics.admin.domain.meeting.RoomItem;
|
||||
import com.ics.admin.mapper.meeting.RoomItemMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ics.admin.service.meeting.IRoomItemService;
|
||||
|
||||
/**
|
||||
* 房间物品Service业务层处理
|
||||
*
|
||||
* @author chen
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
@Service
|
||||
public class RoomItemServiceImpl extends ServiceImpl<RoomItemMapper, RoomItem> implements IRoomItemService {
|
||||
@Autowired
|
||||
private RoomItemMapper roomItemMapper;
|
||||
|
||||
/**
|
||||
* 查询房间物品
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 房间物品
|
||||
*/
|
||||
@Override
|
||||
public RoomItem selectRoomItemById(Long id) {
|
||||
return roomItemMapper.selectById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询房间物品列表
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 房间物品
|
||||
*/
|
||||
@Override
|
||||
public List<RoomItem> selectRoomItemList(RoomItem roomItem) {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
return roomItemMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertRoomItem(RoomItem roomItem) {
|
||||
return roomItemMapper.insert(roomItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateRoomItem(RoomItem roomItem) {
|
||||
return roomItemMapper.updateById(roomItem);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除房间物品对象
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRoomItemByIds(String ids) {
|
||||
String[] idsArray = StrUtil.split(ids,",");
|
||||
return roomItemMapper.deleteBatchIds(CollUtil.toList(idsArray));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除房间物品信息
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteRoomItemById(Long id) {
|
||||
return roomItemMapper.deleteRoomItemById(id);
|
||||
}
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
package com.ics.admin.service.meeting;
|
||||
|
||||
import com.ics.admin.domain.meeting.RoomItem;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.ics.admin.domain.meeting.RoomItem;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 房间物品Service接口
|
||||
*
|
||||
* @author chen
|
||||
* @date 2024-02-23
|
||||
*/
|
||||
public interface IRoomItemService extends IService<RoomItem> {
|
||||
/**
|
||||
* 查询房间物品
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 房间物品
|
||||
*/
|
||||
RoomItem selectRoomItemById(Long id);
|
||||
|
||||
/**
|
||||
* 查询房间物品列表
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 房间物品集合
|
||||
*/
|
||||
List<RoomItem> selectRoomItemList(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 新增房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
int insertRoomItem(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 修改房间物品
|
||||
*
|
||||
* @param roomItem 房间物品
|
||||
* @return 结果
|
||||
*/
|
||||
int updateRoomItem(RoomItem roomItem);
|
||||
|
||||
/**
|
||||
* 批量删除房间物品
|
||||
*
|
||||
* @param ids 需要删除的数据ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteRoomItemByIds(String ids);
|
||||
|
||||
/**
|
||||
* 删除房间物品信息
|
||||
*
|
||||
* @param id 房间物品ID
|
||||
* @return 结果
|
||||
*/
|
||||
int deleteRoomItemById(Long id);
|
||||
}
|
@ -0,0 +1,97 @@
|
||||
<?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.ics.admin.mapper.meeting.RoomItemMapper">
|
||||
|
||||
<resultMap type="com.ics.admin.domain.meeting.RoomItem" id="RoomItemResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="name" column="name" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="specification" column="specification" />
|
||||
<result property="picUrl" column="pic_url" />
|
||||
<result property="fileUrl" column="file_url" />
|
||||
<result property="remark" column="remark" />
|
||||
<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="selectRoomItemVo">
|
||||
SELECT id, name, brand, specification, pic_url, file_url, remark, del_flag, create_by, create_time, update_by, update_time FROM tb_room_item
|
||||
</sql>
|
||||
|
||||
<select id="selectRoomItemList" parameterType="RoomItem" resultMap="RoomItemResult">
|
||||
<include refid="selectRoomItemVo"/>
|
||||
<where>
|
||||
<if test="name != null and name != ''"> AND name LIKE CONCAT('%', #{name}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectRoomItemById" parameterType="Long" resultMap="RoomItemResult">
|
||||
<include refid="selectRoomItemVo"/>
|
||||
WHERE id = #{id}
|
||||
</select>
|
||||
|
||||
<insert id="insertRoomItem" parameterType="RoomItem" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO tb_room_item
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name,</if>
|
||||
<if test="brand != null and brand != ''">brand,</if>
|
||||
<if test="specification != null and specification != ''">specification,</if>
|
||||
<if test="picUrl != null and picUrl != ''">pic_url,</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">file_url,</if>
|
||||
<if test="remark != null and remark != ''">remark,</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag,</if>
|
||||
<if test="createBy != null and createBy != ''">create_by,</if>
|
||||
<if test="createTime != null ">create_time,</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by,</if>
|
||||
<if test="updateTime != null ">update_time,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">#{name},</if>
|
||||
<if test="brand != null and brand != ''">#{brand},</if>
|
||||
<if test="specification != null and specification != ''">#{specification},</if>
|
||||
<if test="picUrl != null and picUrl != ''">#{picUrl},</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">#{fileUrl},</if>
|
||||
<if test="remark != null and remark != ''">#{remark},</if>
|
||||
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">#{createBy},</if>
|
||||
<if test="createTime != null ">#{createTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">#{updateBy},</if>
|
||||
<if test="updateTime != null ">#{updateTime},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateRoomItem" parameterType="RoomItem">
|
||||
UPDATE tb_room_item
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="name != null and name != ''">name = #{name},</if>
|
||||
<if test="brand != null and brand != ''">brand = #{brand},</if>
|
||||
<if test="specification != null and specification != ''">specification = #{specification},</if>
|
||||
<if test="picUrl != null and picUrl != ''">pic_url = #{picUrl},</if>
|
||||
<if test="fileUrl != null and fileUrl != ''">file_url = #{fileUrl},</if>
|
||||
<if test="remark != null and remark != ''">remark = #{remark},</if>
|
||||
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
|
||||
<if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
|
||||
<if test="createTime != null ">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
|
||||
<if test="updateTime != null ">update_time = #{updateTime},</if>
|
||||
</trim>
|
||||
WHERE id = #{id}
|
||||
</update>
|
||||
|
||||
<delete id="deleteRoomItemById" parameterType="Long">
|
||||
DELETE FROM tb_room_item WHERE id = #{id}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteRoomItemByIds" parameterType="String">
|
||||
DELETE FROM tb_room_item where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
</mapper>
|
Loading…
x
Reference in New Issue
Block a user