anderx преди 3 години
родител
ревизия
19df3847e1

+ 3 - 2
src/main/java/com/goafanti/admin/controller/AdminSuperviserApiController.java

@@ -118,7 +118,8 @@ public class AdminSuperviserApiController extends CertifyApiController {
 	 * 修改管理员信息
 	 */
 	@RequestMapping(value = "/updateAdmin", method = RequestMethod.POST)
-	public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds, String data) {
+	public Result updateAdmin(@RequestParam(value = "roles[]", required = false) String[] roleIds, String data,
+							  String ambId) {
 		Result res = new Result();
 		JSONObject jo = (JSONObject) JSON.parse(data);
 		List<String> roles = new ArrayList<String>();
@@ -165,7 +166,7 @@ public class AdminSuperviserApiController extends CertifyApiController {
 			if (!a.getStatus().equals(ad.getStatus())&&!ad.getStatus().equals("正常")){
 				redisUtil.deleteAid(aa.getId());
 			}
-		res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles));
+		res.setData(newAdminService.updateByPrimaryKeySelective(ad, roles,ambId));
 		}
 		return res;
 	}

+ 6 - 6
src/main/java/com/goafanti/admin/service/NewAdminService.java

@@ -10,7 +10,7 @@ import com.goafanti.core.mybatis.page.Pagination;
 
 public interface NewAdminService {
 	Pagination<AdminListBo> listAdmin(AdminListBo alb,String rid,String roleName, Integer pageNo, Integer pageSize);
-	
+
 	List<Admin> selectAllAdmin();
 
 	Admin selectByMobile(String username);
@@ -19,7 +19,7 @@ public interface NewAdminService {
 
 	int insert(Admin ad);
 
-	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds);
+	int updateByPrimaryKeySelective(Admin ad, List<String> roleIds,String ambId);
 
 	int updateByPrimaryKey(Admin a);
 
@@ -60,13 +60,13 @@ public interface NewAdminService {
 	Map<String, String> listAdminSelect();
 
 	List<Admin> listAdminByName(String name);
-	
-	Admin selectAllByid(String id);	
-	
+
+	Admin selectAllByid(String id);
+
 	int deleteById(String id);
 
 	List<AdminListBo> selectAdminByOrg();
 
 	boolean checkAdminRole(List<String> roles, Admin admin);
-	
+
 }

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

@@ -73,7 +73,7 @@ public class NewAdminServiceImpl extends BaseMybatisDao<AdminMapper> implements
 
 	@SuppressWarnings("unused")
 	@Override
-	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds) {
+	public int updateByPrimaryKeySelective(Admin ad, List<String> roleIds,String ambId) {
 		Map<String, Object> params = new HashMap<>();
 		params.put("uid", ad.getId());
 		params.put("roles", roleIds);

+ 35 - 29
src/main/java/com/goafanti/common/mapper/AdminMapper.xml

@@ -24,11 +24,12 @@
     <result column="open_id" jdbcType="VARCHAR" property="openId" />
     <result column="type" jdbcType="INTEGER" property="type" />
     <result column="reviewer" jdbcType="VARCHAR" property="reviewer" />
+    <result column="ambId" jdbcType="VARCHAR" property="ambid" />
   </resultMap>
   <sql id="Base_Column_List">
     id, mobile, `name`, `password`, email, create_time, `number`, province, `position`,
     superior_id, city, department_id, `status`, user_no, duty, district, head_portrait_url,
-    contact_mobile, last_login_time, open_id, `type`, reviewer
+    contact_mobile, last_login_time, open_id, `type`, reviewer, ambId
   </sql>
   <select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
     select
@@ -40,30 +41,27 @@
     delete from admin
     where id = #{id,jdbcType=VARCHAR}
   </delete>
-  <insert id="insert" parameterType="com.goafanti.common.model.Admin">
-    insert into admin (id, mobile, `name`,
-      `password`, email, create_time,
-      `number`, province, `position`,
-      superior_id, city, department_id,
-      `status`, user_no, duty,
-      district, head_portrait_url, contact_mobile,
-      last_login_time, open_id, `type`,
-      reviewer)
-    values (#{id,jdbcType=VARCHAR}, #{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR},
-      #{password,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP},
-      #{number,jdbcType=INTEGER}, #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR},
-      #{superiorId,jdbcType=VARCHAR}, #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR},
-      #{status,jdbcType=VARCHAR}, #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR},
-      #{district,jdbcType=VARCHAR}, #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR},
-      #{lastLoginTime,jdbcType=TIMESTAMP}, #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER},
-      #{reviewer,jdbcType=VARCHAR})
+  <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
+    insert into admin (mobile, `name`, `password`,
+      email, create_time, `number`,
+      province, `position`, superior_id,
+      city, department_id, `status`,
+      user_no, duty, district,
+      head_portrait_url, contact_mobile, last_login_time,
+      open_id, `type`, reviewer,
+      ambId)
+    values (#{mobile,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR},
+      #{email,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{number,jdbcType=INTEGER},
+      #{province,jdbcType=VARCHAR}, #{position,jdbcType=VARCHAR}, #{superiorId,jdbcType=VARCHAR},
+      #{city,jdbcType=VARCHAR}, #{departmentId,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR},
+      #{userNo,jdbcType=VARCHAR}, #{duty,jdbcType=VARCHAR}, #{district,jdbcType=VARCHAR},
+      #{headPortraitUrl,jdbcType=VARCHAR}, #{contactMobile,jdbcType=VARCHAR}, #{lastLoginTime,jdbcType=TIMESTAMP},
+      #{openId,jdbcType=VARCHAR}, #{type,jdbcType=INTEGER}, #{reviewer,jdbcType=VARCHAR},
+      #{ambid,jdbcType=VARCHAR})
   </insert>
-  <insert id="insertSelective" parameterType="com.goafanti.common.model.Admin">
+  <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.goafanti.common.model.Admin" useGeneratedKeys="true">
     insert into admin
     <trim prefix="(" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        id,
-      </if>
       <if test="mobile != null">
         mobile,
       </if>
@@ -127,11 +125,11 @@
       <if test="reviewer != null">
         reviewer,
       </if>
+      <if test="ambid != null">
+        ambId,
+      </if>
     </trim>
     <trim prefix="values (" suffix=")" suffixOverrides=",">
-      <if test="id != null">
-        #{id,jdbcType=VARCHAR},
-      </if>
       <if test="mobile != null">
         #{mobile,jdbcType=VARCHAR},
       </if>
@@ -195,6 +193,9 @@
       <if test="reviewer != null">
         #{reviewer,jdbcType=VARCHAR},
       </if>
+      <if test="ambid != null">
+        #{ambid,jdbcType=VARCHAR},
+      </if>
     </trim>
   </insert>
   <update id="updateByPrimaryKeySelective" parameterType="com.goafanti.common.model.Admin">
@@ -263,6 +264,9 @@
       <if test="reviewer != null">
         reviewer = #{reviewer,jdbcType=VARCHAR},
       </if>
+      <if test="ambid != null">
+        ambId = #{ambid,jdbcType=VARCHAR},
+      </if>
     </set>
     where id = #{id,jdbcType=VARCHAR}
   </update>
@@ -288,10 +292,12 @@
       last_login_time = #{lastLoginTime,jdbcType=TIMESTAMP},
       open_id = #{openId,jdbcType=VARCHAR},
       `type` = #{type,jdbcType=INTEGER},
-      reviewer = #{reviewer,jdbcType=VARCHAR}
+      reviewer = #{reviewer,jdbcType=VARCHAR},
+      ambId = #{ambid,jdbcType=VARCHAR}
     where id = #{id,jdbcType=VARCHAR}
   </update>
 
+
   <select id="selectAllAdmin" resultMap="BaseResultMap">
     select
     <include refid="Base_Column_List" />
@@ -775,9 +781,9 @@
 
   <select id="getAdminRoleNamesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
-                                     left join `role` c on b.rid=c.id
+    left join `role` c on b.rid=c.id
     where a.status='正常'
-      and  c.role_name  in
+    and  c.role_name  in
     <foreach close=")" collection="list" item="name" open="(" separator=",">
       #{name}
     </foreach>
@@ -791,7 +797,7 @@
 
   <select id="getAdminRoleTypesList" parameterType="java.lang.String" resultMap="BaseResultMap">
     select a.id, a.name from admin a left join user_role b on a.id=b.uid
-                                     left join `role` c on b.rid=c.id
+    left join `role` c on b.rid=c.id
     where a.status='正常'
     and  c.role_type  in
     <foreach close=")" collection="list" item="type" open="(" separator=",">

+ 6 - 1
src/main/java/com/goafanti/common/model/Admin.java

@@ -118,6 +118,12 @@ public class Admin extends BaseModel implements AftUser {
     private String reviewer;
 
     /**
+     * 阿米巴编号
+     */
+    private String ambid;
+
+
+    /**
      * 上级管理用户名称
      */
     private String	superior;
@@ -192,7 +198,6 @@ public class Admin extends BaseModel implements AftUser {
         return createTime;
     }
 
-    @Override
     public String getAid() {
         return id;
     }