¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.controller.data; |
| | | |
| | | import com.lf.server.controller.BaseController; |
| | | import com.lf.server.entity.all.ResponseMsg; |
| | | import com.lf.server.entity.data.UsersEntity; |
| | | import com.lf.server.service.data.UsersService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·è¡¨ |
| | | * @author sws |
| | | * @date 2022-09-27 |
| | | */ |
| | | @Api(tags = "ç¨æ·ç®¡ç") |
| | | @RestController |
| | | @RequestMapping("/user") |
| | | public class UsersController extends BaseController { |
| | | @Autowired |
| | | UsersService userService; |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢è®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ·å", dataType = "String", paramType = "query", required = false, example = "sys_user") |
| | | }) |
| | | @GetMapping({"/selectCount"}) |
| | | public ResponseMsg<Integer> selectCount(String uname) { |
| | | try { |
| | | int count = userService.selectCount(uname); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å页æ¥è¯¢") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ¶å", dataType = "String", paramType = "query", example = "sys_user"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPage") |
| | | public ResponseMsg<List<UsersEntity>> selectByPage(String uname, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | |
| | | List<UsersEntity> rs = userService.selectByPage(uname, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å页æ¥è¯¢å¹¶è¿åè®°å½æ°") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "uname", value = "ç¨æ·å", dataType = "String", paramType = "query", example = "sys_dict"), |
| | | @ApiImplicitParam(name = "pageSize", value = "æ¯é¡µæ¡æ°", dataType = "Integer", paramType = "query", example = "10"), |
| | | @ApiImplicitParam(name = "pageIndex", value = "å页æ°ï¼ä»1å¼å§ï¼", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectByPageAndCount") |
| | | public ResponseMsg<List<UsersEntity>> selectByPageAndCount(String uname, Integer pageSize, Integer pageIndex) { |
| | | try { |
| | | if (pageSize < 1 || pageIndex < 1) { |
| | | return fail("æ¯é¡µé¡µæ°æå页æ°å°äº1", null); |
| | | } |
| | | int count = userService.selectCount(uname); |
| | | if (count == 0) { |
| | | return success(0, null); |
| | | } |
| | | List<UsersEntity> rs = userService.selectByPage(uname, pageSize, pageSize * (pageIndex - 1)); |
| | | |
| | | return success(count, rs); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userEntity", value = "åå
¸å®ä½ç±»", dataType = "com.lf.server.entity.data.UserEntity", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertUser", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertUser(UsersEntity usersEntity) { |
| | | try { |
| | | int count = userService.insertUser(usersEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æå
¥å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userEntity", value = "åå
¸å®ä½ç±»éå", dataType = "List<UserEntity>", paramType = "body", example = "") |
| | | }) |
| | | @PostMapping(value = "/insertUsers", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> insertUsers(@RequestBody List<UsersEntity> usersEntity) { |
| | | try { |
| | | int count = userService.insertUsers(usersEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/deleteUser") |
| | | public ResponseMsg<Integer> deleteUser(int id) { |
| | | try { |
| | | int count = userService.deleteUser(id); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "å é¤å¤æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "ids", value = "åå
¸IDéå", dataType = "List<Integer>", paramType = "query", example = "1,2") |
| | | }) |
| | | @GetMapping(value = "/deleteUsers") |
| | | public ResponseMsg<Integer> deleteUsers(@RequestParam List<Integer> ids) { |
| | | try { |
| | | if (ids == null || ids.isEmpty()) { |
| | | return fail("idæ°ç»ä¸è½ä¸ºç©º", -1); |
| | | } |
| | | |
| | | int count = userService.deleteUsers(ids); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ´æ°ä¸æ¡åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "userEntity", value = "åå
¸IDéå", dataType = "UserEntity", paramType = "body", example = "") |
| | | }) |
| | | @ResponseBody |
| | | @PostMapping(value = "/updateUsers", produces = "application/json; charset=UTF-8") |
| | | public ResponseMsg<Integer> updateUsers(UsersEntity usersEntity) { |
| | | try { |
| | | int count = userService.updateUsers(usersEntity); |
| | | |
| | | return success(count); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), -1); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ ¹æ®IDæ¥è¯¢åå
¸") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(name = "id", value = "åå
¸ID", dataType = "Integer", paramType = "query", example = "1") |
| | | }) |
| | | @GetMapping(value = "/selectUser") |
| | | public ResponseMsg<UsersEntity> selectUser(int id) { |
| | | try { |
| | | UsersEntity usersEntity = userService.selectUser(id); |
| | | |
| | | return success(usersEntity); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | |
| | | @ApiOperation(value = "æ¥è¯¢ææåå
¸") |
| | | @GetMapping(value = "/selectUserAll") |
| | | public ResponseMsg<List<UsersEntity>> selectUserAll() { |
| | | try { |
| | | List<UsersEntity> list = userService.selectUserAll(); |
| | | |
| | | return success(list); |
| | | } catch (Exception ex) { |
| | | return fail(ex.getMessage(), null); |
| | | } |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Time; |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * 令ç表 |
| | | * @author sws |
| | | * @date 2022-09-28 |
| | | */ |
| | | public class TokenEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 1419309705830103150L; |
| | | |
| | | private int id; |
| | | |
| | | private String token; |
| | | |
| | | private int duration; |
| | | |
| | | private Timestamp expire; |
| | | |
| | | private int type; |
| | | |
| | | private String ip; |
| | | |
| | | private int createUser; |
| | | |
| | | private Timestamp createTime; |
| | | |
| | | private int updateUser; |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public String getToken() { |
| | | return token; |
| | | } |
| | | |
| | | public void setToken(String token) { |
| | | this.token = token; |
| | | } |
| | | |
| | | public int getDuration() { |
| | | return duration; |
| | | } |
| | | |
| | | public void setDuration(int duration) { |
| | | this.duration = duration; |
| | | } |
| | | |
| | | public Timestamp getExpire() { |
| | | return expire; |
| | | } |
| | | |
| | | public void setExpire(Timestamp expire) { |
| | | this.expire = expire; |
| | | } |
| | | |
| | | public int getType() { |
| | | return type; |
| | | } |
| | | |
| | | public void setType(int type) { |
| | | this.type = type; |
| | | } |
| | | |
| | | public String getIp() { |
| | | return ip; |
| | | } |
| | | |
| | | public void setIp(String ip) { |
| | | this.ip = ip; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(int createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Timestamp getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Timestamp createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public int getUpdateUser() { |
| | | return updateUser; |
| | | } |
| | | |
| | | public void setUpdateUser(int updateUser) { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public Timestamp getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Timestamp updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.entity.data; |
| | | |
| | | import java.io.Serializable; |
| | | import java.sql.Timestamp; |
| | | |
| | | /** |
| | | * ç¨æ·è¡¨ |
| | | * @author sws |
| | | * @date 2022-09-27 |
| | | */ |
| | | public class UsersEntity implements Serializable { |
| | | |
| | | private static final long serialVersionUID = 5676976561729666299L; |
| | | |
| | | private int id; |
| | | |
| | | private int depid; |
| | | |
| | | private String uid; |
| | | |
| | | private String uname; |
| | | |
| | | private String pwd; |
| | | |
| | | private String salt; |
| | | |
| | | private int sex; |
| | | |
| | | private String natives; |
| | | |
| | | private String contact; |
| | | |
| | | private String job; |
| | | |
| | | private String email; |
| | | |
| | | private String addr; |
| | | |
| | | private String edu; |
| | | |
| | | private String idcard; |
| | | |
| | | private int status; |
| | | |
| | | private int createUser; |
| | | |
| | | private Timestamp createTime; |
| | | |
| | | private int updateUser; |
| | | |
| | | private Timestamp updateTime; |
| | | |
| | | private String bak; |
| | | |
| | | public int getId() { |
| | | return id; |
| | | } |
| | | |
| | | public void setId(int id) { |
| | | this.id = id; |
| | | } |
| | | |
| | | public int getDepid() { |
| | | return depid; |
| | | } |
| | | |
| | | public void setDepid(int depid) { |
| | | this.depid = depid; |
| | | } |
| | | |
| | | public String getUid() { |
| | | return uid; |
| | | } |
| | | |
| | | public void setUid(String uid) { |
| | | this.uid = uid; |
| | | } |
| | | |
| | | public String getUname() { |
| | | return uname; |
| | | } |
| | | |
| | | public void setUname(String uname) { |
| | | this.uname = uname; |
| | | } |
| | | |
| | | public String getPwd() { |
| | | return pwd; |
| | | } |
| | | |
| | | public void setPwd(String pwd) { |
| | | this.pwd = pwd; |
| | | } |
| | | |
| | | public String getSalt() { |
| | | return salt; |
| | | } |
| | | |
| | | public void setSalt(String salt) { |
| | | this.salt = salt; |
| | | } |
| | | |
| | | public int getSex() { |
| | | return sex; |
| | | } |
| | | |
| | | public void setSex(int sex) { |
| | | this.sex = sex; |
| | | } |
| | | |
| | | public String getNatives() { |
| | | return natives; |
| | | } |
| | | |
| | | public void setNatives(String natives) { |
| | | this.natives = natives; |
| | | } |
| | | |
| | | public String getContact() { |
| | | return contact; |
| | | } |
| | | |
| | | public void setContact(String contact) { |
| | | this.contact = contact; |
| | | } |
| | | |
| | | public String getJob() { |
| | | return job; |
| | | } |
| | | |
| | | public void setJob(String job) { |
| | | this.job = job; |
| | | } |
| | | |
| | | public String getEmail() { |
| | | return email; |
| | | } |
| | | |
| | | public void setEmail(String email) { |
| | | this.email = email; |
| | | } |
| | | |
| | | public String getAddr() { |
| | | return addr; |
| | | } |
| | | |
| | | public void setAddr(String addr) { |
| | | this.addr = addr; |
| | | } |
| | | |
| | | public String getEdu() { |
| | | return edu; |
| | | } |
| | | |
| | | public void setEdu(String edu) { |
| | | this.edu = edu; |
| | | } |
| | | |
| | | public String getIdcard() { |
| | | return idcard; |
| | | } |
| | | |
| | | public void setIdcard(String idcard) { |
| | | this.idcard = idcard; |
| | | } |
| | | |
| | | public int getStatus() { |
| | | return status; |
| | | } |
| | | |
| | | public void setStatus(int status) { |
| | | this.status = status; |
| | | } |
| | | |
| | | public int getCreateUser() { |
| | | return createUser; |
| | | } |
| | | |
| | | public void setCreateUser(int createUser) { |
| | | this.createUser = createUser; |
| | | } |
| | | |
| | | public Timestamp getCreateTime() { |
| | | return createTime; |
| | | } |
| | | |
| | | public void setCreateTime(Timestamp createTime) { |
| | | this.createTime = createTime; |
| | | } |
| | | |
| | | public int getUpdateUser() { |
| | | return updateUser; |
| | | } |
| | | |
| | | public void setUpdateUser(int updateUser) { |
| | | this.updateUser = updateUser; |
| | | } |
| | | |
| | | public Timestamp getUpdateTime() { |
| | | return updateTime; |
| | | } |
| | | |
| | | public void setUpdateTime(Timestamp updateTime) { |
| | | this.updateTime = updateTime; |
| | | } |
| | | |
| | | public String getBak() { |
| | | return bak; |
| | | } |
| | | |
| | | public void setBak(String bak) { |
| | | this.bak = bak; |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.mapper.data; |
| | | |
| | | |
| | | import com.lf.server.entity.data.DictEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 令ç表 |
| | | * @author sws |
| | | * @date 2022-09-28 |
| | | */ |
| | | |
| | | @Mapper |
| | | @ResponseBody |
| | | public interface TokenMapper { |
| | | /** |
| | | * æ ¹æ®è¡¨åæ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param tab 表å |
| | | * @return è®°å½æ° |
| | | */ |
| | | public Integer selectCount(String tab); |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åå页æ¥è¯¢ |
| | | * |
| | | * @param tab 表å |
| | | * @param limit è®°å½è¡¨ |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<DictEntity> selectByPage(String tab, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ·»å æ°æ® |
| | | * |
| | | * @param dictEntity |
| | | * @return |
| | | */ |
| | | public Integer insertDict(DictEntity dictEntity); |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | * |
| | | * @param dictEntity |
| | | * @return |
| | | */ |
| | | public Integer insertDicts(List<DictEntity> dictEntity); |
| | | |
| | | /** |
| | | * åªé¤æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer deleteDict(int id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deleteDicts(List<Integer> ids); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ°æ® |
| | | * |
| | | * @param dictEntity |
| | | * @return |
| | | */ |
| | | public Integer updateDict(DictEntity dictEntity); |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ¡æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public DictEntity selectDict(int id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å
¨é¨æ°æ® |
| | | * |
| | | * @return |
| | | */ |
| | | public List<DictEntity> selectDictAll(); |
| | | |
| | | |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.mapper.data; |
| | | |
| | | import com.lf.server.entity.data.UsersEntity; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * åå
¸ç®¡ç |
| | | * @author sws |
| | | * @date 2022-09-27 |
| | | */ |
| | | @Mapper |
| | | @Repository |
| | | public interface UsersMapper { |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åæ¥è¯¢è®°å½æ° |
| | | * |
| | | * @param uname ç¨æ·å |
| | | * @return è®°å½æ° |
| | | */ |
| | | public Integer selectCount(String uname); |
| | | |
| | | /** |
| | | * æ ¹æ®è¡¨åå页æ¥è¯¢ |
| | | * |
| | | * @param uname ç¨æ¶å |
| | | * @param limit è®°å½è¡¨ |
| | | * @param offset åç§»é |
| | | * @return å表 |
| | | */ |
| | | public List<UsersEntity> selectByPage(String uname, Integer limit, Integer offset); |
| | | |
| | | /** |
| | | * æ·»å æ°æ® |
| | | * @param usersEntity |
| | | * @return |
| | | */ |
| | | public Integer insertUser(UsersEntity usersEntity); |
| | | |
| | | /** |
| | | * æ¹éæ·»å |
| | | * |
| | | * @param usersEntity |
| | | * @return |
| | | */ |
| | | public Integer insertUsers(List<UsersEntity> usersEntity); |
| | | |
| | | /** |
| | | * åªé¤æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public Integer deleteUser(int id); |
| | | |
| | | /** |
| | | * æ¹éå é¤ |
| | | * |
| | | * @param ids |
| | | * @return |
| | | */ |
| | | public Integer deleteUsers(List<Integer> ids); |
| | | |
| | | /** |
| | | * ä¿®æ¹æ°æ® |
| | | * |
| | | * @param usersEntity |
| | | * @return |
| | | */ |
| | | public Integer updateUsers(UsersEntity usersEntity); |
| | | |
| | | /** |
| | | * æ¥è¯¢åæ¡æ°æ® |
| | | * |
| | | * @param id |
| | | * @return |
| | | */ |
| | | public UsersEntity selectUser(int id); |
| | | |
| | | /** |
| | | * æ¥è¯¢å
¨é¨æ°æ® |
| | | * |
| | | * @return |
| | | */ |
| | | public List<UsersEntity> selectUserAll(); |
| | | |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | package com.lf.server.service.data; |
| | | |
| | | import com.lf.server.entity.data.UsersEntity; |
| | | import com.lf.server.mapper.data.UsersMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * ç¨æ·è¡¨ |
| | | * @author sws |
| | | * @date 2022-09-27 |
| | | */ |
| | | |
| | | @Service |
| | | public class UsersService implements UsersMapper { |
| | | @Autowired |
| | | UsersMapper usersMapper; |
| | | |
| | | @Override |
| | | public Integer selectCount(String uname) { |
| | | return usersMapper.selectCount(uname); |
| | | } |
| | | |
| | | @Override |
| | | public UsersEntity selectUser(int id) { |
| | | return usersMapper.selectUser(id); |
| | | } |
| | | |
| | | @Override |
| | | public List<UsersEntity> selectUserAll() { |
| | | return usersMapper.selectUserAll(); |
| | | } |
| | | |
| | | @Override |
| | | public List<UsersEntity> selectByPage(String uname, Integer limit, Integer offset) { |
| | | return usersMapper.selectByPage(uname,limit,offset); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertUser(UsersEntity usersEntity) { |
| | | return usersMapper.insertUser(usersEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer insertUsers(List<UsersEntity> usersEntity) { |
| | | return usersMapper.insertUsers(usersEntity); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteUser(int id) { |
| | | return usersMapper.deleteUser(id); |
| | | } |
| | | |
| | | @Override |
| | | public Integer deleteUsers(List<Integer> ids) { |
| | | return usersMapper.deleteUsers(ids); |
| | | } |
| | | |
| | | @Override |
| | | public Integer updateUsers(UsersEntity usersEntity) { |
| | | return usersMapper.updateUsers(usersEntity); |
| | | } |
| | | } |
¶Ô±ÈÐÂÎļþ |
| | |
| | | <?xml version="1.0" encoding="UTF-8" ?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.lf.server.mapper.data.UsersMapper"> |
| | | <resultMap id="resultMap" type="com.lf.server.entity.data.UsersEntity"> |
| | | <id property="id" column="id"></id> |
| | | <result property="natives" column="native"></result> |
| | | <result property="createUser" column="create_user"></result> |
| | | <result property="createTime" column="create_time"></result> |
| | | <result property="updateUser" column="update_user"></result> |
| | | <result property="updateTime" column="update_time"></result> |
| | | </resultMap> |
| | | |
| | | <!-- ç»è®¡è¡æ° --> |
| | | <select id="selectCount" resultType="java.lang.Integer" parameterType="java.lang.String"> |
| | | select count(*) from lf.sys_user |
| | | <where> |
| | | <if test="uname != null"> |
| | | uname = #{uname} |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <!-- å页æ¥è¯¢ --> |
| | | <select id="selectByPage" resultMap="resultMap" resultType="com.lf.server.entity.data.UsersEntity"> |
| | | select * from lf.sys_user |
| | | <where> |
| | | <if test="uname != null"> |
| | | uname = #{uname} |
| | | </if> |
| | | </where> |
| | | order by id |
| | | limit #{limit} offset #{offset} |
| | | </select> |
| | | |
| | | |
| | | |
| | | <select id="selectUserAll" resultMap="resultMap" resultType="com.lf.server.entity.data.UsersEntity"> |
| | | select * from lf.sys_user |
| | | </select> |
| | | |
| | | <select id="selectUser" resultMap="resultMap" resultType="com.lf.server.entity.data.UsersEntity"> |
| | | select * from lf.sys_user where id = #{id} |
| | | </select> |
| | | |
| | | <insert id="insertUser" parameterType="com.lf.server.entity.data.UsersEntity"> |
| | | insert into lf.sys_user |
| | | (depid,uid,uname,pwd,salt,sex,native,contact,job,email,addr,edu,idcard,status,create_user,create_time,bak) |
| | | values |
| | | (#{depid},#{uid},#{uname},#{pwd},#{salt},#{sex},#{natives},#{contact},#{job},#{email},#{addr},#{edu},#{idcard}, |
| | | #{status},#{createUser},now(),#{bak}) |
| | | </insert> |
| | | |
| | | <insert id="insertUsers" > |
| | | insert into lf.sys_user |
| | | (depid,uid,uname,pwd,salt,sex,native,contact,job,email,addr,edu,idcard,status,create_user,create_time,bak) |
| | | values |
| | | <foreach collection="list" item="item" index="index" separator="," > |
| | | (#{item.depid},#{item.uid},#{item.uname},#{item.pwd},#{item.salt},#{item.sex},#{item.natives},#{item.contact},#{item.job}, |
| | | #{item.email},#{item.addr},#{item.edu},#{item.idcard},#{item.status},#{item.createUser}, now(),#{item.bak}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <delete id="deleteUser" > |
| | | delete from lf.sys_user where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteUsers" > |
| | | delete from lf.sys_user where id in |
| | | <foreach item="ids" collection="list" index="index" open="(" |
| | | separator="," close=")"> |
| | | #{ids} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <update id="updateUsers"> |
| | | update lf.sys_user set depid=#{depid},uid=#{uid},uname=#{uname},pwd=#{pwd},salt=#{salt},sex=#{sex},native=#{natives},contact=#{contact},job=#{job},email=#{email}, |
| | | addr=#{addr},edu=#{edu},idcard=#{idcard},status=#{status},update_user=#{updateUser},update_time=now(),bak=#{bak} where id=#{id} |
| | | </update> |
| | | </mapper> |