| | |
| | | package com.nq.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.nq.common.ServerResponse; |
| | | import com.nq.dao.StockMapper; |
| | | import com.nq.pojo.Stock; |
| | | import com.nq.pojo.StockSubscribe; |
| | | import com.nq.service.IStockSubscribeService; |
| | | import com.nq.dao.StockSubscribeMapper; |
| | |
| | | implements IStockSubscribeService { |
| | | @Resource |
| | | StockSubscribeMapper stockSubscribeMapper; |
| | | |
| | | @Autowired |
| | | StockMapper stockMapper; |
| | | |
| | | /** |
| | | * @Description: 用户新股列表 |
| | |
| | | public ServerResponse add(StockSubscribe model, HttpServletRequest request) { |
| | | //判断是否已经存在 |
| | | log.info("model:{}", model); |
| | | Stock stock = stockMapper.selectOne(new LambdaQueryWrapper<Stock>().eq(Stock::getStockSpell, model.getCode()).last(" limit 1")); |
| | | if(null == stock){ |
| | | return ServerResponse.createByErrorMsg("新股代码不存在"); |
| | | } |
| | | int resultCount = this.stockSubscribeMapper.insert(model); |
| | | if (resultCount > 0) { |
| | | return ServerResponse.createBySuccessMsg("添加新股成功"); |