| src/main/java/com/nq/dao/AgentUserMapper.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/nq/dao/UserPositionMapper.java | ●●●●● patch | view | raw | blame | history | |
| src/main/java/com/nq/service/impl/UserPositionServiceImpl.java | ●●●●● patch | view | raw | blame | history | |
| src/main/resources/mapper/UserPositionMapper.xml | ●●●●● patch | view | raw | blame | history |
src/main/java/com/nq/dao/AgentUserMapper.java
@@ -2,11 +2,12 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.nq.pojo.AgentUser; import java.util.List; import org.apache.ibatis.annotations.Param; public interface AgentUserMapper { public interface AgentUserMapper extends BaseMapper<AgentUser> { int deleteByPrimaryKey(Integer paramInteger); int insert(AgentUser paramAgentUser); src/main/java/com/nq/dao/UserPositionMapper.java
@@ -35,7 +35,7 @@ List listByAgent(@Param("positionType") Integer paramInteger1, @Param("state") Integer paramInteger2, @Param("userId") Integer paramInteger3, @Param("searchId") Integer paramInteger4, @Param("positionSn") @Param("ids") List<Integer> ids, @Param("positionSn") String paramString, @Param("beginTime") Date paramDate1, @Param("endTime") Date paramDate2, @Param("phone") String phone ); src/main/java/com/nq/service/impl/UserPositionServiceImpl.java
@@ -686,8 +686,14 @@ PageHelper.startPage(pageNum, pageSize); List<Integer> ids = new ArrayList<>(); if(null != agentId){ ids = getSubordinates(searchId); ids.add(agentId); } List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, userId, searchId, positionSn, begin_time, end_time,null); userId, ids, positionSn, begin_time, end_time,null); List<AgentPositionVO> agentPositionVOS = Lists.newArrayList(); for (UserPosition position : userPositions) { @@ -716,8 +722,14 @@ } List<Integer> ids = new ArrayList<>(); if(null != agentId){ ids = getSubordinates(agentId); ids.add(agentId); } List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, Integer.valueOf(1), null, agentId, null, begin_time, end_time,null); null, ids, null, begin_time, end_time,null); BigDecimal order_fee_amt = new BigDecimal("0"); @@ -749,7 +761,14 @@ if (StringUtils.isNotBlank(endTime)) { end_time = DateTimeUtil.searchStrToTimestamp(endTime); } List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, userId, agentId, positionSn, begin_time, end_time,phone); List<Integer> ids = new ArrayList<>(); if(null != agentId){ ids = getSubordinates(agentId); ids.add(agentId); } List<UserPosition> userPositions = this.userPositionMapper.listByAgent(positionType, state, userId, ids, positionSn, begin_time, end_time,phone); List<AdminPositionVO> adminPositionVOS = Lists.newArrayList(); for (UserPosition position : userPositions) { AdminPositionVO adminPositionVO = assembleAdminPositionVO(position); @@ -760,6 +779,18 @@ return ServerResponse.createBySuccess(pageInfo); } public List<Integer> getSubordinates(Integer id) { List<AgentUser> agentUsers = agentUserMapper.selectList(new LambdaQueryWrapper<AgentUser>()); List<Integer> subordinates = new ArrayList<>(); for (AgentUser user : agentUsers) { if (id.equals(user.getParentId())) { subordinates.add(user.getId()); subordinates.addAll(getSubordinates(user.getId())); } } return subordinates; } public int CountPositionNum(Integer state, Integer accountType) { return this.userPositionMapper.CountPositionNum(state, accountType); } src/main/resources/mapper/UserPositionMapper.xml
@@ -485,36 +485,41 @@ <include refid="Base_Column_List"/> FROM user_position <where> <if test="searchId != null and searchId != '' "> and agent_id = #{searchId} 1=1 <if test="ids != null and ids.size > 0"> AND agent_id IN <foreach item="id" collection="ids" open="(" separator="," close=")"> #{id} </foreach> </if> <if test="state != null "> <if test="state == 0"> and sell_order_id is null </if> <if test="state == 1"> and sell_order_id is not null </if> <if test="state != null"> <choose> <when test="state == 0"> AND sell_order_id IS NULL </when> <when test="state == 1"> AND sell_order_id IS NOT NULL </when> </choose> </if> <if test="userId != null and userId != '' "> and user_id = #{userId} <if test="userId != null and userId != ''"> AND user_id = #{userId} </if> <if test="positionSn != null and positionSn != '' "> and position_sn like CONCAT('%','${positionSn}','%') <if test="positionSn != null and positionSn != ''"> AND position_sn LIKE CONCAT('%', #{positionSn}, '%') </if> <if test="positionType != null and positionType != ''"> and position_type = #{positionType} AND position_type = #{positionType} </if> <if test="beginTime != null and beginTime != ''"> and sell_order_time <![CDATA[>=]]> #{beginTime} AND sell_order_time <![CDATA[>=]]> #{beginTime} </if> <if test="endTime != null and endTime != ''"> and sell_order_time <![CDATA[<=]]> #{endTime} AND sell_order_time <![CDATA[<=]]> #{endTime} </if> <if test="phone != null and phone != ''"> and user_id = (select id from user where phone = #{phone}) AND user_id = (SELECT id FROM user WHERE phone = #{phone}) </if> </where> ORDER BY id DESC </select>