修改价格再优化
This commit is contained in:
parent
f420f10508
commit
abb4a0f1d5
|
@ -140,11 +140,7 @@ public class WxCounselorController extends BaseController {
|
||||||
@RepeatSubmit()
|
@RepeatSubmit()
|
||||||
@PutMapping("/price")
|
@PutMapping("/price")
|
||||||
public R<Void> editPrice(@RequestBody CounselorBo bo) {
|
public R<Void> editPrice(@RequestBody CounselorBo bo) {
|
||||||
Long userId = LoginHelper.getUserId();
|
return toAjax(counselorService.updatePrive(bo));
|
||||||
CounselorBo newBo = new CounselorBo();
|
|
||||||
newBo.setId(userId);
|
|
||||||
newBo.setPrice(bo.getPrice());
|
|
||||||
return toAjax(counselorService.updateByBo(newBo));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,6 +56,13 @@ public interface ICounselorService {
|
||||||
*/
|
*/
|
||||||
Boolean updateByBo(CounselorBo bo);
|
Boolean updateByBo(CounselorBo bo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改价格
|
||||||
|
* @param bo
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updatePrive(CounselorBo bo);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 校验并批量删除心理咨询师信息
|
* 校验并批量删除心理咨询师信息
|
||||||
*
|
*
|
||||||
|
|
|
@ -10,6 +10,7 @@ import org.dromara.common.core.utils.MapstructUtils;
|
||||||
import org.dromara.common.core.utils.StringUtils;
|
import org.dromara.common.core.utils.StringUtils;
|
||||||
import org.dromara.common.mybatis.core.page.PageQuery;
|
import org.dromara.common.mybatis.core.page.PageQuery;
|
||||||
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
import org.dromara.common.mybatis.core.page.TableDataInfo;
|
||||||
|
import org.dromara.common.satoken.utils.LoginHelper;
|
||||||
import org.dromara.scale.domain.Counselor;
|
import org.dromara.scale.domain.Counselor;
|
||||||
import org.dromara.scale.domain.bo.CounselorBo;
|
import org.dromara.scale.domain.bo.CounselorBo;
|
||||||
import org.dromara.scale.domain.vo.CounselorVo;
|
import org.dromara.scale.domain.vo.CounselorVo;
|
||||||
|
@ -19,6 +20,7 @@ import org.dromara.system.domain.bo.SysUserBo;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
@ -122,6 +124,19 @@ public class CounselorServiceImpl implements ICounselorService {
|
||||||
return baseMapper.updateById(update) > 0;
|
return baseMapper.updateById(update) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Boolean updatePrive(CounselorBo bo) {
|
||||||
|
Long userId = LoginHelper.getUserId();
|
||||||
|
BigDecimal price = bo.getPrice();
|
||||||
|
if (price.compareTo(BigDecimal.ZERO) < 0) {
|
||||||
|
throw new ServiceException("价格不能等于或小于0");
|
||||||
|
}
|
||||||
|
Counselor update = new Counselor();
|
||||||
|
update.setId(userId);
|
||||||
|
update.setPrice(price);
|
||||||
|
return baseMapper.updateById(update) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 保存前的数据校验
|
* 保存前的数据校验
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue