Commit f27d4dc8 authored by licc's avatar licc

修改方案接口

parent dfa695fc
...@@ -6,6 +6,9 @@ import org.apache.ibatis.annotations.Param; ...@@ -6,6 +6,9 @@ import org.apache.ibatis.annotations.Param;
import java.util.List; import java.util.List;
/**
* @author 86187
*/
public interface UserVolunteerMapper extends BaseMapper<UserVolunteer> { public interface UserVolunteerMapper extends BaseMapper<UserVolunteer> {
UserVolunteer add(UserVolunteer userVolunteer); UserVolunteer add(UserVolunteer userVolunteer);
...@@ -14,5 +17,5 @@ public interface UserVolunteerMapper extends BaseMapper<UserVolunteer> { ...@@ -14,5 +17,5 @@ public interface UserVolunteerMapper extends BaseMapper<UserVolunteer> {
int delById(@Param("id") Integer id); int delById(@Param("id") Integer id);
int creates(List<UserVolunteer> t); int creates(@Param("list") List<UserVolunteer> list);
} }
package cn.wisenergy.mapper; package cn.wisenergy.mapper;
import cn.hutool.system.UserInfo;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
...@@ -9,10 +10,10 @@ import java.util.List; ...@@ -9,10 +10,10 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* @author 86187
* @ Description: * @ Description:
* @ Author : 86187 * @ Author : 86187
* @ Date : 2021/1/6 15:32 * @ Date : 2021/1/6 15:32
* @author 86187
*/ */
@Mapper @Mapper
public interface UsersMapper extends BaseMapper<User> { public interface UsersMapper extends BaseMapper<User> {
...@@ -47,4 +48,6 @@ public interface UsersMapper extends BaseMapper<User> { ...@@ -47,4 +48,6 @@ public interface UsersMapper extends BaseMapper<User> {
Integer getUserNumbers(); Integer getUserNumbers();
User getByPhone(@Param("phone") String phone); User getByPhone(@Param("phone") String phone);
List<User> test(@Param("list") List<String> list);
} }
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</resultMap> </resultMap>
<sql id="table"> <sql id="table">
user user_volunteer
</sql> </sql>
<sql id="cols_all"> <sql id="cols_all">
......
...@@ -106,7 +106,8 @@ ...@@ -106,7 +106,8 @@
<if test="startTime != null"> <if test="startTime != null">
and create_time and create_time
between #{startTime} </if> between #{startTime}
</if>
<if test="endTime != null">and #{endTime}</if> <if test="endTime != null">and #{endTime}</if>
order by create_time desc order by create_time desc
...@@ -128,4 +129,19 @@ ...@@ -128,4 +129,19 @@
<include refid="table"/> <include refid="table"/>
where is_delete=0 and phone=#{phone} where is_delete=0 and phone=#{phone}
</select> </select>
<select id="test" resultType="cn.wisenergy.model.app.User">
select
<include refid="cols_all"/>
from
<include refid="table"/>
<where>
<if test="list != null">
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")">
user_name LIKE CONCAT('%',#{id},'%')
</foreach>
</if>
</where>
</select>
</mapper> </mapper>
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
<result column="nature" property="nature"/> <result column="nature" property="nature"/>
<result column="year_limit" property="yearLimit"/> <result column="year_limit" property="yearLimit"/>
<result column="plan_num" property="planNum"/> <result column="plan_num" property="planNum"/>
<result column="castArchives_num" property="castArchivesNum"/> <result column="cast_archives_num" property="castArchivesNum"/>
<result column="launch_num" property="launchNum"/> <result column="launch_num" property="launchNum"/>
<result column="lowest_mark" property="lowestMark"/> <result column="lowest_mark" property="lowestMark"/>
<result column="lowest_rank" property="lowestRank"/> <result column="lowest_rank" property="lowestRank"/>
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
<sql id="cols_exclude_id"> <sql id="cols_exclude_id">
type,scheme_id,major_name,academy, course_demand,nature,year_limit,plan_num, type,scheme_id,major_name,academy, course_demand,nature,year_limit,plan_num,
castArchives_num,launch_num,lowest_mark, cast_archives_num,launch_num,lowest_mark,
lowest_rank,is_delete,create_time,update_time lowest_rank,is_delete,create_time,update_time
</sql> </sql>
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<if test="nature != null">nature =#{nature},</if> <if test="nature != null">nature =#{nature},</if>
<if test="yearLimit != null">year_limit =#{yearLimit},</if> <if test="yearLimit != null">year_limit =#{yearLimit},</if>
<if test="planNum != null">plan_num =#{planNum},</if> <if test="planNum != null">plan_num =#{planNum},</if>
<if test="castArchivesNum != null">castArchives_num = #{castArchivesNum},</if> <if test="castArchivesNum != null">cast_archives_num = #{castArchivesNum},</if>
<if test="launchNum != null">launch_num = #{launchNum},</if> <if test="launchNum != null">launch_num = #{launchNum},</if>
<if test="lowestMark != null">lowest_mark = #{lowestMark},</if> <if test="lowestMark != null">lowest_mark = #{lowestMark},</if>
<if test="lowestRank != null">lowestMark = #{lowestRank},</if> <if test="lowestRank != null">lowestMark = #{lowestRank},</if>
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<if test="nature != null">and nature =#{nature}</if> <if test="nature != null">and nature =#{nature}</if>
<if test="yearLimit != null">and year_limit =#{yearLimit}</if> <if test="yearLimit != null">and year_limit =#{yearLimit}</if>
<if test="planNum != null">and plan_num =#{planNum}</if> <if test="planNum != null">and plan_num =#{planNum}</if>
<if test="castArchivesNum != null">and castArchives_num = #{castArchivesNum}</if> <if test="castArchivesNum != null">and cast_archives_num = #{castArchivesNum}</if>
<if test="launchNum != null">and launch_num = #{launchNum}</if> <if test="launchNum != null">and launch_num = #{launchNum}</if>
<if test="lowestMark != null">and lowest_mark = #{lowestMark}</if> <if test="lowestMark != null">and lowest_mark = #{lowestMark}</if>
<if test="lowestRank != null">and lowestMark = #{lowestRank}</if> <if test="lowestRank != null">and lowestMark = #{lowestRank}</if>
...@@ -152,18 +152,18 @@ ...@@ -152,18 +152,18 @@
</if> </if>
<if test="classNames != null"> <if test="classNames != null">
and and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")"> <foreach collection="classNames" index="index" item="id" separator="or" open="(" close=")">
course_demand LIKE CONCAT('%',#{item},'%') course_demand LIKE CONCAT('%',#{id},'%')
</foreach> </foreach>
</if> </if>
<if test="professionNames != null"> <if test="professionNames != null">
and and
<foreach collection="list" index="index" item="id" separator="or" open="(" close=")"> <foreach collection="professionNames" index="index" item="id" separator="or" open="(" close=")">
major_name LIKE CONCAT('%',#{item},'%') major_name LIKE CONCAT('%',#{id},'%')
</foreach> </foreach>
</if> </if>
limit #{number}
order by lowest_mark desc order by lowest_mark desc
limit #{number}
</where> </where>
</select> </select>
......
...@@ -18,7 +18,7 @@ import java.util.Date; ...@@ -18,7 +18,7 @@ import java.util.Date;
@Data @Data
@ApiModel(value = "AccountUsers") @ApiModel(value = "AccountUsers")
@TableName("user") @TableName("user")
public class User extends BaseEntity implements Serializable { public class User implements Serializable {
private static final long serialVersionUID = 2525339404301884673L; private static final long serialVersionUID = 2525339404301884673L;
/** /**
......
package cn.wisenergy.model.app; package cn.wisenergy.model.app;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.Data; import lombok.Data;
/**
* @author 86187
*/
@Data @Data
@ApiModel(value = "UserVolunteer") @ApiModel(value = "UserVolunteer")
@TableName("user_volunteer")
public class UserVolunteer { public class UserVolunteer {
/** /**
* 用户方案id * 用户方案id
......
...@@ -25,7 +25,7 @@ import java.util.Date; ...@@ -25,7 +25,7 @@ import java.util.Date;
@NoArgsConstructor @NoArgsConstructor
@AllArgsConstructor @AllArgsConstructor
@ExcelIgnoreUnannotated @ExcelIgnoreUnannotated
public class Volunteer extends BaseEntity implements Serializable { public class Volunteer implements Serializable {
private static final long serialVersionUID = -7880251929353475087L; private static final long serialVersionUID = -7880251929353475087L;
/** /**
...@@ -117,4 +117,24 @@ public class Volunteer extends BaseEntity implements Serializable { ...@@ -117,4 +117,24 @@ public class Volunteer extends BaseEntity implements Serializable {
@ExcelProperty(value = "最低位次") @ExcelProperty(value = "最低位次")
private String lowestRank; private String lowestRank;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 修改时间
*/
@ApiModelProperty("修改时间")
private Date updateTime;
/**
* 删除标记
*/
@ApiModelProperty("是否删除 1,删除;0,未删除")
private Integer isDelete;
} }
package cn.wisenergy.service.app; package cn.wisenergy.service.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.User; import cn.wisenergy.model.app.User;
import cn.wisenergy.model.dto.UserCommitDto; import cn.wisenergy.model.dto.UserCommitDto;
...@@ -10,6 +9,8 @@ import cn.wisenergy.model.vo.UserQueryVo; ...@@ -10,6 +9,8 @@ import cn.wisenergy.model.vo.UserQueryVo;
import cn.wisenergy.model.vo.UserShowVo; import cn.wisenergy.model.vo.UserShowVo;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.List;
/** /**
* @ Description: 用户接口 * @ Description: 用户接口
* @ Author : 86187 * @ Author : 86187
...@@ -58,4 +59,6 @@ public interface UserService { ...@@ -58,4 +59,6 @@ public interface UserService {
*/ */
R<UserShowVo> getById(Integer id); R<UserShowVo> getById(Integer id);
R<List<User>> test();
} }
package cn.wisenergy.service.app;
import cn.wisenergy.model.app.UserVolunteer;
import com.baomidou.mybatisplus.extension.service.IService;
/**
* @author 86187
*/
public interface UserVolunteerService extends IService<UserVolunteer> {
}
...@@ -10,6 +10,8 @@ import cn.wisenergy.model.enums.StudentType; ...@@ -10,6 +10,8 @@ import cn.wisenergy.model.enums.StudentType;
import cn.wisenergy.model.vo.SchemeQueryVo; import cn.wisenergy.model.vo.SchemeQueryVo;
import cn.wisenergy.model.vo.VolunteerVo; import cn.wisenergy.model.vo.VolunteerVo;
import cn.wisenergy.service.app.SchemeService; import cn.wisenergy.service.app.SchemeService;
import cn.wisenergy.service.app.UserVolunteerService;
import cn.wisenergy.service.app.VolunteerService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
...@@ -55,6 +57,9 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -55,6 +57,9 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
@Autowired @Autowired
private ProfessionMapper professionMapper; private ProfessionMapper professionMapper;
@Autowired
private UserVolunteerService userVolunteerService;
@Override @Override
public R<VolunteerVo> getList(SchemeQueryVo queryVo) { public R<VolunteerVo> getList(SchemeQueryVo queryVo) {
log.info("volunteer-service[]SchemeServiceImpl[]getList[]input.param.queryVo:" + queryVo); log.info("volunteer-service[]SchemeServiceImpl[]getList[]input.param.queryVo:" + queryVo);
...@@ -263,7 +268,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -263,7 +268,7 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
* @param list 志愿信息 * @param list 志愿信息
* @return true 成功 false 失败 * @return true 成功 false 失败
*/ */
@Transactional(rollbackFor =Exception.class) @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();
...@@ -290,8 +295,8 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp ...@@ -290,8 +295,8 @@ public class SchemeServiceImpl extends ServiceImpl<SchemeMapper, SchemeInfo> imp
volunteerList.add(userVolunteer); volunteerList.add(userVolunteer);
} }
int save = userVolunteerMapper.creates(volunteerList); boolean bool = userVolunteerService.saveBatch(volunteerList);
if (volunteerList.size() != save) { if (!bool) {
return false; return false;
} }
return true; return true;
......
package cn.wisenergy.service.app.impl; package cn.wisenergy.service.app.impl;
import cn.hutool.system.UserInfo;
import cn.wisenergy.common.constant.CommonAttributes; import cn.wisenergy.common.constant.CommonAttributes;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.mapper.*; import cn.wisenergy.mapper.*;
...@@ -214,6 +215,16 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U ...@@ -214,6 +215,16 @@ public class UserServiceImpl extends ServiceImpl<UsersMapper, User> implements U
return R.ok(userShowVo); return R.ok(userShowVo);
} }
@Override
public R<List<User>> test() {
List<String> names=new ArrayList<>();
names.add("黎楚川");
names.add("陈成");
names.add("雷青松");
List<User> list=usersMapper.test(names);
return R.ok(list);
}
/** /**
* 分页处理方法 * 分页处理方法
* *
......
package cn.wisenergy.service.app.impl;
import cn.wisenergy.mapper.UserVolunteerMapper;
import cn.wisenergy.model.app.UserVolunteer;
import cn.wisenergy.service.app.UserVolunteerService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import java.io.Serializable;
/**
* @author 86187
*/
@Service
public class UserVolunteerServiceImpl extends ServiceImpl<UserVolunteerMapper,UserVolunteer> implements UserVolunteerService {
}
package cn.wisenergy.web.admin.controller.app; package cn.wisenergy.web.admin.controller.app;
import cn.wisenergy.common.utils.R; import cn.wisenergy.common.utils.R;
import cn.wisenergy.model.app.User;
import cn.wisenergy.model.dto.UserCommitDto; import cn.wisenergy.model.dto.UserCommitDto;
import cn.wisenergy.model.dto.UserInfoDto; import cn.wisenergy.model.dto.UserInfoDto;
import cn.wisenergy.model.vo.UserInfoVo; import cn.wisenergy.model.vo.UserInfoVo;
...@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j; ...@@ -15,6 +16,8 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.List;
/** /**
* @ Description: 用户管理模 * @ Description: 用户管理模
...@@ -30,6 +33,7 @@ public class UserController { ...@@ -30,6 +33,7 @@ public class UserController {
@Autowired @Autowired
private UserService userService; private UserService userService;
@ApiOperation(value = "用户管理", notes = "用户管理", httpMethod = "POST") @ApiOperation(value = "用户管理", notes = "用户管理", httpMethod = "POST")
@ApiImplicitParam(name = "queryVo", value = "用户信息", dataType = "UserQueryVo") @ApiImplicitParam(name = "queryVo", value = "用户信息", dataType = "UserQueryVo")
@PostMapping("/manage") @PostMapping("/manage")
...@@ -78,4 +82,14 @@ public class UserController { ...@@ -78,4 +82,14 @@ public class UserController {
//返回数据 //返回数据
return userService.getById(userId); return userService.getById(userId);
} }
@ApiOperation(value = "测试like循环查询", notes = "测试like循环查询", httpMethod = "GET")
@GetMapping("/test")
public R<List<User>> test() {
log.info("UserController[]test[]input.param");
//返回数据
return userService.test();
}
} }
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