| | |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.util.Date; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | @RestController |
| | | public class ConfigTypeController extends BaseController { |
| | |
| | | |
| | | @RequestMapping(value = "/configType/add/auth") |
| | | @ManagerAuth |
| | | public R list(ConfigType configType){ |
| | | public R add(ConfigType configType){ |
| | | if (Cools.isEmpty(configType)){ |
| | | return R.error(); |
| | | } |
| | |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/configType/delete/auth") |
| | | @ManagerAuth |
| | | public R delete(Long id){ |
| | | configTypeService.deleteById(id); |
| | | return R.ok(); |
| | | |
| | | } |
| | | |
| | | @RequestMapping(value = "/configTypeQuery/auth") |
| | | @ManagerAuth |
| | | public R query(String condition) { |
| | | |
| | | String type = condition.split(",")[1]; |
| | | condition = condition.split(",")[0]; |
| | | |
| | | EntityWrapper<ConfigType> wrapper = new EntityWrapper<>(); |
| | | wrapper.eq("type",type); |
| | | wrapper.like("value", condition); |
| | | Page<ConfigType> page = configTypeService.selectPage(new Page<>(0, 32), wrapper); |
| | | List<Map<String, Object>> result = new ArrayList<>(); |
| | | for (ConfigType configType : page.getRecords()){ |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("id", configType.getId()); |
| | | map.put("value", configType.getValue()); |
| | | result.add(map); |
| | | } |
| | | return R.ok(result); |
| | | } |
| | | |
| | | private <T> void convert(Map<String, Object> map, EntityWrapper<T> wrapper){ |
| | | for (Map.Entry<String, Object> entry : map.entrySet()){ |
| | | String val = String.valueOf(entry.getValue()); |