2021-07-13

申诉功能实现

判断申诉的记录是否违约,将用户申诉添加到appeal表

Controller层实现

在这里插入图片描述

@RestController
@RequestMapping("/appeal")
public class AddAppealController {
    @Autowired
    AddAppealService addAppealService;

    @GetMapping ("/addAppeals")//提交申诉
    public int addAppeals(HttpServletRequest request, int act_id,String room_name, int seat_no,String appeal_desc){
        String user_openid = (String) request.getAttribute("openid");
        return addAppealService.addAppeal(user_openid,act_id,room_name,seat_no,appeal_desc);
    }
}

Service层实现

在这里插入图片描述

@Service
public class AddAppealService {
    @Autowired
    AddAppealMapper addAppealMapper;

    public int addAppeal(String user_openid,int act_id,String room_name,int seat_no,String appeal_desc){

        int seat_id = addAppealMapper.getSeatId(room_name,seat_no);
        int act_room_seat_id = addAppealMapper.getActRoomSeatId(act_id,seat_id);
        int user_pick_seat_id = addAppealMapper.getUserPickSeatId(user_openid,act_room_seat_id);

        Date appeal_time = new Date();//获取申诉时间

        String act_name = addAppealMapper.getActName(act_id);//获取活动名

        return addAppealMapper.addAppeal(user_pick_seat_id,act_name+"座位"+seat_no+"申诉理由:"+appeal_desc,appeal_time);

    }
}

Mapper层实现

在这里插入图片描述

@Mapper
public interface AddAppealMapper {

    @Select("SELECT seat_id FROM seat WHERE room_name = #{room_name} and seat_no = #{seat_no}")
    int getSeatId(String room_name,int seat_no);
    //查询seat_id

    @Select("SELECT act_room_seat_id FROM act_room_seat WHERE act_id = #{act_id} and seat_id = #{seat_id}")
    int getActRoomSeatId(int act_id,int seat_id);
    //查询act_room_seat_id

    @Select("SELECT user_pick_seat_id FROM user_pick_seat WHERE user_openid = #{user_openid} and act_room_seat_id = #{act_room_seat_id}")
    int getUserPickSeatId(String user_openid,int act_room_seat_id);
    //查询user_pick_seat_id

    @Select("SELECT act_name FROM activity WHERE act_id = #{act_id}")
    String getActName(int act_id);
    //查询活动名

    @Insert("INSERT INTO appeal (user_pick_seat_id,appeal_desc,appeal_time) VALUES (#{user_pick_seat_id},#{appeal_desc},#{appeal_time})")
    int addAppeal(int user_pick_seat_id,String appeal_desc,Date appeal_time);
    //将用户申诉添加到appeal,result和remark列空着
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值