Package com.lin.user.biz

Source Code of com.lin.user.biz.UserManage

package com.lin.user.biz;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.lin.common.dao.Lz001001Dao;
import com.lin.common.entity.Lz001001;
import com.lin.user.dto.UserDto;

@Service
@Transactional
public class UserManage {
  @Autowired
  Lz001001Dao lz001001Dao;
  /**
   * 保存
   * @param dto
   */
  public void save(UserDto dto){
    Lz001001 lz001001=new Lz001001();
    lz001001.setUserAge(dto.getUserAge());
    lz001001.setUserName(dto.getUserName());
    lz001001.setUserSex(dto.getUserSex());
    lz001001.setUserNo(getMaxUserNo());
    lz001001Dao.save(lz001001);
  }
  /**
   * 查询最大userNo
   * @return
   */
  public Long getMaxUserNo(){
    List objs= lz001001Dao.findByHql("select max(userNo) from Lz001001");
    if (objs.size()>0) {
      if (objs==null) {
        return 1l;
      }
      return (Long)objs.get(0)+1;
    }
    return 1l;
  }
  public UserDto getList1001(){
    UserDto dto=new UserDto();
    List<Lz001001>list=lz001001Dao.findByHql("from Lz001001");
    dto.setList1001(list);
    return dto;
  }
}
TOP

Related Classes of com.lin.user.biz.UserManage

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.