浏览代码

sz 设备管理 添加查询条件,方法等修改

xiao547607 5 年之前
父节点
当前提交
f094d1bd8e

+ 6 - 0
common/src/main/java/com/jpsoft/smart/modules/base/entity/DeviceInfo.java

@@ -67,6 +67,12 @@ public class DeviceInfo {
     @ApiModelProperty(value = "公司ID")
     private String companyId;
 
+	/**
+	 *公司名称
+	 */
+	@ApiModelProperty(value = "公司名称")
+	private String companyName;
+
 	/**
 	 *开锁密码
 	 */

+ 12 - 7
common/src/main/resources/mapper/base/DeviceInfo.xml

@@ -11,6 +11,7 @@
 			<result property="address" column="address_" />
 			<result property="isOnline" column="is_online" />
 			<result property="companyId" column="company_id" />
+			<result property="companyName" column="company_name" />
 			<result property="unlockPassword" column="unlock_password" />
 			<result property="codeAddress" column="code_address" />
 			<result property="ipAddress" column="ip_address" />
@@ -41,8 +42,8 @@
 ,#{aliasName,jdbcType=VARCHAR}
 ,#{address,jdbcType=VARCHAR}
 ,#{isOnline,jdbcType= NUMERIC }
-,#{unlockPassword,jdbcType=VARCHAR}
 ,#{companyId,jdbcType=VARCHAR}
+,#{unlockPassword,jdbcType=VARCHAR}
 ,#{codeAddress,jdbcType=VARCHAR}
 ,#{ipAddress,jdbcType=VARCHAR}
 ,#{port,jdbcType=VARCHAR}
@@ -136,21 +137,25 @@ id_, header_,device_no,alias_name,address_,is_online,company_id,unlock_password,
 	</select>
 	<select id="search" parameterType="hashmap" resultMap="DeviceInfoMap">
 		<![CDATA[
-			select * from base_device_info
+			select
+				a.*,
+				b.name_ AS company_name
+				from base_device_info a
+				LEFT JOIN base_company_info b ON a.company_id = b.id_
 		]]>
 		<where>
-			and del_flag=false
+				and a.del_flag=false
 			<if test="searchParams.aliasName != null">
-				and alias_name like #{searchParams.aliasName}
+				and a.alias_name like #{searchParams.aliasName}
 			</if>
 			<if test="searchParams.deviceNo != null">
-				and device_no like #{searchParams.deviceNo}
+				and a.device_no like #{searchParams.deviceNo}
 			</if>
 			<if test="searchParams.address != null">
-				and address_ like #{searchParams.address}
+				and a.address_ like #{searchParams.address}
 			</if>
 			<if test="searchParams.companyId != null">
-				and company_id = #{searchParams.companyId}
+				and a.company_id = #{searchParams.companyId}
 			</if>
 		</where>
 		<foreach item="sort" collection="sortList"  open="order by" separator=",">

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

@@ -173,9 +173,6 @@
                 a.name_ like #{name}
             </foreach>
             </if>
-<!--            <if test="searchParams.name != null">-->
-<!--                and a.name_ like #{searchParams.name}-->
-<!--            </if>-->
             <if test="searchParams.idCard != null">
                 and a.id_card like #{searchParams.idCard}
             </if>

+ 7 - 4
web/src/main/java/com/jpsoft/smart/modules/base/controller/DeviceInfoController.java

@@ -229,10 +229,11 @@ public class DeviceInfoController {
     @ApiImplicitParams({
             @ApiImplicitParam(name = "aliasName",value = "设备别名",  paramType = "query"),
             @ApiImplicitParam(name = "deviceNo",value = "编号",  paramType = "query"),
-            @ApiImplicitParam(name = "address",value = "位置",  paramType = "query")
+            @ApiImplicitParam(name = "address",value = "位置",  paramType = "query"),
+            @ApiImplicitParam(name = "companyId",value = "企业ID",  paramType = "query")
     })
     public MessageResult<Map> pageList(
-            String aliasName,String deviceNo,String address,
+            String aliasName,String deviceNo,String address,String companyId,
             @RequestParam(value="pageIndex",defaultValue="1") int pageIndex,
             @RequestParam(value="pageSize",defaultValue="20") int pageSize,
             @RequestAttribute String subject){
@@ -245,7 +246,7 @@ public class DeviceInfoController {
         Map<String,Object> searchParams = new HashMap<>();
 
         List<Sort> sortList = new ArrayList<>();
-        sortList.add(new Sort("create_time","desc"));
+        sortList.add(new Sort("a.create_time","desc"));
 
         if (StringUtils.isNotEmpty(aliasName)) {
             searchParams.put("aliasName","%" + aliasName + "%");
@@ -256,7 +257,9 @@ public class DeviceInfoController {
         if (StringUtils.isNotEmpty(address)) {
             searchParams.put("address","%" + address + "%");
         }
-
+        if (StringUtils.isNotEmpty(companyId)) {
+            searchParams.put("companyId",companyId);
+        }
         Page<DeviceInfo> page = deviceInfoService.pageSearch(searchParams,pageIndex,pageSize,true,sortList);
 
         for (DeviceInfo deviceInfo:page) {