Commit c91046a0 authored by zengtianlai3's avatar zengtianlai3

Merge branch 'm33' into 'master'

整合

See merge request !9
parents 61c76390 8b335c2c
...@@ -50,15 +50,15 @@ public class DeviceController { ...@@ -50,15 +50,15 @@ public class DeviceController {
* @param pageNo * @param pageNo
* @param pageSize * @param pageSize
* @param typeName * @param typeName
* @param userId * @param userName
* @return * @return
*/ */
@GetMapping("list") @GetMapping("list")
public PageResult getDeviceList(@RequestParam("pageNo") int pageNo, public PageResult getDeviceList(@RequestParam("pageNo") int pageNo,
@RequestParam("pageSize") int pageSize, @RequestParam("pageSize") int pageSize,
@RequestParam(value = "typeName",required = false) String typeName, @RequestParam(value = "typeName",required = false) String typeName,
@RequestParam(value = "userId",required = false) Integer userId) { @RequestParam(value = "userName",required = false) String userName) {
PageInfoModel<DeviceTypeVo> records = deviceService.getDeviceList(pageNo,pageSize,typeName,userId); PageInfoModel<DeviceTypeVo> records = deviceService.getDeviceList(pageNo,pageSize,typeName,userName);
int total = records.getTotal(); int total = records.getTotal();
int pages = total/pageSize;//pages为总页数 int pages = total/pageSize;//pages为总页数
int mod = total%pageSize; int mod = total%pageSize;
......
...@@ -16,7 +16,7 @@ import java.util.List; ...@@ -16,7 +16,7 @@ import java.util.List;
*/ */
public interface DeviceMapper extends BaseMapper<Device> { public interface DeviceMapper extends BaseMapper<Device> {
List<DeviceTypeVo> getDeviceList(String typeName, Integer userId); List<DeviceTypeVo> getDeviceList(String typeName, String userName);
boolean addDevice(String sn, int userId, int typeId); boolean addDevice(String sn, int userId, int typeId);
} }
...@@ -15,7 +15,7 @@ import iot.sixiang.license.model.vo.DeviceTypeVo; ...@@ -15,7 +15,7 @@ import iot.sixiang.license.model.vo.DeviceTypeVo;
*/ */
public interface DeviceService extends IService<Device> { public interface DeviceService extends IService<Device> {
PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, Integer userId); PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, String userName);
boolean addDevice(int userId, int typeId, int count); boolean addDevice(int userId, int typeId, int count);
} }
...@@ -28,9 +28,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme ...@@ -28,9 +28,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Resource @Resource
private DeviceMapper deviceMapper; private DeviceMapper deviceMapper;
@Override @Override
public PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, Integer userId) { public PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, String userName) {
List<DeviceTypeVo> deviceTypes = deviceMapper.getDeviceList(typeName,userId); List<DeviceTypeVo> deviceTypes = deviceMapper.getDeviceList(typeName,userName);
deviceTypes = deviceTypes.stream().sorted(Comparator.comparing(DeviceTypeVo::getDeviceId)).collect(Collectors.toList()); deviceTypes = deviceTypes.stream().sorted(Comparator.comparing(DeviceTypeVo::getDeviceId)).collect(Collectors.toList());
List<DeviceTypeVo> result = new ArrayList<>(); List<DeviceTypeVo> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize; int begin = (pageNo - 1) * pageSize;
......
...@@ -14,8 +14,8 @@ ...@@ -14,8 +14,8 @@
<if test="null != typeName and '' != typeName"> <if test="null != typeName and '' != typeName">
and type_name like concat('%',#{typeName},'%') and type_name like concat('%',#{typeName},'%')
</if> </if>
<if test="null != userId and '' != userId"> <if test="null != userName and '' != userName">
and us.user_id like concat('%',#{userId},'%') and us.user_name like concat('%',#{userName},'%')
</if> </if>
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment