| | |
| | | |
| | | /*======应用管理======*/ |
| | | public Response insert(Application app) { |
| | | //设置当前用户下的其他应用激活状态为0,本应用为1 |
| | | UpdateWrapper<Application> wrapper = Wrappers.update(); |
| | | wrapper.set("active_status",0).eq("user_id",app.getUserId()); |
| | | mapper.update(null,wrapper); |
| | | |
| | | app.setActiveStatus(1); |
| | | mapper.insert(app); |
| | | return new Response<>().set(1,app,"创建成功"); |
| | | } |
| | |
| | | return new Response<>().setMsg(1,"删除成功"); |
| | | } |
| | | |
| | | public Response updateActive(Application app) { |
| | | UpdateWrapper<Application> wrapper = Wrappers.update(); |
| | | wrapper.set("active_status",0).eq("user_id",app.getUserId()).eq("active_status",1).last("limit 1"); |
| | | mapper.update(null,wrapper); |
| | | |
| | | app.setActiveStatus(1); |
| | | mapper.updateById(app); |
| | | |
| | | return new Response().setMsg(1,"激活成功"); |
| | | } |
| | | |
| | | public Response getActive(Integer userId) { |
| | | QueryWrapper<Application> wrapper = Wrappers.query(); |
| | | wrapper.select("id","name").eq("user_id",userId).eq("active_status",1); |
| | | Application application = mapper.selectOne(wrapper); |
| | | return new Response().set(1,application); |
| | | } |
| | | |
| | | /*======应用配置======*/ |
| | | @Transactional |
| | | public Response saveConfig(ApplicationConfigDTO configDTO) { |