Commit dfa695fc authored by licc's avatar licc

新增价格明细接口

parent a0f3e9ca
...@@ -60,4 +60,6 @@ public interface BannerMapper extends BaseMapper<Banner> { ...@@ -60,4 +60,6 @@ public interface BannerMapper extends BaseMapper<Banner> {
* @return * @return
*/ */
int editStatus(@Param("id") Integer id, @Param("status") Integer status); int editStatus(@Param("id") Integer id, @Param("status") Integer status);
List<Banner> getTopBanners();
} }
package cn.wisenergy.mapper;
import cn.wisenergy.model.app.Price;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import java.util.List;
/**
* @author 86187
*/
public interface PriceMapper extends BaseMapper<Price> {
int add(Price price);
List<Price> getList();
int count();
}
...@@ -17,7 +17,7 @@ public interface SchemeRecordMapper extends BaseMapper<SchemeQueryRecord> { ...@@ -17,7 +17,7 @@ public interface SchemeRecordMapper extends BaseMapper<SchemeQueryRecord> {
* @param schemeQueryRecord 方案记录信息 * @param schemeQueryRecord 方案记录信息
* @return 方案记录信息 * @return 方案记录信息
*/ */
SchemeQueryRecord add(SchemeQueryRecord schemeQueryRecord); int add(SchemeQueryRecord schemeQueryRecord);
/** /**
* 编辑方案记录 * 编辑方案记录
......
...@@ -20,7 +20,7 @@ ...@@ -20,7 +20,7 @@
</resultMap> </resultMap>
<sql id="table"> <sql id="table">
user admission_rule
</sql> </sql>
<sql id="cols_all"> <sql id="cols_all">
...@@ -99,7 +99,8 @@ ...@@ -99,7 +99,8 @@
<select id="getByType" resultType="cn.wisenergy.model.app.AdmissionRule"> <select id="getByType" resultType="cn.wisenergy.model.app.AdmissionRule">
SELECT COUNT(id) SELECT
<include refid="cols_all"/>
FROM FROM
<include refid="table"/> <include refid="table"/>
where is_delete=0 and type=#{type} where is_delete=0 and type=#{type}
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if> <if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql> </sql>
<insert id="add" parameterType="cn.wisenergy.model.app.Banner" keyProperty="id" useGeneratedKeys="true"> <insert id="add" parameterType="cn.wisenergy.model.app.Banner" keyProperty="id" useGeneratedKeys="true">
insert into insert into
<include refid="table"/> <include refid="table"/>
(<include refid="cols_exclude_id"/>) (<include refid="cols_exclude_id"/>)
...@@ -85,7 +85,7 @@ ...@@ -85,7 +85,7 @@
from from
<include refid="table"/> <include refid="table"/>
order by create_time desc order by create_time desc
limit #{pageNo},#{pageSize} limit #{pageNo},#{pageSize}
</select> </select>
<select id="count" resultType="java.lang.Integer"> <select id="count" resultType="java.lang.Integer">
...@@ -95,12 +95,22 @@ ...@@ -95,12 +95,22 @@
</select> </select>
<select id="getById" resultMap="advertisingMap"> <select id="getById" resultMap="advertisingMap">
select <include refid="cols_all"/> select
from <include refid="table"/> <include refid="cols_all"/>
from
<include refid="table"/>
where id=#{id} where id=#{id}
</select> </select>
<update id="aditStatus"> <select id="getTopBanners" resultType="cn.wisenergy.model.app.Banner">
select
<include refid="cols_all"/>
from
<include refid="table"/>
where status=1 and type=1
</select>
<update id="editStatus">
UPDATE UPDATE
<include refid="table"/> <include refid="table"/>
<set> <set>
......
<?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="cn.wisenergy.mapper.PriceMapper">
<resultMap id="priceMap" type="cn.wisenergy.model.app.Price">
<id column="id" property="id"/>
<result column="use_limit" property="useLimit"/>
<result column="money" property="money"/>
<result column="is_delete" property="isDelete"/>
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
</resultMap>
<sql id="table">
price
</sql>
<sql id="cols_all">
id,
<include refid="cols_exclude_id"/>
</sql>
<sql id="cols_exclude_id">
use_limit,money, is_delete, create_time,update_time
</sql>
<sql id="vals">
#{useLimit},#{money},#{isDelete},now(),now()
</sql>
<sql id="updateCondition">
<if test="useLimit != null">use_limit = #{useLimit},</if>
<if test="money != null">money =#{money},</if>
<if test="isDelete != null">is_delete =#{isDelete},</if>
update_time =now()
</sql>
<sql id="criteria">
<if test="id != null">id = #{id}</if>
<if test="useLimit != null">and use_limit = #{useLimit}</if>
<if test="money != null">and money =#{money}</if>
<if test="isDelete != null">and is_delete =#{isDelete}</if>
<if test="createTime != null">and create_time &gt;= #{createTime}</if>
<if test="updateTime != null">and #{updateTime} &gt;= update_time</if>
</sql>
<insert id="add" parameterType="cn.wisenergy.model.app.Price" keyProperty="id" useGeneratedKeys="true">
insert into
<include refid="table"/>
(<include refid="cols_exclude_id"/>)
value(
<include refid="vals"/>
)
</insert>
<select id="getList" resultType="cn.wisenergy.model.app.Price">
select
<include refid="cols_all"/>
from
<include refid="table"/>
where is_delete=0
order by use_limit
</select>
<select id="count" resultType="java.lang.Integer">
select count(1)
from
<include refid="table"/>
where is_delete=0
</select>
</mapper>
...@@ -150,13 +150,13 @@ ...@@ -150,13 +150,13 @@
<if test="downGrade != null"> <if test="downGrade != null">
and lowest_mark >#{downGrade} and lowest_mark >#{downGrade}
</if> </if>
<if test="classNames != null and classNames.size() >0"> <if test="classNames != null">
and and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")"> <foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
course_demand LIKE CONCAT('%',#{item},'%') course_demand LIKE CONCAT('%',#{item},'%')
</foreach> </foreach>
</if> </if>
<if test="professionNames != null and classNames.size() >0"> <if test="professionNames != null">
and and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")"> <foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
major_name LIKE CONCAT('%',#{item},'%') major_name LIKE CONCAT('%',#{item},'%')
......
package cn.wisenergy.model.app;
import cn.wisenergy.model.common.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* @author 86187
* @ Description: 价格表
* @ Author : 86187
* @ Date : 2021/1/24 9:50
*/
@Data
@ApiModel(value = "Price")
public class Price implements Serializable {
private static final long serialVersionUID = 1112644645559505970L;
/**
* 价格id
*/
@ApiModelProperty(value = "价格id", name = "id")
private Integer id;
/**
* 可查询次数
*/
@ApiModelProperty(value = "可查询次数", name = "useLimit")
private Integer useLimit;
/**
* 购买需要的钱
*/
@ApiModelProperty(value = "购买需要的钱", name = "money")
private Integer money;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private Date updateTime;
/**
* 删除标记
*/
@ApiModelProperty("是否删除 1,删除;0,未删除")
private Integer isDelete;
}
...@@ -7,6 +7,8 @@ import cn.wisenergy.model.vo.AdvertisingQueryVo; ...@@ -7,6 +7,8 @@ import cn.wisenergy.model.vo.AdvertisingQueryVo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.sun.org.apache.xpath.internal.operations.Bool; import com.sun.org.apache.xpath.internal.operations.Bool;
import java.util.List;
/** /**
* @ Description: 广告接口定义 * @ Description: 广告接口定义
* @ Author : 86187 * @ Author : 86187
...@@ -35,7 +37,7 @@ public interface BannerService { ...@@ -35,7 +37,7 @@ public interface BannerService {
* @param id 广告id * @param id 广告id
* @return 详情 * @return 详情
*/ */
R getById(Integer id); R<Banner> getById(Integer id);
/** /**
* 获取广告分页列表 * 获取广告分页列表
...@@ -54,4 +56,6 @@ public interface BannerService { ...@@ -54,4 +56,6 @@ public interface BannerService {
*/ */
R<Boolean> editStatus(Integer id, Integer status); R<Boolean> editStatus(Integer id, Integer status);
R<List<Banner>> getTopBanners();
} }
package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Price;
import java.util.List;
/**
* @author 86187
*/
public interface PriceService {
R<List<Price>> getList();
}
...@@ -64,7 +64,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme ...@@ -64,7 +64,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
return R.error("数据修改失败"); return R.error("数据修改失败");
} }
return R.ok(0,true); return R.ok(0, true);
} }
@Override @Override
...@@ -124,7 +124,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme ...@@ -124,7 +124,7 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
public R<Boolean> editStatus(Integer id, Integer status) { public R<Boolean> editStatus(Integer id, Integer status) {
log.info("BannerServiceImpl[].putIn[].input.param,status:{},id" + status, id); log.info("BannerServiceImpl[].putIn[].input.param,status:{},id" + status, id);
//判断数据是否正确 //判断数据是否正确
if (null == id ||null==status) { if (null == id || null == status) {
return R.error("缺少重要数据"); return R.error("缺少重要数据");
} }
...@@ -135,6 +135,11 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme ...@@ -135,6 +135,11 @@ public class BannerServiceImpl extends ServiceImpl<BannerMapper, Banner> impleme
if (i == 0) { if (i == 0) {
return R.error("数据修改失败"); return R.error("数据修改失败");
} }
return R.ok(0,true); return R.ok(0, true);
}
@Override
public R<List<Banner>> getTopBanners() {
return R.ok(bannerMapper.getTopBanners());
} }
} }
package cn.wisenergy.service.app.impl;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.PriceMapper;
import cn.wisenergy.model.app.Price;
import cn.wisenergy.service.app.PriceService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author 86187
*/
@Service
@Slf4j
public class PriceServiceImpl extends ServiceImpl<PriceMapper, Price> implements PriceService {
@Autowired
private PriceMapper priceMapper;
@Override
public R<List<Price>> getList() {
return R.ok(priceMapper.getList());
}
}
...@@ -50,11 +50,11 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch ...@@ -50,11 +50,11 @@ public class SchemeRecordServiceImpl extends ServiceImpl<SchemeRecordMapper, Sch
} }
//保存记录信息 //保存记录信息
SchemeQueryRecord schemeQueryRecord = schemeRecordMapper.add(scheme); int count = schemeRecordMapper.add(scheme);
if (null == schemeQueryRecord) { if (count==0) {
return R.error("添加方案记录失败"); return R.error("添加方案记录失败");
} }
return R.ok(schemeQueryRecord); return R.ok(scheme);
} }
@Override @Override
......
...@@ -263,7 +263,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -263,7 +263,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param list 志愿信息 * @param list 志愿信息
* @return true 成功 false 失败 * @return true 成功 false 失败
*/ */
@Transactional @Transactional(rollbackFor =Exception.class)
public boolean saveUserVolunteer(User user, List<Volunteer> list, ScoreInfo scoreInfo) { public boolean saveUserVolunteer(User user, List<Volunteer> list, ScoreInfo scoreInfo) {
//1、保存方案查询记录 //1、保存方案查询记录
SchemeQueryRecord schemeQueryRecord = new SchemeQueryRecord(); SchemeQueryRecord schemeQueryRecord = new SchemeQueryRecord();
...@@ -276,15 +276,15 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -276,15 +276,15 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
List<Integer> ids = list.stream().map(Volunteer::getId).collect(Collectors.toList()); List<Integer> ids = list.stream().map(Volunteer::getId).collect(Collectors.toList());
//保存方案查询记录 //保存方案查询记录
SchemeQueryRecord count = schemeRecordMapper.add(schemeQueryRecord); int count = schemeRecordMapper.add(schemeQueryRecord);
if (null == count) { if (count == 0) {
return false; return false;
} }
List<UserVolunteer> volunteerList = new ArrayList<>(); List<UserVolunteer> volunteerList = new ArrayList<>();
for (Integer id : ids) { for (Integer id : ids) {
UserVolunteer userVolunteer = new UserVolunteer(); UserVolunteer userVolunteer = new UserVolunteer();
userVolunteer.setSchemeRecordId(count.getId()); userVolunteer.setSchemeRecordId(schemeQueryRecord.getId());
userVolunteer.setUserId(user.getId()); userVolunteer.setUserId(user.getId());
userVolunteer.setVolunteerId(id); userVolunteer.setVolunteerId(id);
volunteerList.add(userVolunteer); volunteerList.add(userVolunteer);
......
...@@ -15,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -15,7 +15,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @author 86187
* @ Description: 管理端-广告管理 * @ Description: 管理端-广告管理
* @ Author : 86187 * @ Author : 86187
* @ Date : 2021/1/14 10:43 * @ Date : 2021/1/14 10:43
...@@ -41,8 +44,7 @@ public class BannerController { ...@@ -41,8 +44,7 @@ public class BannerController {
@PostMapping("/getList") @PostMapping("/getList")
public R<PageInfo<BannerDto>> add(@RequestBody AdvertisingQueryVo advertisingQueryVo) { public R<PageInfo<BannerDto>> add(@RequestBody AdvertisingQueryVo advertisingQueryVo) {
log.info("BannerController[].add[].input.param:advertisingQueryVo:" + advertisingQueryVo); log.info("BannerController[].add[].input.param:advertisingQueryVo:" + advertisingQueryVo);
R<PageInfo<BannerDto>> list = bannerService.getList(advertisingQueryVo); return bannerService.getList(advertisingQueryVo);
return list;
} }
@ApiOperation(value = "查看详情", notes = "查看详情", httpMethod = "GET") @ApiOperation(value = "查看详情", notes = "查看详情", httpMethod = "GET")
...@@ -50,8 +52,8 @@ public class BannerController { ...@@ -50,8 +52,8 @@ public class BannerController {
@GetMapping("/getById") @GetMapping("/getById")
public R<Banner> getById(Integer id) { public R<Banner> getById(Integer id) {
log.info("BannerController[].getById[].input.param:id" + id); log.info("BannerController[].getById[].input.param:id" + id);
R bannerR = bannerService.getById(id); return bannerService.getById(id);
return bannerR;
} }
@ApiOperation(value = "广告投放", notes = "广告投放", httpMethod = "GET") @ApiOperation(value = "广告投放", notes = "广告投放", httpMethod = "GET")
...@@ -61,9 +63,8 @@ public class BannerController { ...@@ -61,9 +63,8 @@ public class BannerController {
}) })
@GetMapping("/putIn") @GetMapping("/putIn")
public R<Boolean> editStatus(Integer id, Integer status) { public R<Boolean> editStatus(Integer id, Integer status) {
log.info("BannerController[].putIn[].input.param:id,status" + id, status); log.info("BannerController[]editStatus[]input.param:id,status{}" + id, status);
R<Boolean> booleanR = bannerService.editStatus(id, status); return bannerService.editStatus(id, status);
return booleanR;
} }
@ApiOperation(value = "广告编辑", notes = "广告编辑", httpMethod = "POST") @ApiOperation(value = "广告编辑", notes = "广告编辑", httpMethod = "POST")
...@@ -72,8 +73,16 @@ public class BannerController { ...@@ -72,8 +73,16 @@ public class BannerController {
}) })
@PostMapping("/edit") @PostMapping("/edit")
public R<Boolean> edit(@RequestBody Banner advertising) { public R<Boolean> edit(@RequestBody Banner advertising) {
log.info("BannerController[].edit[].input.param:advertising:{}" + advertising); log.info("BannerController[].edit[].input.param:advertising:" + advertising);
R<Boolean> booleanR = bannerService.edit(advertising); return bannerService.edit(advertising);
return booleanR; }
@ApiOperation(value = "获取顶部广告", notes = "获取顶部广告", httpMethod = "GET")
@GetMapping("/getTopBanners")
public R<List<Banner>> getTopBanners() {
log.info("BannerController[]getTopBanners[]input.param");
return bannerService.getTopBanners();
} }
} }
...@@ -22,6 +22,7 @@ import java.util.List; ...@@ -22,6 +22,7 @@ import java.util.List;
* @ Description: PC-我的账户 * @ Description: PC-我的账户
* @ Author : 86187 * @ Author : 86187
* @ Date : 2021/1/14 10:45 * @ Date : 2021/1/14 10:45
* @author 86187
*/ */
@RestController @RestController
@Api(tags = "PC-我的账户") @Api(tags = "PC-我的账户")
......
package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.Price;
import cn.wisenergy.service.app.PriceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author 86187
*/
@Api(tags = "价格明细")
@RestController
@RequestMapping("/price")
@Slf4j
public class PriceController {
@Autowired
private PriceService priceService;
@ApiOperation(value = "获取价格明细", notes = "获取价格明细", httpMethod = "GET")
@GetMapping("/getList")
public R<List<Price>> getList() {
log.info("volunteer-service[]PriceController[]getList[]input.param");
return priceService.getList();
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment