Browse Source

管理员搜索列表去空处理修改

anderx 3 years ago
parent
commit
a4d8564a2b

+ 13 - 2
src/main/java/com/goafanti/admin/service/impl/NewAdminServiceImpl.java

@@ -2,7 +2,10 @@ package com.goafanti.admin.service.impl;
 
 import java.util.*;
 
+import com.goafanti.common.dao.AmbSystemMapper;
+import com.goafanti.common.model.AmbSystem;
 import com.goafanti.common.model.Role;
+import com.goafanti.common.utils.AsyncUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -29,6 +32,8 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 	private UserRoleMapper		userRoleMapper;
 	@Autowired
 	private AdminLocationMapper	adminLocationMapper;
+	@Autowired
+	private AmbSystemMapper	ambSystemMapper;
 
 	@Override
 	public Pagination<AdminListBo> listAdmin(AdminListBo alb, String rid,String roleName,Integer pageNo, Integer pageSize) {
@@ -43,7 +48,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		if(StringUtils.isNotBlank(alb.getMobile())) params.put("mobile", alb.getMobile());
 		if(StringUtils.isNotBlank(alb.getSuperiorId())) params.put("superiorId", alb.getSuperiorId());
 		Pagination<AdminListBo> p=(Pagination<AdminListBo>)findPage("selectAdminListByPage","selectAdminCount",params,pageNo,pageSize);
-		List<AdminListBo> list=(List<AdminListBo>)p.getList();
+		List<AdminListBo> list= (List<AdminListBo>) p.getList();
 		for(AdminListBo i:list){
 			i.setRoles(adminMapper.selectRolesByUid(i.getId()));
 			i.setRolesId(adminMapper.selectRolesIdByUid(i.getId()));
@@ -86,8 +91,14 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 		}
 		ad.setType(sumType(roleIds));
 		int count=adminMapper.updateByPrimaryKeySelective(ad);
-		if (count>0&&ad.getAmbid()!=null){
+		if (count>0&&ad.getAmbId()!=null){
 			//进行巴人数计算
+//			AmbSystem ambSystem = ambSystemMapper.selectByPrimaryKey(Long.valueOf(ad.getAmbId()));
+//			if (ambSystem.getAncestors()!=null){
+//				List<String> list = Arrays.asList(ambSystem.getAncestors().split(","));
+//
+//			}
+
 		}
 		List<Admin> Nos =adminMapper.selectIDNBySuperiorId(ad.getId());
 		return count;

+ 1 - 0
src/main/java/com/goafanti/common/dao/AdminMapper.java

@@ -150,4 +150,5 @@ public interface AdminMapper {
     List<String> getLowerFinanceDep(String aid);
 
 
+    int selectByAmbIdCount(String id);
 }

+ 4 - 1
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -648,7 +648,7 @@
            a.province, a.`position`,a.reviewer , a.superior_id as superiorId,
            a.department_id as departmentId, a.status,a.user_no as userNo,a.duty,a.district,
            a.head_portrait_url as headPortraitUrl, a.contact_mobile as contactMobile,
-           b.name superior,c.name reviewerName,a.type
+           b.name superior,c.name reviewerName,a.type,a.amb_id ambId
     from admin a left join admin b on a.superior_id =b.id left join admin c on a.reviewer =c.id
     where a.id= #{id,jdbcType=VARCHAR}
   </select>
@@ -1077,4 +1077,7 @@
     select b.id from admin a left join department b on a.id=b.finance_id
     where a.superior_id = #{aid}
   </select>
+  <select id="selectByAmbIdCount" resultType="java.lang.Integer">
+    SELECT count(*) from admin where amb_id= #{ambId}
+  </select>
 </mapper>

+ 29 - 6
src/main/java/com/goafanti/common/mapper/AmbSystemMapper.xml

@@ -18,10 +18,13 @@
     <result column="ancestors_names" jdbcType="VARCHAR" property="ancestorsNames" />
     <result column="accountant" jdbcType="VARCHAR" property="accountant" />
     <result column="remarks" jdbcType="VARCHAR" property="remarks" />
+    <result column="total_amount" jdbcType="DECIMAL" property="totalAmount" />
+    <result column="members_count" jdbcType="INTEGER" property="membersCount" />
   </resultMap>
   <sql id="Base_Column_List">
     id, parent_id, ancestors, `name`, order_num, leader, `status`, create_by, create_time,
-    update_by, update_time, lvl, finance_id, ancestors_names, accountant, remarks
+    update_by, update_time, lvl, finance_id, ancestors_names, accountant, remarks, total_amount,
+    members_count
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
     select
@@ -38,14 +41,14 @@
       order_num, leader, `status`,
       create_by, create_time, update_by,
       update_time, lvl, finance_id,
-      ancestors_names, accountant, remarks
-      )
+      ancestors_names, accountant, remarks,
+      total_amount, members_count)
     values (#{parentId,jdbcType=BIGINT}, #{ancestors,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
       #{orderNum,jdbcType=INTEGER}, #{leader,jdbcType=VARCHAR}, #{status,jdbcType=CHAR},
       #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{updateBy,jdbcType=VARCHAR},
       #{updateTime,jdbcType=TIMESTAMP}, #{lvl,jdbcType=INTEGER}, #{financeId,jdbcType=VARCHAR},
-      #{ancestorsNames,jdbcType=VARCHAR}, #{accountant,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR}
-      )
+      #{ancestorsNames,jdbcType=VARCHAR}, #{accountant,jdbcType=VARCHAR}, #{remarks,jdbcType=VARCHAR},
+      #{totalAmount,jdbcType=DECIMAL}, #{membersCount,jdbcType=INTEGER})
   </insert>
   <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.AmbSystem" useGeneratedKeys="true">
     insert into amb_system
@@ -95,6 +98,12 @@
       <if test="remarks != null">
         remarks,
       </if>
+      <if test="totalAmount != null">
+        total_amount,
+      </if>
+      <if test="membersCount != null">
+        members_count,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
       <if test="parentId != null">
@@ -142,6 +151,12 @@
       <if test="remarks != null">
         #{remarks,jdbcType=VARCHAR},
       </if>
+      <if test="totalAmount != null">
+        #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="membersCount != null">
+        #{membersCount,jdbcType=INTEGER},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.AmbSystem">
@@ -192,6 +207,12 @@
       <if test="remarks != null">
         remarks = #{remarks,jdbcType=VARCHAR},
       </if>
+      <if test="totalAmount != null">
+        total_amount = #{totalAmount,jdbcType=DECIMAL},
+      </if>
+      <if test="membersCount != null">
+        members_count = #{membersCount,jdbcType=INTEGER},
+      </if>
     </set>
     where id = #{id,jdbcType=BIGINT}
   </update>
@@ -211,7 +232,9 @@
       finance_id = #{financeId,jdbcType=VARCHAR},
       ancestors_names = #{ancestorsNames,jdbcType=VARCHAR},
       accountant = #{accountant,jdbcType=VARCHAR},
-      remarks = #{remarks,jdbcType=VARCHAR}
+      remarks = #{remarks,jdbcType=VARCHAR},
+      total_amount = #{totalAmount,jdbcType=DECIMAL},
+      members_count = #{membersCount,jdbcType=INTEGER}
     where id = #{id,jdbcType=BIGINT}
   </update>
 

+ 27 - 0
src/main/java/com/goafanti/common/model/AmbSystem.java

@@ -1,6 +1,7 @@
 package com.goafanti.common.model;
 
 import java.io.Serializable;
+import java.math.BigDecimal;
 import java.util.Date;
 
 /**
@@ -88,6 +89,16 @@ public class AmbSystem implements Serializable {
      */
     private String remarks;
 
+    /**
+     * 总金额
+     */
+    private BigDecimal totalAmount;
+
+    /**
+     * 成员数
+     */
+    private Integer membersCount;
+
     private static final long serialVersionUID = 1L;
 
     public Long getId() {
@@ -217,4 +228,20 @@ public class AmbSystem implements Serializable {
     public void setRemarks(String remarks) {
         this.remarks = remarks;
     }
+
+    public BigDecimal getTotalAmount() {
+        return totalAmount;
+    }
+
+    public void setTotalAmount(BigDecimal totalAmount) {
+        this.totalAmount = totalAmount;
+    }
+
+    public Integer getMembersCount() {
+        return membersCount;
+    }
+
+    public void setMembersCount(Integer membersCount) {
+        this.membersCount = membersCount;
+    }
 }

+ 1 - 1
src/main/java/com/goafanti/core/mybatis/page/Pagination.java

@@ -18,7 +18,7 @@ public class Pagination<T> extends SimplePage implements java.io.Serializable, P
 		super(pageNo, pageSize, totalCount);
 	}
 
-	public Pagination(int pageNo, int pageSize, int totalCount, List<?> list) {
+	public Pagination(int pageNo, int pageSize, int totalCount, List<T> list) {
 		super(pageNo, pageSize, totalCount);
 		this.list = list;
 	}