|
@@ -7,6 +7,7 @@ import java.util.Map;
|
|
|
import org.apache.ibatis.session.SqlSession;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.ym.adminap.config.MybatisConfig;
|
|
|
import com.ym.adminap.dao.main.UsersMapper;
|
|
|
import com.ym.adminap.enity.ListParam;
|
|
|
import com.ym.adminap.enity.RelationData;
|
|
@@ -34,7 +35,7 @@ public class UsersService {
|
|
|
if (fields.isBlank()) {
|
|
|
fields = "*";
|
|
|
}
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
ListParam param = new ListParam();
|
|
|
if (page > 1) {
|
|
@@ -80,7 +81,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Users query(Integer Id) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Users result = usersMapper.selectByPrimaryKey(Id);
|
|
|
sqlSession.close();
|
|
@@ -95,7 +96,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Users query(Users data) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Users result = usersMapper.selectByCondition(data);
|
|
|
if (result == null)
|
|
@@ -113,7 +114,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Integer count(String field, Users data, String condition) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.getCount(field, data, condition);
|
|
|
sqlSession.close();
|
|
@@ -129,7 +130,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Object sum(String field, Users data, String condition) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Object result = usersMapper.getSum(field, data, condition);
|
|
|
sqlSession.close();
|
|
@@ -144,7 +145,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Boolean exist(Users data, String condition) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.getCount("1", data, condition);
|
|
|
sqlSession.close();
|
|
@@ -161,7 +162,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Integer add(Users data) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.insert(data);
|
|
|
sqlSession.close();
|
|
@@ -175,7 +176,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Integer update(Users data) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.updateByPrimaryKey(data);
|
|
|
sqlSession.close();
|
|
@@ -192,7 +193,7 @@ public class UsersService {
|
|
|
Users data = new Users();
|
|
|
data.setId(id);
|
|
|
data.setStatus(-1);
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.updateByPrimaryKey(data);
|
|
|
sqlSession.close();
|
|
@@ -206,7 +207,7 @@ public class UsersService {
|
|
|
* @return
|
|
|
*/
|
|
|
public static Integer delete(Integer id) {
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.deleteByPrimaryKey(id);
|
|
|
sqlSession.close();
|
|
@@ -224,7 +225,7 @@ public class UsersService {
|
|
|
Users user = new Users();
|
|
|
user.setId(id);
|
|
|
user.setSort(sort);
|
|
|
- SqlSession sqlSession = SqlSessionUtils.getSqlSession();
|
|
|
+ SqlSession sqlSession = SqlSessionUtils.getSqlSession(MybatisConfig.mainConfigFileName);
|
|
|
UsersMapper usersMapper = sqlSession.getMapper(UsersMapper.class);
|
|
|
Integer result = usersMapper.updateByPrimaryKey(user);
|
|
|
sqlSession.close();
|