Commit f27d4dc8 authored by licc's avatar licc

修改方案接口

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