mirror of
https://github.com/suhf/No1WMS.git
synced 2026-02-05 04:03:45 +09:00
mybatis join 관련한 기능 추가
This commit is contained in:
@@ -1,36 +1,48 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/authority")
|
||||
public class AuthorityController {
|
||||
@Autowired
|
||||
AuthorityService authorityService;
|
||||
private static final int PER_PAGE = 10;
|
||||
|
||||
|
||||
@GetMapping("/test/tt")
|
||||
public ModelAndView test(ModelAndView mav, AuthorityDto d){
|
||||
d.setId("94690a18-a933-11ee-b9dd-0242ac110006");
|
||||
AuthorityDto dto = authorityService.selectById(d);
|
||||
|
||||
System.out.println(dto.getName());
|
||||
|
||||
mav.setViewName("test/testlayout");
|
||||
@GetMapping("/list")
|
||||
public ModelAndView list(ModelAndView mav, @RequestParam(defaultValue = "") String search, @RequestParam(defaultValue = "0") int start){
|
||||
List<AuthorityDto> list = authorityService.selectAll(search, start, PER_PAGE);
|
||||
for(int i=0; i < list.size(); ++i){
|
||||
System.out.println(list.get(i));
|
||||
}
|
||||
mav.addObject("list", list);
|
||||
mav.setViewName("/authority/list");
|
||||
return mav;
|
||||
}
|
||||
@GetMapping("/tt")
|
||||
public ModelAndView test2(ModelAndView mav){
|
||||
//AuthorityDto dto = authorityService.selectById("94690a18-a933-11ee-b9dd-0242ac110006");
|
||||
@GetMapping("/create")
|
||||
public String create(){
|
||||
return "/authority/create_group";
|
||||
|
||||
//System.out.println(dto.getName());
|
||||
}
|
||||
|
||||
mav.setViewName("test/testlayout");
|
||||
return mav;
|
||||
@PostMapping("/checkNameDuplicate")
|
||||
@ResponseBody
|
||||
public String checkNameDuplicate(@RequestParam String name, Gson gson){
|
||||
int count = authorityService.selectByName(name);
|
||||
return gson.toJson(count);
|
||||
}
|
||||
@PostMapping("/create_process")
|
||||
@ResponseBody
|
||||
public String createProcess(AuthorityDto dto, Gson gson){
|
||||
int result = authorityService.insert(dto);
|
||||
return gson.toJson(result);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,52 @@
|
||||
package com.no1.wms.authority;
|
||||
|
||||
import com.no1.wms.account.AccountDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.apache.ibatis.type.Alias;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Alias("AuthorityDto")
|
||||
public class AuthorityDto {
|
||||
|
||||
private String id;
|
||||
private String name;
|
||||
private Integer account;
|
||||
private Integer authority;
|
||||
private Integer productCategory;
|
||||
private Integer product;
|
||||
private Integer prices;
|
||||
private Integer vendor;
|
||||
private Integer warehouse;
|
||||
private Integer stock;
|
||||
private Integer planIn;
|
||||
private Integer productIn;
|
||||
private Integer productOut;
|
||||
private Integer board;
|
||||
|
||||
@Builder.Default
|
||||
private Integer account = 0;
|
||||
@Builder.Default
|
||||
private Integer authority = 0;
|
||||
@Builder.Default
|
||||
private Integer productCategory = 0;
|
||||
@Builder.Default
|
||||
private Integer product = 0;
|
||||
@Builder.Default
|
||||
private Integer prices = 0;
|
||||
@Builder.Default
|
||||
private Integer vendor = 0;
|
||||
@Builder.Default
|
||||
private Integer warehouse = 0;
|
||||
@Builder.Default
|
||||
private Integer stock = 0;
|
||||
@Builder.Default
|
||||
private Integer planIn = 0;
|
||||
@Builder.Default
|
||||
private Integer productIn = 0;
|
||||
@Builder.Default
|
||||
private Integer productOut = 0;
|
||||
@Builder.Default
|
||||
private Integer board = 0;
|
||||
|
||||
private AccountDto accountDto;
|
||||
|
||||
|
||||
private Boolean activation;
|
||||
private Boolean isGroupAuthority;
|
||||
|
||||
}
|
||||
|
||||
@@ -3,10 +3,17 @@ package com.no1.wms.authority;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface AuthorityMapper {
|
||||
AuthorityDto selectById(AuthorityDto id);
|
||||
int selectByName(String name);
|
||||
|
||||
int insert(AuthorityDto dto);
|
||||
|
||||
List<AuthorityDto> selectAll(Map<String, Object> m);
|
||||
}
|
||||
|
||||
@@ -4,7 +4,9 @@ package com.no1.wms.authority;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.UUID;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class AuthorityService {
|
||||
@@ -14,4 +16,21 @@ public class AuthorityService {
|
||||
public AuthorityDto selectById(AuthorityDto dto){
|
||||
return mapper.selectById(dto);
|
||||
}
|
||||
|
||||
public List<AuthorityDto> selectAll(String search, int start, int perPage){
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("search", search);
|
||||
map.put("start", start);
|
||||
map.put("perPage", perPage);
|
||||
|
||||
return mapper.selectAll(map);
|
||||
}
|
||||
|
||||
public int selectByName(String name){
|
||||
return mapper.selectByName(name);
|
||||
}
|
||||
|
||||
public int insert(AuthorityDto dto){
|
||||
return mapper.insert(dto);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user