Commit 8b335c2c authored by zengtianlai3's avatar zengtianlai3

整合

parent 989a357e
......@@ -50,15 +50,15 @@ public class DeviceController {
* @param pageNo
* @param pageSize
* @param typeName
* @param userId
* @param userName
* @return
*/
@GetMapping("list")
public PageResult getDeviceList(@RequestParam("pageNo") int pageNo,
@RequestParam("pageSize") int pageSize,
@RequestParam(value = "typeName",required = false) String typeName,
@RequestParam(value = "userId",required = false) Integer userId) {
PageInfoModel<DeviceTypeVo> records = deviceService.getDeviceList(pageNo,pageSize,typeName,userId);
@RequestParam(value = "userName",required = false) String userName) {
PageInfoModel<DeviceTypeVo> records = deviceService.getDeviceList(pageNo,pageSize,typeName,userName);
int total = records.getTotal();
int pages = total/pageSize;//pages为总页数
int mod = total%pageSize;
......
......@@ -16,7 +16,7 @@ import java.util.List;
*/
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);
}
......@@ -15,7 +15,7 @@ import iot.sixiang.license.model.vo.DeviceTypeVo;
*/
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);
}
......@@ -28,9 +28,10 @@ public class DeviceServiceImpl extends ServiceImpl<DeviceMapper, Device> impleme
@Resource
private DeviceMapper deviceMapper;
@Override
public PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, Integer userId) {
List<DeviceTypeVo> deviceTypes = deviceMapper.getDeviceList(typeName,userId);
public PageInfoModel<DeviceTypeVo> getDeviceList(int pageNo, int pageSize, String typeName, String userName) {
List<DeviceTypeVo> deviceTypes = deviceMapper.getDeviceList(typeName,userName);
deviceTypes = deviceTypes.stream().sorted(Comparator.comparing(DeviceTypeVo::getDeviceId)).collect(Collectors.toList());
List<DeviceTypeVo> result = new ArrayList<>();
int begin = (pageNo - 1) * pageSize;
......
......@@ -14,8 +14,8 @@
<if test="null != typeName and '' != typeName">
and type_name like concat('%',#{typeName},'%')
</if>
<if test="null != userId and '' != userId">
and us.user_id like concat('%',#{userId},'%')
<if test="null != userName and '' != userName">
and us.user_name like concat('%',#{userName},'%')
</if>
</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