Browse Source

sz 用户添加企业绑定,其他错误修改

xiao547607 5 years ago
parent
commit
2c38c4b750

+ 6 - 2
src/main/java/com/jpsoft/smart/modules/sys/controller/UserController.java

@@ -252,7 +252,7 @@ public class UserController {
     @ApiOperation(value="列表")
     @ApiOperation(value="列表")
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     @RequestMapping(value = "pageList",method = RequestMethod.POST)
     public MessageResult<Map> pageList(
     public MessageResult<Map> pageList(
-            String userName,String realName,
+            String userName,String realName,String companyId,
             @RequestParam(name="pageIndex",defaultValue = "1") int pageIndex,
             @RequestParam(name="pageIndex",defaultValue = "1") int pageIndex,
             @RequestParam(name="pageSize",defaultValue = "10") int pageSize,
             @RequestParam(name="pageSize",defaultValue = "10") int pageSize,
             @RequestAttribute String subject){
             @RequestAttribute String subject){
@@ -261,7 +261,7 @@ public class UserController {
         Map<String,Object> searchParms = new HashMap<>();
         Map<String,Object> searchParms = new HashMap<>();
 
 
         List<Sort> sortList = new ArrayList<>();
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","asc"));
+        sortList.add(new Sort("a.create_time","asc"));
 
 
         if (StringUtils.isNotEmpty(userName)) {
         if (StringUtils.isNotEmpty(userName)) {
             searchParms.put("userName","%" + userName + "%");
             searchParms.put("userName","%" + userName + "%");
@@ -271,6 +271,10 @@ public class UserController {
             searchParms.put("realName","%" + realName + "%");
             searchParms.put("realName","%" + realName + "%");
         }
         }
 
 
+        if (StringUtils.isNotEmpty(companyId)) {
+            searchParms.put("companyId",companyId);
+        }
+
         Page<User> page = userService.pageSearch(searchParms,pageIndex,pageSize,sortList);
         Page<User> page = userService.pageSearch(searchParms,pageIndex,pageSize,sortList);
 
 
         msgResult.setResult(true);
         msgResult.setResult(true);

+ 16 - 0
src/main/java/com/jpsoft/smart/modules/sys/entity/User.java

@@ -3,6 +3,7 @@ package com.jpsoft.smart.modules.sys.entity;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
+import io.swagger.annotations.ApiModelProperty;
 import org.springframework.format.annotation.DateTimeFormat;
 import org.springframework.format.annotation.DateTimeFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.annotation.JsonFormat;
 
 
@@ -12,6 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
 public class User {
 public class User {
 	private String id;
 	private String id;
 	private String companyId;
 	private String companyId;
+	private String companyName;
 	private String userName;
 	private String userName;
 	private String password;
 	private String password;
 	private String realName;
 	private String realName;
@@ -152,6 +154,9 @@ public class User {
 		this.roles = roles;
 		this.roles = roles;
 	}
 	}
 
 
+	/**
+	 *设置企业名称
+	 */
 	public String getCompanyId() {
 	public String getCompanyId() {
 		return companyId;
 		return companyId;
 	}
 	}
@@ -159,4 +164,15 @@ public class User {
 	public void setCompanyId(String companyId) {
 	public void setCompanyId(String companyId) {
 		this.companyId = companyId;
 		this.companyId = companyId;
 	}
 	}
+
+	/**
+	 *设置企业名称
+	 */
+	public String getCompanyName() {
+		return companyName;
+	}
+
+	public void setCompanyName(String companyName) {
+		this.companyName = companyName;
+	}
 }
 }

+ 1 - 0
src/main/resources/mapper/base/PersonInfo.xml

@@ -150,6 +150,7 @@
             del_flag = 0
             del_flag = 0
             <if test="searchParams.id != null">
             <if test="searchParams.id != null">
                 and ID_ like #{searchParams.id}
                 and ID_ like #{searchParams.id}
+            </if>
             <if test="searchParams.name != null">
             <if test="searchParams.name != null">
                 and name_ like #{searchParams.name}
                 and name_ like #{searchParams.name}
             </if>
             </if>

+ 9 - 4
src/main/resources/mapper/sys/User.xml

@@ -7,6 +7,7 @@
         <id property="id" column="id_"/>
         <id property="id" column="id_"/>
         <result property="userName" column="user_name"/>
         <result property="userName" column="user_name"/>
         <result property="companyId" column="company_id" />
         <result property="companyId" column="company_id" />
+        <result property="companyName" column="company_name" />
         <result property="password" column="password_"/>
         <result property="password" column="password_"/>
         <result property="realName" column="real_name"/>
         <result property="realName" column="real_name"/>
         <result property="createTime" column="create_time"/>
         <result property="createTime" column="create_time"/>
@@ -90,14 +91,18 @@
     </select>
     </select>
     <select id="search" parameterType="hashmap" resultMap="UserMap">
     <select id="search" parameterType="hashmap" resultMap="UserMap">
         <![CDATA[
         <![CDATA[
-			select * from sys_user
-			where del_flag=0
+			select a.*,b.name_ as company_name
+			from sys_user a LEFT JOIN base_company_info b ON a.company_id = b.id_
+			where a.del_flag = 0
 		]]>
 		]]>
         <if test="searchParams.userName != null">
         <if test="searchParams.userName != null">
-            and user_name like #{searchParams.userName}
+            and a.user_name like #{searchParams.userName}
         </if>
         </if>
         <if test="searchParams.realName != null">
         <if test="searchParams.realName != null">
-            and real_name like #{searchParams.realName}
+            and a.real_name like #{searchParams.realName}
+        </if>
+        <if test="searchParams.companyId != null">
+            and a.company_id = #{searchParams.companyId}
         </if>
         </if>
         <foreach item="sort" collection="sortList" open="order by" separator=",">
         <foreach item="sort" collection="sortList" open="order by" separator=",">
             ${sort.name} ${sort.order}
             ${sort.name} ${sort.order}