SysUserDAOImpl.java 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. /*
  2. * Copyright 2010 The YAPULAN Software Foundation
  3. *
  4. * Licensed under the YAPULAN License, Version 2.0 (the "License");
  5. */
  6. package com.miniframe.system.model.dao;
  7. import com.ibatis.sqlmap.client.SqlMapClient;
  8. import com.miniframe.system.model.SysUser;
  9. import com.miniframe.system.model.SysUserSQLBuilder;
  10. import java.sql.SQLException;
  11. import java.util.List;
  12. public class SysUserDAOImpl implements SysUserDAO {
  13. /**
  14. * 用户表 : 用户表
  15. * @generated
  16. */
  17. private SqlMapClient sqlMapClient;
  18. /**
  19. * @generated
  20. */
  21. public SysUserDAOImpl(SqlMapClient sqlMapClient) {
  22. super();
  23. this.sqlMapClient = sqlMapClient;
  24. }
  25. /**
  26. * 获取记录行数
  27. * @generated
  28. */
  29. public int countByExample(SysUserSQLBuilder example) throws SQLException {
  30. Integer count = (Integer) sqlMapClient.queryForObject("sys_user.countByExample", example);
  31. return count;
  32. }
  33. /**
  34. * 条件删除
  35. * @generated
  36. */
  37. public int deleteByExample(SysUserSQLBuilder example) throws SQLException {
  38. int rows = sqlMapClient.delete("sys_user.deleteByExample", example);
  39. return rows;
  40. }
  41. /**
  42. * 根据主键删除
  43. * @generated
  44. */
  45. public int deleteByPrimaryKey(String userid) throws SQLException {
  46. SysUser _key = new SysUser();
  47. _key.setUserid(userid);
  48. int rows = sqlMapClient.delete("sys_user.deleteByPrimaryKey", _key);
  49. return rows;
  50. }
  51. /**
  52. * 插入,所有字段
  53. * @generated
  54. */
  55. public void insert(SysUser record) throws SQLException {
  56. sqlMapClient.insert("sys_user.insert", record);
  57. }
  58. /**
  59. * 动态插入,忽略空字段
  60. * @generated
  61. */
  62. public void insertSelective(SysUser record) throws SQLException {
  63. sqlMapClient.insert("sys_user.insertSelective", record);
  64. }
  65. /**
  66. * 条件查询
  67. * @generated
  68. */
  69. @SuppressWarnings("unchecked")
  70. public List<SysUser> selectByExample(SysUserSQLBuilder example) throws SQLException {
  71. List<SysUser> list = sqlMapClient.queryForList("sys_user.selectByExample", example);
  72. return list;
  73. }
  74. /**
  75. * 根据主键查询
  76. * @generated
  77. */
  78. public SysUser selectByPrimaryKey(String userid) throws SQLException {
  79. SysUser _key = new SysUser();
  80. _key.setUserid(userid);
  81. Object obj = sqlMapClient.queryForObject("sys_user.selectByPrimaryKey", _key);
  82. if(!(obj instanceof SysUser))
  83. return null;
  84. SysUser record = (SysUser) obj;
  85. return record;
  86. }
  87. /**
  88. * 动态修改,不包含空字段
  89. * @generated
  90. */
  91. public int updateByExampleSelective(SysUser record, SysUserSQLBuilder example) throws SQLException {
  92. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  93. int rows = sqlMapClient.update("sys_user.updateByExampleSelective", parms);
  94. return rows;
  95. }
  96. /**
  97. * 条件修改
  98. * @generated
  99. */
  100. public int updateByExample(SysUser record, SysUserSQLBuilder example) throws SQLException {
  101. UpdateByExampleParms parms = new UpdateByExampleParms(record, example);
  102. int rows = sqlMapClient.update("sys_user.updateByExample", parms);
  103. return rows;
  104. }
  105. /**
  106. * 动态根据主键修改,为空字段不修改
  107. * @generated
  108. */
  109. public int updateByPrimaryKeySelective(SysUser record) throws SQLException {
  110. int rows = sqlMapClient.update("sys_user.updateByPrimaryKeySelective", record);
  111. return rows;
  112. }
  113. /**
  114. * 根据主键修改
  115. * @generated
  116. */
  117. public int updateByPrimaryKey(SysUser record) throws SQLException {
  118. int rows = sqlMapClient.update("sys_user.updateByPrimaryKey", record);
  119. return rows;
  120. }
  121. /**
  122. * 用户表 : 用户表
  123. * @generated
  124. */
  125. protected static class UpdateByExampleParms extends SysUserSQLBuilder {
  126. /**
  127. * 用户表 : 用户表
  128. * @generated
  129. */
  130. private Object record;
  131. /**
  132. * @generated
  133. */
  134. public UpdateByExampleParms(Object record, SysUserSQLBuilder example) {
  135. super(example);
  136. this.record = record;
  137. }
  138. /**
  139. * @generated
  140. */
  141. public Object getRecord() {
  142. return record;
  143. }
  144. }
  145. }